Changeset 907 for trunk/dll/worker.c


Ignore:
Timestamp:
Jan 6, 2008, 8:26:17 AM (18 years ago)
Author:
Steven Levine
Message:

Avoid out of memory traps in Compare Directories
Rework Compare Directories progress display for 2 second update rate
Start refactoring to reduce dependence on fm3dll.h
Add timer services (IsITimerExpired etc.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/worker.c

    r888 r907  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2001, 2007 Steven H. Levine
     9  Copyright (c) 2001, 2008 Steven H. Levine
    1010
    1111  16 Oct 02 SHL Comments
     
    2727***********************************************************************/
    2828
    29 #define INCL_DOS
    30 #define INCL_WIN
    31 #define INCL_DOSERRORS
    32 #define INCL_WPCLASS                    // WinQueryObjectPath
    33 #define INCL_LONGLONG
    34 #include <os2.h>
    35 
    36 #include <stdarg.h>
    37 #include <stdio.h>
    3829#include <stdlib.h>
    3930#include <string.h>
    4031#include <ctype.h>
    41 #include <stddef.h>
    4232#include <share.h>
    43 #include <time.h>
    4433#include <process.h>                    // _beginthread
    4534
    46 #include "fm3dll.h"
     35#define INCL_DOS
     36#define INCL_DOSERRORS
     37#define INCL_WINPROGRAMLIST
     38#define INCL_WINHELP
     39#define INCL_LONGLONG
     40#define INCL_WINPOINTERS
     41
    4742#include "fm3dlg.h"
    4843#include "fm3str.h"
     44#include "comp.h"                       // FCOMPARE
     45#include "pathutil.h"                   // BldQuotedFileName
     46#include "makelist.h"                   // AddToList
     47#include "errutil.h"                    // Dos_Error...
     48#include "strutil.h"                    // GetPString
     49#include "fm3dll.h"
    4950
    5051#pragma data_seg(DATA2)
    5152
    5253static PSZ pszSrcFile = __FILE__;
    53 
    5454
    5555#ifdef UNDO
     
    116116  HMQ hmq2;
    117117  CHAR **files = NULL;
    118   INT numfiles = 0, numalloc = 0, plen = 0;
     118  UINT numfiles = 0, numalloc = 0;
     119  INT plen = 0;
    119120  CHAR *p, *pp;
    120121  CHAR szQuotedDirName[CCHMAXPATH];
     
    462463                                   FM3ModHandle, FLE_FRAME, (PVOID) list)) {
    463464                      goto Abort;
    464                     }
     465                    }
    465466                  }
    466467                  else {
     
    857858                  else {
    858859                    runemf2(SEPARATE,
    859                             HWND_DESKTOP, pszSrcFile, __LINE__,
    860                             NULL, NULL,
     860                            HWND_DESKTOP, pszSrcFile, __LINE__,
     861                            NULL, NULL,
    861862                            "%s %s %s",
    862863                            dircompare,
     
    873874                  ExecOnList(wk->hwndFrame,
    874875                             compare,
    875                              WINDOWED | SEPARATEKEEP, NULL, fakelist, NULL,
    876                              pszSrcFile, __LINE__);
     876                             WINDOWED | SEPARATEKEEP, NULL, fakelist, NULL,
     877                             pszSrcFile, __LINE__);
    877878                }
    878879                else {
     
    972973  CHAR **files = NULL;
    973974  register CHAR *p, *pp;
    974   INT numfiles = 0, numalloc = 0;
     975  UINT numfiles = 0, numalloc = 0;
    975976
    976977  if (wk) {
     
    10191020                       "%a",
    10201021                       WINDOWED | SEPARATE | PROMPT,
    1021                        NULL, wk->li->list, GetPString(IDS_DOITYOURSELFTEXT),
    1022                        pszSrcFile, __LINE__);
     1022                       NULL, wk->li->list, GetPString(IDS_DOITYOURSELFTEXT),
     1023                       pszSrcFile, __LINE__);
    10231024            break;
    10241025
     
    10261027            {
    10271028              register INT x;
    1028               register ULONG total;
    1029               CHAR fbuf[CCHMAXPATH];
    1030 
    1031               if (DosSearchPath(SEARCH_IGNORENETERRS | SEARCH_ENVIRONMENT |
    1032                                 SEARCH_CUR_DIRECTORY,
    1033                                 "PATH", "FM2PLAY.EXE", fbuf, CCHMAXPATH - 1))
    1034                 total += strlen("..\\FM2UTILS\\FM2PLAY.EXE ");
    1035               else
    1036                 total = strlen(fbuf);
     1029              register ULONG total;
     1030              CHAR fbuf[CCHMAXPATH];
     1031
     1032              if (DosSearchPath(SEARCH_IGNORENETERRS | SEARCH_ENVIRONMENT |
     1033                                SEARCH_CUR_DIRECTORY,
     1034                                "PATH", "FM2PLAY.EXE", fbuf, CCHMAXPATH - 1))
     1035                total += strlen("..\\FM2UTILS\\FM2PLAY.EXE ");
     1036              else
     1037                total = strlen(fbuf);
    10371038              for (x = 0; wk->li->list[x]; x++)
    10381039                total += (strlen(wk->li->list[x]) + 1 +
     
    10481049                    fprintf(fp, "%s\n", wk->li->list[x]);
    10491050                  fprintf(fp, ";end\n");
    1050                   fclose(fp);
    1051                   RunFM2Util("FM2PLAY.EXE", "/#$FM2PLAY.$$$");
     1051                  fclose(fp);
     1052                  RunFM2Util("FM2PLAY.EXE", "/#$FM2PLAY.$$$");
    10521053                  break;
    10531054                }
     
    10611062                 wk->li->info->extract && *wk->li->targetpath)) {
    10621063
    1063               CHAR szBuffer[1025];
    1064               CHAR fbuf[CCHMAXPATH];
     1064              CHAR szBuffer[1025];
     1065              CHAR fbuf[CCHMAXPATH];
    10651066              register INT x;
    10661067
     
    10741075              }
    10751076              else {
    1076                 if (DosSearchPath(SEARCH_IGNORENETERRS | SEARCH_ENVIRONMENT |
    1077                                   SEARCH_CUR_DIRECTORY,
    1078                                   "PATH", "FM2PLAY.EXE", fbuf, CCHMAXPATH - 1))
     1077                if (DosSearchPath(SEARCH_IGNORENETERRS | SEARCH_ENVIRONMENT |
     1078                                  SEARCH_CUR_DIRECTORY,
     1079                                  "PATH", "FM2PLAY.EXE", fbuf, CCHMAXPATH - 1))
    10791080                  strcpy(szBuffer, "UTILS\\FM2PLAY.EXE");
    10801081                else
     
    12681269              ExecOnList((HWND) 0,
    12691270                         binview,
    1270                         WINDOWED | SEPARATE, NULL, wk->li->list, NULL,
    1271                         pszSrcFile, __LINE__);
     1271                        WINDOWED | SEPARATE, NULL, wk->li->list, NULL,
     1272                        pszSrcFile, __LINE__);
    12721273              break;
    12731274            }
     
    12791280                         WINDOWED | SEPARATE |
    12801281                         ((fViewChild) ? CHILD : 0),
    1281                         NULL, wk->li->list, NULL,
    1282                         pszSrcFile, __LINE__);
     1282                        NULL, wk->li->list, NULL,
     1283                        pszSrcFile, __LINE__);
    12831284            else {
    12841285
     
    13141315              ExecOnList((HWND) 0,
    13151316                         bined,
    1316                         WINDOWED | SEPARATE, NULL, wk->li->list, NULL,
    1317                         pszSrcFile, __LINE__);
     1317                        WINDOWED | SEPARATE, NULL, wk->li->list, NULL,
     1318                        pszSrcFile, __LINE__);
    13181319              break;
    13191320            }
     
    13241325              ExecOnList((HWND) 0,
    13251326                         editor,
    1326                         WINDOWED | SEPARATE, NULL, wk->li->list, NULL,
    1327                         pszSrcFile, __LINE__);
     1327                        WINDOWED | SEPARATE, NULL, wk->li->list, NULL,
     1328                        pszSrcFile, __LINE__);
    13281329            else {
    13291330
Note: See TracChangeset for help on using the changeset viewer.