StelJsonParser.cpp   StelJsonParser.cpp 
skipping to change at line 199 skipping to change at line 199
// Read a string without the initial " // Read a string without the initial "
QByteArray StelJsonParserInstance::readString() QByteArray StelJsonParserInstance::readString()
{ {
QByteArray name; QByteArray name;
char c; char c;
while (getChar(&c)) while (getChar(&c))
{ {
switch (c) switch (c)
{ {
case '\"': case '"':
return name; return name;
case '\\': case '\\':
{ {
getChar(&c); getChar(&c);
// case '\"': break;
// case '\\': break;
// case '/': break;
if (c=='b') c='\b'; if (c=='b') c='\b';
if (c=='f') c='\f'; if (c=='f') c='\f';
if (c=='n') c='\n'; if (c=='n') c='\n';
if (c=='r') c='\r'; if (c=='r') c='\r';
if (c=='t') c='\t'; if (c=='t') c='\t';
if (c=='u') {qWarning() << "don't support \\ uxxxx char"; continue;} if (c=='u') {qWarning() << "don't support \\ uxxxx char"; continue;}
break;
} }
default: default:
name+=c; name+=c;
} }
} }
if (atEnd()) if (atEnd())
throw std::runtime_error(qPrintable(QString("End of file bef ore end of string: "+name))); throw std::runtime_error(qPrintable(QString("End of file bef ore end of string: "+name)));
throw std::runtime_error(qPrintable(QString("Read error before end o f string: "+name))); throw std::runtime_error(qPrintable(QString("Read error before end o f string: "+name)));
return ""; return "";
} }
skipping to change at line 346 skipping to change at line 342
{ {
case QVariant::Bool: case QVariant::Bool:
output->write(v.toBool()==true ? "true" : "false"); output->write(v.toBool()==true ? "true" : "false");
break; break;
case QVariant::Invalid: case QVariant::Invalid:
output->write("null"); output->write("null");
break; break;
case QVariant::ByteArray: case QVariant::ByteArray:
{ {
QByteArray s(v.toByteArray()); QByteArray s(v.toByteArray());
s.replace('\\', "\\\\");
s.replace('\"', "\\\""); s.replace('\"', "\\\"");
s.replace('\b', "\\b"); s.replace('\b', "\\b");
s.replace('\n', "\\n"); s.replace('\n', "\\n");
s.replace('\f', "\\f"); s.replace('\f', "\\f");
s.replace('\r', "\\r"); s.replace('\r', "\\r");
s.replace('\t', "\\t"); s.replace('\t', "\\t");
output->write("\"" + s + "\""); output->write("\"" + s + "\"");
break; break;
} }
case QVariant::String: case QVariant::String:
{ {
QString s(v.toString()); QString s(v.toString());
s.replace('\\', "\\\\");
s.replace('\"', "\\\""); s.replace('\"', "\\\"");
s.replace('\b', "\\b"); s.replace('\b', "\\b");
s.replace('\n', "\\n"); s.replace('\n', "\\n");
s.replace('\f', "\\f"); s.replace('\f', "\\f");
s.replace('\r', "\\r"); s.replace('\r', "\\r");
s.replace('\t', "\\t"); s.replace('\t', "\\t");
output->write(QString("\"%1\"").arg(s).toUtf8()); output->write(QString("\"%1\"").arg(s).toUtf8());
break; break;
} }
case QVariant::Int: case QVariant::Int:
 End of changes. 5 change blocks. 
5 lines changed or deleted 3 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/