Update create_archve.py to output a uint8_t array

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1419263004 .
This commit is contained in:
John McCutchan
2015-10-28 13:58:32 -07:00
parent 8f94e36a74
commit 60f911944b
+4 -5
View File
@@ -56,20 +56,19 @@ typedef unsigned __int8 uint8_t;
cc_text += 'namespace %s {\n' % inner_namespace
cc_text += '\n\n'
# Write the archive.
cc_text += 'static const char %s_[] = {\n ' % name
cc_text += 'static const uint8_t %s_[] = {\n ' % name
lineCounter = 0
for byte in tar_archive:
cc_text += r" '\x%02x'," % ord(byte)
cc_text += r" %d," % ord(byte)
lineCounter += 1
if lineCounter == 10:
cc_text += '\n '
lineCounter = 0
if lineCounter != 0:
cc_text += '\n '
cc_text += '};\n'
cc_text += '\n};\n'
cc_text += '\nunsigned int %s_len = %d;\n' % (name, len(tar_archive))
cc_text += '\nconst uint8_t* %s = ' % name
cc_text += 'reinterpret_cast<const uint8_t*>(&%s_[0]);\n' % name
cc_text += '\nconst uint8_t* %s = %s_;\n\n' % (name, name)
if inner_namespace != None:
cc_text += '} // namespace %s\n' % inner_namespace
cc_text += '} // namespace %s\n' % outer_namespace