Changed: Use NLMISC::toString instead of itoa

--HG--
branch : develop
This commit is contained in:
kervala 2015-03-02 13:09:57 +01:00
parent a0c60bc896
commit bb429f0ea9

View file

@ -95,17 +95,6 @@ const std::string historyDir("history/");
string diffVersion; string diffVersion;
#ifndef NL_OS_WINDOWS
char* itoa(int val, char *buffer, int base)
{
static char buf[32] = {0};
int i = 30;
for(; val && i ; --i, val /= base)
buf[i] = "0123456789abcdef"[val % base];
return &buf[i+1];
}
#endif // NL_OS_WINDOWS
#ifdef NL_DEBUG #ifdef NL_DEBUG
# define LOG nldebug # define LOG nldebug
#else #else
@ -970,7 +959,6 @@ public:
void onChanged(uint addIndex, uint refIndex, TPhraseDiffContext &context) void onChanged(uint addIndex, uint refIndex, TPhraseDiffContext &context)
{ {
ucstring chg; ucstring chg;
char temp[1024];
// check what is changed. // check what is changed.
if (context.Addition[addIndex].Parameters != context.Reference[refIndex].Parameters) if (context.Addition[addIndex].Parameters != context.Reference[refIndex].Parameters)
chg += "// Parameter list changed." + nl; chg += "// Parameter list changed." + nl;
@ -981,11 +969,11 @@ public:
for (uint i=0; i<context.Addition[addIndex].Clauses.size(); ++i) for (uint i=0; i<context.Addition[addIndex].Clauses.size(); ++i)
{ {
if (context.Addition[addIndex].Clauses[i].Identifier != context.Reference[refIndex].Clauses[i].Identifier) if (context.Addition[addIndex].Clauses[i].Identifier != context.Reference[refIndex].Clauses[i].Identifier)
chg += ucstring("// Clause ")+itoa(i, temp, 10) + " : identifier changed." + nl; chg += ucstring("// Clause ") + toString(i) + " : identifier changed." + nl;
else if (context.Addition[addIndex].Clauses[i].Conditions != context.Reference[refIndex].Clauses[i].Conditions) else if (context.Addition[addIndex].Clauses[i].Conditions != context.Reference[refIndex].Clauses[i].Conditions)
chg += ucstring("// Clause ")+itoa(i, temp, 10) + " : condition changed." + nl; chg += ucstring("// Clause ") + toString(i) + " : condition changed." + nl;
else if (context.Addition[addIndex].Clauses[i].Text != context.Reference[refIndex].Clauses[i].Text) else if (context.Addition[addIndex].Clauses[i].Text != context.Reference[refIndex].Clauses[i].Text)
chg += ucstring("// Clause ")+itoa(i, temp, 10) + " : text changed." + nl; chg += ucstring("// Clause ") + toString(i) + " : text changed." + nl;
} }
} }
@ -2683,7 +2671,6 @@ void CMakePhraseDiff2::onRemove(uint addIndex, uint refIndex, TPhraseDiffContext
void CMakePhraseDiff2::onChanged(uint addIndex, uint refIndex, TPhraseDiffContext &context) void CMakePhraseDiff2::onChanged(uint addIndex, uint refIndex, TPhraseDiffContext &context)
{ {
ucstring chg; ucstring chg;
char temp[1024];
// check what is changed. // check what is changed.
if (context.Addition[addIndex].Parameters != context.Reference[refIndex].Parameters) if (context.Addition[addIndex].Parameters != context.Reference[refIndex].Parameters)
chg += "// Parameter list changed." + nl; chg += "// Parameter list changed." + nl;
@ -2694,11 +2681,11 @@ void CMakePhraseDiff2::onChanged(uint addIndex, uint refIndex, TPhraseDiffContex
for (uint i=0; i<context.Addition[addIndex].Clauses.size(); ++i) for (uint i=0; i<context.Addition[addIndex].Clauses.size(); ++i)
{ {
if (context.Addition[addIndex].Clauses[i].Identifier != context.Reference[refIndex].Clauses[i].Identifier) if (context.Addition[addIndex].Clauses[i].Identifier != context.Reference[refIndex].Clauses[i].Identifier)
chg += ucstring("// Clause ")+itoa(i, temp, 10) + " : identifier changed." + nl; chg += ucstring("// Clause ") + toString(i) + " : identifier changed." + nl;
else if (context.Addition[addIndex].Clauses[i].Conditions != context.Reference[refIndex].Clauses[i].Conditions) else if (context.Addition[addIndex].Clauses[i].Conditions != context.Reference[refIndex].Clauses[i].Conditions)
chg += ucstring("// Clause ")+itoa(i, temp, 10) + " : condition changed." + nl; chg += ucstring("// Clause ") + toString(i) + " : condition changed." + nl;
else if (context.Addition[addIndex].Clauses[i].Text != context.Reference[refIndex].Clauses[i].Text) else if (context.Addition[addIndex].Clauses[i].Text != context.Reference[refIndex].Clauses[i].Text)
chg += ucstring("// Clause ")+itoa(i, temp, 10) + " : text changed." + nl; chg += ucstring("// Clause ") + toString(i) + " : text changed." + nl;
} }
} }