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

Method x_putbytes

src/remote/inet.cpp:2700–2764  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2698}
2699
2700bool_t InetXdr::x_putbytes(const SCHAR* buff, unsigned bytecount)
2701{
2702/**************************************
2703 *
2704 * i n e t _ p u t b y t e s
2705 *
2706 **************************************
2707 *
2708 * Functional description
2709 * Put a bunch of bytes to a memory stream if it fits.
2710 *
2711 **************************************/
2712
2713 // Use memcpy to optimize bulk transfers.
2714
2715 while (bytecount > sizeof(ISC_QUAD))
2716 {
2717 if (x_handy >= bytecount)
2718 {
2719 memcpy(x_private, buff, bytecount);
2720 x_private += bytecount;
2721 x_handy -= bytecount;
2722 return TRUE;
2723 }
2724
2725 if (x_handy > 0)
2726 {
2727 memcpy(x_private, buff, x_handy);
2728 x_private += x_handy;
2729 buff += x_handy;
2730 bytecount -= x_handy;
2731 x_handy = 0;
2732 }
2733
2734 if (!REMOTE_deflate(this, inet_write, packet_send, false))
2735 {
2736 return FALSE;
2737 }
2738 }
2739
2740 // Scalar values and bulk transfer remainder fall thru
2741 // to be moved byte-by-byte to avoid memcpy setup costs.
2742
2743 if (!bytecount)
2744 return TRUE;
2745
2746 if (x_handy >= bytecount)
2747 {
2748 x_handy -= bytecount;
2749 while (bytecount--)
2750 *x_private++ = *buff++;
2751
2752 return TRUE;
2753 }
2754
2755 while (bytecount--)
2756 {
2757 if (x_handy == 0 && !REMOTE_deflate(this, inet_write, packet_send, false))

Callers 3

xdr_bytesFunction · 0.45
xdr_cstring_with_limitFunction · 0.45
xdr_blobBufferFunction · 0.45

Calls 1

REMOTE_deflateFunction · 0.85

Tested by

no test coverage detected