| 479 | // |
| 480 | |
| 481 | TempFile* TempSpace::setupFile(FB_SIZE_T size) |
| 482 | { |
| 483 | StaticStatusVector status_vector; |
| 484 | |
| 485 | for (FB_SIZE_T i = 0; i < tempDirs->getCount(); i++) |
| 486 | { |
| 487 | TempFile* file = NULL; |
| 488 | |
| 489 | PathName directory = (*tempDirs)[i]; |
| 490 | PathUtils::ensureSeparator(directory); |
| 491 | |
| 492 | for (FB_SIZE_T j = 0; j < tempFiles.getCount(); j++) |
| 493 | { |
| 494 | PathName dirname, filename; |
| 495 | PathUtils::splitLastComponent(dirname, filename, tempFiles[j]->getName()); |
| 496 | PathUtils::ensureSeparator(dirname); |
| 497 | if (!directory.compare(dirname)) |
| 498 | { |
| 499 | file = tempFiles[j]; |
| 500 | break; |
| 501 | } |
| 502 | } |
| 503 | |
| 504 | try |
| 505 | { |
| 506 | if (!file) |
| 507 | { |
| 508 | file = FB_NEW_POOL(pool) TempFile(pool, filePrefix, directory); |
| 509 | tempFiles.add(file); |
| 510 | } |
| 511 | |
| 512 | file->extend(size); |
| 513 | } |
| 514 | catch (const system_error& ex) |
| 515 | { |
| 516 | ex.stuffException(status_vector); |
| 517 | continue; |
| 518 | } |
| 519 | |
| 520 | return file; |
| 521 | } |
| 522 | |
| 523 | // no room in all directories |
| 524 | Arg::Gds status(isc_out_of_temp_space); |
| 525 | status.append(Arg::StatusVector(status_vector.begin())); |
| 526 | iscLogStatus(NULL, status.value()); |
| 527 | status.raise(); |
| 528 | |
| 529 | return NULL; // compiler silencer |
| 530 | } |
| 531 | |
| 532 | // |
| 533 | // TempSpace::allocateSpace |
nothing calls this directly
no test coverage detected