Changed: Discard \r and only use \n

--HG--
branch : develop
This commit is contained in:
kervala 2016-11-04 20:22:10 +01:00
parent 542c63f03d
commit 9f934f7765
2 changed files with 21 additions and 9 deletions

View file

@ -502,17 +502,30 @@ void CI18N::skipWhiteSpace(ucstring::const_iterator &it, ucstring::const_iterato
if (storeComments && *it == '/' && it+1 != last && *(it+1) == '/')
{
// found a one line C comment. Store it until end of line.
while (it != last && *it != '\n')
while (it != last && (*it != '\n' && *it != '\r'))
storeComments->push_back(*it++);
// store the final '\n'
if (it != last)
storeComments->push_back(*it++);
storeComments->push_back('\n');
}
else if (storeComments && *it == '/' && it+1 != last && *(it+1) == '*')
{
// found a multi line C++ comment. store until we found the closing '*/'
while (it != last && !(*it == '*' && it+1 != last && *(it+1) == '/'))
while (it != last && !(*it == '*' && it + 1 != last && *(it + 1) == '/'))
{
// don't put \r
if (*it == '\r')
{
// skip it
++it;
}
else
{
storeComments->push_back(*it++);
}
}
// store the final '*'
if (it != last)
storeComments->push_back(*it++);
@ -522,7 +535,6 @@ void CI18N::skipWhiteSpace(ucstring::const_iterator &it, ucstring::const_iterato
storeComments->push_back(*it++);
// and a new line.
storeComments->push_back('\r');
storeComments->push_back('\n');
}
else

View file

@ -153,9 +153,9 @@ void showUsage(char *exeName)
void verifyVersion(ucstring& doc, int versionId)
{
ucstring version1("// DIFF_VERSION 1\r\n");
ucstring version1("// DIFF_VERSION 1\n");
ucstring::size_type version1Size = version1.size();
ucstring version2("// DIFF_VERSION 2\r\n");
ucstring version2("// DIFF_VERSION 2\n");
ucstring::size_type version2Size = version2.size();
switch (versionId)
@ -1071,7 +1071,7 @@ int makePhraseDiff(int argc, char *argv[])
{
LOG("Writing difference file for language %s\n", Languages[l].c_str());
ucstring text;
text += "// DIFF_VERSION 1\r\n";
text += "// DIFF_VERSION 1\n";
text += preparePhraseFile(diff, false);
// add the tag for non translation
text += nl + ucstring ("// REMOVE THE FOLOWING LINE WHEN TRANSLATION IS DONE") + nl + ucstring("// DIFF NOT TRANSLATED") + nl;
@ -2805,7 +2805,7 @@ int makePhraseDiff2(int argc, char *argv[])
{
LOG("Writing difference file for language %s\n", Languages[l].c_str());
ucstring text;
text += "// DIFF_VERSION 2\r\n";
text += "// DIFF_VERSION 2\n";
text += preparePhraseFile(diff, false);
// add the tag for non translation
text += nl + ucstring ("// REMOVE THE FOLOWING LINE WHEN TRANSLATION IS DONE") + nl + ucstring("// DIFF NOT TRANSLATED") + nl;