Mercurial > hg > xemacs-beta
comparison src/event-msw.c @ 462:0784d089fdc9 r21-2-46
Import from CVS: tag r21-2-46
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:44:37 +0200 |
parents | c33ae14dd6d0 |
children | 5aa1854ad537 |
comparison
equal
deleted
inserted
replaced
461:120ed4009e51 | 462:0784d089fdc9 |
---|---|
364 { | 364 { |
365 struct ntpipe_slurp_stream* s = NTPIPE_SLURP_STREAM_DATA(stream); | 365 struct ntpipe_slurp_stream* s = NTPIPE_SLURP_STREAM_DATA(stream); |
366 return s->thread_data->hev_caller; | 366 return s->thread_data->hev_caller; |
367 } | 367 } |
368 | 368 |
369 static ssize_t | 369 static Lstream_data_count |
370 ntpipe_slurp_reader (Lstream *stream, unsigned char *data, size_t size) | 370 ntpipe_slurp_reader (Lstream *stream, unsigned char *data, |
371 Lstream_data_count size) | |
371 { | 372 { |
372 /* This function must be called from the main thread only */ | 373 /* This function must be called from the main thread only */ |
373 struct ntpipe_slurp_stream_shared_data* s = | 374 struct ntpipe_slurp_stream_shared_data* s = |
374 NTPIPE_SLURP_STREAM_DATA(stream)->thread_data; | 375 NTPIPE_SLURP_STREAM_DATA(stream)->thread_data; |
375 | 376 |
578 struct ntpipe_shove_stream* s = NTPIPE_SHOVE_STREAM_DATA(stream); | 579 struct ntpipe_shove_stream* s = NTPIPE_SHOVE_STREAM_DATA(stream); |
579 return s->user_data; | 580 return s->user_data; |
580 } | 581 } |
581 #endif | 582 #endif |
582 | 583 |
583 static ssize_t | 584 static Lstream_data_count |
584 ntpipe_shove_writer (Lstream *stream, const unsigned char *data, size_t size) | 585 ntpipe_shove_writer (Lstream *stream, const unsigned char *data, |
586 Lstream_data_count size) | |
585 { | 587 { |
586 struct ntpipe_shove_stream* s = NTPIPE_SHOVE_STREAM_DATA(stream); | 588 struct ntpipe_shove_stream* s = NTPIPE_SHOVE_STREAM_DATA(stream); |
587 | 589 |
588 if (s->error_p) | 590 if (s->error_p) |
589 return -1; | 591 return -1; |
695 } | 697 } |
696 else if (str->bufsize == 0) | 698 else if (str->bufsize == 0) |
697 str->eof_p = 1; | 699 str->eof_p = 1; |
698 } | 700 } |
699 | 701 |
700 static ssize_t | 702 static Lstream_data_count |
701 winsock_reader (Lstream *stream, unsigned char *data, size_t size) | 703 winsock_reader (Lstream *stream, unsigned char *data, Lstream_data_count size) |
702 { | 704 { |
703 struct winsock_stream *str = WINSOCK_STREAM_DATA (stream); | 705 struct winsock_stream *str = WINSOCK_STREAM_DATA (stream); |
704 | 706 |
705 /* If the current operation is not yet complete, there's nothing to | 707 /* If the current operation is not yet complete, there's nothing to |
706 give back */ | 708 give back */ |
730 return 0; | 732 return 0; |
731 if (str->error_p) | 733 if (str->error_p) |
732 return -1; | 734 return -1; |
733 | 735 |
734 /* Return as much of buffer as we have */ | 736 /* Return as much of buffer as we have */ |
735 size = min (size, (size_t) (str->bufsize - str->bufpos)); | 737 size = min (size, (Lstream_data_count) (str->bufsize - str->bufpos)); |
736 memcpy (data, (void*)((BYTE*)str->buffer + str->bufpos), size); | 738 memcpy (data, (void*)((BYTE*)str->buffer + str->bufpos), size); |
737 str->bufpos += size; | 739 str->bufpos += size; |
738 | 740 |
739 /* Read more if buffer is exhausted */ | 741 /* Read more if buffer is exhausted */ |
740 if (str->bufsize == str->bufpos) | 742 if (str->bufsize == str->bufpos) |
741 winsock_initiate_read (str); | 743 winsock_initiate_read (str); |
742 | 744 |
743 return size; | 745 return size; |
744 } | 746 } |
745 | 747 |
746 static ssize_t | 748 static Lstream_data_count |
747 winsock_writer (Lstream *stream, const unsigned char *data, size_t size) | 749 winsock_writer (Lstream *stream, const unsigned char *data, |
750 Lstream_data_count size) | |
748 { | 751 { |
749 struct winsock_stream *str = WINSOCK_STREAM_DATA (stream); | 752 struct winsock_stream *str = WINSOCK_STREAM_DATA (stream); |
750 | 753 |
751 if (str->pending_p) | 754 if (str->pending_p) |
752 { | 755 { |