Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions hunspell/src/hunspell/strmgr.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ int StrMgr::fail(const char * err, const char * par) {
StrMgr::StrMgr(const char * str, const char * key) {
linenum = 0;
index = 0;
st = NULL;
size = strlen(str);
if(size > 0)
if(size > 0) {
st = strdup(str);
if (!st) fail(MSG_OPEN, "Buffer allocation failed in StrMgr.");
if (!st) fail(MSG_OPEN, "Buffer allocation failed in StrMgr.");
}
}

StrMgr::~StrMgr()
Expand Down
17 changes: 16 additions & 1 deletion src/Nodehun.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,25 @@ Napi::Object Nodehun::Init(Napi::Env env, Napi::Object exports) {
return exports;
}

Nodehun::Nodehun(const Napi::CallbackInfo& info) : Napi::ObjectWrap<Nodehun>(info) {
Nodehun::Nodehun(const Napi::CallbackInfo& info) : Napi::ObjectWrap<Nodehun>(info), context(NULL) {
Napi::Env env = info.Env();
Napi::HandleScope scope(env);

if (info.Length() != 2) {
Napi::Error::New(env, INVALID_NUMBER_OF_ARGUMENTS).ThrowAsJavaScriptException();
return;
}

if (!info[0].IsBuffer()) {
Napi::Error::New(env, INVALID_FIRST_ARGUMENT).ThrowAsJavaScriptException();
return;
}

if (!info[1].IsBuffer()) {
Napi::Error::New(env, INVALID_SECOND_ARGUMENT).ThrowAsJavaScriptException();
return;
}

Napi::Buffer<char> affixBuffer = info[0].As<Napi::Buffer<char>>();
Napi::Buffer<char> dictionaryBuffer = info[1].As<Napi::Buffer<char>>();

Expand Down