Commit 6a4e8342a2efe817d26fcab2cb0ac6f7653f8b8d

Authored by Perry Werneck
1 parent d61ed387

Refactoring output buffer management.

Makefile.in
... ... @@ -344,9 +344,9 @@ doc:
344 344 #---[ Debug Targets ]--------------------------------------------------------------------
345 345  
346 346 Debug: \
347   - $(BINDBG)/$(LIBNAME)@EXEEXT@
  347 + $(BINDBG)/lib3270@EXEEXT@
348 348  
349   -$(BINDBG)/$(LIBNAME)@EXEEXT@: \
  349 +$(BINDBG)/lib3270@EXEEXT@: \
350 350 $(foreach SRC, $(basename $(TEST_SOURCES)), $(OBJDBG)/$(SRC).o) \
351 351 $(BINDBG)/$(SONAME)
352 352  
... ... @@ -361,19 +361,19 @@ $(BINDBG)/$(LIBNAME)@EXEEXT@: \
361 361 $(LIBS)
362 362  
363 363 run: \
364   - $(BINDBG)/$(LIBNAME)@EXEEXT@
  364 + $(BINDBG)/lib3270@EXEEXT@
365 365  
366 366 ifeq ($(VALGRIND),no)
367 367  
368 368 @LD_LIBRARY_PATH=$(BINDBG) \
369   - $(BINDBG)/$(LIBNAME)@EXEEXT@
  369 + $(BINDBG)/lib3270@EXEEXT@
370 370  
371 371 else
372 372 @touch valgrind.suppression
373 373  
374 374 @LD_LIBRARY_PATH=$(BINDBG) \
375 375 $(VALGRIND) --leak-check=full --track-origins=yes --gen-suppressions=all --suppressions=valgrind.suppression \
376   - $(BINDBG)/$(LIBNAME)@EXEEXT@
  376 + $(BINDBG)/lib3270@EXEEXT@
377 377 endif
378 378  
379 379 $(BINDBG)/$(SONAME): \
... ...
src/core/ctlr.c
... ... @@ -685,9 +685,9 @@ static void insert_sa1(H3270 *hSession, unsigned char attr, unsigned char value,
685 685 return;
686 686 *currentp = value;
687 687 space3270out(hSession,3);
688   - *hSession->obptr++ = ORDER_SA;
689   - *hSession->obptr++ = attr;
690   - *hSession->obptr++ = value;
  688 + *hSession->output.ptr++ = ORDER_SA;
  689 + *hSession->output.ptr++ = attr;
  690 + *hSession->output.ptr++ = value;
691 691 if (*anyp)
692 692 trace_ds(hSession,"'");
693 693 trace_ds(hSession, " SetAttribute(%s)", see_efa(attr, value));
... ... @@ -763,16 +763,16 @@ void ctlr_read_modified(H3270 *hSession, unsigned char aid_byte, Boolean all)
763 763 #endif /*]*/
764 764  
765 765 trace_ds(hSession,"> ");
766   - hSession->obptr = hSession->obuf;
  766 + hSession->output.ptr = hSession->output.buf;
767 767  
768 768 switch (aid_byte)
769 769 {
770 770 case AID_SYSREQ: /* test request */
771 771 space3270out(hSession,4);
772   - *hSession->obptr++ = 0x01; /* soh */
773   - *hSession->obptr++ = 0x5b; /* % */
774   - *hSession->obptr++ = 0x61; /* / */
775   - *hSession->obptr++ = 0x02; /* stx */
  772 + *hSession->output.ptr++ = 0x01; /* soh */
  773 + *hSession->output.ptr++ = 0x5b; /* % */
  774 + *hSession->output.ptr++ = 0x61; /* / */
  775 + *hSession->output.ptr++ = 0x02; /* stx */
776 776 trace_ds(hSession,"SYSREQ");
777 777 break;
778 778  
... ... @@ -793,13 +793,13 @@ void ctlr_read_modified(H3270 *hSession, unsigned char aid_byte, Boolean all)
793 793 if (!IN_SSCP)
794 794 {
795 795 space3270out(hSession,3);
796   - *hSession->obptr++ = aid_byte;
  796 + *hSession->output.ptr++ = aid_byte;
797 797 trace_ds(hSession,"%s",see_aid(aid_byte));
798 798  
799 799 if (short_read)
800 800 goto rm_done;
801 801  
802   - ENCODE_BADDR(hSession->obptr, hSession->cursor_addr);
  802 + ENCODE_BADDR(hSession->output.ptr, hSession->cursor_addr);
803 803 trace_ds(hSession,"%s",rcba(hSession,hSession->cursor_addr));
804 804 }
805 805 else
... ... @@ -829,8 +829,8 @@ void ctlr_read_modified(H3270 *hSession, unsigned char aid_byte, Boolean all)
829 829  
830 830 INC_BA(baddr);
831 831 space3270out(hSession,3);
832   - *hSession->obptr++ = ORDER_SBA;
833   - ENCODE_BADDR(hSession->obptr, baddr);
  832 + *hSession->output.ptr++ = ORDER_SBA;
  833 + ENCODE_BADDR(hSession->output.ptr, baddr);
834 834 trace_ds(hSession," SetBufferAddress%s (Cols: %d Rows: %d)", rcba(hSession,baddr), hSession->view.cols, hSession->view.rows);
835 835 while (!hSession->ea_buf[baddr].fa)
836 836 {
... ... @@ -841,14 +841,14 @@ void ctlr_read_modified(H3270 *hSession, unsigned char aid_byte, Boolean all)
841 841 if (hSession->ea_buf[baddr].cs & CS_GE)
842 842 {
843 843 space3270out(hSession,1);
844   - *hSession->obptr++ = ORDER_GE;
  844 + *hSession->output.ptr++ = ORDER_GE;
845 845 if (any)
846 846 trace_ds(hSession,"'");
847 847 trace_ds(hSession," GraphicEscape");
848 848 any = False;
849 849 }
850 850 space3270out(hSession,1);
851   - *hSession->obptr++ = hSession->ea_buf[baddr].cc;
  851 + *hSession->output.ptr++ = hSession->ea_buf[baddr].cc;
852 852 if (!any)
853 853 trace_ds(hSession," '");
854 854  
... ... @@ -890,7 +890,7 @@ void ctlr_read_modified(H3270 *hSession, unsigned char aid_byte, Boolean all)
890 890 if (hSession->ea_buf[baddr].cs & CS_GE)
891 891 {
892 892 space3270out(hSession,1);
893   - *hSession->obptr++ = ORDER_GE;
  893 + *hSession->output.ptr++ = ORDER_GE;
894 894 if (any)
895 895 trace_ds(hSession,"' ");
896 896 trace_ds(hSession," GraphicEscape ");
... ... @@ -898,7 +898,7 @@ void ctlr_read_modified(H3270 *hSession, unsigned char aid_byte, Boolean all)
898 898 }
899 899  
900 900 space3270out(hSession,1);
901   - *hSession->obptr++ = hSession->ea_buf[baddr].cc;
  901 + *hSession->output.ptr++ = hSession->ea_buf[baddr].cc;
902 902 if (!any)
903 903 trace_ds(hSession,"%s","'");
904 904 trace_ds(hSession,"%s",see_ebc(hSession, hSession->ea_buf[baddr].cc));
... ... @@ -949,11 +949,11 @@ void ctlr_read_buffer(H3270 *hSession, unsigned char aid_byte)
949 949 #endif /*]*/
950 950  
951 951 trace_ds(hSession,"> ");
952   - hSession->obptr = hSession->obuf;
  952 + hSession->output.ptr = hSession->output.buf;
953 953  
954 954 space3270out(hSession,3);
955   - *hSession->obptr++ = aid_byte;
956   - ENCODE_BADDR(hSession->obptr, hSession->cursor_addr);
  955 + *hSession->output.ptr++ = aid_byte;
  956 + ENCODE_BADDR(hSession->output.ptr, hSession->cursor_addr);
957 957 trace_ds(hSession,"%s%s", see_aid(aid_byte), rcba(hSession,hSession->cursor_addr));
958 958  
959 959 baddr = 0;
... ... @@ -963,18 +963,18 @@ void ctlr_read_buffer(H3270 *hSession, unsigned char aid_byte)
963 963 if (hSession->reply_mode == SF_SRM_FIELD)
964 964 {
965 965 space3270out(hSession,2);
966   - *hSession->obptr++ = ORDER_SF;
  966 + *hSession->output.ptr++ = ORDER_SF;
967 967 }
968 968 else
969 969 {
970 970 space3270out(hSession,4);
971   - *hSession->obptr++ = ORDER_SFE;
972   - attr_count = hSession->obptr - hSession->obuf;
973   - *hSession->obptr++ = 1; /* for now */
974   - *hSession->obptr++ = XA_3270;
  971 + *hSession->output.ptr++ = ORDER_SFE;
  972 + attr_count = hSession->output.ptr - hSession->output.buf;
  973 + *hSession->output.ptr++ = 1; /* for now */
  974 + *hSession->output.ptr++ = XA_3270;
975 975 }
976 976 fa = hSession->ea_buf[baddr].fa & ~FA_PRINTABLE;
977   - *hSession->obptr++ = code_table[fa];
  977 + *hSession->output.ptr++ = code_table[fa];
978 978  
979 979 if (any)
980 980 trace_ds(hSession,"'");
... ... @@ -986,32 +986,32 @@ void ctlr_read_buffer(H3270 *hSession, unsigned char aid_byte)
986 986 {
987 987 if (hSession->ea_buf[baddr].fg) {
988 988 space3270out(hSession,2);
989   - *hSession->obptr++ = XA_FOREGROUND;
990   - *hSession->obptr++ = hSession->ea_buf[baddr].fg;
  989 + *hSession->output.ptr++ = XA_FOREGROUND;
  990 + *hSession->output.ptr++ = hSession->ea_buf[baddr].fg;
991 991 trace_ds(hSession,"%s", see_efa(XA_FOREGROUND, hSession->ea_buf[baddr].fg));
992   - (*(hSession->obuf + attr_count))++;
  992 + (*(hSession->output.buf + attr_count))++;
993 993 }
994 994 if (hSession->ea_buf[baddr].bg) {
995 995 space3270out(hSession,2);
996   - *hSession->obptr++ = XA_BACKGROUND;
997   - *hSession->obptr++ = hSession->ea_buf[baddr].bg;
  996 + *hSession->output.ptr++ = XA_BACKGROUND;
  997 + *hSession->output.ptr++ = hSession->ea_buf[baddr].bg;
998 998 trace_ds(hSession,"%s", see_efa(XA_BACKGROUND, hSession->ea_buf[baddr].bg));
999   - (*(hSession->obuf + attr_count))++;
  999 + (*(hSession->output.buf + attr_count))++;
1000 1000 }
1001 1001 if (hSession->ea_buf[baddr].gr) {
1002 1002 space3270out(hSession,2);
1003   - *hSession->obptr++ = XA_HIGHLIGHTING;
1004   - *hSession->obptr++ = hSession->ea_buf[baddr].gr | 0xf0;
  1003 + *hSession->output.ptr++ = XA_HIGHLIGHTING;
  1004 + *hSession->output.ptr++ = hSession->ea_buf[baddr].gr | 0xf0;
1005 1005 trace_ds(hSession,"%s", see_efa(XA_HIGHLIGHTING,
1006 1006 hSession->ea_buf[baddr].gr | 0xf0));
1007   - (*(hSession->obuf + attr_count))++;
  1007 + (*(hSession->output.buf + attr_count))++;
1008 1008 }
1009 1009 if (hSession->ea_buf[baddr].cs & CS_MASK) {
1010 1010 space3270out(hSession,2);
1011   - *hSession->obptr++ = XA_CHARSET;
1012   - *hSession->obptr++ = host_cs(hSession->ea_buf[baddr].cs);
  1011 + *hSession->output.ptr++ = XA_CHARSET;
  1012 + *hSession->output.ptr++ = host_cs(hSession->ea_buf[baddr].cs);
1013 1013 trace_ds(hSession,"%s", see_efa(XA_CHARSET,host_cs(hSession->ea_buf[baddr].cs)));
1014   - (*(hSession->obuf + attr_count))++;
  1014 + (*(hSession->output.buf + attr_count))++;
1015 1015 }
1016 1016 }
1017 1017 any = False;
... ... @@ -1019,14 +1019,14 @@ void ctlr_read_buffer(H3270 *hSession, unsigned char aid_byte)
1019 1019 insert_sa(hSession,baddr,&current_fg,&current_bg,&current_gr,&current_cs,&any);
1020 1020 if (hSession->ea_buf[baddr].cs & CS_GE) {
1021 1021 space3270out(hSession,1);
1022   - *hSession->obptr++ = ORDER_GE;
  1022 + *hSession->output.ptr++ = ORDER_GE;
1023 1023 if (any)
1024 1024 trace_ds(hSession,"'");
1025 1025 trace_ds(hSession," GraphicEscape");
1026 1026 any = False;
1027 1027 }
1028 1028 space3270out(hSession,1);
1029   - *hSession->obptr++ = hSession->ea_buf[baddr].cc;
  1029 + *hSession->output.ptr++ = hSession->ea_buf[baddr].cc;
1030 1030 if (hSession->ea_buf[baddr].cc <= 0x3f ||
1031 1031 hSession->ea_buf[baddr].cc == 0xff) {
1032 1032 if (any)
... ...
src/core/ft/ft_dft.c
... ... @@ -201,12 +201,12 @@ static void dft_open_request(H3270 *hSession, unsigned short len, unsigned char
201 201  
202 202 /* Acknowledge the Open. */
203 203 trace_ds(hSession,"> WriteStructuredField FileTransferData OpenAck\n");
204   - hSession->obptr = hSession->obuf;
  204 + hSession->output.ptr = hSession->output.buf;
205 205 space3270out(hSession,6);
206   - *hSession->obptr++ = AID_SF;
207   - SET16(hSession->obptr, 5);
208   - *hSession->obptr++ = SF_TRANSFER_DATA;
209   - SET16(hSession->obptr, 9);
  206 + *hSession->output.ptr++ = AID_SF;
  207 + SET16(hSession->output.ptr, 5);
  208 + *hSession->output.ptr++ = SF_TRANSFER_DATA;
  209 + SET16(hSession->output.ptr, 9);
210 210 net_output(hSession);
211 211 }
212 212  
... ... @@ -338,14 +338,14 @@ static void dft_data_insert(H3270 *hSession, struct data_buffer *data_bufr)
338 338  
339 339 /* Send an acknowledgement frame back. */
340 340 trace_ds(hSession,"> WriteStructuredField FileTransferData DataAck(rec=%lu)\n", ft->recnum);
341   - hSession->obptr = hSession->obuf;
  341 + hSession->output.ptr = hSession->output.buf;
342 342 space3270out(hSession,12);
343   - *hSession->obptr++ = AID_SF;
344   - SET16(hSession->obptr, 11);
345   - *hSession->obptr++ = SF_TRANSFER_DATA;
346   - SET16(hSession->obptr, TR_NORMAL_REPLY);
347   - SET16(hSession->obptr, TR_RECNUM_HDR);
348   - SET32(hSession->obptr, ft->recnum);
  343 + *hSession->output.ptr++ = AID_SF;
  344 + SET16(hSession->output.ptr, 11);
  345 + *hSession->output.ptr++ = SF_TRANSFER_DATA;
  346 + SET16(hSession->output.ptr, TR_NORMAL_REPLY);
  347 + SET16(hSession->output.ptr, TR_RECNUM_HDR);
  348 + SET32(hSession->output.ptr, ft->recnum);
349 349 ft->recnum++;
350 350 net_output(hSession);
351 351 }
... ... @@ -378,7 +378,7 @@ static void dft_get_request(H3270 *hSession)
378 378 set_dft_buffersize(hSession);
379 379 space3270out(hSession,hSession->dft_buffersize);
380 380 numbytes = hSession->dft_buffersize - 27; /* always read 5 bytes less than we're allowed */
381   - bufptr = hSession->obuf + 17;
  381 + bufptr = hSession->output.buf + 17;
382 382  
383 383 while (!ft->dft_eof && numbytes)
384 384 {
... ... @@ -456,22 +456,22 @@ static void dft_get_request(H3270 *hSession)
456 456 }
457 457  
458 458 /* Set up SF header for Data or EOF. */
459   - hSession->obptr = hSession->obuf;
460   - *hSession->obptr++ = AID_SF;
461   - hSession->obptr += 2; /* skip SF length for now */
462   - *hSession->obptr++ = SF_TRANSFER_DATA;
  459 + hSession->output.ptr = hSession->output.buf;
  460 + *hSession->output.ptr++ = AID_SF;
  461 + hSession->output.ptr += 2; /* skip SF length for now */
  462 + *hSession->output.ptr++ = SF_TRANSFER_DATA;
463 463  
464 464 if (total_read)
465 465 {
466 466 trace_ds(hSession,"> WriteStructuredField FileTransferData Data(rec=%lu) %d bytes\n",(unsigned long) ft->recnum, (int) total_read);
467   - SET16(hSession->obptr, TR_GET_REPLY);
468   - SET16(hSession->obptr, TR_RECNUM_HDR);
469   - SET32(hSession->obptr, ft->recnum);
  467 + SET16(hSession->output.ptr, TR_GET_REPLY);
  468 + SET16(hSession->output.ptr, TR_RECNUM_HDR);
  469 + SET32(hSession->output.ptr, ft->recnum);
470 470 ft->recnum++;
471   - SET16(hSession->obptr, TR_NOT_COMPRESSED);
472   - *hSession->obptr++ = TR_BEGIN_DATA;
473   - SET16(hSession->obptr, total_read + 5);
474   - hSession->obptr += total_read;
  471 + SET16(hSession->output.ptr, TR_NOT_COMPRESSED);
  472 + *hSession->output.ptr++ = TR_BEGIN_DATA;
  473 + SET16(hSession->output.ptr, total_read + 5);
  474 + hSession->output.ptr += total_read;
475 475  
476 476 ft->ft_length += total_read;
477 477  
... ... @@ -484,26 +484,26 @@ static void dft_get_request(H3270 *hSession)
484 484 else
485 485 {
486 486 trace_ds(hSession,"> WriteStructuredField FileTransferData EOF\n");
487   - *hSession->obptr++ = HIGH8(TR_GET_REQ);
488   - *hSession->obptr++ = TR_ERROR_REPLY;
489   - SET16(hSession->obptr, TR_ERROR_HDR);
490   - SET16(hSession->obptr, TR_ERR_EOF);
  487 + *hSession->output.ptr++ = HIGH8(TR_GET_REQ);
  488 + *hSession->output.ptr++ = TR_ERROR_REPLY;
  489 + SET16(hSession->output.ptr, TR_ERROR_HDR);
  490 + SET16(hSession->output.ptr, TR_ERR_EOF);
491 491  
492 492 ft->dft_eof = 1;
493 493 }
494 494  
495 495 /* Set the SF length. */
496   - bufptr = hSession->obuf + 1;
497   - SET16(bufptr, hSession->obptr - (hSession->obuf + 1));
  496 + bufptr = hSession->output.buf + 1;
  497 + SET16(bufptr, hSession->output.ptr - (hSession->output.buf + 1));
498 498  
499 499 /* Save the data. */
500   - ft->dft_savebuf_len = hSession->obptr - hSession->obuf;
  500 + ft->dft_savebuf_len = hSession->output.ptr - hSession->output.buf;
501 501 if (ft->dft_savebuf_len > ft->dft_savebuf_max)
502 502 {
503 503 ft->dft_savebuf_max = ft->dft_savebuf_len;
504 504 Replace(ft->dft_savebuf, (unsigned char *)lib3270_malloc(ft->dft_savebuf_max));
505 505 }
506   - (void) memcpy(ft->dft_savebuf, hSession->obuf, ft->dft_savebuf_len);
  506 + (void) memcpy(ft->dft_savebuf, hSession->output.buf, ft->dft_savebuf_len);
507 507 hSession->aid = AID_SF;
508 508  
509 509 /* Write the data. */
... ... @@ -520,12 +520,12 @@ static void dft_close_request(H3270 *hSession)
520 520 */
521 521 trace_ds(hSession," Close\n");
522 522 trace_ds(hSession,"> WriteStructuredField FileTransferData CloseAck\n");
523   - hSession->obptr = hSession->obuf;
  523 + hSession->output.ptr = hSession->output.buf;
524 524 space3270out(hSession,6);
525   - *hSession->obptr++ = AID_SF;
526   - SET16(hSession->obptr, 5); /* length */
527   - *hSession->obptr++ = SF_TRANSFER_DATA;
528   - SET16(hSession->obptr, TR_CLOSE_REPLY);
  525 + *hSession->output.ptr++ = AID_SF;
  526 + SET16(hSession->output.ptr, 5); /* length */
  527 + *hSession->output.ptr++ = SF_TRANSFER_DATA;
  528 + SET16(hSession->output.ptr, TR_CLOSE_REPLY);
529 529 net_output(hSession);
530 530 }
531 531  
... ... @@ -543,15 +543,15 @@ static void dft_abort(H3270 *hSession, unsigned short code, const char *fmt, ...
543 543  
544 544 trace_ds(hSession,"> WriteStructuredField FileTransferData Error\n");
545 545  
546   - hSession->obptr = hSession->obuf;
  546 + hSession->output.ptr = hSession->output.buf;
547 547 space3270out(hSession,10);
548   - *hSession->obptr++ = AID_SF;
549   - SET16(hSession->obptr, 9); /* length */
550   - *hSession->obptr++ = SF_TRANSFER_DATA;
551   - *hSession->obptr++ = HIGH8(code);
552   - *hSession->obptr++ = TR_ERROR_REPLY;
553   - SET16(hSession->obptr, TR_ERROR_HDR);
554   - SET16(hSession->obptr, TR_ERR_CMDFAIL);
  548 + *hSession->output.ptr++ = AID_SF;
  549 + SET16(hSession->output.ptr, 9); /* length */
  550 + *hSession->output.ptr++ = SF_TRANSFER_DATA;
  551 + *hSession->output.ptr++ = HIGH8(code);
  552 + *hSession->output.ptr++ = TR_ERROR_REPLY;
  553 + SET16(hSession->output.ptr, TR_ERROR_HDR);
  554 + SET16(hSession->output.ptr, TR_ERR_CMDFAIL);
555 555 net_output(hSession);
556 556  
557 557 /* Update the pop-up and state. */
... ... @@ -581,10 +581,10 @@ void dft_read_modified(H3270 *hSession)
581 581 if(ft->dft_savebuf_len)
582 582 {
583 583 trace_ds(hSession,"> WriteStructuredField FileTransferData\n");
584   - hSession->obptr = hSession->obuf;
  584 + hSession->output.ptr = hSession->output.buf;
585 585 space3270out(hSession,ft->dft_savebuf_len);
586   - memcpy(hSession->obptr, ft->dft_savebuf, ft->dft_savebuf_len);
587   - hSession->obptr += ft->dft_savebuf_len;
  586 + memcpy(hSession->output.ptr, ft->dft_savebuf, ft->dft_savebuf_len);
  587 + hSession->output.ptr += ft->dft_savebuf_len;
588 588 net_output(hSession);
589 589 }
590 590 }
... ...
src/core/rpq.c
... ... @@ -146,14 +146,14 @@ void do_qr_rpqnames(H3270 *hSession)
146 146 */
147 147 space3270out(hSession,4+4+1+remaining); /* Maximum space for an RPQNAME item */
148 148  
149   - SET32(hSession->obptr, 0); /* Device number, 0 = All */
150   - SET32(hSession->obptr, 0); /* Model number, 0 = All */
  149 + SET32(hSession->output.ptr, 0); /* Device number, 0 = All */
  150 + SET32(hSession->output.ptr, 0); /* Model number, 0 = All */
151 151  
152   - rpql = hSession->obptr++; /* Save address to place data length. */
  152 + rpql = hSession->output.ptr++; /* Save address to place data length. */
153 153  
154 154 /* Create fixed length portion - program id: x3270 */
155 155 for (j = 0; j < 5; j++) {
156   - *hSession->obptr++ = hSession->charset.asc2ebc[(int)"x3270"[j]];
  156 + *hSession->output.ptr++ = hSession->charset.asc2ebc[(int)"x3270"[j]];
157 157 remaining--;
158 158 }
159 159  
... ... @@ -168,9 +168,9 @@ void do_qr_rpqnames(H3270 *hSession)
168 168  
169 169 term_id = rpq_keywords[j].id;
170 170  
171   - p_term = hSession->obptr; /* save starting address (to insert length later) */
172   - hSession->obptr++; /* skip length of term, fill in later */
173   - *hSession->obptr++ = term_id; /* identify this term */
  171 + p_term = hSession->output.ptr; /* save starting address (to insert length later) */
  172 + hSession->output.ptr++; /* skip length of term, fill in later */
  173 + *hSession->output.ptr++ = term_id; /* identify this term */
174 174  
175 175 /*
176 176 * Adjust remaining space by the term prefix size so each case
... ... @@ -183,18 +183,18 @@ void do_qr_rpqnames(H3270 *hSession)
183 183 switch (term_id) /* build the term based on id */
184 184 {
185 185 case RPQ_USER: /* User text from env. vars */
186   - hSession->obptr += get_rpq_user(hSession,hSession->obptr, remaining);
  186 + hSession->output.ptr += get_rpq_user(hSession,hSession->output.ptr, remaining);
187 187 break;
188 188  
189 189 case RPQ_TIMEZONE: /* UTC time offset */
190 190 omit_due_space_limit = (remaining < 2);
191 191 if (!omit_due_space_limit)
192   - SET16(hSession->obptr, get_rpq_timezone(hSession));
  192 + SET16(hSession->output.ptr, get_rpq_timezone(hSession));
193 193 break;
194 194  
195 195 case RPQ_ADDRESS: /* Workstation address */
196 196 #if !defined(_WIN32) /*[*/
197   - hSession->obptr += get_rpq_address(hSession, hSession->obptr, remaining);
  197 + hSession->output.ptr += get_rpq_address(hSession, hSession->output.ptr, remaining);
198 198 #endif /*]*/
199 199 break;
200 200  
... ... @@ -205,7 +205,7 @@ void do_qr_rpqnames(H3270 *hSession)
205 205 {
206 206 for (i = 0; i < x; i++)
207 207 {
208   - *hSession->obptr++ = hSession->charset.asc2ebc[(int)(*(build_rpq_version+i) & 0xff)];
  208 + *hSession->output.ptr++ = hSession->charset.asc2ebc[(int)(*(build_rpq_version+i) & 0xff)];
209 209 }
210 210 }
211 211 break;
... ... @@ -217,7 +217,7 @@ void do_qr_rpqnames(H3270 *hSession)
217 217 {
218 218 for (i=0; i < x; i+=2)
219 219 {
220   - *hSession->obptr++ = ((*(build_rpq_timestamp+i) - '0') << 4)
  220 + *hSession->output.ptr++ = ((*(build_rpq_timestamp+i) - '0') << 4)
221 221 + (*(build_rpq_timestamp+i+1) - '0');
222 222 }
223 223 }
... ... @@ -239,14 +239,14 @@ void do_qr_rpqnames(H3270 *hSession)
239 239 * adjust space remaining.
240 240 * obptr now points at "next available byte".
241 241 */
242   - x = hSession->obptr-p_term;
  242 + x = hSession->output.ptr-p_term;
243 243 if (x > TERM_PREFIX_SIZE) {
244 244 *p_term = x;
245 245 remaining -= x; /* This includes length and id fields,
246 246 correction below */
247 247 } else {
248 248 /* We didn't add an item after all, reset pointer. */
249   - hSession->obptr = p_term;
  249 + hSession->output.ptr = p_term;
250 250 }
251 251 /*
252 252 * When we calculated the length of the term, a few lines
... ... @@ -268,7 +268,7 @@ void do_qr_rpqnames(H3270 *hSession)
268 268 }
269 269  
270 270 /* Fill in overall length of RPQNAME info */
271   - *rpql = (hSession->obptr - rpql);
  271 + *rpql = (hSession->output.ptr - rpql);
272 272  
273 273 rpq_dump_warnings(hSession);
274 274 }
... ...
src/core/session.c
... ... @@ -140,7 +140,7 @@ void lib3270_session_free(H3270 *h)
140 140 release_pointer(h->text);
141 141 release_pointer(h->zero_buf);
142 142  
143   - release_pointer(h->obuf_base);
  143 + release_pointer(h->output.base);
144 144  
145 145 release_pointer(h->sbbuf);
146 146 release_pointer(h->tabs);
... ...
src/core/sf.c
... ... @@ -93,12 +93,19 @@ static void query_reply_start(H3270 *hSession);
93 93 static void do_query_reply(H3270 *hSession, unsigned char code);
94 94 static void query_reply_end(H3270 *hSession);
95 95  
96   -typedef Boolean qr_multi_fn_t(H3270 *hSession, unsigned *subindex, Boolean *more);
97   -
98   -static qr_single_fn_t do_qr_summary, do_qr_usable_area, do_qr_alpha_part,
99   - do_qr_charsets, do_qr_color, do_qr_highlighting, do_qr_reply_modes,
100   - do_qr_imp_part, do_qr_null;
  96 +//static void qr_single_fn_t(H3270 *hSession);
  97 +
  98 +static void do_qr_summary(H3270 *hSession);
  99 +static void do_qr_usable_area(H3270 *hSession);
  100 +static void do_qr_alpha_part(H3270 *hSession);
  101 +static void do_qr_charsets(H3270 *hSession);
  102 +static void do_qr_color(H3270 *hSession);
  103 +static void do_qr_highlighting(H3270 *hSession);
  104 +static void do_qr_reply_modes(H3270 *hSession);
  105 +static void do_qr_imp_part(H3270 *hSession);
  106 +static void do_qr_null(H3270 *hSession);
101 107  
  108 +typedef Boolean qr_multi_fn_t(H3270 *hSession, unsigned *subindex, Boolean *more);
102 109  
103 110 #if defined(X3270_DBCS) /*[*/
104 111 static qr_single_fn_t do_qr_dbcs_asia;
... ... @@ -692,9 +699,9 @@ static enum pds sf_outbound_ds(H3270 *hSession, unsigned char buf[], int buflen)
692 699  
693 700 static void query_reply_start(H3270 *hSession)
694 701 {
695   - hSession->obptr = hSession->obuf;
  702 + hSession->output.ptr = hSession->output.buf;
696 703 space3270out(hSession,1);
697   - *hSession->obptr++ = AID_SF;
  704 + *hSession->output.ptr++ = AID_SF;
698 705 qr_in_progress = True;
699 706 }
700 707  
... ... @@ -721,13 +728,13 @@ static void do_query_reply(H3270 *hSession, unsigned char code)
721 728  
722 729 do
723 730 {
724   - int obptr0 = hSession->obptr - hSession->obuf;
  731 + int obptr0 = hSession->output.ptr - hSession->output.buf;
725 732 Boolean full = True;
726 733  
727 734 space3270out(hSession,4);
728   - hSession->obptr += 2; /* skip length for now */
729   - *hSession->obptr++ = SFID_QREPLY;
730   - *hSession->obptr++ = code;
  735 + hSession->output.ptr += 2; /* skip length for now */
  736 + *hSession->output.ptr++ = SFID_QREPLY;
  737 + *hSession->output.ptr++ = code;
731 738  
732 739 more = False;
733 740 if (replies[i].single_fn)
... ... @@ -741,12 +748,12 @@ static void do_query_reply(H3270 *hSession, unsigned char code)
741 748 unsigned char *obptr_len;
742 749  
743 750 /* Fill in the length. */
744   - obptr_len = hSession->obuf + obptr0;
745   - len = (hSession->obptr - hSession->obuf) - obptr0;
  751 + obptr_len = hSession->output.buf + obptr0;
  752 + len = (hSession->output.ptr - hSession->output.buf) - obptr0;
746 753 SET16(obptr_len, len);
747 754 } else {
748 755 /* Back over the header. */
749   - hSession->obptr -= 4;
  756 + hSession->output.ptr -= 4;
750 757 }
751 758 } while (more);
752 759 }
... ... @@ -771,7 +778,7 @@ static void do_qr_summary(H3270 *hSession)
771 778 #endif /*]*/
772 779 trace_ds(hSession,"%s%s", comma, see_qcode(replies[i].code));
773 780 comma = ",";
774   - *hSession->obptr++ = replies[i].code;
  781 + *hSession->output.ptr++ = replies[i].code;
775 782 #if defined(X3270_DBCS) /*[*/
776 783 }
777 784 #endif /*]*/
... ... @@ -785,11 +792,11 @@ static void do_qr_usable_area(H3270 *hSession)
785 792  
786 793 trace_ds(hSession,"> QueryReply(UsableArea)\n");
787 794 space3270out(hSession,19);
788   - *hSession->obptr++ = 0x01; /* 12/14-bit addressing */
789   - *hSession->obptr++ = 0x00; /* no special character features */
790   - SET16(hSession->obptr, hSession->max.cols); /* usable width */
791   - SET16(hSession->obptr, hSession->max.rows); /* usable height */
792   - *hSession->obptr++ = 0x01; /* units (mm) */
  795 + *hSession->output.ptr++ = 0x01; /* 12/14-bit addressing */
  796 + *hSession->output.ptr++ = 0x00; /* no special character features */
  797 + SET16(hSession->output.ptr, hSession->max.cols); /* usable width */
  798 + SET16(hSession->output.ptr, hSession->max.rows); /* usable height */
  799 + *hSession->output.ptr++ = 0x01; /* units (mm) */
793 800 num = display_widthMM();
794 801 denom = display_width();
795 802 while (!(num %2) && !(denom % 2))
... ... @@ -797,8 +804,8 @@ static void do_qr_usable_area(H3270 *hSession)
797 804 num /= 2;
798 805 denom /= 2;
799 806 }
800   - SET16(hSession->obptr, (int)num); /* Xr numerator */
801   - SET16(hSession->obptr, (int)denom); /* Xr denominator */
  807 + SET16(hSession->output.ptr, (int)num); /* Xr numerator */
  808 + SET16(hSession->output.ptr, (int)denom); /* Xr denominator */
802 809 num = display_heightMM();
803 810 denom = display_height();
804 811 while (!(num %2) && !(denom % 2))
... ... @@ -806,11 +813,11 @@ static void do_qr_usable_area(H3270 *hSession)
806 813 num /= 2;
807 814 denom /= 2;
808 815 }
809   - SET16(hSession->obptr, (int)num); /* Yr numerator */
810   - SET16(hSession->obptr, (int)denom); /* Yr denominator */
811   - *hSession->obptr++ = *char_width; /* AW */
812   - *hSession->obptr++ = *char_height; /* AH */
813   - SET16(hSession->obptr, hSession->max.cols * hSession->max.cols); /* buffer, questionable */
  816 + SET16(hSession->output.ptr, (int)num); /* Yr numerator */
  817 + SET16(hSession->output.ptr, (int)denom); /* Yr denominator */
  818 + *hSession->output.ptr++ = *char_width; /* AW */
  819 + *hSession->output.ptr++ = *char_height; /* AH */
  820 + SET16(hSession->output.ptr, hSession->max.cols * hSession->max.cols); /* buffer, questionable */
814 821 }
815 822  
816 823 static void do_qr_color(H3270 *hSession)
... ... @@ -823,17 +830,17 @@ static void do_qr_color(H3270 *hSession)
823 830 color_max = (hSession->colors == 8) ? 8: 16; /* report on 8 or 16 colors */
824 831  
825 832 space3270out(hSession,4 + 2*15);
826   - *hSession->obptr++ = 0x00; /* no options */
827   - *hSession->obptr++ = color_max; /* report on 8 or 16 colors */
828   - *hSession->obptr++ = 0x00; /* default color: */
829   - *hSession->obptr++ = 0xf0 + COLOR_GREEN; /* green */
  833 + *hSession->output.ptr++ = 0x00; /* no options */
  834 + *hSession->output.ptr++ = color_max; /* report on 8 or 16 colors */
  835 + *hSession->output.ptr++ = 0x00; /* default color: */
  836 + *hSession->output.ptr++ = 0xf0 + COLOR_GREEN; /* green */
830 837 for (i = 0xf1; i < 0xf1 + color_max - 1; i++)
831 838 {
832   - *hSession->obptr++ = i;
  839 + *hSession->output.ptr++ = i;
833 840 if (hSession->m3279)
834   - *hSession->obptr++ = i;
  841 + *hSession->output.ptr++ = i;
835 842 else
836   - *hSession->obptr++ = 0x00;
  843 + *hSession->output.ptr++ = 0x00;
837 844 }
838 845  
839 846 /*
... ... @@ -841,10 +848,10 @@ static void do_qr_color(H3270 *hSession)
841 848 // Add background color.
842 849 if (hSession->m3279) {
843 850 space3270out(4);
844   - *hSession->obptr++ = 4; // length
845   - *hSession->obptr++ = 0x02; // background color
846   - *hSession->obptr++ = 0x00; // attribute
847   - *hSession->obptr++ = 0xf0; // default color
  851 + *hSession->output.ptr++ = 4; // length
  852 + *hSession->output.ptr++ = 0x02; // background color
  853 + *hSession->output.ptr++ = 0x00; // attribute
  854 + *hSession->output.ptr++ = 0xf0; // default color
848 855 }
849 856 #endif
850 857 */
... ... @@ -854,26 +861,26 @@ static void do_qr_highlighting(H3270 *hSession)
854 861 {
855 862 trace_ds(hSession,"> QueryReply(Highlighting)\n");
856 863 space3270out(hSession,11);
857   - *hSession->obptr++ = 5; /* report on 5 pairs */
858   - *hSession->obptr++ = XAH_DEFAULT; /* default: */
859   - *hSession->obptr++ = XAH_NORMAL; /* normal */
860   - *hSession->obptr++ = XAH_BLINK; /* blink: */
861   - *hSession->obptr++ = XAH_BLINK; /* blink */
862   - *hSession->obptr++ = XAH_REVERSE; /* reverse: */
863   - *hSession->obptr++ = XAH_REVERSE; /* reverse */
864   - *hSession->obptr++ = XAH_UNDERSCORE; /* underscore: */
865   - *hSession->obptr++ = XAH_UNDERSCORE; /* underscore */
866   - *hSession->obptr++ = XAH_INTENSIFY; /* intensify: */
867   - *hSession->obptr++ = XAH_INTENSIFY; /* intensify */
  864 + *hSession->output.ptr++ = 5; /* report on 5 pairs */
  865 + *hSession->output.ptr++ = XAH_DEFAULT; /* default: */
  866 + *hSession->output.ptr++ = XAH_NORMAL; /* normal */
  867 + *hSession->output.ptr++ = XAH_BLINK; /* blink: */
  868 + *hSession->output.ptr++ = XAH_BLINK; /* blink */
  869 + *hSession->output.ptr++ = XAH_REVERSE; /* reverse: */
  870 + *hSession->output.ptr++ = XAH_REVERSE; /* reverse */
  871 + *hSession->output.ptr++ = XAH_UNDERSCORE; /* underscore: */
  872 + *hSession->output.ptr++ = XAH_UNDERSCORE; /* underscore */
  873 + *hSession->output.ptr++ = XAH_INTENSIFY; /* intensify: */
  874 + *hSession->output.ptr++ = XAH_INTENSIFY; /* intensify */
868 875 }
869 876  
870 877 static void do_qr_reply_modes(H3270 *hSession)
871 878 {
872 879 trace_ds(hSession,"> QueryReply(ReplyModes)\n");
873 880 space3270out(hSession,3);
874   - *hSession->obptr++ = SF_SRM_FIELD;
875   - *hSession->obptr++ = SF_SRM_XFIELD;
876   - *hSession->obptr++ = SF_SRM_CHAR;
  881 + *hSession->output.ptr++ = SF_SRM_FIELD;
  882 + *hSession->output.ptr++ = SF_SRM_XFIELD;
  883 + *hSession->output.ptr++ = SF_SRM_CHAR;
877 884 }
878 885  
879 886 #if defined(X3270_DBCS) /*[*/
... ... @@ -882,13 +889,13 @@ static void do_qr_dbcs_asia(H3270 *hSession)
882 889 /* XXX: Should we support this, even when not in DBCS mode? */
883 890 trace_ds(hSession,"> QueryReply(DbcsAsia)\n");
884 891 space3270out(hSession,7);
885   - *hSession->obptr++ = 0x00; /* flags (none) */
886   - *hSession->obptr++ = 0x03; /* field length 3 */
887   - *hSession->obptr++ = 0x01; /* SI/SO supported */
888   - *hSession->obptr++ = 0x80; /* character set ID 0x80 */
889   - *hSession->obptr++ = 0x03; /* field length 3 */
890   - *hSession->obptr++ = 0x02; /* input control */
891   - *hSession->obptr++ = 0x01; /* creation supported */
  892 + *hSession->output.ptr++ = 0x00; /* flags (none) */
  893 + *hSession->output.ptr++ = 0x03; /* field length 3 */
  894 + *hSession->output.ptr++ = 0x01; /* SI/SO supported */
  895 + *hSession->output.ptr++ = 0x80; /* character set ID 0x80 */
  896 + *hSession->output.ptr++ = 0x03; /* field length 3 */
  897 + *hSession->output.ptr++ = 0x02; /* input control */
  898 + *hSession->output.ptr++ = 0x01; /* creation supported */
892 899 }
893 900 #endif /*]*/
894 901  
... ... @@ -896,9 +903,9 @@ static void do_qr_alpha_part(H3270 *hSession)
896 903 {
897 904 trace_ds(hSession,"> QueryReply(AlphanumericPartitions)\n");
898 905 space3270out(hSession,4);
899   - *hSession->obptr++ = 0; /* 1 partition */
900   - SET16(hSession->obptr, hSession->max.cols * hSession->max.rows); /* buffer space */
901   - *hSession->obptr++ = 0; /* no special features */
  906 + *hSession->output.ptr++ = 0; /* 1 partition */
  907 + SET16(hSession->output.ptr, hSession->max.cols * hSession->max.rows); /* buffer space */
  908 + *hSession->output.ptr++ = 0; /* no special features */
902 909 }
903 910  
904 911 static void do_qr_charsets(H3270 *hSession)
... ... @@ -907,79 +914,79 @@ static void do_qr_charsets(H3270 *hSession)
907 914 space3270out(hSession,64);
908 915 #if defined(X3270_DBCS) /*[*/
909 916 if (dbcs)
910   - *hSession->obptr++ = 0x8e; /* flags: GE, CGCSGID, DBCS */
  917 + *hSession->output.ptr++ = 0x8e; /* flags: GE, CGCSGID, DBCS */
911 918 else
912 919 #endif /*]*/
913   - *hSession->obptr++ = 0x82; /* flags: GE, CGCSGID present */
914   -
915   - *hSession->obptr++ = 0x00; /* more flags */
916   - *hSession->obptr++ = *char_width; /* SDW */
917   - *hSession->obptr++ = *char_height; /* SDW */
918   - *hSession->obptr++ = 0x00; /* no load PS */
919   - *hSession->obptr++ = 0x00;
920   - *hSession->obptr++ = 0x00;
921   - *hSession->obptr++ = 0x00;
  920 + *hSession->output.ptr++ = 0x82; /* flags: GE, CGCSGID present */
  921 +
  922 + *hSession->output.ptr++ = 0x00; /* more flags */
  923 + *hSession->output.ptr++ = *char_width; /* SDW */
  924 + *hSession->output.ptr++ = *char_height; /* SDW */
  925 + *hSession->output.ptr++ = 0x00; /* no load PS */
  926 + *hSession->output.ptr++ = 0x00;
  927 + *hSession->output.ptr++ = 0x00;
  928 + *hSession->output.ptr++ = 0x00;
922 929 #if defined(X3270_DBCS) /*[*/
923 930 if (dbcs)
924   - *hSession->obptr++ = 0x0b; /* DL (11 bytes) */
  931 + *hSession->output.ptr++ = 0x0b; /* DL (11 bytes) */
925 932 else
926 933 #endif /*]*/
927   - *hSession->obptr++ = 0x07; /* DL (7 bytes) */
  934 + *hSession->output.ptr++ = 0x07; /* DL (7 bytes) */
928 935  
929   - *hSession->obptr++ = 0x00; /* SET 0: */
  936 + *hSession->output.ptr++ = 0x00; /* SET 0: */
930 937 #if defined(X3270_DBCS) /*[*/
931 938 if (dbcs)
932   - *hSession->obptr++ = 0x00; /* FLAGS: non-load, single-
  939 + *hSession->output.ptr++ = 0x00; /* FLAGS: non-load, single-
933 940 plane, single-bute */
934 941 else
935 942 #endif /*]*/
936   - *hSession->obptr++ = 0x10; /* FLAGS: non-loadable,
  943 + *hSession->output.ptr++ = 0x10; /* FLAGS: non-loadable,
937 944 single-plane, single-byte,
938 945 no compare */
939   - *hSession->obptr++ = 0x00; /* LCID 0 */
  946 + *hSession->output.ptr++ = 0x00; /* LCID 0 */
940 947 #if defined(X3270_DBCS) /*[*/
941 948 if (dbcs) {
942   - *hSession->obptr++ = 0x00; /* SW 0 */
943   - *hSession->obptr++ = 0x00; /* SH 0 */
944   - *hSession->obptr++ = 0x00; /* SUBSN */
945   - *hSession->obptr++ = 0x00; /* SUBSN */
  949 + *hSession->output.ptr++ = 0x00; /* SW 0 */
  950 + *hSession->output.ptr++ = 0x00; /* SH 0 */
  951 + *hSession->output.ptr++ = 0x00; /* SUBSN */
  952 + *hSession->output.ptr++ = 0x00; /* SUBSN */
946 953 }
947 954 #endif /*]*/
948   - SET32(hSession->obptr, hSession->charset.cgcsgid); /* CGCSGID */
  955 + SET32(hSession->output.ptr, hSession->charset.cgcsgid); /* CGCSGID */
949 956 if (!*standard_font)
950 957 {
951 958 /* special 3270 font, includes APL */
952   - *hSession->obptr++ = 0x01;/* SET 1: */
  959 + *hSession->output.ptr++ = 0x01;/* SET 1: */
953 960 if (hSession->apl_mode)
954   - *hSession->obptr++ = 0x00;/* FLAGS: non-loadable, single-plane, single-byte, no compare */
  961 + *hSession->output.ptr++ = 0x00;/* FLAGS: non-loadable, single-plane, single-byte, no compare */
955 962 else
956   - *hSession->obptr++ = 0x10;/* FLAGS: non-loadable, single-plane, single-byte, no compare */
957   - *hSession->obptr++ = 0xf1;/* LCID */
  963 + *hSession->output.ptr++ = 0x10;/* FLAGS: non-loadable, single-plane, single-byte, no compare */
  964 + *hSession->output.ptr++ = 0xf1;/* LCID */
958 965 #if defined(X3270_DBCS) /*[*/
959 966 if (dbcs)
960 967 {
961   - *hSession->obptr++ = 0x00;/* SW 0 */
962   - *hSession->obptr++ = 0x00;/* SH 0 */
963   - *hSession->obptr++ = 0x00;/* SUBSN */
964   - *hSession->obptr++ = 0x00;/* SUBSN */
  968 + *hSession->output.ptr++ = 0x00;/* SW 0 */
  969 + *hSession->output.ptr++ = 0x00;/* SH 0 */
  970 + *hSession->output.ptr++ = 0x00;/* SUBSN */
  971 + *hSession->output.ptr++ = 0x00;/* SUBSN */
965 972 }
966 973 #endif /*]*/
967   - *hSession->obptr++ = 0x03;/* CGCSGID: 3179-style APL2 */
968   - *hSession->obptr++ = 0xc3;
969   - *hSession->obptr++ = 0x01;
970   - *hSession->obptr++ = 0x36;
  974 + *hSession->output.ptr++ = 0x03;/* CGCSGID: 3179-style APL2 */
  975 + *hSession->output.ptr++ = 0xc3;
  976 + *hSession->output.ptr++ = 0x01;
  977 + *hSession->output.ptr++ = 0x36;
971 978 }
972 979 #if defined(X3270_DBCS) /*[*/
973 980 if (dbcs)
974 981 {
975   - *hSession->obptr++ = 0x80; /* SET 0x80: */
976   - *hSession->obptr++ = 0x20; /* FLAGS: DBCS */
977   - *hSession->obptr++ = 0xf8; /* LCID: 0xf8 */
978   - *hSession->obptr++ = *char_width * 2; /* SW */
979   - *hSession->obptr++ = *char_height; /* SH */
980   - *hSession->obptr++ = 0x41; /* SUBSN */
981   - *hSession->obptr++ = 0x7f; /* SUBSN */
982   - SET32(hSession->obptr, cgcsgid_dbcs); /* CGCSGID */
  982 + *hSession->output.ptr++ = 0x80; /* SET 0x80: */
  983 + *hSession->output.ptr++ = 0x20; /* FLAGS: DBCS */
  984 + *hSession->output.ptr++ = 0xf8; /* LCID: 0xf8 */
  985 + *hSession->output.ptr++ = *char_width * 2; /* SW */
  986 + *hSession->output.ptr++ = *char_height; /* SH */
  987 + *hSession->output.ptr++ = 0x41; /* SUBSN */
  988 + *hSession->output.ptr++ = 0x7f; /* SUBSN */
  989 + SET32(hSession->output.ptr, cgcsgid_dbcs); /* CGCSGID */
983 990 }
984 991 #endif /*]*/
985 992 }
... ... @@ -991,10 +998,10 @@ static void do_qr_ddm(H3270 *hSession)
991 998  
992 999 trace_ds(hSession,"> QueryReply(DistributedDataManagement)\n");
993 1000 space3270out(hSession,8);
994   - SET16(hSession->obptr,0); /* set reserved field to 0 */
995   - SET16(hSession->obptr, hSession->dft_buffersize); /* set inbound length limit INLIM */
996   - SET16(hSession->obptr, hSession->dft_buffersize); /* set outbound length limit OUTLIM */
997   - SET16(hSession->obptr, 0x0101); /* NSS=01, DDMSS=01 */
  1001 + SET16(hSession->output.ptr,0); /* set reserved field to 0 */
  1002 + SET16(hSession->output.ptr, hSession->dft_buffersize); /* set inbound length limit INLIM */
  1003 + SET16(hSession->output.ptr, hSession->dft_buffersize); /* set outbound length limit OUTLIM */
  1004 + SET16(hSession->output.ptr, 0x0101); /* NSS=01, DDMSS=01 */
998 1005 }
999 1006 #endif /*]*/
1000 1007  
... ... @@ -1002,15 +1009,15 @@ static void do_qr_imp_part(H3270 *hSession)
1002 1009 {
1003 1010 trace_ds(hSession,"> QueryReply(ImplicitPartition)\n");
1004 1011 space3270out(hSession,13);
1005   - *hSession->obptr++ = 0x0; /* reserved */
1006   - *hSession->obptr++ = 0x0;
1007   - *hSession->obptr++ = 0x0b; /* length of display size */
1008   - *hSession->obptr++ = 0x01; /* "implicit partition size" */
1009   - *hSession->obptr++ = 0x00; /* reserved */
1010   - SET16(hSession->obptr, 80); /* implicit partition width */
1011   - SET16(hSession->obptr, 24); /* implicit partition height */
1012   - SET16(hSession->obptr, hSession->max.cols); /* alternate height */
1013   - SET16(hSession->obptr, hSession->max.rows); /* alternate width */
  1012 + *hSession->output.ptr++ = 0x0; /* reserved */
  1013 + *hSession->output.ptr++ = 0x0;
  1014 + *hSession->output.ptr++ = 0x0b; /* length of display size */
  1015 + *hSession->output.ptr++ = 0x01; /* "implicit partition size" */
  1016 + *hSession->output.ptr++ = 0x00; /* reserved */
  1017 + SET16(hSession->output.ptr, 80); /* implicit partition width */
  1018 + SET16(hSession->output.ptr, 24); /* implicit partition height */
  1019 + SET16(hSession->output.ptr, hSession->max.cols); /* alternate height */
  1020 + SET16(hSession->output.ptr, hSession->max.rows); /* alternate width */
1014 1021 }
1015 1022  
1016 1023 static void query_reply_end(H3270 *hSession)
... ...
src/core/telnet.c
... ... @@ -2144,20 +2144,20 @@ void space3270out(H3270 *hSession, int n)
2144 2144 unsigned nc = 0; /* amount of data currently in obuf */
2145 2145 unsigned more = 0;
2146 2146  
2147   - if (hSession->obuf_size)
2148   - nc = hSession->obptr - hSession->obuf;
  2147 + if (hSession->output.length)
  2148 + nc = hSession->output.ptr - hSession->output.buf;
2149 2149  
2150   - while ((nc + n + EH_SIZE) > (hSession->obuf_size + more))
  2150 + while ((nc + n + EH_SIZE) > (hSession->output.length + more))
2151 2151 {
2152 2152 more += BUFSIZ;
2153 2153 }
2154 2154  
2155 2155 if (more)
2156 2156 {
2157   - hSession->obuf_size += more;
2158   - hSession->obuf_base = (unsigned char *)Realloc((char *) hSession->obuf_base,hSession->obuf_size);
2159   - hSession->obuf = hSession->obuf_base + EH_SIZE;
2160   - hSession->obptr = hSession->obuf + nc;
  2157 + hSession->output.length += more;
  2158 + hSession->output.base = (unsigned char *)Realloc((char *) hSession->output.base,hSession->output.length);
  2159 + hSession->output.buf = hSession->output.base + EH_SIZE;
  2160 + hSession->output.ptr = hSession->output.buf + nc;
2161 2161 }
2162 2162 }
2163 2163  
... ... @@ -2342,7 +2342,7 @@ void net_output(H3270 *hSession)
2342 2342 unsigned char *nxoptr, *xoptr;
2343 2343  
2344 2344 #if defined(X3270_TN3270E)
2345   - #define BSTART ((IN_TN3270E || IN_SSCP) ? hSession->obuf_base : hSession->obuf)
  2345 + #define BSTART ((IN_TN3270E || IN_SSCP) ? hSession->output.base : hSession->output.buf)
2346 2346 #else
2347 2347 #define BSTART obuf
2348 2348 #endif
... ... @@ -2351,7 +2351,7 @@ void net_output(H3270 *hSession)
2351 2351 /* Set the TN3720E header. */
2352 2352 if (IN_TN3270E || IN_SSCP)
2353 2353 {
2354   - tn3270e_header *h = (tn3270e_header *) hSession->obuf_base;
  2354 + tn3270e_header *h = (tn3270e_header *) hSession->output.base;
2355 2355  
2356 2356 /* Check for sending a TN3270E response. */
2357 2357 if (hSession->response_required == TN3270E_RSF_ALWAYS_RESPONSE)
... ... @@ -2374,7 +2374,7 @@ void net_output(H3270 *hSession)
2374 2374 #endif /*]*/
2375 2375  
2376 2376 /* Reallocate the expanded output buffer. */
2377   - while (xobuf_len < (hSession->obptr - BSTART + 1) * 2)
  2377 + while (xobuf_len < (hSession->output.ptr - BSTART + 1) * 2)
2378 2378 {
2379 2379 xobuf_len += BUFSZ;
2380 2380 need_resize++;
... ... @@ -2388,7 +2388,7 @@ void net_output(H3270 *hSession)
2388 2388 /* Copy and expand IACs. */
2389 2389 xoptr = xobuf;
2390 2390 nxoptr = BSTART;
2391   - while (nxoptr < hSession->obptr)
  2391 + while (nxoptr < hSession->output.ptr)
2392 2392 {
2393 2393 if ((*xoptr++ = *nxoptr++) == IAC)
2394 2394 {
... ...
src/include/lib3270-internals.h
... ... @@ -488,8 +488,6 @@ struct _h3270
488 488 // Telnet.c
489 489 unsigned char * ibuf;
490 490 int ibuf_size; /**< @brief size of ibuf */
491   - unsigned char * obuf; /**< @brief 3270 output buffer */
492   - unsigned char * obptr;
493 491 time_t ns_time;
494 492 int ns_brcvd;
495 493 int ns_rrcvd;
... ... @@ -529,8 +527,15 @@ struct _h3270
529 527  
530 528 // 3270 input buffer
531 529 unsigned char * ibptr;
532   - unsigned char * obuf_base;
533   - int obuf_size;
  530 +
  531 + // Output buffer.
  532 + struct
  533 + {
  534 + unsigned char * buf; ///< @brief 3270 output buffer */
  535 + unsigned char * base;
  536 + int length; ///< @brief Length of the output buffer.
  537 + unsigned char * ptr;
  538 + } output;
534 539  
535 540 // network input buffer
536 541 unsigned char * sbbuf;
... ...