summaryrefslogtreecommitdiff
path: root/xmake/modules/private/utils/bin2c.lua
diff options
context:
space:
mode:
authorÂngelo Andrade Cirino <[email protected]>2022-01-10 10:23:17 -0300
committerÂngelo Andrade Cirino <[email protected]>2022-01-10 10:23:17 -0300
commited0c0c5e0249aa966ea7061b30710abdd0b09d87 (patch)
tree2a51c869a3aea1a093ed569e749bdf0465634a6c /xmake/modules/private/utils/bin2c.lua
parent885d00da8caf74aeed758d030b9a1b50d9078e1f (diff)
parent2431dd7e6142ff98b55741cfd4de4d2e69f4f8b5 (diff)
Merged from upstream/master
Diffstat (limited to 'xmake/modules/private/utils/bin2c.lua')
-rw-r--r--xmake/modules/private/utils/bin2c.lua11
1 files changed, 7 insertions, 4 deletions
diff --git a/xmake/modules/private/utils/bin2c.lua b/xmake/modules/private/utils/bin2c.lua
index 91ea1eafe..6f18833fc 100644
--- a/xmake/modules/private/utils/bin2c.lua
+++ b/xmake/modules/private/utils/bin2c.lua
@@ -23,9 +23,10 @@ import("core.base.bytes")
import("core.base.option")
local options = {
- {'w', "linewidth", "kv", nil, "Set the line width"},
- {'i', "binarypath", "kv", nil, "Set the binary file path."},
- {'o', "outputpath", "kv", nil, "Set the output file path."}
+ {'w', "linewidth", "kv", nil, "Set the line width"},
+ {nil, "nozeroend", "k", false, "Disable to patch zero terminating character"},
+ {'i', "binarypath", "kv", nil, "Set the binary file path."},
+ {'o', "outputpath", "kv", nil, "Set the output file path."}
}
function _do_dump(binarydata, outputfile, opt)
@@ -84,7 +85,9 @@ function _do_bin2c(binarypath, outputpath, opt)
local binarydata = bytes(io.readfile(binarypath, {encoding = "binary"}))
local outputfile = io.open(outputpath, 'w')
if outputfile then
- binarydata = binarydata .. bytes('\0')
+ if not opt.nozeroend then
+ binarydata = binarydata .. bytes('\0')
+ end
_do_dump(binarydata, outputfile, opt)
outputfile:close()
end