| 73 | } |
| 74 | |
| 75 | void save(unsigned int length, const ISC_STATUS* status, bool warningMode) throw() |
| 76 | { |
| 77 | try |
| 78 | { |
| 79 | char* oldBuffer = this->prepareForNewValue(); |
| 80 | ISC_STATUS* b = this->getBuffer(length + 1); |
| 81 | unsigned newLen = makeDynamicStrings(length, b, status); |
| 82 | delete[] oldBuffer; |
| 83 | |
| 84 | fb_assert(newLen <= length); |
| 85 | |
| 86 | // Sanity check |
| 87 | if (newLen < 2) |
| 88 | fb_utils::init_status(this->getBuffer(3)); |
| 89 | else |
| 90 | this->resize(newLen + 1); |
| 91 | } |
| 92 | catch (const BadAlloc&) |
| 93 | { |
| 94 | if (!warningMode) |
| 95 | { |
| 96 | // do not use stuff here to avoid endless cycle |
| 97 | this->shrink(3); |
| 98 | ISC_STATUS* s = this->getBuffer(3); // Should not throw - see assert() in ctor |
| 99 | fb_utils::statusBadAlloc(s); |
| 100 | } |
| 101 | else |
| 102 | { |
| 103 | this->clear(); |
| 104 | } |
| 105 | } |
| 106 | catch (const Exception&) |
| 107 | { |
| 108 | fb_assert(false); |
| 109 | |
| 110 | this->shrink(3); |
| 111 | ISC_STATUS* s = this->getBuffer(3); // Should not throw - see assert() in ctor |
| 112 | fb_utils::statusUnknown(s); |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | ISC_STATUS save(const ISC_STATUS* status, bool warningMode = false) throw() |
| 117 | { |
no test coverage detected