summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-12-07 08:06:04 +0800
committerruki <[email protected]>2025-12-07 17:15:59 +0800
commit1c5bf925dc824a6032832c7c8b7461981f512edb (patch)
treeb4669d6e4d0596c8dbd072ddcda9bb1d90d3b6cf
parentbce2cef4a7832f9df5b9e41e8b1689a5490249b3 (diff)
fix some review tips
-rw-r--r--core/src/xmake/utils/bin2coff.c10
-rw-r--r--xmake/modules/private/utils/bin2obj.lua2
2 files changed, 6 insertions, 6 deletions
diff --git a/core/src/xmake/utils/bin2coff.c b/core/src/xmake/utils/bin2coff.c
index d48d89e09..426aab089 100644
--- a/core/src/xmake/utils/bin2coff.c
+++ b/core/src/xmake/utils/bin2coff.c
@@ -145,7 +145,7 @@ static tb_bool_t xm_utils_bin2coff_dump(tb_stream_ref_t istream,
// get file size
tb_hong_t filesize = tb_stream_size(istream);
- if (filesize < 0) {
+ if (filesize < 0 || filesize > 0xffffffffU) {
return tb_false;
}
tb_uint32_t datasize = (tb_uint32_t)filesize;
@@ -304,13 +304,13 @@ static tb_bool_t xm_utils_bin2coff_dump(tb_stream_ref_t istream,
// write string table
tb_stream_bwrit(ostream, (tb_byte_t const *)&string_table_size, 4);
- if (tb_strlen(symbol_start) > 8) {
- xm_utils_bin2coff_write_string(ostream, symbol_start, 0);
+ if (start_len > 8) {
+ xm_utils_bin2coff_write_string(ostream, symbol_start, start_len);
tb_byte_t null = 0;
tb_stream_bwrit(ostream, &null, 1);
}
- if (tb_strlen(symbol_end) > 8) {
- xm_utils_bin2coff_write_string(ostream, symbol_end, 0);
+ if (end_len > 8) {
+ xm_utils_bin2coff_write_string(ostream, symbol_end, end_len);
tb_byte_t null = 0;
tb_stream_bwrit(ostream, &null, 1);
}
diff --git a/xmake/modules/private/utils/bin2obj.lua b/xmake/modules/private/utils/bin2obj.lua
index 7ee7ea3a1..37c78b633 100644
--- a/xmake/modules/private/utils/bin2obj.lua
+++ b/xmake/modules/private/utils/bin2obj.lua
@@ -31,7 +31,7 @@ local options = {
function _do_bin2obj_coff(binarypath, outputpath, opt)
-- get symbol prefix
- local symbol_prefix = opt["symbol-prefix"] or opt.symbol_prefix or "_binary_"
+ local symbol_prefix = opt["symbol-prefix"] or "_binary_"
-- get architecture
local arch = opt.arch