Changeset 341 for trunk/dll/autoview.c
- Timestamp:
- Jul 26, 2006, 3:58:56 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/autoview.c
r291 r341 14 14 23 May 05 SHL Use QWL_USER 15 15 29 May 06 SHL Sync with archiver.bb2 mods 16 22 Jul 06 SHL Check more run time errors 16 17 17 18 ***********************************************************************/ … … 21 22 #define INCL_WIN 22 23 #define INCL_GPI 23 24 24 #include <os2.h> 25 25 26 #include <stdlib.h> 26 27 #include <stdio.h> 27 28 #include <string.h> 28 29 #include <ctype.h> 30 29 31 #include "fm3dll.h" 30 32 #include "fm3dlg.h" … … 33 35 34 36 #pragma data_seg(DATA1) 37 38 static PSZ pszSrcFile = __FILE__; 39 35 40 #pragma alloc_text(AUTOVIEW,AutoViewProc,CreateHexDump,AutoObjProc) 36 41 #pragma alloc_text(AUTOVIEW2,MakeAutoWin,WriteEA,PutComments) 37 42 38 static HWND hwndAutoObj = (HWND)0;43 static HWND hwndAutoObj; 39 44 static CHAR stopflag; 40 45 static CHAR currfile[CCHMAXPATH]; 41 46 42 BOOL WriteEA (HWND hwnd,CHAR *filename,CHAR *eaname,USHORT type,CHAR *data) {43 47 BOOL WriteEA (HWND hwnd,CHAR *filename,CHAR *eaname,USHORT type,CHAR *data) 48 { 44 49 /* save an ea to disk */ 45 50 … … 88 93 } 89 94 90 if(!DosAllocMem((PPVOID)&pfealist,ealen,PAG_COMMIT | PAG_READ | 91 PAG_WRITE | OBJ_TILE) && pfealist) { 95 rc = DosAllocMem((PPVOID)&pfealist,ealen,PAG_COMMIT | PAG_READ | 96 PAG_WRITE | OBJ_TILE); 97 if (rc || !pfealist) 98 Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,GetPString(IDS_OUTOFMEMORY)); 99 else { 92 100 memset(pfealist,0,ealen); 93 101 pfealist->list[0].cbName = strlen(eaname); … … 194 202 195 203 196 BOOL PutComments (HWND hwnd,CHAR *filename,CHAR *comments) {197 204 BOOL PutComments (HWND hwnd,CHAR *filename,CHAR *comments) 205 { 198 206 register CHAR *p; 199 207 … … 272 280 MRESULT EXPENTRY AutoObjProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) 273 281 { 274 275 282 switch(msg) { 276 283 case UM_LOADFILE: … … 304 311 0L)) { 305 312 ibufflen = (AutoviewHeight < 96) ? 512 : 3072; 306 ibuff = malloc(ibufflen + 2);307 if (ibuff) {313 ibuff = xmalloc(ibufflen + 2,pszSrcFile,__LINE__); 314 if (ibuff) { 308 315 // Depends on CreateHexDump line width 309 316 obufflen = (ibufflen / 16) * (6 + 3 * 16 + 1 + 16 + 1) + 80; 310 obuff = malloc(obufflen + 1);311 if (obuff) {317 obuff = xmalloc(obufflen + 1,pszSrcFile,__LINE__); 318 if (obuff) { 312 319 *obuff = 0; 313 320 if(!DosRead(handle, … … 450 457 } 451 458 bufflen = (CCHMAXPATHCOMP + 42) * nm; 452 buff = malloc(bufflen);453 if (buff) {459 buff = xmalloc(bufflen,pszSrcFile,__LINE__); 460 if (buff) { 454 461 p = buff; 455 462 *p = 0; … … 518 525 BOOL readonly = FALSE; 519 526 520 pgealist = malloc(sizeof(GEA2LIST) + 64); 521 if(pgealist) { 522 memset(pgealist,0,sizeof(GEA2LIST) + 64); 527 pgealist = xmallocz(sizeof(GEA2LIST) + 64,pszSrcFile,__LINE__); 528 if (pgealist) { 523 529 pgea = &pgealist->list[0]; 524 530 strcpy(pgea->szName,".COMMENTS"); … … 526 532 pgea->oNextEntryOffset = 0L; 527 533 pgealist->cbList = (sizeof(GEA2LIST) + pgea->cbName); 528 pfealist = malloc(65536); 529 if(pfealist) { 530 memset(pfealist,0,65536); 534 pfealist = xmallocz(65536,pszSrcFile,__LINE__); 535 if (pfealist) { 531 536 pfealist->cbList = 65536; 532 537 eaop.fpGEA2List = pgealist; … … 543 548 value[pfea->cbValue] = 0; 544 549 if(*(USHORT *)value == EAT_MVMT) { 545 buff = malloc(65536);546 if (buff) {550 buff = xmalloc(65536,pszSrcFile,__LINE__); 551 if (buff) { 547 552 p = buff; 548 553 *buff = 0; … … 619 624 620 625 621 VOID MakeAutoWin (VOID *args) {622 626 VOID MakeAutoWin (VOID *args) 627 { 623 628 HAB hab2; 624 629 HMQ hmq2; … … 669 674 670 675 671 MRESULT EXPENTRY AutoViewProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {672 676 MRESULT EXPENTRY AutoViewProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) 677 { 673 678 USHORT id = WinQueryWindowUShort(hwnd,QWS_ID); 674 679 … … 678 683 MRESULT mr; 679 684 680 if (!hwndAutoObj &&681 _beginthread(MakeAutoWin, 682 NULL,683 65536,684 (PVOID)hwnd) == -1)685 PostMsg(hwnd,686 UM_CLOSE,687 MPVOID, 688 MPVOID); 685 if (!hwndAutoObj) { 686 if (_beginthread(MakeAutoWin,NULL,65536,(PVOID)hwnd) == -1) { 687 Runtime_Error(pszSrcFile, __LINE__, GetPString(IDS_COULDNTSTARTTHREADTEXT)); 688 PostMsg(hwnd, 689 UM_CLOSE, 690 MPVOID, 691 MPVOID); 692 } 693 } 689 694 mr = PFNWPStatic(hwnd,msg,mp1,mp2); 690 695 SetPresParams(hwnd, … … 791 796 if(*currfile) { 792 797 if(MLEgetchanged(hwnd)) { 793 794 CHAR *ea = malloc(32768); 795 796 if(ea) { 798 CHAR *ea = xmalloc(32768,pszSrcFile,__LINE__); 799 if (ea) { 797 800 *ea = 0; 798 801 WinQueryWindowText(hwnd,32767,ea); … … 863 866 if(*currfile) { 864 867 865 CHAR *cf = strdup(currfile);866 867 if (cf) {868 CHAR *cf = xstrdup(currfile,pszSrcFile,__LINE__); 869 870 if (cf) { 868 871 stopflag++; 869 872 if(!PostMsg(hwndAutoObj, … … 1003 1006 return PFNWPStatic(hwnd,msg,mp1,mp2); 1004 1007 } 1005
Note:
See TracChangeset
for help on using the changeset viewer.