| 625 | |
| 626 | |
| 627 | ULONG blb::BLB_get_data(thread_db* tdbb, UCHAR* buffer, SLONG length, bool close) |
| 628 | { |
| 629 | /************************************** |
| 630 | * |
| 631 | * b l b : : g e t _ d a t a |
| 632 | * |
| 633 | ************************************** |
| 634 | * |
| 635 | * Functional description |
| 636 | * Get a large hunk of data from a blob, which can then be |
| 637 | * closed (if close == true). Return total number of bytes read. |
| 638 | * Don't worry about segment boundaries. |
| 639 | * |
| 640 | **************************************/ |
| 641 | SET_TDBB(tdbb); |
| 642 | BLOB_PTR* p = buffer; |
| 643 | |
| 644 | while (length > 0) |
| 645 | { |
| 646 | // I have no idea why this limit is 32768 instead of 32767 |
| 647 | // 1994-August-12 David Schnepper |
| 648 | USHORT n = (USHORT) MIN(length, (SLONG) 32768); |
| 649 | n = BLB_get_segment(tdbb, p, n); |
| 650 | p += n; |
| 651 | length -= n; |
| 652 | if (blb_flags & BLB_eof) |
| 653 | break; |
| 654 | } |
| 655 | |
| 656 | if (close) |
| 657 | BLB_close(tdbb); |
| 658 | |
| 659 | return (ULONG)(p - buffer); |
| 660 | } |
| 661 | |
| 662 | |
| 663 | USHORT blb::BLB_get_segment(thread_db* tdbb, void* segment, USHORT buffer_length) |
no test coverage detected