| 2349 | } |
| 2350 | |
| 2351 | static 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) |
no test coverage detected