Skip to content

Commit 8e00a4a

Browse files
authored
Merge pull request #105 from rosshadden/fix-memcpy
Replaced usages of `copymem` with `memcpy`
2 parents c56f793 + 7e9d1ce commit 8e00a4a

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

quickjs/builtin_binding_generator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def generate_constructor(cls):
147147
ERR_PRINTS("Length of the ArrayBuffer does not match for ${class}");
148148
}
149149
tmp.resize(size / sizeof(${element}));
150-
copymem(tmp.write().ptr(), buffer, size / sizeof(${element}) * sizeof(${element}));
150+
memcpy(tmp.write().ptr(), buffer, size / sizeof(${element}) * sizeof(${element}));
151151
}
152152
} else if (JS_IsDataView(argv[0])) {
153153
JSValue byte_length = JS_GetPropertyStr(ctx, argv[0], "byteLength");
@@ -164,7 +164,7 @@ def generate_constructor(cls):
164164
JS_FreeValue(ctx, arraybuffer);
165165
if (length) {
166166
tmp.resize(length / sizeof(${element}));
167-
copymem(tmp.write().ptr(), buffer + offset, length / sizeof(${element}) * sizeof(${element}));
167+
memcpy(tmp.write().ptr(), buffer + offset, length / sizeof(${element}) * sizeof(${element}));
168168
}
169169
} else {
170170
#ifdef DEBUG_METHODS_ENABLED

quickjs/quickjs_binder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1536,7 +1536,7 @@ Error QuickJSBinder::compile_to_bytecode(const String &p_code, const String &p_f
15361536
size_t size;
15371537
if (uint8_t *buf = JS_WriteObject(ctx, &size, module, JS_WRITE_OBJ_BYTECODE | JS_WRITE_OBJ_REFERENCE | JS_WRITE_OBJ_SAB)) {
15381538
r_bytecode.resize(size);
1539-
copymem(r_bytecode.ptrw(), buf, size);
1539+
memcpy(r_bytecode.ptrw(), buf, size);
15401540
js_free(ctx, buf);
15411541
JS_FreeValue(ctx, module);
15421542
} else {

quickjs/quickjs_builtin_binder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,7 @@ void QuickJSBuiltinBinder::bind_builtin_propties_manually() {
10111011
PoolByteArray::Read r = ptr->read();
10121012
CharString cs;
10131013
cs.resize(ptr->size() + 1);
1014-
copymem(cs.ptrw(), r.ptr(), ptr->size());
1014+
memcpy(cs.ptrw(), r.ptr(), ptr->size());
10151015
cs[ptr->size()] = 0;
10161016
ret = cs.get_data();
10171017
}

0 commit comments

Comments
 (0)