MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / insertBytesLengthCheck

Method insertBytesLengthCheck

src/common/classes/ClumpletWriter.cpp:327–446  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

325}
326
327void ClumpletWriter::insertBytesLengthCheck(UCHAR tag, const void* bytes, const FB_SIZE_T length)
328{
329 // Check that we're not beyond the end of buffer.
330 // We get there when we set end marker.
331 if (cur_offset > dynamic_buffer.getCount())
332 {
333 usage_mistake("write past EOF");
334 return;
335 }
336
337 UCHAR lenSize = 0;
338 // Check length according to clumplet type
339 // Perform structure upgrade when needed and possible
340 for(;;)
341 {
342 const ClumpletType t = getClumpletType(tag);
343 string m;
344
345 switch (t)
346 {
347 case Wide:
348 if (length > MAX_ULONG)
349 {
350 m.printf("attempt to store %d bytes in a clumplet", length);
351 break;
352 }
353 lenSize = 4;
354 break;
355 case TraditionalDpb:
356 if (length > MAX_UCHAR)
357 {
358 m.printf("attempt to store %d bytes in a clumplet with maximum size 255 bytes", length);
359 break;
360 }
361 lenSize = 1;
362 break;
363 case SingleTpb:
364 if (length > 0)
365 {
366 m.printf("attempt to store data in dataless clumplet");
367 }
368 break;
369 case StringSpb:
370 if (length > MAX_USHORT)
371 {
372 m.printf("attempt to store %d bytes in a clumplet", length);
373 break;
374 }
375 lenSize = 2;
376 break;
377 case IntSpb:
378 if (length != 4)
379 {
380 m.printf("attempt to store %d bytes in a clumplet, need 4", length);
381 }
382 break;
383 case BigIntSpb:
384 if (length != 8)

Callers

nothing calls this directly

Calls 5

getCountMethod · 0.45
printfMethod · 0.45
isEmptyMethod · 0.45
c_strMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected