Do not close string data by a double null terminator.

There is no point in saving \0 twice. Any code that could relay on it
is broken anyway, because moc saves \0\0 for an empty string.

Change-Id: I28fa4f78aae8c883c088df43ec89d608a99b3bdd
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Jędrzej Nowacki 2013-12-18 13:47:44 +01:00 committed by The Qt Project
parent e5e43a2386
commit a88d97174e
1 changed files with 3 additions and 2 deletions

View File

@ -244,7 +244,7 @@ void Generator::generateCode()
int len = 0;
for (int i = 0; i < strings.size(); ++i)
len += strings.at(i).length() + 1;
fprintf(out, " char stringdata[%d];\n", len + 1);
fprintf(out, " char stringdata[%d];\n", len);
}
fprintf(out, "};\n");
@ -316,7 +316,8 @@ void Generator::generateCode()
col += spanLen;
}
fputs("\\0", out);
if (i != strings.size() - 1) // skip the last \0 the c++ will add it for us
fputs("\\0", out);
col += len + 2;
}