- Timestamp:
- Dec 5, 2004, 1:19:43 AM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/avv.c
r107 r122 3 3 4 4 $Id$ 5 6 archiver.bb2 editor 5 7 6 8 Copyright (c) 1993-98 M. Kimes … … 9 11 Archive containers 10 12 11 Revisions 31 Jul 04 SHL - ArcReviewDlgProc: correct nameis... decodes 13 Revisions 31 Jul 04 SHL ArcReviewDlgProc: correct nameis... decodes 14 01 Aug 04 SHL Localize functions 15 01 Aug 04 SHL Rework fixup usage 12 16 13 17 ***********************************************************************/ … … 29 33 30 34 #pragma data_seg(DATA1) 31 #pragma alloc_text(AVV,EditArchiverData, assign,reassign_from_window)35 #pragma alloc_text(AVV,EditArchiverData,xstrdup,xstrdup_from_window) 32 36 #pragma alloc_text(AVV,get_int_from_window,get_int2_from_window) 33 37 #pragma alloc_text(AVV,get_long_from_window,get_int3_from_window) 34 38 #pragma alloc_text(AVV,get_int4_from_window) 35 39 36 37 APIRET EditArchiverData (HWND hwnd,DIRCNRDATA *arc) { 38 40 static PSZ checkfile(PSZ file,INT *error); 41 static ULONG checkfile2(PSZ file,INT *error); 42 static PSZ checksayfile(HWND hwnd,PSZ file,INT *error); 43 static INT check_archiver (HWND hwnd,ARC_TYPE *info); 44 static INT get_int_from_window (HWND hwnd,USHORT id); 45 static LONG get_long_from_window (HWND hwnd,USHORT id); 46 static PSZ nonull(PSZ a); 47 static PSZ xstrdup(PSZ pszDest,PSZ pszSrc); 48 static PSZ xstrdup_from_window(HWND hwnd,USHORT id,PSZ pszDest); 49 50 APIRET EditArchiverData(HWND hwnd,DIRCNRDATA *arc) 51 { 39 52 ARCDUMP ad; 40 53 FILE *fp; … … 101 114 102 115 103 CHAR * assign (CHAR *a,CHAR *b) { 104 116 static PSZ xstrdup(PSZ a,PSZ b) 117 { 105 118 if(a) 106 119 free(a); … … 114 127 115 128 116 CHAR * reassign_from_window (HWND hwnd,USHORT id,char *a) { 117 118 char s [257] = "";129 static PSZ xstrdup_from_window(HWND hwnd,USHORT id,PSZ pszDest) 130 { 131 char sz[257] = ""; 119 132 120 133 WinQueryDlgItemText(hwnd, 121 134 id, 122 135 255, 123 s );124 a = assign(a,s);125 return a;126 } 127 128 129 INT get_int_from_window (HWND hwnd,USHORT id) { 130 136 sz); 137 pszDest = xstrdup(pszDest,sz); 138 return pszDest; 139 } 140 141 142 static INT get_int_from_window(HWND hwnd,USHORT id) 143 { 131 144 char s[257] = ""; 132 145 … … 136 149 137 150 138 INT get_int2_from_window (HWND hwnd,USHORT id) { 139 151 static INT get_int2_from_window(HWND hwnd,USHORT id) 152 { 140 153 char s[257] = "",*p; 141 154 … … 148 161 149 162 150 INT get_int3_from_window (HWND hwnd,USHORT id) {151 163 INT get_int3_from_window (HWND hwnd,USHORT id) 164 { 152 165 char s[257] = "",*p; 153 166 … … 164 177 165 178 166 INT get_int4_from_window (HWND hwnd,USHORT id) {167 179 INT get_int4_from_window (HWND hwnd,USHORT id) 180 { 168 181 char s[257] = "",*p; 169 182 … … 184 197 185 198 186 LONG get_long_from_window (HWND hwnd,USHORT id) {187 199 LONG get_long_from_window (HWND hwnd,USHORT id) 200 { 188 201 char s[257] = ""; 189 202 … … 195 208 #pragma alloc_text (AVV2,nonull,rewrite_archiverbb2,checkfile,checkfile2) 196 209 197 CHAR * nonull (CHAR *a) { 198 199 if(!a) 200 return NullStr; 201 return a; 202 } 203 204 205 VOID rewrite_archiverbb2 (CHAR *archiverbb2) { 206 210 // nonull - convert NULL pointer to empty string 211 212 static PSZ nonull(PSZ psz) 213 { 214 if(!psz) 215 psz = NullStr; 216 return psz; 217 } 218 219 220 VOID rewrite_archiverbb2 (PSZ archiverbb2) 221 { 207 222 FILE *fp; 208 223 INT counter = 0; … … 274 289 fixup(info->signature, 275 290 s, 276 255,291 sizeof(s), 277 292 strlen(info->signature)), 278 293 nonull(info->startlist), … … 295 310 296 311 297 CHAR * checkfile (CHAR *file,INT *error) { 298 312 static PSZ checkfile(PSZ file,INT *error) 313 { 299 314 CHAR *p,*pp = NULL; 300 315 INT ret; … … 335 350 336 351 337 ULONG checkfile2 (CHAR *file,INT *error) { 338 352 static ULONG checkfile2 (PSZ file,INT *error) 353 { 339 354 CHAR *p,*pp = NULL; 340 355 INT ret; … … 376 391 #pragma alloc_text (AVV3,checksayfile,check_archiver,ArcReviewDlgProc) 377 392 378 CHAR *checksayfile (HWND hwnd,CHAR *file,INT *error) { 379 380 CHAR *p,*pp = NULL; 393 static PSZ checksayfile (HWND hwnd,PSZ file,INT *error) 394 { 395 PSZ p; 396 PSZ pp = NULL; 381 397 382 398 p = checkfile(file,error); … … 421 437 422 438 423 INT check_archiver (HWND hwnd,ARC_TYPE *info) { 424 439 static INT check_archiver(HWND hwnd,ARC_TYPE *info) 440 { 425 441 BOOL fStart = FALSE,fEnd = FALSE,fNpos = FALSE; 426 442 INT List = 0,Create = 0,Extract = 0; 427 static CHAR *aerrors[3];443 static PSZ aerrors[3]; 428 444 429 445 aerrors[0] = GetPString(IDS_STARTLISTEMPTYTEXT); … … 481 497 482 498 483 MRESULT EXPENTRY ArcReviewDlgProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {484 485 ARCDUMP 486 static CHAR s[258];487 SHORT 499 MRESULT EXPENTRY ArcReviewDlgProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) 500 { 501 ARCDUMP *admp; 502 CHAR s[256]; 503 SHORT sSelect; 488 504 489 505 if(msg != WM_INITDLG) … … 497 513 return 0; 498 514 } 515 499 516 WinSetWindowPtr(hwnd,0,mp2); 517 518 WinSendDlgItemMsg(hwnd, 519 AD_LISTBOX, 520 LM_DELETEALL, 521 MPVOID, 522 MPVOID); 523 for(sSelect = AD_ID;sSelect < AD_ADDWPATHS + 1;sSelect++) 500 524 { 501 502 AD_LISTBOX,503 LM_DELETEALL,504 MP VOID,525 WinSendDlgItemMsg(hwnd, 526 sSelect, 527 EM_SETTEXTLIMIT, 528 MPFROM2SHORT(sizeof(s) - 1,0), 505 529 MPVOID); 506 for(sSelect = AD_ID;sSelect < AD_ADDWPATHS + 1;sSelect++) 507 WinSendDlgItemMsg(hwnd, 508 sSelect, 509 EM_SETTEXTLIMIT, 510 MPFROM2SHORT(255,0), 511 MPVOID); 512 if(admp->info->id) 513 WinSetDlgItemText(hwnd, 514 AD_ID, 515 admp->info->id); 516 if(admp->info->ext) 517 WinSetDlgItemText(hwnd, 518 AD_EXT, 519 admp->info->ext); 520 sprintf(s, 521 "%ld", 522 admp->info->file_offset); 530 } 531 if (admp->info->id) { 523 532 WinSetDlgItemText(hwnd, 524 AD_SIGPOS, 525 s); 526 if(admp->info->signature) 527 WinSetDlgItemText(hwnd, 528 AD_SIG, 529 fixup(admp->info->signature, 530 s, 531 255, 532 strlen(admp->info->signature))); 533 if(admp->info->startlist) 534 WinSetDlgItemText(hwnd, 535 AD_STARTLIST, 536 admp->info->startlist); 537 if(admp->info->endlist) 538 WinSetDlgItemText(hwnd, 539 AD_ENDLIST, 540 admp->info->endlist); 541 if(admp->info->list) 542 WinSetDlgItemText(hwnd, 543 AD_LIST, 544 admp->info->list); 545 sprintf(s, 546 "%d,%d,%d,%d", 547 admp->info->fnpos, 548 admp->info->nameislast, 549 admp->info->nameisnext, 550 admp->info->nameisfirst); 551 WinSetDlgItemText(hwnd,AD_FNAMEPOS,s); 552 sprintf(s,"%d",admp->info->osizepos); 553 WinSetDlgItemText(hwnd,AD_OLDSZ,s); 554 sprintf(s,"%d",admp->info->nsizepos); 555 WinSetDlgItemText(hwnd,AD_NEWSZ,s); 556 sprintf(s,"%d,%d",admp->info->fdpos,admp->info->datetype); 557 WinSetDlgItemText(hwnd,AD_DATEPOS,s); 558 sprintf(s,"%d",admp->info->fdflds); 559 WinSetDlgItemText(hwnd,AD_NUMDATEFLDS,s); 560 if(admp->info->extract) 561 WinSetDlgItemText(hwnd,AD_EXTRACT,admp->info->extract); 562 if(admp->info->exwdirs) 563 WinSetDlgItemText(hwnd,AD_WDIRS,admp->info->exwdirs); 564 if(admp->info->test) 565 WinSetDlgItemText(hwnd,AD_TEST,admp->info->test); 566 if(admp->info->create) 567 WinSetDlgItemText(hwnd,AD_ADD,admp->info->create); 568 if(admp->info->move) 569 WinSetDlgItemText(hwnd,AD_MOVE,admp->info->move); 570 if(admp->info->delete) 571 WinSetDlgItemText(hwnd,AD_DELETE,admp->info->delete); 572 if(admp->info->createrecurse) 573 WinSetDlgItemText(hwnd,AD_ADDRECURSE,admp->info->createrecurse); 574 if(admp->info->createwdirs) 575 WinSetDlgItemText(hwnd,AD_ADDWPATHS,admp->info->createwdirs); 576 if(admp->info->movewdirs) 577 WinSetDlgItemText(hwnd,AD_MOVEWPATHS,admp->info->movewdirs); 578 } 533 AD_ID, 534 admp->info->id); 535 } 536 if (admp->info->ext) { 537 WinSetDlgItemText(hwnd, 538 AD_EXT, 539 admp->info->ext); 540 } 541 sprintf(s, 542 "%ld", 543 admp->info->file_offset); 544 WinSetDlgItemText(hwnd, 545 AD_SIGPOS, 546 s); 547 if (admp->info->signature) { 548 WinSetDlgItemText(hwnd, 549 AD_SIG, 550 fixup(admp->info->signature, 551 s, 552 sizeof(s), 553 strlen(admp->info->signature))); 554 } 555 if (admp->info->startlist) { 556 WinSetDlgItemText(hwnd, 557 AD_STARTLIST, 558 admp->info->startlist); 559 } 560 if (admp->info->endlist) { 561 WinSetDlgItemText(hwnd, 562 AD_ENDLIST, 563 admp->info->endlist); 564 } 565 if (admp->info->list) { 566 WinSetDlgItemText(hwnd, 567 AD_LIST, 568 admp->info->list); 569 } 570 sprintf(s, 571 "%d,%d,%d,%d", 572 admp->info->fnpos, 573 admp->info->nameislast, 574 admp->info->nameisnext, 575 admp->info->nameisfirst); 576 WinSetDlgItemText(hwnd,AD_FNAMEPOS,s); 577 sprintf(s,"%d",admp->info->osizepos); 578 WinSetDlgItemText(hwnd,AD_OLDSZ,s); 579 sprintf(s,"%d",admp->info->nsizepos); 580 WinSetDlgItemText(hwnd,AD_NEWSZ,s); 581 sprintf(s,"%d,%d",admp->info->fdpos,admp->info->datetype); 582 WinSetDlgItemText(hwnd,AD_DATEPOS,s); 583 sprintf(s,"%d",admp->info->fdflds); 584 WinSetDlgItemText(hwnd,AD_NUMDATEFLDS,s); 585 if(admp->info->extract) 586 WinSetDlgItemText(hwnd,AD_EXTRACT,admp->info->extract); 587 if(admp->info->exwdirs) 588 WinSetDlgItemText(hwnd,AD_WDIRS,admp->info->exwdirs); 589 if(admp->info->test) 590 WinSetDlgItemText(hwnd,AD_TEST,admp->info->test); 591 if(admp->info->create) 592 WinSetDlgItemText(hwnd,AD_ADD,admp->info->create); 593 if(admp->info->move) 594 WinSetDlgItemText(hwnd,AD_MOVE,admp->info->move); 595 if(admp->info->delete) 596 WinSetDlgItemText(hwnd,AD_DELETE,admp->info->delete); 597 if(admp->info->createrecurse) 598 WinSetDlgItemText(hwnd,AD_ADDRECURSE,admp->info->createrecurse); 599 if(admp->info->createwdirs) 600 WinSetDlgItemText(hwnd,AD_ADDWPATHS,admp->info->createwdirs); 601 if(admp->info->movewdirs) 602 WinSetDlgItemText(hwnd,AD_MOVEWPATHS,admp->info->movewdirs); 603 579 604 PostMsg(hwnd, 580 605 UM_SETUP, 581 606 MPVOID, 582 607 MPVOID); 583 break; 608 break; // WM_INITDLG 584 609 585 610 … … 599 624 else { 600 625 while(!feof(fp)) { 601 if(!fgets(s, 256,fp)) break;626 if(!fgets(s,sizeof(s),fp)) break; 602 627 stripcr(s); 603 628 WinSendDlgItemMsg(hwnd, … … 654 679 if(*s) { 655 680 656 char *p,*pp; 681 PSZ p; 682 PSZ pp; 657 683 658 684 p = s; … … 890 916 else { 891 917 892 CHAR *p;893 894 p =lstrip(tempargs);918 PSZ p; 919 920 lstrip(tempargs); 895 921 p = strchr(tempargs,' '); 896 922 if(p) … … 921 947 922 948 case DID_OK: 923 admp->info->startlist = reassign_from_window(hwnd,AD_STARTLIST,admp->info->startlist);924 admp->info->endlist = reassign_from_window(hwnd,AD_ENDLIST,admp->info->endlist);925 admp->info->id = reassign_from_window(hwnd,AD_ID,admp->info->id);926 admp->info->create = reassign_from_window(hwnd,AD_ADD,admp->info->create);927 admp->info->createwdirs = reassign_from_window(hwnd,AD_ADDWPATHS,admp->info->createwdirs);928 admp->info->createrecurse = reassign_from_window(hwnd,AD_ADDRECURSE,admp->info->createrecurse);929 admp->info->movewdirs = reassign_from_window(hwnd,AD_MOVEWPATHS,admp->info->movewdirs);930 admp->info->move = reassign_from_window(hwnd,AD_MOVE,admp->info->move);931 admp->info->delete = reassign_from_window(hwnd,AD_DELETE,admp->info->delete);932 admp->info->test = reassign_from_window(hwnd,AD_TEST,admp->info->test);933 admp->info->extract = reassign_from_window(hwnd,AD_EXTRACT,admp->info->extract);934 admp->info->exwdirs = reassign_from_window(hwnd,AD_WDIRS,admp->info->exwdirs);935 admp->info->ext = reassign_from_window(hwnd,AD_EXT,admp->info->ext);936 literal( reassign_from_window(hwnd,949 admp->info->startlist = xstrdup_from_window(hwnd,AD_STARTLIST,admp->info->startlist); 950 admp->info->endlist = xstrdup_from_window(hwnd,AD_ENDLIST,admp->info->endlist); 951 admp->info->id = xstrdup_from_window(hwnd,AD_ID,admp->info->id); 952 admp->info->create = xstrdup_from_window(hwnd,AD_ADD,admp->info->create); 953 admp->info->createwdirs = xstrdup_from_window(hwnd,AD_ADDWPATHS,admp->info->createwdirs); 954 admp->info->createrecurse = xstrdup_from_window(hwnd,AD_ADDRECURSE,admp->info->createrecurse); 955 admp->info->movewdirs = xstrdup_from_window(hwnd,AD_MOVEWPATHS,admp->info->movewdirs); 956 admp->info->move = xstrdup_from_window(hwnd,AD_MOVE,admp->info->move); 957 admp->info->delete = xstrdup_from_window(hwnd,AD_DELETE,admp->info->delete); 958 admp->info->test = xstrdup_from_window(hwnd,AD_TEST,admp->info->test); 959 admp->info->extract = xstrdup_from_window(hwnd,AD_EXTRACT,admp->info->extract); 960 admp->info->exwdirs = xstrdup_from_window(hwnd,AD_WDIRS,admp->info->exwdirs); 961 admp->info->ext = xstrdup_from_window(hwnd,AD_EXT,admp->info->ext); 962 literal(xstrdup_from_window(hwnd, 937 963 AD_SIG, 938 964 admp->info->signature)); 939 admp->info->list = reassign_from_window(hwnd,965 admp->info->list = xstrdup_from_window(hwnd, 940 966 AD_LIST, 941 967 admp->info->list); … … 963 989 MBID_YES) { 964 990 965 CHAR *ab2;991 PSZ ab2; 966 992 967 993 ab2 = searchpath(GetPString(IDS_ARCHIVERBB2));
Note:
See TracChangeset
for help on using the changeset viewer.