| 803 | |
| 804 | |
| 805 | bool cByteBuffer::ReadToByteBuffer(cByteBuffer & a_Dst, size_t a_NumBytes) |
| 806 | { |
| 807 | if (!a_Dst.CanWriteBytes(a_NumBytes) || !CanReadBytes(a_NumBytes)) |
| 808 | { |
| 809 | // There's not enough source bytes or space in the dest BB |
| 810 | return false; |
| 811 | } |
| 812 | char buf[1024]; |
| 813 | // > 0 without generating warnings about unsigned comparisons where size_t is unsigned |
| 814 | while (a_NumBytes != 0) |
| 815 | { |
| 816 | size_t num = (a_NumBytes > sizeof(buf)) ? sizeof(buf) : a_NumBytes; |
| 817 | VERIFY(ReadBuf(buf, num)); |
| 818 | VERIFY(a_Dst.Write(buf, num)); |
| 819 | ASSERT(a_NumBytes >= num); |
| 820 | a_NumBytes -= num; |
| 821 | } |
| 822 | return true; |
| 823 | } |
| 824 | |
| 825 | |
| 826 |
no test coverage detected