Skip to content

Commit

Permalink
unsigned numbers are never negative
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro Paixao authored and Pedro Paixao committed Apr 13, 2016
1 parent 36595ed commit 5da41aa
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/include/node_sodium.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,13 @@ using namespace v8;
#define GET_ARG_NUMBER(i, NAME) \
size_t NAME; \
if (info[i]->IsUint32()) { \
NAME = info[i]->Int32Value(); \
NAME = info[i]->Uint32Value()(); \
} else { \
return Nan::ThrowError("argument size must be a number"); \
}

#define GET_ARG_POSITIVE_NUMBER(i, NAME) \
GET_ARG_NUMBER(i, NAME); \
if( NAME < 0 ) { \
return Nan::ThrowError("argument size must be a positive number"); \
}
GET_ARG_NUMBER(i, NAME);

#define ARG_TO_BUFFER_TYPE(NAME, TYPE) GET_ARG_AS(_arg, NAME, TYPE); _arg++
#define ARG_TO_BUFFER_TYPE_LEN(NAME, MAXLEN, TYPE) GET_ARG_AS_LEN(_arg, NAME, MAXLEN, TYPE); _arg++
Expand Down

0 comments on commit 5da41aa

Please sign in to comment.