| 711 | } |
| 712 | |
| 713 | bool_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 | |
| 766 | void PortsCleanup::registerPort(rem_port* port) |
| 767 | { |
no test coverage detected