Changed: Discard \r and only use \n

--HG--
branch : develop
feature/pipeline-tools
kervala 8 years ago
parent 542c63f03d
commit 9f934f7765

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

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

Loading…
Cancel
Save