Changeset 350 for trunk/dll/dirsize.c


Ignore:
Timestamp:
Jul 26, 2006, 9:01:20 PM (19 years ago)
Author:
root
Message:

Use Runtime_Error

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/dirsize.c

    r239 r350  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2001, 2005 Steven H. Levine
     9  Copyright (c) 2001, 2006 Steven H. Levine
    1010
    1111  16 Oct 02 SHL Handle large partitions
     
    2020  19 Jun 05 SHL More 64-bit math fixes
    2121  08 Aug 05 SHL Avoid Expand/Collapse hangs while working
     22  17 Jul 06 SHL Use Runtime_Error
    2223
    2324***********************************************************************/
     
    3738#include "fm3dlg.h"
    3839#include "fm3str.h"
    39 
    40 #pragma alloc_text(DIRSIZE,ProcessDir,FillCnrThread,DirSizeProc)
    41 #pragma alloc_text(DIRSIZE2,PrintToFile,FillInRecSizes,SortSizeCnr)
    4240
    4341typedef struct {
     
    5654} tState;
    5755
     56
     57static PSZ pszSrcFile = __FILE__;
     58
     59#pragma alloc_text(DIRSIZE,ProcessDir,FillCnrThread,DirSizeProc)
     60#pragma alloc_text(DIRSIZE2,PrintToFile,FillInRecSizes,SortSizeCnr)
    5861
    5962static SHORT APIENTRY SortSizeCnr (PMINIRECORDCORE p1,PMINIRECORDCORE p2,
     
    9295  *pullTotalBytes = 0;          // In case we fail
    9396
    94   pFFB = malloc(sizeof(FILEFINDBUF4) /* * FilesToGet */);
     97  pFFB = xmalloc(sizeof(FILEFINDBUF4),pszSrcFile,__LINE__);
    9598  if(!pFFB)
    9699    return FALSE;
     
    150153              rc,
    151154              HWND_DESKTOP,
    152               __FILE__,
     155              pszSrcFile,
    153156              __LINE__,
    154157              GetPString(IDS_CANTFINDDIRTEXT),
     
    445448        break;
    446449      }
    447       pState = malloc(sizeof(tState));
     450      pState = xmallocz(sizeof(tState),pszSrcFile,__LINE__);
    448451      if(!pState) {
    449452        WinDismissDlg(hwnd,0);
    450453        break;
    451454      }
    452       memset(pState,0,sizeof(tState));
    453455      strcpy(pState->szDirName,(CHAR *)mp2);
    454456      WinSetWindowPtr(hwnd,0,(PVOID)pState);
     
    466468        DIRSIZE *dirsize;
    467469
    468         dirsize = malloc(sizeof(DIRSIZE));
     470        dirsize = xmalloc(sizeof(DIRSIZE),pszSrcFile,__LINE__);
    469471        if(!dirsize) {
    470472          WinDismissDlg(hwnd,0);
     
    475477        dirsize->hwndCnr = WinWindowFromID(hwnd,DSZ_CNR);
    476478        if(_beginthread(FillCnrThread,NULL,122880L * 5L,(PVOID)dirsize) == -1) {
     479          Runtime_Error(pszSrcFile, __LINE__, GetPString(IDS_COULDNTSTARTTHREADTEXT));
    477480          free(dirsize);
    478481          WinDismissDlg(hwnd,0);
     
    573576      WinSendDlgItemMsg(hwnd,DSZ_CNR,CM_SORTRECORD,MPFROMP(SortSizeCnr),
    574577                        MPVOID);
    575       DosBeep(500,25);
     578      DosBeep(500,25);                  // Wake up user
    576579      return 0;
    577580
     
    853856          // Save button
    854857          pState = INSTDATA(hwnd);
    855           if (pState) {
     858          if (!pState)
     859            Runtime_Error(pszSrcFile, __LINE__, "no data");
     860          else {
    856861
    857862            CHAR  pszFileName[CCHMAXPATH];
     
    867872                strcat(pszFileName,".RPT");
    868873              fp = fopen(pszFileName,"a+");
    869               if (fp) {
     874              if (!fp) {
     875                saymsg(MB_CANCEL,
     876                       hwnd,
     877                       GetPString(IDS_ERRORTEXT),
     878                       GetPString(IDS_COMPCANTOPENTEXT),
     879                       pszFileName);
     880              }
     881              else {
    870882                WinSetPointer(HWND_DESKTOP,hptrBusy);
    871883                PrintToFile(WinWindowFromID(hwnd,DSZ_CNR),0,NULL,fp);
     
    873885                WinSetPointer(HWND_DESKTOP,hptrArrow);
    874886              }
    875               else
    876                 saymsg(MB_CANCEL,
    877                        hwnd,
    878                        GetPString(IDS_ERRORTEXT),
    879                        GetPString(IDS_COMPCANTOPENTEXT),
    880                        pszFileName);
    881887            }
    882888          }
    883           else
    884             DosBeep(50,100);
    885889          break;
    886890
     
    917921        case DID_CANCEL:
    918922          pState = INSTDATA(hwnd);
    919           if (pState) {
     923          if (!pState)
     924            Runtime_Error(pszSrcFile, __LINE__, "no data");
     925          else {
    920926            if (pState->working) {
    921927              pState->dying = TRUE;
    922928              pState->chStopFlag = 0xff;
    923               DosBeep(1000,100);
     929              DosBeep(1000,100);                        // Complain?
    924930            }
    925931            else
Note: See TracChangeset for help on using the changeset viewer.