| 169 | } |
| 170 | |
| 171 | char *FString::LockBuffer() |
| 172 | { |
| 173 | if (Data()->RefCount == 1) |
| 174 | { // We're the only user, so we can lock it straight away |
| 175 | Data()->RefCount = -1; |
| 176 | } |
| 177 | else if (Data()->RefCount < -1) |
| 178 | { // Already locked; just add to the lock count |
| 179 | Data()->RefCount--; |
| 180 | } |
| 181 | else |
| 182 | { // Somebody else is also using this character buffer, so create a copy |
| 183 | FStringData *old = Data(); |
| 184 | AllocBuffer (old->Len); |
| 185 | StrCopy (Chars, old->Chars(), old->Len); |
| 186 | old->Release(); |
| 187 | Data()->RefCount = -1; |
| 188 | } |
| 189 | return Chars; |
| 190 | } |
| 191 | |
| 192 | void FString::UnlockBuffer() |
| 193 | { |
no test coverage detected