| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/corelib/json/qjsonparser.cpp | 
| Switch to Source code | Preprocessed file | 
| Line | Source | Count | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||||||||
| 2 | static const int nestingLimit = 1024; | - | ||||||||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||||||||
| 5 | QString QJsonParseError::errorString() const | - | ||||||||||||||||||||||||||||||
| 6 | { | - | ||||||||||||||||||||||||||||||
| 7 | const char *sz = ""; | - | ||||||||||||||||||||||||||||||
| 8 | switch (error) { | - | ||||||||||||||||||||||||||||||
| 9 |     case never executed:   NoError:case NoError:never executed:  case NoError: | 0 | ||||||||||||||||||||||||||||||
| 10 | sz = "no error occurred"; | - | ||||||||||||||||||||||||||||||
| 11 |         break; never executed:  break; | 0 | ||||||||||||||||||||||||||||||
| 12 |     case never executed:   UnterminatedObject:case UnterminatedObject:never executed:  case UnterminatedObject: | 0 | ||||||||||||||||||||||||||||||
| 13 | sz = "unterminated object"; | - | ||||||||||||||||||||||||||||||
| 14 |         break; never executed:  break; | 0 | ||||||||||||||||||||||||||||||
| 15 |     case never executed:   MissingNameSeparator:case MissingNameSeparator:never executed:  case MissingNameSeparator: | 0 | ||||||||||||||||||||||||||||||
| 16 | sz = "missing name separator"; | - | ||||||||||||||||||||||||||||||
| 17 |         break; never executed:  break; | 0 | ||||||||||||||||||||||||||||||
| 18 |     case never executed:   UnterminatedArray:case UnterminatedArray:never executed:  case UnterminatedArray: | 0 | ||||||||||||||||||||||||||||||
| 19 | sz = "unterminated array"; | - | ||||||||||||||||||||||||||||||
| 20 |         break; never executed:  break; | 0 | ||||||||||||||||||||||||||||||
| 21 |     case never executed:   MissingValueSeparator:case MissingValueSeparator:never executed:  case MissingValueSeparator: | 0 | ||||||||||||||||||||||||||||||
| 22 | sz = "missing value separator"; | - | ||||||||||||||||||||||||||||||
| 23 |         break; never executed:  break; | 0 | ||||||||||||||||||||||||||||||
| 24 |     case never executed:   IllegalValue:case IllegalValue:never executed:  case IllegalValue: | 0 | ||||||||||||||||||||||||||||||
| 25 | sz = "illegal value"; | - | ||||||||||||||||||||||||||||||
| 26 |         break; never executed:  break; | 0 | ||||||||||||||||||||||||||||||
| 27 |     case never executed:   TerminationByNumber:case TerminationByNumber:never executed:  case TerminationByNumber: | 0 | ||||||||||||||||||||||||||||||
| 28 | sz = "invalid termination by number"; | - | ||||||||||||||||||||||||||||||
| 29 |         break; never executed:  break; | 0 | ||||||||||||||||||||||||||||||
| 30 |     case never executed:   IllegalNumber:case IllegalNumber:never executed:  case IllegalNumber: | 0 | ||||||||||||||||||||||||||||||
| 31 | sz = "illegal number"; | - | ||||||||||||||||||||||||||||||
| 32 |         break; never executed:  break; | 0 | ||||||||||||||||||||||||||||||
| 33 |     case never executed:   IllegalEscapeSequence:case IllegalEscapeSequence:never executed:  case IllegalEscapeSequence: | 0 | ||||||||||||||||||||||||||||||
| 34 | sz = "invalid escape sequence"; | - | ||||||||||||||||||||||||||||||
| 35 |         break; never executed:  break; | 0 | ||||||||||||||||||||||||||||||
| 36 |     case never executed:   IllegalUTF8String:case IllegalUTF8String:never executed:  case IllegalUTF8String: | 0 | ||||||||||||||||||||||||||||||
| 37 | sz = "invalid UTF8 string"; | - | ||||||||||||||||||||||||||||||
| 38 |         break; never executed:  break; | 0 | ||||||||||||||||||||||||||||||
| 39 |     case never executed:   UnterminatedString:case UnterminatedString:never executed:  case UnterminatedString: | 0 | ||||||||||||||||||||||||||||||
| 40 | sz = "unterminated string"; | - | ||||||||||||||||||||||||||||||
| 41 |         break; never executed:  break; | 0 | ||||||||||||||||||||||||||||||
| 42 |     case never executed:   MissingObject:case MissingObject:never executed:  case MissingObject: | 0 | ||||||||||||||||||||||||||||||
| 43 | sz = "object is missing after a comma"; | - | ||||||||||||||||||||||||||||||
| 44 |         break; never executed:  break; | 0 | ||||||||||||||||||||||||||||||
| 45 |     case never executed:   DeepNesting:case DeepNesting:never executed:  case DeepNesting: | 0 | ||||||||||||||||||||||||||||||
| 46 | sz = "too deeply nested document"; | - | ||||||||||||||||||||||||||||||
| 47 |         break; never executed:  break; | 0 | ||||||||||||||||||||||||||||||
| 48 |     case never executed:   DocumentTooLarge:case DocumentTooLarge:never executed:  case DocumentTooLarge: | 0 | ||||||||||||||||||||||||||||||
| 49 | sz = "too large document"; | - | ||||||||||||||||||||||||||||||
| 50 |         break; never executed:  break; | 0 | ||||||||||||||||||||||||||||||
| 51 |     case never executed:   GarbageAtEnd:case GarbageAtEnd:never executed:  case GarbageAtEnd: | 0 | ||||||||||||||||||||||||||||||
| 52 | sz = "garbage at the end of the document"; | - | ||||||||||||||||||||||||||||||
| 53 |         break; never executed:  break; | 0 | ||||||||||||||||||||||||||||||
| 54 | } | - | ||||||||||||||||||||||||||||||
| 55 | - | |||||||||||||||||||||||||||||||
| 56 |     return never executed:   QCoreApplication::translate("QJsonParseError", sz);return QCoreApplication::translate("QJsonParseError", sz);never executed:  return QCoreApplication::translate("QJsonParseError", sz); | 0 | ||||||||||||||||||||||||||||||
| 57 | - | |||||||||||||||||||||||||||||||
| 58 | - | |||||||||||||||||||||||||||||||
| 59 | - | |||||||||||||||||||||||||||||||
| 60 | } | - | ||||||||||||||||||||||||||||||
| 61 | - | |||||||||||||||||||||||||||||||
| 62 | using namespace QJsonPrivate; | - | ||||||||||||||||||||||||||||||
| 63 | - | |||||||||||||||||||||||||||||||
| 64 | Parser::Parser(const char *json, int length) | - | ||||||||||||||||||||||||||||||
| 65 | : head(json), json(json), data(0), dataLength(0), current(0), nestingLevel(0), lastError(QJsonParseError::NoError) | - | ||||||||||||||||||||||||||||||
| 66 | { | - | ||||||||||||||||||||||||||||||
| 67 | end = json + length; | - | ||||||||||||||||||||||||||||||
| 68 | } executed 10 times by 4 tests:  end of blockExecuted by: 
  | 10 | ||||||||||||||||||||||||||||||
| 69 | enum { | - | ||||||||||||||||||||||||||||||
| 70 | Space = 0x20, | - | ||||||||||||||||||||||||||||||
| 71 | Tab = 0x09, | - | ||||||||||||||||||||||||||||||
| 72 | LineFeed = 0x0a, | - | ||||||||||||||||||||||||||||||
| 73 | Return = 0x0d, | - | ||||||||||||||||||||||||||||||
| 74 | BeginArray = 0x5b, | - | ||||||||||||||||||||||||||||||
| 75 | BeginObject = 0x7b, | - | ||||||||||||||||||||||||||||||
| 76 | EndArray = 0x5d, | - | ||||||||||||||||||||||||||||||
| 77 | EndObject = 0x7d, | - | ||||||||||||||||||||||||||||||
| 78 | NameSeparator = 0x3a, | - | ||||||||||||||||||||||||||||||
| 79 | ValueSeparator = 0x2c, | - | ||||||||||||||||||||||||||||||
| 80 | Quote = 0x22 | - | ||||||||||||||||||||||||||||||
| 81 | }; | - | ||||||||||||||||||||||||||||||
| 82 | - | |||||||||||||||||||||||||||||||
| 83 | void Parser::eatBOM() | - | ||||||||||||||||||||||||||||||
| 84 | { | - | ||||||||||||||||||||||||||||||
| 85 | - | |||||||||||||||||||||||||||||||
| 86 | uchar utf8bom[3] = { 0xef, 0xbb, 0xbf }; | - | ||||||||||||||||||||||||||||||
| 87 |     if (end - json > 3
  | 0-10 | ||||||||||||||||||||||||||||||
| 88 |         (
 
  | 0-10 | ||||||||||||||||||||||||||||||
| 89 |         (
 
  | 0 | ||||||||||||||||||||||||||||||
| 90 |         (
 
  | 0 | ||||||||||||||||||||||||||||||
| 91 |         json += 3; never executed:  json += 3; | 0 | ||||||||||||||||||||||||||||||
| 92 | } executed 10 times by 4 tests:  end of blockExecuted by: 
  | 10 | ||||||||||||||||||||||||||||||
| 93 | - | |||||||||||||||||||||||||||||||
| 94 | bool Parser::eatSpace() | - | ||||||||||||||||||||||||||||||
| 95 | { | - | ||||||||||||||||||||||||||||||
| 96 |     while (json < end
  | 14-30245 | ||||||||||||||||||||||||||||||
| 97 |         if (*
 
  | 9523-20722 | ||||||||||||||||||||||||||||||
| 98 |             break; executed 9523 times by 4 tests:  break;Executed by: 
  | 9523 | ||||||||||||||||||||||||||||||
| 99 |         if (*
 
  | 2643-18079 | ||||||||||||||||||||||||||||||
| 100 |             *
 
  | 0-2643 | ||||||||||||||||||||||||||||||
| 101 |             *
 
  | 0-2643 | ||||||||||||||||||||||||||||||
| 102 |             *
 
  | 0 | ||||||||||||||||||||||||||||||
| 103 |             break; never executed:  break; | 0 | ||||||||||||||||||||||||||||||
| 104 | ++json; | - | ||||||||||||||||||||||||||||||
| 105 |     } executed 20722 times by 4 tests:  end of blockExecuted by: 
  | 20722 | ||||||||||||||||||||||||||||||
| 106 |     return executed 9537 times by 4 tests:   (json < end);return (json < end);Executed by: 
 executed 9537 times by 4 tests:  return (json < end);Executed by: 
  | 9537 | ||||||||||||||||||||||||||||||
| 107 | } | - | ||||||||||||||||||||||||||||||
| 108 | - | |||||||||||||||||||||||||||||||
| 109 | char Parser::nextToken() | - | ||||||||||||||||||||||||||||||
| 110 | { | - | ||||||||||||||||||||||||||||||
| 111 |     if (!eatSpace()
  | 0-5213 | ||||||||||||||||||||||||||||||
| 112 |         return never executed:   0;return 0;never executed:  return 0; | 0 | ||||||||||||||||||||||||||||||
| 113 | char token = *json++; | - | ||||||||||||||||||||||||||||||
| 114 | switch (token) { | - | ||||||||||||||||||||||||||||||
| 115 |     case executed 1 time by 1 test:   BeginArray:case BeginArray:Executed by: 
 executed 1 time by 1 test:  case BeginArray:Executed by: 
  | 1 | ||||||||||||||||||||||||||||||
| 116 |     case executed 8 times by 3 tests:   BeginObject:case BeginObject:Executed by: 
 executed 8 times by 3 tests:  case BeginObject:Executed by: 
  | 8 | ||||||||||||||||||||||||||||||
| 117 |     case executed 1439 times by 3 tests:   NameSeparator:case NameSeparator:Executed by: 
 executed 1439 times by 3 tests:  case NameSeparator:Executed by: 
  | 1439 | ||||||||||||||||||||||||||||||
| 118 |     case executed 1278 times by 3 tests:   ValueSeparator:case ValueSeparator:Executed by: 
 executed 1278 times by 3 tests:  case ValueSeparator:Executed by: 
  | 1278 | ||||||||||||||||||||||||||||||
| 119 |     case executed 546 times by 3 tests:   EndArray:case EndArray:Executed by: 
 executed 546 times by 3 tests:  case EndArray:Executed by: 
  | 546 | ||||||||||||||||||||||||||||||
| 120 |     case executed 499 times by 3 tests:   EndObject:case EndObject:Executed by: 
 executed 499 times by 3 tests:  case EndObject:Executed by: 
  | 499 | ||||||||||||||||||||||||||||||
| 121 | eatSpace(); | - | ||||||||||||||||||||||||||||||
| 122 |     case executed 1439 times by 3 tests:   Quote:case Quote:Executed by: 
 executed 1439 times by 3 tests:  case Quote:Executed by: 
 code before this statement executed 3771 times by 4 tests:  case Quote:Executed by: 
  | 1439-3771 | ||||||||||||||||||||||||||||||
| 123 |         break; executed 5210 times by 4 tests:  break;Executed by: 
  | 5210 | ||||||||||||||||||||||||||||||
| 124 |     default executed 3 times by 2 tests:  :default:Executed by: 
 executed 3 times by 2 tests:  default:Executed by: 
  | 3 | ||||||||||||||||||||||||||||||
| 125 | token = 0; | - | ||||||||||||||||||||||||||||||
| 126 |         break; executed 3 times by 2 tests:  break;Executed by: 
  | 3 | ||||||||||||||||||||||||||||||
| 127 | } | - | ||||||||||||||||||||||||||||||
| 128 |     return executed 5213 times by 4 tests:   token;return token;Executed by: 
 executed 5213 times by 4 tests:  return token;Executed by: 
  | 5213 | ||||||||||||||||||||||||||||||
| 129 | } | - | ||||||||||||||||||||||||||||||
| 130 | - | |||||||||||||||||||||||||||||||
| 131 | - | |||||||||||||||||||||||||||||||
| 132 | - | |||||||||||||||||||||||||||||||
| 133 | - | |||||||||||||||||||||||||||||||
| 134 | QJsonDocument Parser::parse(QJsonParseError *error) | - | ||||||||||||||||||||||||||||||
| 135 | { | - | ||||||||||||||||||||||||||||||
| 136 | - | |||||||||||||||||||||||||||||||
| 137 | - | |||||||||||||||||||||||||||||||
| 138 | - | |||||||||||||||||||||||||||||||
| 139 | - | |||||||||||||||||||||||||||||||
| 140 | - | |||||||||||||||||||||||||||||||
| 141 | dataLength = qMax(end - json, (ptrdiff_t) 256); | - | ||||||||||||||||||||||||||||||
| 142 | data = (char *)malloc(dataLength); | - | ||||||||||||||||||||||||||||||
| 143 | - | |||||||||||||||||||||||||||||||
| 144 | - | |||||||||||||||||||||||||||||||
| 145 | QJsonPrivate::Header *h = (QJsonPrivate::Header *)data; | - | ||||||||||||||||||||||||||||||
| 146 | h->tag = QJsonDocument::BinaryFormatTag; | - | ||||||||||||||||||||||||||||||
| 147 | h->version = 1u; | - | ||||||||||||||||||||||||||||||
| 148 | - | |||||||||||||||||||||||||||||||
| 149 | current = sizeof(QJsonPrivate::Header); | - | ||||||||||||||||||||||||||||||
| 150 | - | |||||||||||||||||||||||||||||||
| 151 | eatBOM(); | - | ||||||||||||||||||||||||||||||
| 152 | char token = nextToken(); | - | ||||||||||||||||||||||||||||||
| 153 | - | |||||||||||||||||||||||||||||||
| 154 |     if (1) ; executed 10 times by 4 tests:   else QMessageLogger(__FILE__, 313, __PRETTY_FUNCTION__).debug() << hex << (uint)token;;Executed by: 
 dead code:  QMessageLogger(__FILE__, 313, __PRETTY_FUNCTION__).debug() << hex << (uint)token; | - | ||||||||||||||||||||||||||||||
| 155 |     if (token == BeginArray
  | 1-9 | ||||||||||||||||||||||||||||||
| 156 |         if (!parseArray()
  | 0-1 | ||||||||||||||||||||||||||||||
| 157 |             goto never executed:   error;goto error;never executed:  goto error; | 0 | ||||||||||||||||||||||||||||||
| 158 |     } executed 1 time by 1 test:   else if (token == BeginObjectend of blockExecuted by: 
 
  | 1-8 | ||||||||||||||||||||||||||||||
| 159 |         if (!parseObject()
  | 2-6 | ||||||||||||||||||||||||||||||
| 160 |             goto executed 2 times by 1 test:   error;goto error;Executed by: 
 executed 2 times by 1 test:  goto error;Executed by: 
  | 2 | ||||||||||||||||||||||||||||||
| 161 |     } executed 6 times by 2 tests:   else {end of blockExecuted by: 
  | 6 | ||||||||||||||||||||||||||||||
| 162 | lastError = QJsonParseError::IllegalValue; | - | ||||||||||||||||||||||||||||||
| 163 |         goto executed 1 time by 1 test:   error;goto error;Executed by: 
 executed 1 time by 1 test:  goto error;Executed by: 
  | 1 | ||||||||||||||||||||||||||||||
| 164 | } | - | ||||||||||||||||||||||||||||||
| 165 | - | |||||||||||||||||||||||||||||||
| 166 | eatSpace(); | - | ||||||||||||||||||||||||||||||
| 167 |     if (json < end
  | 0-7 | ||||||||||||||||||||||||||||||
| 168 | lastError = QJsonParseError::GarbageAtEnd; | - | ||||||||||||||||||||||||||||||
| 169 |         goto never executed:   error;goto error;never executed:  goto error; | 0 | ||||||||||||||||||||||||||||||
| 170 | } | - | ||||||||||||||||||||||||||||||
| 171 | - | |||||||||||||||||||||||||||||||
| 172 | do {} while (0); | - | ||||||||||||||||||||||||||||||
| 173 | { | - | ||||||||||||||||||||||||||||||
| 174 |         if (error
  | 2-5 | ||||||||||||||||||||||||||||||
| 175 | error->offset = 0; | - | ||||||||||||||||||||||||||||||
| 176 | error->error = QJsonParseError::NoError; | - | ||||||||||||||||||||||||||||||
| 177 |         } executed 5 times by 1 test:  end of blockExecuted by: 
  | 5 | ||||||||||||||||||||||||||||||
| 178 | QJsonPrivate::Data *d = new QJsonPrivate::Data(data, current); | - | ||||||||||||||||||||||||||||||
| 179 |         return executed 7 times by 3 tests:   QJsonDocument(d);return QJsonDocument(d);Executed by: 
 executed 7 times by 3 tests:  return QJsonDocument(d);Executed by: 
  | 7 | ||||||||||||||||||||||||||||||
| 180 | } | - | ||||||||||||||||||||||||||||||
| 181 | - | |||||||||||||||||||||||||||||||
| 182 | error: | - | ||||||||||||||||||||||||||||||
| 183 | - | |||||||||||||||||||||||||||||||
| 184 | - | |||||||||||||||||||||||||||||||
| 185 | - | |||||||||||||||||||||||||||||||
| 186 |     if (error
  | 0-3 | ||||||||||||||||||||||||||||||
| 187 | error->offset = json - head; | - | ||||||||||||||||||||||||||||||
| 188 | error->error = lastError; | - | ||||||||||||||||||||||||||||||
| 189 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||||||||
| 190 | free(data); | - | ||||||||||||||||||||||||||||||
| 191 |     return executed 3 times by 2 tests:   QJsonDocument();return QJsonDocument();Executed by: 
 executed 3 times by 2 tests:  return QJsonDocument();Executed by: 
  | 3 | ||||||||||||||||||||||||||||||
| 192 | } | - | ||||||||||||||||||||||||||||||
| 193 | - | |||||||||||||||||||||||||||||||
| 194 | - | |||||||||||||||||||||||||||||||
| 195 | void Parser::ParsedObject::insert(uint offset) { | - | ||||||||||||||||||||||||||||||
| 196 | const QJsonPrivate::Entry *newEntry = reinterpret_cast<const QJsonPrivate::Entry *>(parser->data + objectPosition + offset); | - | ||||||||||||||||||||||||||||||
| 197 | int min = 0; | - | ||||||||||||||||||||||||||||||
| 198 | int n = offsets.size(); | - | ||||||||||||||||||||||||||||||
| 199 |     while (n > 0
  | 1397-1439 | ||||||||||||||||||||||||||||||
| 200 | int half = n >> 1; | - | ||||||||||||||||||||||||||||||
| 201 | int middle = min + half; | - | ||||||||||||||||||||||||||||||
| 202 |         if (*
 
  | 674-723 | ||||||||||||||||||||||||||||||
| 203 | n = half; | - | ||||||||||||||||||||||||||||||
| 204 |         } executed 723 times by 3 tests:   else {end of blockExecuted by: 
  | 723 | ||||||||||||||||||||||||||||||
| 205 | min = middle + 1; | - | ||||||||||||||||||||||||||||||
| 206 | n -= half + 1; | - | ||||||||||||||||||||||||||||||
| 207 |         } executed 674 times by 3 tests:  end of blockExecuted by: 
  | 674 | ||||||||||||||||||||||||||||||
| 208 | } | - | ||||||||||||||||||||||||||||||
| 209 |     if (min < offsets.size()
 
 
  | 0-728 | ||||||||||||||||||||||||||||||
| 210 | offsets[min] = offset; | - | ||||||||||||||||||||||||||||||
| 211 |     } never executed:   else {end of block | 0 | ||||||||||||||||||||||||||||||
| 212 | offsets.insert(min, offset); | - | ||||||||||||||||||||||||||||||
| 213 |     } executed 1439 times by 3 tests:  end of blockExecuted by: 
  | 1439 | ||||||||||||||||||||||||||||||
| 214 | } | - | ||||||||||||||||||||||||||||||
| 215 | - | |||||||||||||||||||||||||||||||
| 216 | - | |||||||||||||||||||||||||||||||
| 217 | - | |||||||||||||||||||||||||||||||
| 218 | - | |||||||||||||||||||||||||||||||
| 219 | - | |||||||||||||||||||||||||||||||
| 220 | - | |||||||||||||||||||||||||||||||
| 221 | bool Parser::parseObject() | - | ||||||||||||||||||||||||||||||
| 222 | { | - | ||||||||||||||||||||||||||||||
| 223 |     if (++
 
  | 0-501 | ||||||||||||||||||||||||||||||
| 224 | lastError = QJsonParseError::DeepNesting; | - | ||||||||||||||||||||||||||||||
| 225 |         return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 226 | } | - | ||||||||||||||||||||||||||||||
| 227 | - | |||||||||||||||||||||||||||||||
| 228 | int objectOffset = reserveSpace(sizeof(QJsonPrivate::Object)); | - | ||||||||||||||||||||||||||||||
| 229 |     if (objectOffset < 0
  | 0-501 | ||||||||||||||||||||||||||||||
| 230 |         return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 231 |     if (1) ; executed 501 times by 4 tests:   else QMessageLogger(__FILE__, 390, __PRETTY_FUNCTION__).debug() << "parseObject pos=" << objectOffset << current << json;;Executed by: 
 dead code:  QMessageLogger(__FILE__, 390, __PRETTY_FUNCTION__).debug() << "parseObject pos=" << objectOffset << current << json; | - | ||||||||||||||||||||||||||||||
| 232 | - | |||||||||||||||||||||||||||||||
| 233 | ParsedObject parsedObject(this, objectOffset); | - | ||||||||||||||||||||||||||||||
| 234 | - | |||||||||||||||||||||||||||||||
| 235 | char token = nextToken(); | - | ||||||||||||||||||||||||||||||
| 236 |     while (token == Quote
  | 2-1439 | ||||||||||||||||||||||||||||||
| 237 | int off = current - objectOffset; | - | ||||||||||||||||||||||||||||||
| 238 |         if (!parseMember(objectOffset)
  | 0-1439 | ||||||||||||||||||||||||||||||
| 239 |             return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 240 | parsedObject.insert(off); | - | ||||||||||||||||||||||||||||||
| 241 | token = nextToken(); | - | ||||||||||||||||||||||||||||||
| 242 |         if (token != ValueSeparator
  | 499-940 | ||||||||||||||||||||||||||||||
| 243 |             break; executed 499 times by 3 tests:  break;Executed by: 
  | 499 | ||||||||||||||||||||||||||||||
| 244 | token = nextToken(); | - | ||||||||||||||||||||||||||||||
| 245 |         if (token == EndObject
  | 0-940 | ||||||||||||||||||||||||||||||
| 246 | lastError = QJsonParseError::MissingObject; | - | ||||||||||||||||||||||||||||||
| 247 |             return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 248 | } | - | ||||||||||||||||||||||||||||||
| 249 |     } executed 940 times by 3 tests:  end of blockExecuted by: 
  | 940 | ||||||||||||||||||||||||||||||
| 250 | - | |||||||||||||||||||||||||||||||
| 251 |     if (1) ; executed 501 times by 4 tests:   else QMessageLogger(__FILE__, 410, __PRETTY_FUNCTION__).debug() << "end token=" << token;;Executed by: 
 dead code:  QMessageLogger(__FILE__, 410, __PRETTY_FUNCTION__).debug() << "end token=" << token; | - | ||||||||||||||||||||||||||||||
| 252 |     if (token != EndObject
  | 2-499 | ||||||||||||||||||||||||||||||
| 253 | lastError = QJsonParseError::UnterminatedObject; | - | ||||||||||||||||||||||||||||||
| 254 |         return executed 2 times by 1 test:   false;return false;Executed by: 
 executed 2 times by 1 test:  return false;Executed by: 
  | 2 | ||||||||||||||||||||||||||||||
| 255 | } | - | ||||||||||||||||||||||||||||||
| 256 | - | |||||||||||||||||||||||||||||||
| 257 |     if (1) ; executed 499 times by 3 tests:   else QMessageLogger(__FILE__, 416, __PRETTY_FUNCTION__).debug() << "numEntries" << parsedObject.offsets.size();;Executed by: 
 dead code:  QMessageLogger(__FILE__, 416, __PRETTY_FUNCTION__).debug() << "numEntries" << parsedObject.offsets.size(); | - | ||||||||||||||||||||||||||||||
| 258 | int table = objectOffset; | - | ||||||||||||||||||||||||||||||
| 259 | - | |||||||||||||||||||||||||||||||
| 260 |     if (parsedObject.offsets.size()
  | 0-499 | ||||||||||||||||||||||||||||||
| 261 | int tableSize = parsedObject.offsets.size()*sizeof(uint); | - | ||||||||||||||||||||||||||||||
| 262 | table = reserveSpace(tableSize); | - | ||||||||||||||||||||||||||||||
| 263 |         if (table < 0
  | 0-499 | ||||||||||||||||||||||||||||||
| 264 |             return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 265 | - | |||||||||||||||||||||||||||||||
| 266 | - | |||||||||||||||||||||||||||||||
| 267 | memcpy(data + table, parsedObject.offsets.constData(), tableSize); | - | ||||||||||||||||||||||||||||||
| 268 | - | |||||||||||||||||||||||||||||||
| 269 | - | |||||||||||||||||||||||||||||||
| 270 | - | |||||||||||||||||||||||||||||||
| 271 | - | |||||||||||||||||||||||||||||||
| 272 | - | |||||||||||||||||||||||||||||||
| 273 | - | |||||||||||||||||||||||||||||||
| 274 |     } executed 499 times by 3 tests:  end of blockExecuted by: 
  | 499 | ||||||||||||||||||||||||||||||
| 275 | - | |||||||||||||||||||||||||||||||
| 276 | QJsonPrivate::Object *o = (QJsonPrivate::Object *)(data + objectOffset); | - | ||||||||||||||||||||||||||||||
| 277 | o->tableOffset = table - objectOffset; | - | ||||||||||||||||||||||||||||||
| 278 | o->size = current - objectOffset; | - | ||||||||||||||||||||||||||||||
| 279 | o->is_object = true; | - | ||||||||||||||||||||||||||||||
| 280 | o->length = parsedObject.offsets.size(); | - | ||||||||||||||||||||||||||||||
| 281 | - | |||||||||||||||||||||||||||||||
| 282 |     if (1) ; executed 499 times by 3 tests:   else QMessageLogger(__FILE__, 441, __PRETTY_FUNCTION__).debug() << "current=" << current;;Executed by: 
 dead code:  QMessageLogger(__FILE__, 441, __PRETTY_FUNCTION__).debug() << "current=" << current; | - | ||||||||||||||||||||||||||||||
| 283 | do {} while (0); | - | ||||||||||||||||||||||||||||||
| 284 | - | |||||||||||||||||||||||||||||||
| 285 | --nestingLevel; | - | ||||||||||||||||||||||||||||||
| 286 |     return executed 499 times by 3 tests:   true;return true;Executed by: 
 executed 499 times by 3 tests:  return true;Executed by: 
  | 499 | ||||||||||||||||||||||||||||||
| 287 | } | - | ||||||||||||||||||||||||||||||
| 288 | - | |||||||||||||||||||||||||||||||
| 289 | - | |||||||||||||||||||||||||||||||
| 290 | - | |||||||||||||||||||||||||||||||
| 291 | - | |||||||||||||||||||||||||||||||
| 292 | bool Parser::parseMember(int baseOffset) | - | ||||||||||||||||||||||||||||||
| 293 | { | - | ||||||||||||||||||||||||||||||
| 294 | int entryOffset = reserveSpace(sizeof(QJsonPrivate::Entry)); | - | ||||||||||||||||||||||||||||||
| 295 |     if (entryOffset < 0
  | 0-1439 | ||||||||||||||||||||||||||||||
| 296 |         return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 297 |     if (1) ; executed 1439 times by 3 tests:   else QMessageLogger(__FILE__, 456, __PRETTY_FUNCTION__).debug() << "parseMember pos=" << entryOffset;;Executed by: 
 dead code:  QMessageLogger(__FILE__, 456, __PRETTY_FUNCTION__).debug() << "parseMember pos=" << entryOffset; | - | ||||||||||||||||||||||||||||||
| 298 | - | |||||||||||||||||||||||||||||||
| 299 | bool latin1; | - | ||||||||||||||||||||||||||||||
| 300 |     if (!parseString(&latin1)
  | 0-1439 | ||||||||||||||||||||||||||||||
| 301 |         return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 302 | char token = nextToken(); | - | ||||||||||||||||||||||||||||||
| 303 |     if (token != NameSeparator
  | 0-1439 | ||||||||||||||||||||||||||||||
| 304 | lastError = QJsonParseError::MissingNameSeparator; | - | ||||||||||||||||||||||||||||||
| 305 |         return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 306 | } | - | ||||||||||||||||||||||||||||||
| 307 | QJsonPrivate::Value val; | - | ||||||||||||||||||||||||||||||
| 308 |     if (!parseValue(&val, baseOffset)
  | 0-1439 | ||||||||||||||||||||||||||||||
| 309 |         return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 310 | - | |||||||||||||||||||||||||||||||
| 311 | - | |||||||||||||||||||||||||||||||
| 312 | QJsonPrivate::Entry *e = (QJsonPrivate::Entry *)(data + entryOffset); | - | ||||||||||||||||||||||||||||||
| 313 | e->value = val; | - | ||||||||||||||||||||||||||||||
| 314 | e->value.latinKey = latin1; | - | ||||||||||||||||||||||||||||||
| 315 | - | |||||||||||||||||||||||||||||||
| 316 | do {} while (0); | - | ||||||||||||||||||||||||||||||
| 317 |     return executed 1439 times by 3 tests:   true;return true;Executed by: 
 executed 1439 times by 3 tests:  return true;Executed by: 
  | 1439 | ||||||||||||||||||||||||||||||
| 318 | } | - | ||||||||||||||||||||||||||||||
| 319 | - | |||||||||||||||||||||||||||||||
| 320 | namespace { | - | ||||||||||||||||||||||||||||||
| 321 | struct ValueArray { | - | ||||||||||||||||||||||||||||||
| 322 | static const int prealloc = 128; | - | ||||||||||||||||||||||||||||||
| 323 |         ValueArray() : data(stackValues), alloc(prealloc), size(0) {} executed 546 times by 3 tests:  end of blockExecuted by: 
  | 546 | ||||||||||||||||||||||||||||||
| 324 |         ~ValueArray() { if (data != stackValues
 executed 1 time by 1 test:   }free(data);Executed by: 
 executed 546 times by 3 tests:  end of blockExecuted by: 
  | 1-546 | ||||||||||||||||||||||||||||||
| 325 | - | |||||||||||||||||||||||||||||||
| 326 | inline bool grow() { | - | ||||||||||||||||||||||||||||||
| 327 | alloc *= 2; | - | ||||||||||||||||||||||||||||||
| 328 |             if (data == stackValues
  | 0-1 | ||||||||||||||||||||||||||||||
| 329 | QJsonPrivate::Value *newValues = static_cast<QJsonPrivate::Value *>(malloc(alloc*sizeof(QJsonPrivate::Value))); | - | ||||||||||||||||||||||||||||||
| 330 |                 if (!newValues
  | 0-1 | ||||||||||||||||||||||||||||||
| 331 |                     return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 332 | memcpy(newValues, data, size*sizeof(QJsonPrivate::Value)); | - | ||||||||||||||||||||||||||||||
| 333 | data = newValues; | - | ||||||||||||||||||||||||||||||
| 334 |             } executed 1 time by 1 test:   else {end of blockExecuted by: 
  | 1 | ||||||||||||||||||||||||||||||
| 335 | void *newValues = realloc(data, alloc * sizeof(QJsonPrivate::Value)); | - | ||||||||||||||||||||||||||||||
| 336 |                 if (!newValues
  | 0 | ||||||||||||||||||||||||||||||
| 337 |                     return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 338 | data = static_cast<QJsonPrivate::Value *>(newValues); | - | ||||||||||||||||||||||||||||||
| 339 |             } never executed:  end of block | 0 | ||||||||||||||||||||||||||||||
| 340 |             return executed 1 time by 1 test:   true;return true;Executed by: 
 executed 1 time by 1 test:  return true;Executed by: 
  | 1 | ||||||||||||||||||||||||||||||
| 341 | } | - | ||||||||||||||||||||||||||||||
| 342 | bool append(const QJsonPrivate::Value &v) { | - | ||||||||||||||||||||||||||||||
| 343 |             if (alloc == size
 
  | 0-796 | ||||||||||||||||||||||||||||||
| 344 |                 return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 345 | data[size] = v; | - | ||||||||||||||||||||||||||||||
| 346 | ++size; | - | ||||||||||||||||||||||||||||||
| 347 |             return executed 797 times by 3 tests:   true;return true;Executed by: 
 executed 797 times by 3 tests:  return true;Executed by: 
  | 797 | ||||||||||||||||||||||||||||||
| 348 | } | - | ||||||||||||||||||||||||||||||
| 349 | - | |||||||||||||||||||||||||||||||
| 350 | QJsonPrivate::Value stackValues[prealloc]; | - | ||||||||||||||||||||||||||||||
| 351 | QJsonPrivate::Value *data; | - | ||||||||||||||||||||||||||||||
| 352 | int alloc; | - | ||||||||||||||||||||||||||||||
| 353 | int size; | - | ||||||||||||||||||||||||||||||
| 354 | }; | - | ||||||||||||||||||||||||||||||
| 355 | } | - | ||||||||||||||||||||||||||||||
| 356 | - | |||||||||||||||||||||||||||||||
| 357 | - | |||||||||||||||||||||||||||||||
| 358 | - | |||||||||||||||||||||||||||||||
| 359 | - | |||||||||||||||||||||||||||||||
| 360 | bool Parser::parseArray() | - | ||||||||||||||||||||||||||||||
| 361 | { | - | ||||||||||||||||||||||||||||||
| 362 |     if (1) ; executed 546 times by 3 tests:   else QMessageLogger(__FILE__, 521, __PRETTY_FUNCTION__).debug() << "parseArray";;Executed by: 
 dead code:  QMessageLogger(__FILE__, 521, __PRETTY_FUNCTION__).debug() << "parseArray"; | - | ||||||||||||||||||||||||||||||
| 363 | - | |||||||||||||||||||||||||||||||
| 364 |     if (++
 
  | 0-546 | ||||||||||||||||||||||||||||||
| 365 | lastError = QJsonParseError::DeepNesting; | - | ||||||||||||||||||||||||||||||
| 366 |         return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 367 | } | - | ||||||||||||||||||||||||||||||
| 368 | - | |||||||||||||||||||||||||||||||
| 369 | int arrayOffset = reserveSpace(sizeof(QJsonPrivate::Array)); | - | ||||||||||||||||||||||||||||||
| 370 |     if (arrayOffset < 0
  | 0-546 | ||||||||||||||||||||||||||||||
| 371 |         return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 372 | - | |||||||||||||||||||||||||||||||
| 373 | ValueArray values; | - | ||||||||||||||||||||||||||||||
| 374 | - | |||||||||||||||||||||||||||||||
| 375 |     if (!eatSpace()
  | 0-546 | ||||||||||||||||||||||||||||||
| 376 | lastError = QJsonParseError::UnterminatedArray; | - | ||||||||||||||||||||||||||||||
| 377 |         return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 378 | } | - | ||||||||||||||||||||||||||||||
| 379 |     if (*
 
  | 87-459 | ||||||||||||||||||||||||||||||
| 380 | nextToken(); | - | ||||||||||||||||||||||||||||||
| 381 |     } executed 87 times by 1 test:   else {end of blockExecuted by: 
  | 87 | ||||||||||||||||||||||||||||||
| 382 | while (1) { | - | ||||||||||||||||||||||||||||||
| 383 | QJsonPrivate::Value val; | - | ||||||||||||||||||||||||||||||
| 384 |             if (!parseValue(&val, arrayOffset)
  | 0-797 | ||||||||||||||||||||||||||||||
| 385 |                 return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 386 |             if (!values.append(val)
  | 0-797 | ||||||||||||||||||||||||||||||
| 387 | lastError = QJsonParseError::DocumentTooLarge; | - | ||||||||||||||||||||||||||||||
| 388 |                 return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 389 | } | - | ||||||||||||||||||||||||||||||
| 390 | char token = nextToken(); | - | ||||||||||||||||||||||||||||||
| 391 |             if (token == EndArray
  | 338-459 | ||||||||||||||||||||||||||||||
| 392 |                 break; executed 459 times by 3 tests:  break;Executed by: 
  | 459 | ||||||||||||||||||||||||||||||
| 393 |             else if (token != ValueSeparator
  | 0-338 | ||||||||||||||||||||||||||||||
| 394 |                 if (!eatSpace()
  | 0 | ||||||||||||||||||||||||||||||
| 395 |                     lastError = QJsonParseError::UnterminatedArray; never executed:  lastError = QJsonParseError::UnterminatedArray; | 0 | ||||||||||||||||||||||||||||||
| 396 | else | - | ||||||||||||||||||||||||||||||
| 397 |                     lastError = QJsonParseError::MissingValueSeparator; never executed:  lastError = QJsonParseError::MissingValueSeparator; | 0 | ||||||||||||||||||||||||||||||
| 398 |                 return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 399 | } | - | ||||||||||||||||||||||||||||||
| 400 |         } executed 338 times by 3 tests:  end of blockExecuted by: 
  | 338 | ||||||||||||||||||||||||||||||
| 401 |     } executed 459 times by 3 tests:  end of blockExecuted by: 
  | 459 | ||||||||||||||||||||||||||||||
| 402 | - | |||||||||||||||||||||||||||||||
| 403 |     if (1) ; executed 546 times by 3 tests:   else QMessageLogger(__FILE__, 562, __PRETTY_FUNCTION__).debug() << "size =" << values.size;;Executed by: 
 dead code:  QMessageLogger(__FILE__, 562, __PRETTY_FUNCTION__).debug() << "size =" << values.size; | - | ||||||||||||||||||||||||||||||
| 404 | int table = arrayOffset; | - | ||||||||||||||||||||||||||||||
| 405 | - | |||||||||||||||||||||||||||||||
| 406 |     if (values.size
  | 87-459 | ||||||||||||||||||||||||||||||
| 407 | int tableSize = values.size*sizeof(QJsonPrivate::Value); | - | ||||||||||||||||||||||||||||||
| 408 | table = reserveSpace(tableSize); | - | ||||||||||||||||||||||||||||||
| 409 |         if (table < 0
  | 0-459 | ||||||||||||||||||||||||||||||
| 410 |             return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 411 | memcpy(data + table, values.data, tableSize); | - | ||||||||||||||||||||||||||||||
| 412 |     } executed 459 times by 3 tests:  end of blockExecuted by: 
  | 459 | ||||||||||||||||||||||||||||||
| 413 | - | |||||||||||||||||||||||||||||||
| 414 | QJsonPrivate::Array *a = (QJsonPrivate::Array *)(data + arrayOffset); | - | ||||||||||||||||||||||||||||||
| 415 | a->tableOffset = table - arrayOffset; | - | ||||||||||||||||||||||||||||||
| 416 | a->size = current - arrayOffset; | - | ||||||||||||||||||||||||||||||
| 417 | a->is_object = false; | - | ||||||||||||||||||||||||||||||
| 418 | a->length = values.size; | - | ||||||||||||||||||||||||||||||
| 419 | - | |||||||||||||||||||||||||||||||
| 420 |     if (1) ; executed 546 times by 3 tests:   else QMessageLogger(__FILE__, 579, __PRETTY_FUNCTION__).debug() << "current=" << current;;Executed by: 
 dead code:  QMessageLogger(__FILE__, 579, __PRETTY_FUNCTION__).debug() << "current=" << current; | - | ||||||||||||||||||||||||||||||
| 421 | do {} while (0); | - | ||||||||||||||||||||||||||||||
| 422 | - | |||||||||||||||||||||||||||||||
| 423 | --nestingLevel; | - | ||||||||||||||||||||||||||||||
| 424 |     return executed 546 times by 3 tests:   true;return true;Executed by: 
 executed 546 times by 3 tests:  return true;Executed by: 
  | 546 | ||||||||||||||||||||||||||||||
| 425 | } | - | ||||||||||||||||||||||||||||||
| 426 | - | |||||||||||||||||||||||||||||||
| 427 | - | |||||||||||||||||||||||||||||||
| 428 | - | |||||||||||||||||||||||||||||||
| 429 | - | |||||||||||||||||||||||||||||||
| 430 | - | |||||||||||||||||||||||||||||||
| 431 | - | |||||||||||||||||||||||||||||||
| 432 | bool Parser::parseValue(QJsonPrivate::Value *val, int baseOffset) | - | ||||||||||||||||||||||||||||||
| 433 | { | - | ||||||||||||||||||||||||||||||
| 434 |     if (1) ; executed 2236 times by 3 tests:   else QMessageLogger(__FILE__, 593, __PRETTY_FUNCTION__).debug() << "parse Value" << json;;Executed by: 
 dead code:  QMessageLogger(__FILE__, 593, __PRETTY_FUNCTION__).debug() << "parse Value" << json; | - | ||||||||||||||||||||||||||||||
| 435 | val->_dummy = 0; | - | ||||||||||||||||||||||||||||||
| 436 | - | |||||||||||||||||||||||||||||||
| 437 | switch (*json++) { | - | ||||||||||||||||||||||||||||||
| 438 |     case executed 1 time by 1 test:   'n':case 'n':Executed by: 
 executed 1 time by 1 test:  case 'n':Executed by: 
  | 1 | ||||||||||||||||||||||||||||||
| 439 |         if (end - json < 4
  | 0-1 | ||||||||||||||||||||||||||||||
| 440 | lastError = QJsonParseError::IllegalValue; | - | ||||||||||||||||||||||||||||||
| 441 |             return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 442 | } | - | ||||||||||||||||||||||||||||||
| 443 |         if (*
 
  | 0-1 | ||||||||||||||||||||||||||||||
| 444 |             *
 
  | 0-1 | ||||||||||||||||||||||||||||||
| 445 |             *
 
  | 0-1 | ||||||||||||||||||||||||||||||
| 446 | val->type = QJsonValue::Null; | - | ||||||||||||||||||||||||||||||
| 447 |             if (1) ; executed 1 time by 1 test:   else QMessageLogger(__FILE__, 606, __PRETTY_FUNCTION__).debug() << "value: null";;Executed by: 
 dead code:  QMessageLogger(__FILE__, 606, __PRETTY_FUNCTION__).debug() << "value: null"; | - | ||||||||||||||||||||||||||||||
| 448 | do {} while (0); | - | ||||||||||||||||||||||||||||||
| 449 |             return executed 1 time by 1 test:   true;return true;Executed by: 
 executed 1 time by 1 test:  return true;Executed by: 
  | 1 | ||||||||||||||||||||||||||||||
| 450 | } | - | ||||||||||||||||||||||||||||||
| 451 | lastError = QJsonParseError::IllegalValue; | - | ||||||||||||||||||||||||||||||
| 452 |         return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 453 |     case executed 1 time by 1 test:   't':case 't':Executed by: 
 executed 1 time by 1 test:  case 't':Executed by: 
  | 1 | ||||||||||||||||||||||||||||||
| 454 |         if (end - json < 4
  | 0-1 | ||||||||||||||||||||||||||||||
| 455 | lastError = QJsonParseError::IllegalValue; | - | ||||||||||||||||||||||||||||||
| 456 |             return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 457 | } | - | ||||||||||||||||||||||||||||||
| 458 |         if (*
 
  | 0-1 | ||||||||||||||||||||||||||||||
| 459 |             *
 
  | 0-1 | ||||||||||||||||||||||||||||||
| 460 |             *
 
  | 0-1 | ||||||||||||||||||||||||||||||
| 461 | val->type = QJsonValue::Bool; | - | ||||||||||||||||||||||||||||||
| 462 | val->value = true; | - | ||||||||||||||||||||||||||||||
| 463 |             if (1) ; executed 1 time by 1 test:   else QMessageLogger(__FILE__, 622, __PRETTY_FUNCTION__).debug() << "value: true";;Executed by: 
 dead code:  QMessageLogger(__FILE__, 622, __PRETTY_FUNCTION__).debug() << "value: true"; | - | ||||||||||||||||||||||||||||||
| 464 | do {} while (0); | - | ||||||||||||||||||||||||||||||
| 465 |             return executed 1 time by 1 test:   true;return true;Executed by: 
 executed 1 time by 1 test:  return true;Executed by: 
  | 1 | ||||||||||||||||||||||||||||||
| 466 | } | - | ||||||||||||||||||||||||||||||
| 467 | lastError = QJsonParseError::IllegalValue; | - | ||||||||||||||||||||||||||||||
| 468 |         return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 469 |     case executed 1 time by 1 test:   'f':case 'f':Executed by: 
 executed 1 time by 1 test:  case 'f':Executed by: 
  | 1 | ||||||||||||||||||||||||||||||
| 470 |         if (end - json < 5
  | 0-1 | ||||||||||||||||||||||||||||||
| 471 | lastError = QJsonParseError::IllegalValue; | - | ||||||||||||||||||||||||||||||
| 472 |             return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 473 | } | - | ||||||||||||||||||||||||||||||
| 474 |         if (*
 
  | 0-1 | ||||||||||||||||||||||||||||||
| 475 |             *
 
  | 0-1 | ||||||||||||||||||||||||||||||
| 476 |             *
 
  | 0-1 | ||||||||||||||||||||||||||||||
| 477 |             *
 
  | 0-1 | ||||||||||||||||||||||||||||||
| 478 | val->type = QJsonValue::Bool; | - | ||||||||||||||||||||||||||||||
| 479 | val->value = false; | - | ||||||||||||||||||||||||||||||
| 480 |             if (1) ; executed 1 time by 1 test:   else QMessageLogger(__FILE__, 639, __PRETTY_FUNCTION__).debug() << "value: false";;Executed by: 
 dead code:  QMessageLogger(__FILE__, 639, __PRETTY_FUNCTION__).debug() << "value: false"; | - | ||||||||||||||||||||||||||||||
| 481 | do {} while (0); | - | ||||||||||||||||||||||||||||||
| 482 |             return executed 1 time by 1 test:   true;return true;Executed by: 
 executed 1 time by 1 test:  return true;Executed by: 
  | 1 | ||||||||||||||||||||||||||||||
| 483 | } | - | ||||||||||||||||||||||||||||||
| 484 | lastError = QJsonParseError::IllegalValue; | - | ||||||||||||||||||||||||||||||
| 485 |         return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 486 |     case executed 1144 times by 3 tests:   Quote:case Quote:Executed by: 
 executed 1144 times by 3 tests:   {case Quote:Executed by: 
  | 1144 | ||||||||||||||||||||||||||||||
| 487 | val->type = QJsonValue::String; | - | ||||||||||||||||||||||||||||||
| 488 |         if (current - baseOffset >= Value::MaxSize
  | 0-1144 | ||||||||||||||||||||||||||||||
| 489 | lastError = QJsonParseError::DocumentTooLarge; | - | ||||||||||||||||||||||||||||||
| 490 |             return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 491 | } | - | ||||||||||||||||||||||||||||||
| 492 | val->value = current - baseOffset; | - | ||||||||||||||||||||||||||||||
| 493 | bool latin1; | - | ||||||||||||||||||||||||||||||
| 494 |         if (!parseString(&latin1)
  | 0-1144 | ||||||||||||||||||||||||||||||
| 495 |             return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 496 | val->latinOrIntValue = latin1; | - | ||||||||||||||||||||||||||||||
| 497 |         if (1) ; executed 1144 times by 3 tests:   else QMessageLogger(__FILE__, 656, __PRETTY_FUNCTION__).debug() << "value: string";;Executed by: 
 dead code:  QMessageLogger(__FILE__, 656, __PRETTY_FUNCTION__).debug() << "value: string"; | - | ||||||||||||||||||||||||||||||
| 498 | do {} while (0); | - | ||||||||||||||||||||||||||||||
| 499 |         return executed 1144 times by 3 tests:   true;return true;Executed by: 
 executed 1144 times by 3 tests:  return true;Executed by: 
  | 1144 | ||||||||||||||||||||||||||||||
| 500 | } | - | ||||||||||||||||||||||||||||||
| 501 |     case executed 545 times by 3 tests:   BeginArray:case BeginArray:Executed by: 
 executed 545 times by 3 tests:  case BeginArray:Executed by: 
  | 545 | ||||||||||||||||||||||||||||||
| 502 | val->type = QJsonValue::Array; | - | ||||||||||||||||||||||||||||||
| 503 |         if (current - baseOffset >= Value::MaxSize
  | 0-545 | ||||||||||||||||||||||||||||||
| 504 | lastError = QJsonParseError::DocumentTooLarge; | - | ||||||||||||||||||||||||||||||
| 505 |             return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 506 | } | - | ||||||||||||||||||||||||||||||
| 507 | val->value = current - baseOffset; | - | ||||||||||||||||||||||||||||||
| 508 |         if (!parseArray()
  | 0-545 | ||||||||||||||||||||||||||||||
| 509 |             return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 510 |         if (1) ; executed 545 times by 3 tests:   else QMessageLogger(__FILE__, 669, __PRETTY_FUNCTION__).debug() << "value: array";;Executed by: 
 dead code:  QMessageLogger(__FILE__, 669, __PRETTY_FUNCTION__).debug() << "value: array"; | - | ||||||||||||||||||||||||||||||
| 511 | do {} while (0); | - | ||||||||||||||||||||||||||||||
| 512 |         return executed 545 times by 3 tests:   true;return true;Executed by: 
 executed 545 times by 3 tests:  return true;Executed by: 
  | 545 | ||||||||||||||||||||||||||||||
| 513 |     case executed 493 times by 3 tests:   BeginObject:case BeginObject:Executed by: 
 executed 493 times by 3 tests:  case BeginObject:Executed by: 
  | 493 | ||||||||||||||||||||||||||||||
| 514 | val->type = QJsonValue::Object; | - | ||||||||||||||||||||||||||||||
| 515 |         if (current - baseOffset >= Value::MaxSize
  | 0-493 | ||||||||||||||||||||||||||||||
| 516 | lastError = QJsonParseError::DocumentTooLarge; | - | ||||||||||||||||||||||||||||||
| 517 |             return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 518 | } | - | ||||||||||||||||||||||||||||||
| 519 | val->value = current - baseOffset; | - | ||||||||||||||||||||||||||||||
| 520 |         if (!parseObject()
  | 0-493 | ||||||||||||||||||||||||||||||
| 521 |             return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 522 |         if (1) ; executed 493 times by 3 tests:   else QMessageLogger(__FILE__, 681, __PRETTY_FUNCTION__).debug() << "value: object";;Executed by: 
 dead code:  QMessageLogger(__FILE__, 681, __PRETTY_FUNCTION__).debug() << "value: object"; | - | ||||||||||||||||||||||||||||||
| 523 | do {} while (0); | - | ||||||||||||||||||||||||||||||
| 524 |         return executed 493 times by 3 tests:   true;return true;Executed by: 
 executed 493 times by 3 tests:  return true;Executed by: 
  | 493 | ||||||||||||||||||||||||||||||
| 525 |     case never executed:   EndArray:case EndArray:never executed:  case EndArray: | 0 | ||||||||||||||||||||||||||||||
| 526 | lastError = QJsonParseError::MissingObject; | - | ||||||||||||||||||||||||||||||
| 527 |         return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 528 |     default executed 51 times by 2 tests:  :default:Executed by: 
 executed 51 times by 2 tests:  default:Executed by: 
  | 51 | ||||||||||||||||||||||||||||||
| 529 | --json; | - | ||||||||||||||||||||||||||||||
| 530 |         if (!parseNumber(val, baseOffset)
  | 0-51 | ||||||||||||||||||||||||||||||
| 531 |             return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 532 |         if (1) ; executed 51 times by 2 tests:   else QMessageLogger(__FILE__, 691, __PRETTY_FUNCTION__).debug() << "value: number";;Executed by: 
 dead code:  QMessageLogger(__FILE__, 691, __PRETTY_FUNCTION__).debug() << "value: number"; | - | ||||||||||||||||||||||||||||||
| 533 | do {} while (0); | - | ||||||||||||||||||||||||||||||
| 534 |     } executed 51 times by 2 tests:  end of blockExecuted by: 
  | 51 | ||||||||||||||||||||||||||||||
| 535 | - | |||||||||||||||||||||||||||||||
| 536 |     return executed 51 times by 2 tests:   true;return true;Executed by: 
 executed 51 times by 2 tests:  return true;Executed by: 
  | 51 | ||||||||||||||||||||||||||||||
| 537 | } | - | ||||||||||||||||||||||||||||||
| 538 | bool Parser::parseNumber(QJsonPrivate::Value *val, int baseOffset) | - | ||||||||||||||||||||||||||||||
| 539 | { | - | ||||||||||||||||||||||||||||||
| 540 |     if (1) ; executed 51 times by 2 tests:   else QMessageLogger(__FILE__, 718, __PRETTY_FUNCTION__).debug() << "parseNumber" << json;;Executed by: 
 dead code:  QMessageLogger(__FILE__, 718, __PRETTY_FUNCTION__).debug() << "parseNumber" << json; | - | ||||||||||||||||||||||||||||||
| 541 | val->type = QJsonValue::Double; | - | ||||||||||||||||||||||||||||||
| 542 | - | |||||||||||||||||||||||||||||||
| 543 | const char *start = json; | - | ||||||||||||||||||||||||||||||
| 544 | bool isInt = true; | - | ||||||||||||||||||||||||||||||
| 545 | - | |||||||||||||||||||||||||||||||
| 546 | - | |||||||||||||||||||||||||||||||
| 547 |     if (json < end
 
 
  | 0-51 | ||||||||||||||||||||||||||||||
| 548 |         ++ never executed:  json;++json;never executed:  ++json; | 0 | ||||||||||||||||||||||||||||||
| 549 | - | |||||||||||||||||||||||||||||||
| 550 | - | |||||||||||||||||||||||||||||||
| 551 |     if (json < end
 
 
  | 0-51 | ||||||||||||||||||||||||||||||
| 552 | ++json; | - | ||||||||||||||||||||||||||||||
| 553 |     } never executed:   else {end of block | 0 | ||||||||||||||||||||||||||||||
| 554 |         while (json < end
 
 
 
 
  | 0-114 | ||||||||||||||||||||||||||||||
| 555 |             ++ executed 63 times by 2 tests:  json;++json;Executed by: 
 executed 63 times by 2 tests:  ++json;Executed by: 
  | 63 | ||||||||||||||||||||||||||||||
| 556 |     } executed 51 times by 2 tests:  end of blockExecuted by: 
  | 51 | ||||||||||||||||||||||||||||||
| 557 | - | |||||||||||||||||||||||||||||||
| 558 | - | |||||||||||||||||||||||||||||||
| 559 |     if (json < end
 
 
  | 0-51 | ||||||||||||||||||||||||||||||
| 560 | isInt = false; | - | ||||||||||||||||||||||||||||||
| 561 | ++json; | - | ||||||||||||||||||||||||||||||
| 562 |         while (json < end
 
 
 
 
  | 0 | ||||||||||||||||||||||||||||||
| 563 |             ++ never executed:  json;++json;never executed:  ++json; | 0 | ||||||||||||||||||||||||||||||
| 564 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||||||||
| 565 | - | |||||||||||||||||||||||||||||||
| 566 | - | |||||||||||||||||||||||||||||||
| 567 |     if (json < end
 
 
 
 
  | 0-51 | ||||||||||||||||||||||||||||||
| 568 | isInt = false; | - | ||||||||||||||||||||||||||||||
| 569 | ++json; | - | ||||||||||||||||||||||||||||||
| 570 |         if (json < end
 
 
 
 
  | 0 | ||||||||||||||||||||||||||||||
| 571 |             ++ never executed:  json;++json;never executed:  ++json; | 0 | ||||||||||||||||||||||||||||||
| 572 |         while (json < end
 
 
 
 
  | 0 | ||||||||||||||||||||||||||||||
| 573 |             ++ never executed:  json;++json;never executed:  ++json; | 0 | ||||||||||||||||||||||||||||||
| 574 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||||||||
| 575 | - | |||||||||||||||||||||||||||||||
| 576 |     if (json >= end
  | 0-51 | ||||||||||||||||||||||||||||||
| 577 | lastError = QJsonParseError::TerminationByNumber; | - | ||||||||||||||||||||||||||||||
| 578 |         return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 579 | } | - | ||||||||||||||||||||||||||||||
| 580 | - | |||||||||||||||||||||||||||||||
| 581 | QByteArray number(start, json - start); | - | ||||||||||||||||||||||||||||||
| 582 |     if (1) ; executed 51 times by 2 tests:   else QMessageLogger(__FILE__, 760, __PRETTY_FUNCTION__).debug() << "numberstring" << number;;Executed by: 
 dead code:  QMessageLogger(__FILE__, 760, __PRETTY_FUNCTION__).debug() << "numberstring" << number; | - | ||||||||||||||||||||||||||||||
| 583 | - | |||||||||||||||||||||||||||||||
| 584 |     if (isInt
  | 0-51 | ||||||||||||||||||||||||||||||
| 585 | bool ok; | - | ||||||||||||||||||||||||||||||
| 586 | int n = number.toInt(&ok); | - | ||||||||||||||||||||||||||||||
| 587 |         if (ok
 
 
  | 0-51 | ||||||||||||||||||||||||||||||
| 588 | val->int_value = n; | - | ||||||||||||||||||||||||||||||
| 589 | val->latinOrIntValue = true; | - | ||||||||||||||||||||||||||||||
| 590 | do {} while (0); | - | ||||||||||||||||||||||||||||||
| 591 |             return executed 51 times by 2 tests:   true;return true;Executed by: 
 executed 51 times by 2 tests:  return true;Executed by: 
  | 51 | ||||||||||||||||||||||||||||||
| 592 | } | - | ||||||||||||||||||||||||||||||
| 593 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||||||||
| 594 | - | |||||||||||||||||||||||||||||||
| 595 | bool ok; | - | ||||||||||||||||||||||||||||||
| 596 | union { | - | ||||||||||||||||||||||||||||||
| 597 | quint64 ui; | - | ||||||||||||||||||||||||||||||
| 598 | double d; | - | ||||||||||||||||||||||||||||||
| 599 | }; | - | ||||||||||||||||||||||||||||||
| 600 | d = number.toDouble(&ok); | - | ||||||||||||||||||||||||||||||
| 601 | - | |||||||||||||||||||||||||||||||
| 602 |     if (!ok
  | 0 | ||||||||||||||||||||||||||||||
| 603 | lastError = QJsonParseError::IllegalNumber; | - | ||||||||||||||||||||||||||||||
| 604 |         return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 605 | } | - | ||||||||||||||||||||||||||||||
| 606 | - | |||||||||||||||||||||||||||||||
| 607 | int pos = reserveSpace(sizeof(double)); | - | ||||||||||||||||||||||||||||||
| 608 |     if (pos < 0
  | 0 | ||||||||||||||||||||||||||||||
| 609 |         return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 610 | qToLittleEndian(ui, reinterpret_cast<uchar *>(data + pos)); | - | ||||||||||||||||||||||||||||||
| 611 |     if (current - baseOffset >= Value::MaxSize
  | 0 | ||||||||||||||||||||||||||||||
| 612 | lastError = QJsonParseError::DocumentTooLarge; | - | ||||||||||||||||||||||||||||||
| 613 |         return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 614 | } | - | ||||||||||||||||||||||||||||||
| 615 | val->value = pos - baseOffset; | - | ||||||||||||||||||||||||||||||
| 616 | val->latinOrIntValue = false; | - | ||||||||||||||||||||||||||||||
| 617 | - | |||||||||||||||||||||||||||||||
| 618 | do {} while (0); | - | ||||||||||||||||||||||||||||||
| 619 |     return never executed:   true;return true;never executed:  return true; | 0 | ||||||||||||||||||||||||||||||
| 620 | } | - | ||||||||||||||||||||||||||||||
| 621 | static inline bool addHexDigit(char digit, uint *result) | - | ||||||||||||||||||||||||||||||
| 622 | { | - | ||||||||||||||||||||||||||||||
| 623 | *result <<= 4; | - | ||||||||||||||||||||||||||||||
| 624 |     if (digit >= '0'
 
  | 0-412 | ||||||||||||||||||||||||||||||
| 625 |         * executed 300 times by 1 test:  result |= (digit - '0');*result |= (digit - '0');Executed by: 
 executed 300 times by 1 test:  *result |= (digit - '0');Executed by: 
  | 300 | ||||||||||||||||||||||||||||||
| 626 |     else if (digit >= 'a'
 
  | 0-112 | ||||||||||||||||||||||||||||||
| 627 |         * never executed:  result |= (digit - 'a') + 10;*result |= (digit - 'a') + 10;never executed:  *result |= (digit - 'a') + 10; | 0 | ||||||||||||||||||||||||||||||
| 628 |     else if (digit >= 'A'
 
  | 0-112 | ||||||||||||||||||||||||||||||
| 629 |         * executed 112 times by 1 test:  result |= (digit - 'A') + 10;*result |= (digit - 'A') + 10;Executed by: 
 executed 112 times by 1 test:  *result |= (digit - 'A') + 10;Executed by: 
  | 112 | ||||||||||||||||||||||||||||||
| 630 | else | - | ||||||||||||||||||||||||||||||
| 631 |         return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 632 |     return executed 412 times by 1 test:   true;return true;Executed by: 
 executed 412 times by 1 test:  return true;Executed by: 
  | 412 | ||||||||||||||||||||||||||||||
| 633 | } | - | ||||||||||||||||||||||||||||||
| 634 | - | |||||||||||||||||||||||||||||||
| 635 | static inline bool scanEscapeSequence(const char *&json, const char *end, uint *ch) | - | ||||||||||||||||||||||||||||||
| 636 | { | - | ||||||||||||||||||||||||||||||
| 637 | ++json; | - | ||||||||||||||||||||||||||||||
| 638 |     if (json >= end
  | 0-206 | ||||||||||||||||||||||||||||||
| 639 |         return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 640 | - | |||||||||||||||||||||||||||||||
| 641 |     if (1) ; executed 206 times by 1 test:   else QMessageLogger(__FILE__, 842, __PRETTY_FUNCTION__).debug() << "scan escape" << (char)*json;;Executed by: 
 dead code:  QMessageLogger(__FILE__, 842, __PRETTY_FUNCTION__).debug() << "scan escape" << (char)*json; | - | ||||||||||||||||||||||||||||||
| 642 | uint escaped = *json++; | - | ||||||||||||||||||||||||||||||
| 643 | switch (escaped) { | - | ||||||||||||||||||||||||||||||
| 644 |     case executed 98 times by 1 test:   '"':case '"':Executed by: 
 executed 98 times by 1 test:  case '"':Executed by: 
  | 98 | ||||||||||||||||||||||||||||||
| 645 |         *ch = '"'; break; executed 98 times by 1 test:  break;Executed by: 
  | 98 | ||||||||||||||||||||||||||||||
| 646 |     case executed 4 times by 1 test:   '\\':case '\\':Executed by: 
 executed 4 times by 1 test:  case '\\':Executed by: 
  | 4 | ||||||||||||||||||||||||||||||
| 647 |         *ch = '\\'; break; executed 4 times by 1 test:  break;Executed by: 
  | 4 | ||||||||||||||||||||||||||||||
| 648 |     case never executed:   '/':case '/':never executed:  case '/': | 0 | ||||||||||||||||||||||||||||||
| 649 |         *ch = '/'; break; never executed:  break; | 0 | ||||||||||||||||||||||||||||||
| 650 |     case never executed:   'b':case 'b':never executed:  case 'b': | 0 | ||||||||||||||||||||||||||||||
| 651 |         *ch = 0x8; break; never executed:  break; | 0 | ||||||||||||||||||||||||||||||
| 652 |     case never executed:   'f':case 'f':never executed:  case 'f': | 0 | ||||||||||||||||||||||||||||||
| 653 |         *ch = 0xc; break; never executed:  break; | 0 | ||||||||||||||||||||||||||||||
| 654 |     case never executed:   'n':case 'n':never executed:  case 'n': | 0 | ||||||||||||||||||||||||||||||
| 655 |         *ch = 0xa; break; never executed:  break; | 0 | ||||||||||||||||||||||||||||||
| 656 |     case executed 1 time by 1 test:   'r':case 'r':Executed by: 
 executed 1 time by 1 test:  case 'r':Executed by: 
  | 1 | ||||||||||||||||||||||||||||||
| 657 |         *ch = 0xd; break; executed 1 time by 1 test:  break;Executed by: 
  | 1 | ||||||||||||||||||||||||||||||
| 658 |     case never executed:   't':case 't':never executed:  case 't': | 0 | ||||||||||||||||||||||||||||||
| 659 |         *ch = 0x9; break; never executed:  break; | 0 | ||||||||||||||||||||||||||||||
| 660 |     case executed 103 times by 1 test:   'u':case 'u':Executed by: 
 executed 103 times by 1 test:   {case 'u':Executed by: 
  | 103 | ||||||||||||||||||||||||||||||
| 661 | *ch = 0; | - | ||||||||||||||||||||||||||||||
| 662 |         if (json > end - 4
  | 0-103 | ||||||||||||||||||||||||||||||
| 663 |             return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 664 |         for (int i = 0; i < 4
  | 103-412 | ||||||||||||||||||||||||||||||
| 665 |             if (!addHexDigit(*json, ch)
  | 0-412 | ||||||||||||||||||||||||||||||
| 666 |                 return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 667 | ++json; | - | ||||||||||||||||||||||||||||||
| 668 |         } executed 412 times by 1 test:  end of blockExecuted by: 
  | 412 | ||||||||||||||||||||||||||||||
| 669 |         return executed 103 times by 1 test:   true;return true;Executed by: 
 executed 103 times by 1 test:  return true;Executed by: 
  | 103 | ||||||||||||||||||||||||||||||
| 670 | } | - | ||||||||||||||||||||||||||||||
| 671 |     default never executed:  :default:never executed:  default: | 0 | ||||||||||||||||||||||||||||||
| 672 | - | |||||||||||||||||||||||||||||||
| 673 | - | |||||||||||||||||||||||||||||||
| 674 | *ch = escaped; | - | ||||||||||||||||||||||||||||||
| 675 |         return never executed:   true;return true;never executed:  return true; | 0 | ||||||||||||||||||||||||||||||
| 676 | } | - | ||||||||||||||||||||||||||||||
| 677 |     return executed 103 times by 1 test:   true;return true;Executed by: 
 executed 103 times by 1 test:  return true;Executed by: 
  | 103 | ||||||||||||||||||||||||||||||
| 678 | } | - | ||||||||||||||||||||||||||||||
| 679 | - | |||||||||||||||||||||||||||||||
| 680 | static inline bool scanUtf8Char(const char *&json, const char *end, uint *result) | - | ||||||||||||||||||||||||||||||
| 681 | { | - | ||||||||||||||||||||||||||||||
| 682 | const uchar *&src = reinterpret_cast<const uchar *&>(json); | - | ||||||||||||||||||||||||||||||
| 683 | const uchar *uend = reinterpret_cast<const uchar *>(end); | - | ||||||||||||||||||||||||||||||
| 684 | uchar b = *src++; | - | ||||||||||||||||||||||||||||||
| 685 | int res = QUtf8Functions::fromUtf8<QUtf8BaseTraits>(b, result, src, uend); | - | ||||||||||||||||||||||||||||||
| 686 |     if (res < 0
  | 0-35995 | ||||||||||||||||||||||||||||||
| 687 | - | |||||||||||||||||||||||||||||||
| 688 | --json; | - | ||||||||||||||||||||||||||||||
| 689 |         return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 690 | } | - | ||||||||||||||||||||||||||||||
| 691 | - | |||||||||||||||||||||||||||||||
| 692 |     return executed 35995 times by 3 tests:   true;return true;Executed by: 
 executed 35995 times by 3 tests:  return true;Executed by: 
  | 35995 | ||||||||||||||||||||||||||||||
| 693 | } | - | ||||||||||||||||||||||||||||||
| 694 | - | |||||||||||||||||||||||||||||||
| 695 | bool Parser::parseString(bool *latin1) | - | ||||||||||||||||||||||||||||||
| 696 | { | - | ||||||||||||||||||||||||||||||
| 697 | *latin1 = true; | - | ||||||||||||||||||||||||||||||
| 698 | - | |||||||||||||||||||||||||||||||
| 699 | const char *start = json; | - | ||||||||||||||||||||||||||||||
| 700 | int outStart = current; | - | ||||||||||||||||||||||||||||||
| 701 | - | |||||||||||||||||||||||||||||||
| 702 | - | |||||||||||||||||||||||||||||||
| 703 | - | |||||||||||||||||||||||||||||||
| 704 | int stringPos = reserveSpace(2); | - | ||||||||||||||||||||||||||||||
| 705 |     if (stringPos < 0
  | 0-2583 | ||||||||||||||||||||||||||||||
| 706 |         return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 707 | - | |||||||||||||||||||||||||||||||
| 708 |     if (1) ; executed 2583 times by 3 tests:   else QMessageLogger(__FILE__, 909, __PRETTY_FUNCTION__).debug() << "parse string stringPos=" << stringPos << json;;Executed by: 
 dead code:  QMessageLogger(__FILE__, 909, __PRETTY_FUNCTION__).debug() << "parse string stringPos=" << stringPos << json; | - | ||||||||||||||||||||||||||||||
| 709 |     while (json < end
  | 0-38666 | ||||||||||||||||||||||||||||||
| 710 | uint ch = 0; | - | ||||||||||||||||||||||||||||||
| 711 |         if (*
 
  | 2573-36093 | ||||||||||||||||||||||||||||||
| 712 |             break; executed 2573 times by 3 tests:  break;Executed by: 
  | 2573 | ||||||||||||||||||||||||||||||
| 713 |         else if (*
 
  | 110-35983 | ||||||||||||||||||||||||||||||
| 714 |             if (!scanEscapeSequence(json, end, &ch)
  | 0-110 | ||||||||||||||||||||||||||||||
| 715 | lastError = QJsonParseError::IllegalEscapeSequence; | - | ||||||||||||||||||||||||||||||
| 716 |                 return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 717 | } | - | ||||||||||||||||||||||||||||||
| 718 |         } executed 110 times by 1 test:   else {end of blockExecuted by: 
  | 110 | ||||||||||||||||||||||||||||||
| 719 |             if (!scanUtf8Char(json, end, &ch)
  | 0-35983 | ||||||||||||||||||||||||||||||
| 720 | lastError = QJsonParseError::IllegalUTF8String; | - | ||||||||||||||||||||||||||||||
| 721 |                 return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 722 | } | - | ||||||||||||||||||||||||||||||
| 723 |         } executed 35983 times by 3 tests:  end of blockExecuted by: 
  | 35983 | ||||||||||||||||||||||||||||||
| 724 | - | |||||||||||||||||||||||||||||||
| 725 |         if (ch > 0xff
 
  | 0-36083 | ||||||||||||||||||||||||||||||
| 726 | *latin1 = false; | - | ||||||||||||||||||||||||||||||
| 727 |             break; executed 10 times by 1 test:  break;Executed by: 
  | 10 | ||||||||||||||||||||||||||||||
| 728 | } | - | ||||||||||||||||||||||||||||||
| 729 | int pos = reserveSpace(1); | - | ||||||||||||||||||||||||||||||
| 730 |         if (pos < 0
  | 0-36083 | ||||||||||||||||||||||||||||||
| 731 |             return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 732 |         if (1) ; executed 36083 times by 3 tests:   else QMessageLogger(__FILE__, 933, __PRETTY_FUNCTION__).debug() << "  " << ch << (char)ch;;Executed by: 
 dead code:  QMessageLogger(__FILE__, 933, __PRETTY_FUNCTION__).debug() << " " << ch << (char)ch; | - | ||||||||||||||||||||||||||||||
| 733 | data[pos] = (uchar)ch; | - | ||||||||||||||||||||||||||||||
| 734 |     } executed 36083 times by 3 tests:  end of blockExecuted by: 
  | 36083 | ||||||||||||||||||||||||||||||
| 735 | ++json; | - | ||||||||||||||||||||||||||||||
| 736 |     if (1) ; executed 2583 times by 3 tests:   else QMessageLogger(__FILE__, 937, __PRETTY_FUNCTION__).debug() << "end of string";;Executed by: 
 dead code:  QMessageLogger(__FILE__, 937, __PRETTY_FUNCTION__).debug() << "end of string"; | - | ||||||||||||||||||||||||||||||
| 737 |     if (json >= end
  | 0-2583 | ||||||||||||||||||||||||||||||
| 738 | lastError = QJsonParseError::UnterminatedString; | - | ||||||||||||||||||||||||||||||
| 739 |         return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 740 | } | - | ||||||||||||||||||||||||||||||
| 741 | - | |||||||||||||||||||||||||||||||
| 742 | - | |||||||||||||||||||||||||||||||
| 743 |     if (*
 
  | 10-2573 | ||||||||||||||||||||||||||||||
| 744 | - | |||||||||||||||||||||||||||||||
| 745 | *(QJsonPrivate::qle_ushort *)(data + stringPos) = ushort(current - outStart - sizeof(ushort)); | - | ||||||||||||||||||||||||||||||
| 746 | int pos = reserveSpace((4 - current) & 3); | - | ||||||||||||||||||||||||||||||
| 747 |         if (pos < 0
  | 0-2573 | ||||||||||||||||||||||||||||||
| 748 |             return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 749 |         while (pos & 3
  | 2573-4433 | ||||||||||||||||||||||||||||||
| 750 |             data[pos++] = 0; executed 4433 times by 3 tests:  data[pos++] = 0;Executed by: 
  | 4433 | ||||||||||||||||||||||||||||||
| 751 | do {} while (0); | - | ||||||||||||||||||||||||||||||
| 752 |         return executed 2573 times by 3 tests:   true;return true;Executed by: 
 executed 2573 times by 3 tests:  return true;Executed by: 
  | 2573 | ||||||||||||||||||||||||||||||
| 753 | } | - | ||||||||||||||||||||||||||||||
| 754 | - | |||||||||||||||||||||||||||||||
| 755 | *latin1 = false; | - | ||||||||||||||||||||||||||||||
| 756 |     if (1) ; executed 10 times by 1 test:   else QMessageLogger(__FILE__, 957, __PRETTY_FUNCTION__).debug() << "not latin";;Executed by: 
 dead code:  QMessageLogger(__FILE__, 957, __PRETTY_FUNCTION__).debug() << "not latin"; | - | ||||||||||||||||||||||||||||||
| 757 | - | |||||||||||||||||||||||||||||||
| 758 | json = start; | - | ||||||||||||||||||||||||||||||
| 759 | current = outStart + sizeof(int); | - | ||||||||||||||||||||||||||||||
| 760 | - | |||||||||||||||||||||||||||||||
| 761 |     while (json < end
  | 0-118 | ||||||||||||||||||||||||||||||
| 762 | uint ch = 0; | - | ||||||||||||||||||||||||||||||
| 763 |         if (*
 
  | 10-108 | ||||||||||||||||||||||||||||||
| 764 |             break; executed 10 times by 1 test:  break;Executed by: 
  | 10 | ||||||||||||||||||||||||||||||
| 765 |         else if (*
 
  | 12-96 | ||||||||||||||||||||||||||||||
| 766 |             if (!scanEscapeSequence(json, end, &ch)
  | 0-96 | ||||||||||||||||||||||||||||||
| 767 | lastError = QJsonParseError::IllegalEscapeSequence; | - | ||||||||||||||||||||||||||||||
| 768 |                 return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 769 | } | - | ||||||||||||||||||||||||||||||
| 770 |         } executed 96 times by 1 test:   else {end of blockExecuted by: 
  | 96 | ||||||||||||||||||||||||||||||
| 771 |             if (!scanUtf8Char(json, end, &ch)
  | 0-12 | ||||||||||||||||||||||||||||||
| 772 | lastError = QJsonParseError::IllegalUTF8String; | - | ||||||||||||||||||||||||||||||
| 773 |                 return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 774 | } | - | ||||||||||||||||||||||||||||||
| 775 |         } executed 12 times by 1 test:  end of blockExecuted by: 
  | 12 | ||||||||||||||||||||||||||||||
| 776 |         if (QChar::requiresSurrogates(ch)
  | 0-108 | ||||||||||||||||||||||||||||||
| 777 | int pos = reserveSpace(4); | - | ||||||||||||||||||||||||||||||
| 778 |             if (pos < 0
  | 0 | ||||||||||||||||||||||||||||||
| 779 |                 return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 780 | *(QJsonPrivate::qle_ushort *)(data + pos) = QChar::highSurrogate(ch); | - | ||||||||||||||||||||||||||||||
| 781 | *(QJsonPrivate::qle_ushort *)(data + pos + 2) = QChar::lowSurrogate(ch); | - | ||||||||||||||||||||||||||||||
| 782 |         } never executed:   else {end of block | 0 | ||||||||||||||||||||||||||||||
| 783 | int pos = reserveSpace(2); | - | ||||||||||||||||||||||||||||||
| 784 |             if (pos < 0
  | 0-108 | ||||||||||||||||||||||||||||||
| 785 |                 return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 786 | *(QJsonPrivate::qle_ushort *)(data + pos) = (ushort)ch; | - | ||||||||||||||||||||||||||||||
| 787 |         } executed 108 times by 1 test:  end of blockExecuted by: 
  | 108 | ||||||||||||||||||||||||||||||
| 788 | } | - | ||||||||||||||||||||||||||||||
| 789 | ++json; | - | ||||||||||||||||||||||||||||||
| 790 | - | |||||||||||||||||||||||||||||||
| 791 |     if (json >= end
  | 0-10 | ||||||||||||||||||||||||||||||
| 792 | lastError = QJsonParseError::UnterminatedString; | - | ||||||||||||||||||||||||||||||
| 793 |         return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 794 | } | - | ||||||||||||||||||||||||||||||
| 795 | - | |||||||||||||||||||||||||||||||
| 796 | - | |||||||||||||||||||||||||||||||
| 797 | *(QJsonPrivate::qle_int *)(data + stringPos) = (current - outStart - sizeof(int))/2; | - | ||||||||||||||||||||||||||||||
| 798 | int pos = reserveSpace((4 - current) & 3); | - | ||||||||||||||||||||||||||||||
| 799 |     if (pos < 0
  | 0-10 | ||||||||||||||||||||||||||||||
| 800 |         return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||||||||
| 801 |     while (pos & 3
  | 10-12 | ||||||||||||||||||||||||||||||
| 802 |         data[pos++] = 0; executed 12 times by 1 test:  data[pos++] = 0;Executed by: 
  | 12 | ||||||||||||||||||||||||||||||
| 803 | do {} while (0); | - | ||||||||||||||||||||||||||||||
| 804 |     return executed 10 times by 1 test:   true;return true;Executed by: 
 executed 10 times by 1 test:  return true;Executed by: 
  | 10 | ||||||||||||||||||||||||||||||
| 805 | } | - | ||||||||||||||||||||||||||||||
| 806 | - | |||||||||||||||||||||||||||||||
| 807 | - | |||||||||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |