Skip to content
This repository has been archived by the owner on Jan 6, 2020. It is now read-only.

Commit

Permalink
Fix FFI usage of appendable_data_filter_type
Browse files Browse the repository at this point in the history
C/FFI interface for C's `enum` is `int`, not a JS object. Update code to
receive such `int` and convert to a proper `Enum` within JS environment.

We use the `String` extracted from `EnumItem` instead the `EnumItem`
itself because the rest of the code is expecting a string which will be
sent over the wire.
  • Loading branch information
vinipsmaker committed Nov 17, 2016
1 parent 9fcf0ea commit 8f5ebc5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions app/ffi/api/appendable_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { FILTER_TYPE } from '../model/enum';
import log from '../../logger/log';

const int32 = ref.types.int32;
const Int = ref.types.int;
const u8 = ref.types.uint8;
const u64 = ref.types.uint64;
const Void = ref.types.void;
Expand All @@ -23,8 +24,6 @@ const boolPointer = ref.refType(bool);
const size_tPointer = ref.refType(size_t);

const Ffi_FilterType = new Enum({ BlackList: 0, WhiteList: 1 });

const filterTypePointer = ref.refType(Ffi_FilterType);
/* eslint-enable camelcase */

class AppendableData extends FfiApi {
Expand Down Expand Up @@ -57,7 +56,7 @@ class AppendableData extends FfiApi {
appendable_data_clear_deleted_data: [int32, [u64]],
appendable_data_remove_nth_deleted_data: [int32, [u64, size_t]],
appendable_data_remove_from_filter: [int32, [u64, u64]],
appendable_data_filter_type: [int32, [u64, filterTypePointer]],
appendable_data_filter_type: [int32, [u64, ref.refType(Int)]],
appendable_data_num_of_filter_keys: [int32, [u64, size_tPointer]],
appendable_data_nth_filter_key: [int32, [u64, size_t, u64Pointer]]
// 'appendable_data_delete': [int32, [AppHandle, u64]]
Expand Down

0 comments on commit 8f5ebc5

Please sign in to comment.