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

Replaced usages of copymem with memcpy #105

Merged
merged 1 commit into from
Sep 11, 2021
Merged
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
4 changes: 2 additions & 2 deletions quickjs/builtin_binding_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def generate_constructor(cls):
ERR_PRINTS("Length of the ArrayBuffer does not match for ${class}");
}
tmp.resize(size / sizeof(${element}));
copymem(tmp.write().ptr(), buffer, size / sizeof(${element}) * sizeof(${element}));
memcpy(tmp.write().ptr(), buffer, size / sizeof(${element}) * sizeof(${element}));
}
} else if (JS_IsDataView(argv[0])) {
JSValue byte_length = JS_GetPropertyStr(ctx, argv[0], "byteLength");
Expand All @@ -164,7 +164,7 @@ def generate_constructor(cls):
JS_FreeValue(ctx, arraybuffer);
if (length) {
tmp.resize(length / sizeof(${element}));
copymem(tmp.write().ptr(), buffer + offset, length / sizeof(${element}) * sizeof(${element}));
memcpy(tmp.write().ptr(), buffer + offset, length / sizeof(${element}) * sizeof(${element}));
}
} else {
#ifdef DEBUG_METHODS_ENABLED
Expand Down
2 changes: 1 addition & 1 deletion quickjs/quickjs_binder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1536,7 +1536,7 @@ Error QuickJSBinder::compile_to_bytecode(const String &p_code, const String &p_f
size_t size;
if (uint8_t *buf = JS_WriteObject(ctx, &size, module, JS_WRITE_OBJ_BYTECODE | JS_WRITE_OBJ_REFERENCE | JS_WRITE_OBJ_SAB)) {
r_bytecode.resize(size);
copymem(r_bytecode.ptrw(), buf, size);
memcpy(r_bytecode.ptrw(), buf, size);
js_free(ctx, buf);
JS_FreeValue(ctx, module);
} else {
Expand Down
2 changes: 1 addition & 1 deletion quickjs/quickjs_builtin_binder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1011,7 +1011,7 @@ void QuickJSBuiltinBinder::bind_builtin_propties_manually() {
PoolByteArray::Read r = ptr->read();
CharString cs;
cs.resize(ptr->size() + 1);
copymem(cs.ptrw(), r.ptr(), ptr->size());
memcpy(cs.ptrw(), r.ptr(), ptr->size());
cs[ptr->size()] = 0;
ret = cs.get_data();
}
Expand Down