Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove C warnings, when build with --verbose #339

Merged
merged 2 commits into from
Feb 6, 2023
Merged
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
12 changes: 6 additions & 6 deletions packages/near-sdk-js/builder/builder.c
Original file line number Diff line number Diff line change
Expand Up @@ -1008,25 +1008,25 @@ static JSValue near_validator_total_stake(JSContext *ctx, JSValueConst this_val,

static JSValue near_utf8_string_to_uint8array(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
{
char *data;
const char *data;
size_t len;
JSValue arraybuffer;

data = JS_ToCStringLen(ctx, &len, argv[0]);

arraybuffer = JS_NewArrayBuffer(ctx, data, len, NULL, NULL, TRUE);
arraybuffer = JS_NewArrayBuffer(ctx, (uint8_t *)data, len, NULL, NULL, TRUE);
return JS_CallConstructor(ctx, JS_GetPropertyStr(ctx, JS_GetGlobalObject(ctx), "Uint8Array"), 1, (JSValueConst *)&arraybuffer);
}

static JSValue near_latin1_string_to_uint8array(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
{
char *data;
const char *data;
size_t len;
JSValue arraybuffer;

data = JS_ToCStringLenRaw(ctx, &len, argv[0]);

arraybuffer = JS_NewArrayBuffer(ctx, data, len, NULL, NULL, TRUE);
arraybuffer = JS_NewArrayBuffer(ctx, (uint8_t *)data, len, NULL, NULL, TRUE);
return JS_CallConstructor(ctx, JS_GetPropertyStr(ctx, JS_GetGlobalObject(ctx), "Uint8Array"), 1, (JSValueConst *)&arraybuffer);
}

Expand All @@ -1040,7 +1040,7 @@ static JSValue near_uint8array_to_latin1_string(JSContext *ctx, JSValueConst thi
return JS_ThrowTypeError(ctx, "Expect Uint8Array");
}

return JS_NewStringLenRaw(ctx, data_ptr, data_len);
return JS_NewStringLenRaw(ctx, (const char *)data_ptr, data_len);
}

static JSValue near_uint8array_to_utf8_string(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
Expand All @@ -1053,7 +1053,7 @@ static JSValue near_uint8array_to_utf8_string(JSContext *ctx, JSValueConst this_
return JS_ThrowTypeError(ctx, "Expect Uint8Array");
}

return JS_NewStringLen(ctx, data_ptr, data_len);
return JS_NewStringLen(ctx, (const char *)data_ptr, data_len);
}

#ifdef NIGHTLY
Expand Down