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

Function REMOTE_getbytes

src/remote/remote.cpp:713–764  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

711}
712
713bool_t REMOTE_getbytes (RemoteXdr* xdrs, SCHAR* buff, unsigned bytecount)
714{
715/**************************************
716 *
717 * R E M O T E _ g e t b y t e s
718 *
719 **************************************
720 *
721 * Functional description
722 * Get a bunch of bytes from a port buffer
723 *
724 **************************************/
725
726 while (bytecount > 0)
727 {
728 if (xdrs->x_handy >= bytecount)
729 {
730 memcpy(buff, xdrs->x_private, bytecount);
731 xdrs->x_private += bytecount;
732 xdrs->x_handy -= bytecount;
733 break;
734 }
735
736 if (xdrs->x_handy > 0)
737 {
738 memcpy(buff, xdrs->x_private, xdrs->x_handy);
739 xdrs->x_private += xdrs->x_handy;
740 buff += xdrs->x_handy;
741 bytecount -= xdrs->x_handy;
742 xdrs->x_handy = 0;
743 }
744
745 rem_port* port = xdrs->x_public;
746 RefMutexEnsureUnlock queGuard(*port->port_que_sync, FB_FUNCTION);
747 queGuard.enter();
748 if (port->port_qoffset >= port->port_queue.getCount())
749 {
750 queGuard.leave();
751
752 port->port_partial_data = true;
753 return FALSE;
754 }
755
756 xdrs->x_handy = port->port_queue[port->port_qoffset].getCount();
757 fb_assert(xdrs->x_handy <= port->port_buff_size);
758 memcpy(xdrs->x_base, port->port_queue[port->port_qoffset].begin(), xdrs->x_handy);
759 ++port->port_qoffset;
760 xdrs->x_private = xdrs->x_base;
761 }
762
763 return TRUE;
764}
765
766void PortsCleanup::registerPort(rem_port* port)
767{

Callers 1

x_getbytesMethod · 0.85

Calls 4

enterMethod · 0.45
getCountMethod · 0.45
leaveMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected