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

Function xdr_blob_stream

src/remote/protocol.cpp:2351–2568  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2349}
2350
2351static bool_t xdr_blob_stream(RemoteXdr* xdrs, SSHORT statement_id, CSTRING* strmPortion)
2352{
2353 if (xdrs->x_op == XDR_FREE)
2354 return xdr_cstring(xdrs, strmPortion);
2355
2356 Rsr* statement = getStatement(xdrs, statement_id);
2357 if (!statement)
2358 return FALSE;
2359
2360 // create local copy - required in a case when packet is not complete and will be restarted
2361 Rsr::BatchStream localStrm(statement->rsr_batch_stream);
2362
2363 struct BlobFlow
2364 {
2365 ULONG remains;
2366 UCHAR* streamPtr;
2367 ULONG& blobSize;
2368 ULONG& bpbSize;
2369 ULONG& segSize;
2370
2371 BlobFlow(Rsr::BatchStream* bs)
2372 : remains(0), streamPtr(NULL),
2373 blobSize(bs->blobRemaining), bpbSize(bs->bpbRemaining), segSize(bs->segRemaining)
2374 { }
2375
2376 void newBlob(ULONG totalSize, ULONG parSize)
2377 {
2378 blobSize = totalSize;
2379 bpbSize = parSize;
2380 segSize = 0;
2381 }
2382
2383 void move(ULONG step)
2384 {
2385 move2(step);
2386 blobSize -= step;
2387 }
2388
2389 void moveBpb(ULONG step)
2390 {
2391 move(step);
2392 bpbSize -= step;
2393 }
2394
2395 void moveSeg(ULONG step)
2396 {
2397 move(step);
2398 segSize -= step;
2399 }
2400
2401 bool align(ULONG alignment)
2402 {
2403 ULONG a = IPTR(streamPtr) % alignment;
2404 if (a)
2405 {
2406 a = alignment - a;
2407 move2(a);
2408 if (blobSize)

Callers 1

xdr_protocolFunction · 0.85

Calls 15

xdr_cstringFunction · 0.85
getStatementFunction · 0.85
xdr_u_longFunction · 0.85
alloc_cstringFunction · 0.85
xdr_quadFunction · 0.85
xdr_bytesFunction · 0.85
isBpbSegmentedFunction · 0.85
xdr_u_shortFunction · 0.85
saveDataMethod · 0.80
moveBpbMethod · 0.80
moveSegMethod · 0.80
alignMethod · 0.45

Tested by

no test coverage detected