diff options
| author | ruki <[email protected]> | 2024-10-25 22:44:36 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-10-25 22:44:36 +0800 |
| commit | 5e3238136f8fd9387c92934b05ea38aeb7c79dd5 (patch) | |
| tree | b41a207886aa187f9d805bedcd4d39b033b0331e | |
| parent | 70a00eb8873410b1b6ba69bd05d11d94d1011ac7 (diff) | |
add nozeroend
| -rw-r--r-- | core/src/xmake/utils/bin2c.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/core/src/xmake/utils/bin2c.c b/core/src/xmake/utils/bin2c.c index 3c4b9e424..a00bb25a3 100644 --- a/core/src/xmake/utils/bin2c.c +++ b/core/src/xmake/utils/bin2c.c @@ -51,6 +51,12 @@ static tb_bool_t xm_utils_bin2c_dump(tb_stream_ref_t istream, tb_stream_ref_t os if (!tb_stream_bread(istream, data, need)) break; + if (!nozeroend && tb_stream_beof(istream)) + { + tb_assert_and_check_break(need + 1 < sizeof(data)); + data[need++] = '\0'; + } + for (i = 0; i < need; i++) { tb_assert_and_check_break(linesize < sizeof(line)); |
