diff --git a/c_src/bdberl_drv.c b/c_src/bdberl_drv.c index 3b618f4..58b7098 100644 --- a/c_src/bdberl_drv.c +++ b/c_src/bdberl_drv.c @@ -562,7 +562,7 @@ static int bdberl_drv_control(ErlDrvData handle, unsigned int cmd, // Inbuf is << DbRef:32, Flags:32 >> int dbref = UNPACK_INT(inbuf, 0); - int flags = UNPACK_INT(inbuf, 4); + unsigned int flags = UNPACK_INT(inbuf, 4); // Make sure we have a reference to the requested database if (has_dbref(d, dbref)) diff --git a/src/bdberl.erl b/src/bdberl.erl index 770858a..4fcd1d2 100644 --- a/src/bdberl.erl +++ b/src/bdberl.erl @@ -39,11 +39,11 @@ open(Name, Type, Opts) -> hash -> TypeCode = ?DB_TYPE_HASH end, Flags = process_flags(lists:umerge(Opts, [auto_commit, threaded])), - Cmd = <>, + Cmd = <>, case erlang:port_control(get_port(), ?CMD_OPEN_DB, Cmd) of - <> -> + <> -> {ok, Db}; - <> -> + <> -> {error, Errno} end. @@ -52,8 +52,8 @@ close(Db) -> close(Db, Opts) -> Flags = process_flags(Opts), - Cmd = <>, - <> = erlang:port_control(get_port(), ?CMD_CLOSE_DB, Cmd), + Cmd = <>, + <> = erlang:port_control(get_port(), ?CMD_CLOSE_DB, Cmd), case decode_rc(Rc) of ok -> ok; @@ -66,8 +66,8 @@ txn_begin() -> txn_begin(Opts) -> Flags = process_flags(Opts), - Cmd = <>, - <> = erlang:port_control(get_port(), ?CMD_TXN_BEGIN, Cmd), + Cmd = <>, + <> = erlang:port_control(get_port(), ?CMD_TXN_BEGIN, Cmd), case decode_rc(Result) of ok -> ok; Error -> {error, {txn_begin, Error}} @@ -78,8 +78,8 @@ txn_commit() -> txn_commit(Opts) -> Flags = process_flags(Opts), - Cmd = <>, - <> = erlang:port_control(get_port(), ?CMD_TXN_COMMIT, Cmd), + Cmd = <>, + <> = erlang:port_control(get_port(), ?CMD_TXN_COMMIT, Cmd), case decode_rc(Result) of ok -> receive @@ -91,7 +91,7 @@ txn_commit(Opts) -> end. txn_abort() -> - <> = erlang:port_control(get_port(), ?CMD_TXN_ABORT, <<>>), + <> = erlang:port_control(get_port(), ?CMD_TXN_ABORT, <<>>), case decode_rc(Result) of ok -> receive @@ -169,8 +169,8 @@ get(Db, Key) -> get(Db, Key, Opts) -> {KeyLen, KeyBin} = to_binary(Key), Flags = process_flags(Opts), - Cmd = <>, - <> = erlang:port_control(get_port(), ?CMD_GET, Cmd), + Cmd = <>, + <> = erlang:port_control(get_port(), ?CMD_GET, Cmd), case decode_rc(Result) of ok -> receive @@ -214,8 +214,8 @@ truncate() -> truncate(-1). truncate(Db) -> - Cmd = <>, - <> = erlang:port_control(get_port(), ?CMD_TRUNCATE, Cmd), + Cmd = <>, + <> = erlang:port_control(get_port(), ?CMD_TRUNCATE, Cmd), case decode_rc(Result) of ok -> receive @@ -228,8 +228,8 @@ truncate(Db) -> end. cursor_open(Db) -> - Cmd = <>, - <> = erlang:port_control(get_port(), ?CMD_CURSOR_OPEN, Cmd), + Cmd = <>, + <> = erlang:port_control(get_port(), ?CMD_CURSOR_OPEN, Cmd), case decode_rc(Rc) of ok -> ok; @@ -248,7 +248,7 @@ cursor_current() -> do_cursor_move(?CMD_CURSOR_CURR). cursor_close() -> - <> = erlang:port_control(get_port(), ?CMD_CURSOR_CLOSE, <<>>), + <> = erlang:port_control(get_port(), ?CMD_CURSOR_CLOSE, <<>>), case decode_rc(Rc) of ok -> ok; @@ -258,7 +258,7 @@ cursor_close() -> delete_database(Filename) -> Cmd = <<(list_to_binary(Filename))/binary, 0:8>>, - <> = erlang:port_control(get_port(), ?CMD_REMOVE_DB, Cmd), + <> = erlang:port_control(get_port(), ?CMD_REMOVE_DB, Cmd), case decode_rc(Rc) of ok -> ok; @@ -269,7 +269,7 @@ delete_database(Filename) -> get_data_dirs() -> %% Call into the BDB library and get a list of configured data directories - Cmd = <>, + Cmd = <>, <> = erlang:port_control(get_port(), ?CMD_TUNE, Cmd), case decode_rc(Result) of ok -> @@ -286,7 +286,7 @@ get_data_dirs() -> end. get_cache_size() -> - Cmd = <>, + Cmd = <>, <> = erlang:port_control(get_port(), ?CMD_TUNE, Cmd), case Result of @@ -297,7 +297,7 @@ get_cache_size() -> end. get_txn_timeout() -> - Cmd = <>, + Cmd = <>, <> = erlang:port_control(get_port(), ?CMD_TUNE, Cmd), case Result of 0 -> @@ -307,7 +307,7 @@ get_txn_timeout() -> end. set_txn_timeout(Timeout) -> - Cmd = <>, + Cmd = <>, <> = erlang:port_control(get_port(), ?CMD_TUNE, Cmd), case Result of 0 -> @@ -409,8 +409,8 @@ do_put(Action, Db, Key, Value, Opts) -> {KeyLen, KeyBin} = to_binary(Key), {ValLen, ValBin} = to_binary(Value), Flags = process_flags(Opts), - Cmd = <>, - <> = erlang:port_control(get_port(), Action, Cmd), + Cmd = <>, + <> = erlang:port_control(get_port(), Action, Cmd), case decode_rc(Result) of ok -> receive @@ -427,7 +427,7 @@ do_put(Action, Db, Key, Value, Opts) -> %% Move the cursor in a given direction. Invoked by cursor_next/prev/current. %% do_cursor_move(Direction) -> - <> = erlang:port_control(get_port(), Direction, <<>>), + <> = erlang:port_control(get_port(), Direction, <<>>), case decode_rc(Rc) of ok -> receive