| 346 | } |
| 347 | |
| 348 | void |
| 349 | loadDataFromFile(StorageCacheImpl* cache) |
| 350 | { |
| 351 | bool structIsCorrect = true; |
| 352 | char* name = NULL; |
| 353 | unsigned int nameLen; |
| 354 | unsigned int numExtra; |
| 355 | unsigned int curFunc = 0; |
| 356 | unsigned int curPatt = 0; |
| 357 | unsigned int func; |
| 358 | unsigned int patt; |
| 359 | HfInfo file; |
| 360 | |
| 361 | if ( hfOpenRead(&file, cache->fpath) == FILE_NOT_FOUND ) { |
| 362 | cache->isPopulate = false; |
| 363 | return; |
| 364 | } |
| 365 | |
| 366 | // Read file Header |
| 367 | loadHeader(&file); |
| 368 | |
| 369 | // Read pattern header |
| 370 | structIsCorrect &= loadPatternDataFromFile(&file, &name, &nameLen, |
| 371 | &numExtra); |
| 372 | |
| 373 | while (structIsCorrect) |
| 374 | { |
| 375 | unsigned int func = curFunc; |
| 376 | unsigned int patt = curPatt; |
| 377 | bool ret; |
| 378 | BlasPatternInfo* bPatt = getPatternInfo(cache, func, patt); |
| 379 | |
| 380 | |
| 381 | while (bPatt != NULL && memcmp(name, bPatt->name, nameLen) != 0 ) { |
| 382 | nextPattern(cache, &func, &patt); |
| 383 | bPatt = getPatternInfo(cache, func, patt); |
| 384 | } |
| 385 | |
| 386 | if (bPatt != NULL) { |
| 387 | bPatt->sstatus = SS_CORRECT_DATA; |
| 388 | |
| 389 | // Read pattern data |
| 390 | ret = readPatternData(&file, bPatt, numExtra); |
| 391 | |
| 392 | // go to next pattern |
| 393 | nextPattern(cache, &func, &patt); |
| 394 | // if the pattern is read witch error or not completely |
| 395 | if (!ret) { |
| 396 | bPatt = getPatternInfo(cache, func, patt); |
| 397 | hfJump(&file, bPatt->offset); |
| 398 | } |
| 399 | |
| 400 | curFunc = func; |
| 401 | curPatt = patt; |
| 402 | } |
| 403 | free(name); |
| 404 | name = NULL; |
| 405 | structIsCorrect &= loadPatternDataFromFile(&file, &name, &nameLen, |
no test coverage detected