Commit 9c9992790b75796e66d37c930619aa82d4c8a080

Authored by perry.werneck@gmail.com
1 parent efcc2418

Ajustes no fonte para facilitar a análise de prossível problema com RPQ

src/lib3270/rpq.c
@@ -92,8 +92,8 @@ static void rpq_dump_warnings(H3270 *hSession); @@ -92,8 +92,8 @@ static void rpq_dump_warnings(H3270 *hSession);
92 #define RPQ_ADDRESS 0 92 #define RPQ_ADDRESS 0
93 #define RPQ_TIMESTAMP 1 93 #define RPQ_TIMESTAMP 1
94 #define RPQ_TIMEZONE 2 94 #define RPQ_TIMEZONE 2
95 -#define RPQ_USER 3  
96 -#define RPQ_VERSION 4 95 +#define RPQ_USER 3
  96 +#define RPQ_VERSION 4
97 97
98 /* 98 /*
99 * Define a table of RPQ self-defing terms. 99 * Define a table of RPQ self-defing terms.
@@ -127,8 +127,7 @@ static char *x3270rpq; @@ -127,8 +127,7 @@ static char *x3270rpq;
127 */ 127 */
128 void do_qr_rpqnames(H3270 *hSession) 128 void do_qr_rpqnames(H3270 *hSession)
129 { 129 {
130 - #define TERM_PREFIX_SIZE 2 /* Each term has 1 byte length and 1  
131 - byte id */ 130 + #define TERM_PREFIX_SIZE 2 /* Each term has 1 byte length and 1 byte id */
132 131
133 unsigned char *rpql, *p_term; 132 unsigned char *rpql, *p_term;
134 int term_id,i,j,x; 133 int term_id,i,j,x;
@@ -178,7 +177,8 @@ void do_qr_rpqnames(H3270 *hSession) @@ -178,7 +177,8 @@ void do_qr_rpqnames(H3270 *hSession)
178 */ 177 */
179 remaining -= TERM_PREFIX_SIZE; 178 remaining -= TERM_PREFIX_SIZE;
180 179
181 - switch (term_id) { /* build the term based on id */ 180 + switch (term_id) /* build the term based on id */
  181 + {
182 case RPQ_USER: /* User text from env. vars */ 182 case RPQ_USER: /* User text from env. vars */
183 hSession->obptr += get_rpq_user(hSession,hSession->obptr, remaining); 183 hSession->obptr += get_rpq_user(hSession,hSession->obptr, remaining);
184 break; 184 break;
@@ -198,8 +198,10 @@ void do_qr_rpqnames(H3270 *hSession) @@ -198,8 +198,10 @@ void do_qr_rpqnames(H3270 *hSession)
198 case RPQ_VERSION: /* program version */ 198 case RPQ_VERSION: /* program version */
199 x = strlen(build_rpq_version); 199 x = strlen(build_rpq_version);
200 omit_due_space_limit = (x > remaining); 200 omit_due_space_limit = (x > remaining);
201 - if (!omit_due_space_limit) {  
202 - for (i = 0; i < x; i++) { 201 + if (!omit_due_space_limit)
  202 + {
  203 + for (i = 0; i < x; i++)
  204 + {
203 *hSession->obptr++ = asc2ebc[(int)(*(build_rpq_version+i) & 0xff)]; 205 *hSession->obptr++ = asc2ebc[(int)(*(build_rpq_version+i) & 0xff)];
204 } 206 }
205 } 207 }
@@ -208,8 +210,10 @@ void do_qr_rpqnames(H3270 *hSession) @@ -208,8 +210,10 @@ void do_qr_rpqnames(H3270 *hSession)
208 case RPQ_TIMESTAMP: /* program build time (yyyymmddhhmmss bcd) */ 210 case RPQ_TIMESTAMP: /* program build time (yyyymmddhhmmss bcd) */
209 x = strlen(build_rpq_timestamp); 211 x = strlen(build_rpq_timestamp);
210 omit_due_space_limit = ((x+1)/2 > remaining) ? 1 : 0; 212 omit_due_space_limit = ((x+1)/2 > remaining) ? 1 : 0;
211 - if (!omit_due_space_limit) {  
212 - for (i=0; i < x; i+=2) { 213 + if (!omit_due_space_limit)
  214 + {
  215 + for (i=0; i < x; i+=2)
  216 + {
213 *hSession->obptr++ = ((*(build_rpq_timestamp+i) - '0') << 4) 217 *hSession->obptr++ = ((*(build_rpq_timestamp+i) - '0') << 4)
214 + (*(build_rpq_timestamp+i+1) - '0'); 218 + (*(build_rpq_timestamp+i+1) - '0');
215 } 219 }
@@ -217,7 +221,11 @@ void do_qr_rpqnames(H3270 *hSession) @@ -217,7 +221,11 @@ void do_qr_rpqnames(H3270 *hSession)
217 break; 221 break;
218 222
219 default: /* unsupported ID, (can't happen) */ 223 default: /* unsupported ID, (can't happen) */
220 - Error(hSession,_( "Unsupported RPQ term" )); 224 + lib3270_popup_dialog( hSession,
  225 + LIB3270_NOTIFY_ERROR,
  226 + _( "RPQ Error" ),
  227 + _( "Unsupported RPQ term" ),
  228 + _( "RPQ term %d is unknown" ), term_id );
221 break; 229 break;
222 } 230 }
223 231
src/lib3270/screen.c
@@ -653,10 +653,7 @@ void Error(H3270 *session, const char *fmt, ...) @@ -653,10 +653,7 @@ void Error(H3270 *session, const char *fmt, ...)
653 653
654 va_start(arg_ptr, fmt); 654 va_start(arg_ptr, fmt);
655 655
656 - if(session && session->sz == sizeof(H3270))  
657 - popup_handler(session,session->widget,LIB3270_NOTIFY_ERROR, _( "3270 Error" ),NULL,fmt,arg_ptr);  
658 - else  
659 - popup_handler(NULL,NULL,LIB3270_NOTIFY_ERROR, _( "3270 Error" ),NULL,fmt,arg_ptr); 656 + popup_handler(session,session->widget,LIB3270_NOTIFY_ERROR, _( "3270 Error" ),NULL,fmt,arg_ptr);
660 657
661 va_end(arg_ptr); 658 va_end(arg_ptr);
662 659
src/lib3270/see.c
@@ -460,37 +460,37 @@ see_efa_only(unsigned char efa) @@ -460,37 +460,37 @@ see_efa_only(unsigned char efa)
460 } 460 }
461 } 461 }
462 462
463 -const char *  
464 -see_qcode(unsigned char id) 463 +const char * see_qcode(unsigned char id)
465 { 464 {
466 static char buf[64]; 465 static char buf[64];
467 466
468 - switch (id) { 467 + switch (id)
  468 + {
469 case QR_CHARSETS: 469 case QR_CHARSETS:
470 - return "CharacterSets"; 470 + return "CharacterSets";
471 case QR_IMP_PART: 471 case QR_IMP_PART:
472 - return "ImplicitPartition"; 472 + return "ImplicitPartition";
473 case QR_SUMMARY: 473 case QR_SUMMARY:
474 - return "Summary"; 474 + return "Summary";
475 case QR_USABLE_AREA: 475 case QR_USABLE_AREA:
476 - return "UsableArea"; 476 + return "UsableArea";
477 case QR_COLOR: 477 case QR_COLOR:
478 - return "Color"; 478 + return "Color";
479 case QR_HIGHLIGHTING: 479 case QR_HIGHLIGHTING:
480 - return "Highlighting"; 480 + return "Highlighting";
481 case QR_REPLY_MODES: 481 case QR_REPLY_MODES:
482 - return "ReplyModes"; 482 + return "ReplyModes";
483 case QR_DBCS_ASIA: 483 case QR_DBCS_ASIA:
484 - return "DbcsAsia"; 484 + return "DbcsAsia";
485 case QR_ALPHA_PART: 485 case QR_ALPHA_PART:
486 - return "AlphanumericPartitions"; 486 + return "AlphanumericPartitions";
487 case QR_DDM: 487 case QR_DDM:
488 - return "DistributedDataManagement"; 488 + return "DistributedDataManagement";
489 case QR_RPQNAMES: 489 case QR_RPQNAMES:
490 - return "RPQNames"; 490 + return "RPQNames";
491 default: 491 default:
492 - (void) sprintf(buf, "unknown[0x%x]", id);  
493 - return buf; 492 + (void) sprintf(buf, "unknown[0x%x]", id);
  493 + return buf;
494 } 494 }
495 } 495 }
496 496