Adjust chunk-size in TLD-suffix list to placate MSVC 2015
MSVC 2015 has a size limit on strings; sizeof (including the terminating '\0') must not exceed 0xffff. The generator for the suffix-list data worked round this by breaking its data into chunks of at most 0xffff bytes; however, it was limiting on the strlen, not the sizeof, so was off by one. It checked for this before adding each suffix, so has (until now) always happened to break early enough; but the latest update gave an exactly 0xffff chunk, whose terminating '\0' took it over MSVC's limit. So adjust the cutoff to effectively include the terminating '\0'. Task-number: QTBUG-72623 Change-Id: I76ea40060d9fc13c0f7002c5ba22e71b8d0af787 Reviewed-by: Peter Hartmann <peter-qt@hartmann.tk>
This commit is contained in:
parent
55b4641962
commit
f9421f0968
@ -113,7 +113,7 @@ int main(int argc, char **argv) {
|
||||
outIndicesBuffer.write("] = {\n");
|
||||
|
||||
int totalUtf8Size = 0;
|
||||
int chunkSize = 0;
|
||||
int chunkSize = 0; // strlen of the current chunk (sizeof is bigger by 1)
|
||||
int stringUtf8Size = 0;
|
||||
QStringList chunks;
|
||||
for (int a = 0; a < lineCount; a++) {
|
||||
@ -127,7 +127,8 @@ int main(int argc, char **argv) {
|
||||
int quoteCount = strings.at(a).count('"');
|
||||
stringUtf8Size = strings.at(a).count() - (zeroCount + quoteCount + utf8CharsCount * 3);
|
||||
chunkSize += stringUtf8Size;
|
||||
if (chunkSize > 65535) {
|
||||
// MSVC 2015 chokes if sizeof(a single string) > 0xffff
|
||||
if (chunkSize >= 0xffff) {
|
||||
static int chunkCount = 0;
|
||||
qWarning() << "chunk" << ++chunkCount << "has length" << chunkSize - stringUtf8Size;
|
||||
outDataBuffer.write(",\n\n");
|
||||
|
Loading…
Reference in New Issue
Block a user