mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 853111 - Kill -Wnarrowing warnings for zipped selfhosted sources. (r=till)
This commit is contained in:
parent
0ce011f1b2
commit
e2a34428ff
@ -62,9 +62,9 @@ HEADER_TEMPLATE = """\
|
||||
|
||||
namespace js {
|
||||
namespace selfhosted {
|
||||
static const char data[] = { %(sources_data)s };
|
||||
static const %(sources_type)s data[] = { %(sources_data)s };
|
||||
|
||||
%(sources_declaration)s
|
||||
static const %(sources_type)s *%(sources_name)s = reinterpret_cast<const %(sources_type)s *>(data);
|
||||
|
||||
uint32_t GetCompressedSize() {
|
||||
return %(compressed_total_length)i;
|
||||
@ -77,14 +77,6 @@ namespace selfhosted {
|
||||
} // js
|
||||
"""
|
||||
|
||||
RAW_SOURCES_DECLARATION = """\
|
||||
static const char *rawSources = reinterpret_cast<const char *>(data);
|
||||
"""
|
||||
|
||||
COMPRESSED_SOURCES_DECLARATION = """\
|
||||
static const unsigned char *compressedSources = reinterpret_cast<const unsigned char *>(data);
|
||||
"""
|
||||
|
||||
def embed(cpp, msgs, sources, c_out, js_out, env):
|
||||
# Clang seems to complain and not output anything if the extension of the
|
||||
# input is not something it recognizes, so just fake a .h here.
|
||||
@ -106,16 +98,18 @@ def embed(cpp, msgs, sources, c_out, js_out, env):
|
||||
compressed = zlib.compress(processed)
|
||||
data = ToCArray(compressed)
|
||||
output.write(HEADER_TEMPLATE % {
|
||||
'sources_type': 'unsigned char',
|
||||
'sources_data': data,
|
||||
'sources_declaration': COMPRESSED_SOURCES_DECLARATION,
|
||||
'sources_name': 'compressedSources',
|
||||
'compressed_total_length': len(compressed),
|
||||
'raw_total_length': len(processed)
|
||||
})
|
||||
else:
|
||||
data = ToCAsciiArray(processed)
|
||||
output.write(HEADER_TEMPLATE % {
|
||||
'sources_type': 'char',
|
||||
'sources_data': data,
|
||||
'sources_declaration': RAW_SOURCES_DECLARATION,
|
||||
'sources_name': 'rawSources',
|
||||
'compressed_total_length': 0,
|
||||
'raw_total_length': len(processed)
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user