Firstly, write a byte, which shows if the nonce will be put in text (if it was defined in config) Secondly, write nonce in text (this step depends from first step) return new position to write
| 265 | /// Secondly, write nonce in text (this step depends from first step) |
| 266 | /// return new position to write |
| 267 | inline char* writeNonce(const String& nonce, char* dest) |
| 268 | { |
| 269 | /// If nonce consists of nul bytes, it shouldn't be in dest. Zero byte is the only byte that should be written. |
| 270 | /// Otherwise, 1 is written and data from nonce is copied |
| 271 | if (nonce != empty_nonce) |
| 272 | { |
| 273 | *dest = 1; |
| 274 | ++dest; |
| 275 | size_t copied_symbols = nonce.copy(dest, nonce.size()); |
| 276 | if (copied_symbols != nonce.size()) |
| 277 | throw Exception(ErrorCodes::INCORRECT_DATA, |
| 278 | "Can't copy nonce into destination. Count of copied symbols {}, need to copy {}", |
| 279 | copied_symbols, nonce.size()); |
| 280 | dest += copied_symbols; |
| 281 | return dest; |
| 282 | } |
| 283 | |
| 284 | *dest = 0; |
| 285 | return ++dest; |
| 286 | } |
| 287 | |
| 288 | /// Firstly, read a byte, which shows if the nonce will be put in text (if it was defined in config) |
| 289 | /// Secondly, read nonce in text (this step depends from first step) |
no test coverage detected