Changeset 985


Ignore:
Timestamp:
Mar 1, 2008, 2:37:14 AM (17 years ago)
Author:
Gregg Young
Message:

Update sizes dialog (ticket 44); Make max command line length user settable (ticket 199); use xfree for free in most cases (ticket 212); initial code to check for valid ini file (ticket 102); Some additional refactoring and structure rework; Some documentation updates;

Location:
trunk
Files:
61 edited

Legend:

Unmodified
Added
Removed
  • trunk/HISTORY

    r961 r985  
    3737 o Restore SaveDirCnrState internal state save logic - accidentally removed
    3838 o Move save shutdown state name to strings (IDS_SHUTDOWNSTATE, ShutdownState)
     39 o Add unhide menu option (Gregg)
     40 o Enable user settable command line length (Gregg)
     41 o Add presparams & update appearence of "Sizes" dialog (Gregg)
    3942
    40433.09
  • trunk/dll/arccnrs.c

    r959 r985  
    5252  10 Feb 08 GKY Implement bubble help for bitmap menu items
    5353  15 Feb 08 SHL Sync with settings menu rework
     54  29 Feb 08 GKY Use xfree where appropriate
    5455
    5556***********************************************************************/
     
    14371438        if (!dcd->info->extract) {
    14381439          Runtime_Error(pszSrcFile, __LINE__, "no extract");
    1439           free(s);
     1440          xfree(s);
    14401441          return 0;
    14411442        }
     
    14671468        }
    14681469        // printf("%s %d UM_ENTER %s %s\n",__FILE__, __LINE__,filename, s); fflush(stdout);     // 10 Mar 07 SHL hang
    1469         free(s);
     1470        xfree(s);
    14701471        if (IsFile(filename) == 1) {
    14711472#if 1 // 06 Oct 07 SHL fixme to be gone - set to 0 for ticket #58 testing
     
    17461747                  strcat(p, temp);
    17471748                  li->list[x] = p;
    1748                   free(temp);
     1749                  xfree(temp);
    17491750                }
    17501751              }
     
    19931994      FreeList(dcd->lastselection);
    19941995      WinSendMsg(dcd->hwndCnr, UM_CLOSE, MPVOID, MPVOID);
    1995       free(dcd);
     1996      xfree(dcd);
    19961997      WinSetWindowPtr(dcd->hwndCnr, QWL_USER, NULL);
    19971998    }
     
    25402541      ret = StartMLEEditor(dcd->hwndParent,
    25412542                           (INT) mp1, (CHAR *) mp2, dcd->hwndFrame);
    2542       free((CHAR *) mp2);
     2543      xfree((CHAR *) mp2);
    25432544      return MRFROMLONG(ret);
    25442545    }
     
    29072908                BldFullPathName(s, dcd->workdir, li->list[x]);
    29082909                if (IsFile(s) != 1) {
    2909                   free(li->list[x]);
     2910                  xfree(li->list[x]);
    29102911                  li->list[x] = NULL;
    29112912                  for (y = x; li->list[y]; y++)
     
    29192920                  p = xstrdup(s, pszSrcFile, __LINE__);
    29202921                  if (p) {
    2921                     free(li->list[x]);
     2922                    xfree(li->list[x]);
    29222923                    li->list[x] = p;
    29232924                  }
     
    29672968            }
    29682969            else
    2969               free(li);
     2970              xfree(li);
    29702971          }
    29712972        }
     
    32283229              if (!PostMsg(dcd->hwndObject, UM_ENTER, MPFROMP(s), MPVOID)) {
    32293230                Runtime_Error(pszSrcFile, __LINE__, "post");
    3230                 free(s);
     3231                xfree(s);
    32313232              }
    32323233            }
     
    35213522                     IDS_WINCREATEWINDOW);
    35223523          PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID);
    3523           free(dcd);
     3524          xfree(dcd);
    35243525          hwndFrame = (HWND) 0;
    35253526        }
  • trunk/dll/assoc.c

    r959 r985  
    1616  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
    1717  06 Jan 08 GKY Use NormalizeCmdLine to check program strings on entry
     18  29 Feb 08 GKY Changes to enable user settable command line length
     19  29 Feb 08 GKY Use xfree where appropriate
    1820
    1921**************************************************************************************/
     
    4042typedef struct
    4143{
    42   CHAR mask[CCHMAXPATH];
    43   CHAR cl[MAXCOMLINESTRG];
    44   CHAR sig[CCHMAXPATH];
    4544  LONG offset;
    4645  ULONG flags;
     46  PSZ pszCmdLine;
     47  CHAR mask[CCHMAXPATH];
     48  CHAR sig[CCHMAXPATH];
    4749}
    4850ASSOC;
     
    5153{
    5254  CHAR *mask;
    53   CHAR *cl;
     55  PSZ pszCmdLine;
    5456  CHAR *sig;
    5557  LONG offset;
     
    118120    next = info->next;
    119121    xfree(info->mask);
    120     xfree(info->cl);
     122    xfree(info->pszCmdLine);
    121123    xfree(info->sig);
    122124    xfree(info);
     
    130132  FILE *fp;
    131133  LINKASSOC *info;
    132   CHAR cl[1024];
     134  PSZ pszCmdLine;
    133135  CHAR mask[CCHMAXPATH + 24];
    134136  CHAR sig[CCHMAXPATH + 24];
     
    144146  strcat(mask, "ASSOC.DAT");
    145147  fp = _fsopen(mask, "r", SH_DENYWR);
     148  pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
     149  if (!pszCmdLine) {
     150    if (fp)
     151      fclose(fp); //already complained
     152  }
    146153  if (fp) {
    147154    while (!feof(fp)) {
     
    152159      if (!*mask || *mask == ';')
    153160        continue;
    154       if (!xfgets(cl, sizeof(cl), fp, pszSrcFile, __LINE__) ||
     161      if (!xfgets(pszCmdLine, MaxComLineStrg, fp, pszSrcFile, __LINE__) ||
    155162          !xfgets(sig, CCHMAXPATH + 24, fp, pszSrcFile, __LINE__) ||
    156163          !xfgets(offset, sizeof(offset), fp, pszSrcFile, __LINE__) ||
    157164          !xfgets(flags, sizeof(flags), fp, pszSrcFile, __LINE__))
    158165        break;                          /* error! */
    159       cl[1000] = 0;
    160       bstripcr(cl);
     166      pszCmdLine[MaxComLineStrg - 1] = 0;
     167      bstripcr(pszCmdLine);
    161168      sig[CCHMAXPATH] = 0;
    162169      bstripcr(sig);
     
    165172      flags[34] = 0;
    166173      bstripcr(flags);
    167       if (!*cl)
     174      if (!*pszCmdLine)
    168175        continue;
    169176      info = xmallocz(sizeof(LINKASSOC), pszSrcFile, __LINE__);
    170177      if (info) {
    171         info->cl = xstrdup(cl, pszSrcFile, __LINE__);
     178        info->pszCmdLine = xstrdup(pszCmdLine, pszSrcFile, __LINE__);
    172179        info->mask = xstrdup(mask, pszSrcFile, __LINE__);
    173180        if (*sig)
     
    175182        info->offset = atol(offset);
    176183        info->flags = atol(flags);
    177         if (!info->cl || !info->mask) {
    178           xfree(info->cl);
     184        if (!info->pszCmdLine || !info->mask) {
     185          xfree(info->pszCmdLine);
    179186          xfree(info->mask);
    180187          xfree(info);
     
    191198    }
    192199    fclose(fp);
     200  }
     201}
     202
     203VOID display_associations(HWND hwnd, ASSOC *temp, LINKASSOC *info)
     204{
     205  CHAR szEnviroment[2048];
     206  PSZ pszDisplayStr;
     207  SHORT x;
     208
     209  *szEnviroment = 0;
     210  WinQueryDlgItemText(hwnd, ASS_ENVIRON, 2048, szEnviroment);
     211  bstripcr(szEnviroment);
     212  if (*szEnviroment)
     213    PrfWriteProfileString(fmprof, FM3Str, temp->pszCmdLine, szEnviroment);
     214  pszDisplayStr = xmallocz((CCHMAXPATH * 2) + MaxComLineStrg + 6,
     215                           pszSrcFile, __LINE__);
     216  if (pszDisplayStr) {
     217    sprintf(pszDisplayStr, "%-12s \x1a %-24s %s%s%s", temp->mask,
     218            temp->pszCmdLine, (*temp->sig) ?
     219            "[" : NullStr, (*temp->sig) ? temp->sig : NullStr,
     220            (*temp->sig) ? "]" : NullStr);
     221    x = (SHORT) WinSendDlgItemMsg(hwnd,
     222                                  ASS_LISTBOX,
     223                                  LM_INSERTITEM,
     224                                  MPFROM2SHORT(LIT_END, 0), MPFROMP(pszDisplayStr));
     225    if (x >= 0) {
     226      WinSendDlgItemMsg(hwnd,
     227                        ASS_LISTBOX,
     228                        LM_SETITEMHANDLE,
     229                        MPFROMSHORT(x), MPFROMP(info));
     230      WinSendDlgItemMsg(hwnd,
     231                        ASS_LISTBOX,
     232                        LM_SELECTITEM,
     233                        MPFROMSHORT(x), MPFROMSHORT(TRUE));
     234    }
     235    xfree(pszDisplayStr);
    193236  }
    194237}
     
    232275    while (info) {
    233276      fprintf(fp,
    234               ";\n%0.*s\n%0.1000s\n%0.*s\n%lu\n%lu\n",
     277              ";\n%0.*s\n%0.4096s\n%0.*s\n%lu\n%lu\n",
    235278              CCHMAXPATH,
    236279              info->mask,
    237               info->cl,
     280              info->pszCmdLine,
    238281              CCHMAXPATH,
    239282              (info->sig) ? info->sig : NullStr, info->offset, info->flags);
     
    248291  LINKASSOC *info;
    249292
    250   if (addme && *addme->cl && *addme->mask) {
     293  if (addme && *addme->pszCmdLine && *addme->mask) {
    251294    info = asshead;
    252295    while (info) {
     
    260303      info = xmallocz(sizeof(LINKASSOC), pszSrcFile, __LINE__);
    261304      if (info) {
    262         info->cl = xstrdup(addme->cl, pszSrcFile, __LINE__);
     305        info->pszCmdLine = xstrdup(addme->pszCmdLine, pszSrcFile, __LINE__);
    263306        info->mask = xstrdup(addme->mask, pszSrcFile, __LINE__);
    264307        if (*addme->sig)
     
    268311        if (addme->flags)
    269312          info->flags = addme->flags;
    270         if (!info->cl || !info->mask) {
    271           xfree(info->cl);
     313        if (!info->pszCmdLine || !info->mask) {
     314          xfree(info->pszCmdLine);
    272315          xfree(info->mask);
    273316          xfree(info);
     
    315358            asstail = info->prev;
    316359        }
    317         xfree(info->cl);
     360        xfree(info->pszCmdLine);
    318361        xfree(info->mask);
    319362        xfree(info->sig);
     
    392435
    393436        if (fAmAV2) {
    394           if (stristr(info->cl, "AV2.EXE") ||
    395               stristr(info->cl, "AV2.CMD") || stristr(info->cl, "<>"))
     437          if (stristr(info->pszCmdLine, "AV2.EXE") ||
     438              stristr(info->pszCmdLine, "AV2.CMD") || stristr(info->pszCmdLine, "<>"))
    396439            return -1;
    397440        }
    398         if (!strcmp(info->cl, "<>")) {
     441        if (!strcmp(info->pszCmdLine, "<>")) {
    399442          OpenObject(datafile, Default, hwnd);
    400443          return 0;
     
    414457        flags &= (~DIEAFTER);
    415458        rc = ExecOnList(hwnd,
    416                         info->cl,
     459                        info->pszCmdLine,
    417460                        flags,
    418461                        NULL, list, GetPString(IDS_EXECASSOCTITLETEXT),
     
    467510  case UM_UNDO:
    468511    {
    469       CHAR s[1002 + CCHMAXPATH + 6];
     512      CHAR s[4096];
    470513
    471514      WinSendDlgItemMsg(hwnd, ASS_LISTBOX, LM_DELETEALL, MPVOID, MPVOID);
     
    475518                "%-12s \x1a %-24s %s%s%s",
    476519                info->mask,
    477                 info->cl,
     520                info->pszCmdLine,
    478521                (info->sig && *info->sig) ?
    479522                "[" : NullStr,
     
    518561          }
    519562          WinSetDlgItemText(hwnd, ASS_MASK, info->mask);
    520           WinSetDlgItemText(hwnd, ASS_CL, info->cl);
     563          WinSetDlgItemText(hwnd, ASS_CL, info->pszCmdLine);
    521564          WinSetDlgItemText(hwnd, ASS_SIG,
    522565                            (info->sig && *info->sig) ? info->sig : NullStr);
     
    545588            size = sizeof(env) - 1;
    546589            if (PrfQueryProfileData(fmprof,
    547                                     FM3Str, info->cl, env, &size) && *env)
     590                                    FM3Str, info->pszCmdLine, env, &size) && *env)
    548591              WinSetDlgItemText(hwnd, ASS_ENVIRON, env);
    549592            else
     
    629672        replace = FALSE;
    630673
     674        memset(&temp, 0, sizeof(ASSOC));
     675        temp.pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
     676        if (!temp.pszCmdLine)
     677          break; //already complained
     678
    631679        {
    632680          x = (SHORT) WinSendDlgItemMsg(hwnd,
     
    639687                                          MPFROMSHORT(0), MPFROMSHORT(TRUE));
    640688        }
    641         pszWorkBuf = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__);
    642         if (!pszWorkBuf)
     689        pszWorkBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__);
     690        if (!pszWorkBuf) {
     691          xfree(temp.pszCmdLine);
    643692          break; //already complained
    644         memset(&temp, 0, sizeof(ASSOC));
     693        }
    645694        WinQueryDlgItemText(hwnd, ASS_MASK, sizeof(temp.mask), temp.mask);
    646         WinQueryDlgItemText(hwnd, ASS_CL, sizeof(temp.cl), temp.cl);
    647         NormalizeCmdLine(pszWorkBuf, temp.cl);
    648         memcpy(temp.cl, pszWorkBuf, strlen(pszWorkBuf) + 1);
     695        WinQueryDlgItemText(hwnd, ASS_CL, MaxComLineStrg, temp.pszCmdLine);
     696        if (strcmp(temp.pszCmdLine, "<>")) {
     697          NormalizeCmdLine(pszWorkBuf, temp.pszCmdLine);
     698          memcpy(temp.pszCmdLine, pszWorkBuf, strlen(pszWorkBuf) + 1);
     699        }
    649700        xfree(pszWorkBuf);
    650701        WinQueryDlgItemText(hwnd, ASS_SIG, sizeof(temp.sig), temp.sig);
     
    655706        }
    656707        bstrip(temp.mask);
    657         bstrip(temp.cl);
     708        bstrip(temp.pszCmdLine);
    658709        if (WinQueryButtonCheckstate(hwnd, ASS_DEFAULT))
    659710          temp.flags = 0;
     
    674725        if (fCancelAction){
    675726          fCancelAction = FALSE;
     727          xfree(temp.pszCmdLine);
    676728          break;
    677729        }
     
    680732        if (!info)
    681733          WinDismissDlg(hwnd, 1);       /* Runtime_Error(pszSrcFile, __LINE__, "add_association"); */
    682         else {
    683 
    684           CHAR s[1002 + CCHMAXPATH + 6];
    685 
    686           *s = 0;
    687           WinQueryDlgItemText(hwnd, ASS_ENVIRON, 1000, s);
    688           bstripcr(s);
    689           if (*s)
    690             PrfWriteProfileString(fmprof, FM3Str, temp.cl, s);
    691           sprintf(s, "%-12s \x1a %-24s %s%s%s", temp.mask,
    692                   temp.cl, (*temp.sig) ?
    693                   "[" : NullStr, (*temp.sig) ? temp.sig : NullStr,
    694                   (*temp.sig) ? "]" : NullStr);
    695           x = (SHORT) WinSendDlgItemMsg(hwnd,
    696                                         ASS_LISTBOX,
    697                                         LM_INSERTITEM,
    698                                         MPFROM2SHORT(LIT_END, 0), MPFROMP(s));
    699           if (x >= 0) {
    700             WinSendDlgItemMsg(hwnd,
    701                               ASS_LISTBOX,
    702                               LM_SETITEMHANDLE,
    703                               MPFROMSHORT(x), MPFROMP(info));
    704             WinSendDlgItemMsg(hwnd,
    705                               ASS_LISTBOX,
    706                               LM_SELECTITEM,
    707                               MPFROMSHORT(x), MPFROMSHORT(TRUE));
    708           }
     734        else {
     735          display_associations(hwnd, &temp, info);
    709736          save_associations();
    710         }
     737        }
     738        xfree(temp.pszCmdLine);
    711739      }
    712740      WinDismissDlg(hwnd, 1);
     
    728756        CHAR dummy[34];
    729757        PSZ pszWorkBuf;
    730         replace = FALSE;
    731 
    732         pszWorkBuf = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__);
    733         if (!pszWorkBuf)
     758        replace = FALSE;
     759
     760        memset(&temp, 0, sizeof(ASSOC));
     761        temp.pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
     762        if (!temp.pszCmdLine)
    734763          break; //already complained
    735         memset(&temp, 0, sizeof(ASSOC));
    736         WinQueryDlgItemText(hwnd, ASS_MASK, sizeof(temp.mask), temp.mask);
    737         WinQueryDlgItemText(hwnd, ASS_CL, sizeof(temp.cl), temp.cl);
    738         NormalizeCmdLine(pszWorkBuf, temp.cl);
    739         memcpy(temp.cl, pszWorkBuf, strlen(pszWorkBuf) + 1);
     764        pszWorkBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__);
     765        if (!pszWorkBuf) {
     766          xfree(temp.pszCmdLine);
     767          break; //already complained
     768        }
     769        WinQueryDlgItemText(hwnd, ASS_MASK, sizeof(temp.mask), temp.mask);
     770        WinQueryDlgItemText(hwnd, ASS_CL, MaxComLineStrg, temp.pszCmdLine);
     771        if (strcmp(temp.pszCmdLine, "<>")) {
     772          NormalizeCmdLine(pszWorkBuf, temp.pszCmdLine);
     773          memcpy(temp.pszCmdLine, pszWorkBuf, strlen(pszWorkBuf) + 1);
     774        }
    740775        xfree(pszWorkBuf);
    741776        WinQueryDlgItemText(hwnd, ASS_SIG, sizeof(temp.sig), temp.sig);
     
    746781        }
    747782        bstrip(temp.mask);
    748         bstrip(temp.cl);
     783        bstrip(temp.pszCmdLine);
    749784        if (WinQueryButtonCheckstate(hwnd, ASS_DEFAULT))
    750785          temp.flags = 0;
     
    765800        if (fCancelAction){
    766801          fCancelAction = FALSE;
     802          xfree(temp.pszCmdLine);
    767803          break;
    768804        }
     
    771807        //Add will fail if mask is not changed
    772808        if (info) {
    773 
    774           CHAR s[1002 + CCHMAXPATH + 6];
    775 
    776           *s = 0;
    777           WinQueryDlgItemText(hwnd, ASS_ENVIRON, 1000, s);
    778           bstripcr(s);
    779           if (*s)
    780             PrfWriteProfileString(fmprof, FM3Str, temp.cl, s);
    781           sprintf(s, "%-12s \x1a %-24s %s%s%s", temp.mask,
    782                   temp.cl, (*temp.sig) ?
    783                   "[" : NullStr, (*temp.sig) ? temp.sig : NullStr,
    784                   (*temp.sig) ? "]" : NullStr);
    785           x = (SHORT) WinSendDlgItemMsg(hwnd,
    786                                         ASS_LISTBOX,
    787                                         LM_INSERTITEM,
    788                                         MPFROM2SHORT(LIT_END, 0), MPFROMP(s));
    789           if (x >= 0) {
    790             WinSendDlgItemMsg(hwnd,
    791                               ASS_LISTBOX,
    792                               LM_SETITEMHANDLE,
    793                               MPFROMSHORT(x), MPFROMP(info));
    794             WinSendDlgItemMsg(hwnd,
    795                               ASS_LISTBOX,
    796                               LM_SELECTITEM,
    797                               MPFROMSHORT(x), MPFROMSHORT(TRUE));
    798           }
     809          display_associations(hwnd, &temp, info);
    799810          save_associations();
    800811        }
     812        xfree(temp.pszCmdLine);
    801813      }
    802814      break;
     
    805817      {
    806818        ASSOC temp;
    807         CHAR dummy[34];
    808 
    809         memset(&temp, 0, sizeof(ASSOC));
     819        CHAR dummy[34];
     820
     821        memset(&temp, 0, sizeof(ASSOC));
     822        temp.pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
     823        if (!temp.pszCmdLine)
     824          break; //already complained
    810825        WinQueryDlgItemText(hwnd, ASS_MASK, sizeof(temp.mask), temp.mask);
    811826        WinQueryDlgItemText(hwnd, ASS_SIG, sizeof(temp.sig), temp.sig);
     
    817832        bstrip(temp.mask);
    818833        PrfWriteProfileData(fmprof, FM3Str, temp.mask, NULL, 0L);
    819         if (kill_association(&temp))
    820          /* Runtime_Error(pszSrcFile, __LINE__, "kill_association");
    821         else */{
     834        if (kill_association(&temp)) {
    822835          x = (SHORT) WinSendDlgItemMsg(hwnd,
    823836                                        ASS_LISTBOX,
     
    832845          }
    833846          save_associations();
    834         }
    835       }
     847        }
     848        xfree(temp.pszCmdLine);
     849      }
     850
    836851      break;
    837852    case ASS_REPLACE:
     
    841856        CHAR dummy[34];
    842857        PSZ pszWorkBuf;
    843         replace = TRUE;
    844 
     858        replace = TRUE;
     859
     860        memset(&temp, 0, sizeof(ASSOC));
     861        temp.pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
     862        if (!temp.pszCmdLine)
     863          break; //already complained
    845864        y = (SHORT) WinSendDlgItemMsg(hwnd,
    846865                                      ASS_LISTBOX,
    847866                                      LM_QUERYSELECTION,
    848867                                      MPFROMSHORT(LIT_CURSOR), MPVOID);
    849         pszWorkBuf = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__);
    850         if (!pszWorkBuf)
     868        pszWorkBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__);
     869        if (!pszWorkBuf) {
     870          xfree(temp.pszCmdLine);
    851871          break; //already complained
    852         memset(&temp, 0, sizeof(ASSOC));
     872        }
    853873        WinQueryDlgItemText(hwnd, ASS_MASK, sizeof(temp.mask), temp.mask);
    854         WinQueryDlgItemText(hwnd, ASS_CL, sizeof(temp.cl), temp.cl);
    855         NormalizeCmdLine(pszWorkBuf, temp.cl);
    856         memcpy(temp.cl, pszWorkBuf, strlen(pszWorkBuf) + 1);
     874        WinQueryDlgItemText(hwnd, ASS_CL, MaxComLineStrg, temp.pszCmdLine);
     875        if (strcmp(temp.pszCmdLine, "<>")) {
     876          NormalizeCmdLine(pszWorkBuf, temp.pszCmdLine);
     877          memcpy(temp.pszCmdLine, pszWorkBuf, strlen(pszWorkBuf) + 1);
     878        }
    857879        xfree(pszWorkBuf);
    858880        WinQueryDlgItemText(hwnd, ASS_SIG, sizeof(temp.sig), temp.sig);
     
    863885        }
    864886        bstrip(temp.mask);
    865         bstrip(temp.cl);
     887        bstrip(temp.pszCmdLine);
    866888        if (WinQueryButtonCheckstate(hwnd, ASS_DEFAULT))
    867889          temp.flags = 0;
     
    882904        if (fCancelAction){
    883905          fCancelAction = FALSE;
     906          xfree(temp.pszCmdLine);
    884907          break;
    885908        }
    886909        else
    887910          info = add_association(&temp);
    888         //Add will fail if mask is not changed
    889911        if (info) {
    890 
    891           CHAR s[1002 + CCHMAXPATH + 6];
    892 
    893           *s = 0;
    894           WinQueryDlgItemText(hwnd, ASS_ENVIRON, 1000, s);
    895           bstripcr(s);
    896           if (*s)
    897             PrfWriteProfileString(fmprof, FM3Str, temp.cl, s);
    898           sprintf(s, "%-12s \x1a %-24s %s%s%s", temp.mask,
    899                   temp.cl, (*temp.sig) ?
    900                   "[" : NullStr, (*temp.sig) ? temp.sig : NullStr,
    901                   (*temp.sig) ? "]" : NullStr);
    902           x = (SHORT) WinSendDlgItemMsg(hwnd,
    903                                         ASS_LISTBOX,
    904                                         LM_INSERTITEM,
    905                                         MPFROM2SHORT(LIT_END, 0), MPFROMP(s));
    906           if (x >= 0) {
    907             WinSendDlgItemMsg(hwnd,
    908                               ASS_LISTBOX,
    909                               LM_SETITEMHANDLE,
    910                               MPFROMSHORT(x), MPFROMP(info));
    911             WinSendDlgItemMsg(hwnd,
    912                               ASS_LISTBOX,
    913                               LM_SELECTITEM,
    914                               MPFROMSHORT(x), MPFROMSHORT(TRUE));
    915           }
     912          display_associations(hwnd, &temp, info);
    916913          save_associations();
    917         }
     914        }
     915        xfree(temp.pszCmdLine);
    918916      }
    919917      {
    920918        ASSOC temp;
    921         CHAR dummy[34];
    922 
     919        CHAR dummy[34];
     920
     921        temp.pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
     922        if (!temp.pszCmdLine)
     923          break; //already complained
    923924        WinSendDlgItemMsg(hwnd,
    924925                          ASS_LISTBOX,
    925926                          LM_SELECTITEM, MPFROMSHORT(y), MPFROMSHORT(TRUE));
    926         memset(&temp, 0, sizeof(ASSOC));
     927        memset(temp.sig, 0, sizeof(temp.sig));
     928        memset(temp.mask, 0, sizeof(temp.mask));
     929        temp.offset = 0;
    927930        WinQueryDlgItemText(hwnd, ASS_MASK, sizeof(temp.mask), temp.mask);
    928931        WinQueryDlgItemText(hwnd, ASS_SIG, sizeof(temp.sig), temp.sig);
     
    946949          }
    947950          save_associations();
    948         }
     951        }
     952        xfree(temp.pszCmdLine);
    949953      }
    950954      break;
     
    968972}
    969973
    970 #pragma alloc_text(ASSOC2,free_commands,load_associations,save_associations)
     974#pragma alloc_text(ASSOC2,free_commands,load_associations,save_associations,display_associations)
    971975#pragma alloc_text(ASSOC2,ExecAssociation,AssocTextProc)
    972976#pragma alloc_text(ASSOC,add_association,kill_association,AssocDlgProc,EditAssociations)
  • trunk/dll/autoview.c

    r959 r985  
    2323  22 Nov 07 GKY Use CopyPresParams to fix presparam inconsistencies in menus
    2424  30 Dec 07 GKY Use CommaFmtULL
     25  29 Feb 08 GKY Use xfree where appropriate
    2526
    2627***********************************************************************/
     
    412413                      WinSetWindowText(hwndAutoview, obuff);
    413414                  }
    414                   free(obuff);
     415                  xfree(obuff);
    415416                }
    416                 free(ibuff);
     417                xfree(ibuff);
    417418              }
    418419              DosClose(handle);
     
    507508                if (*pszBuf)
    508509                  WinSetWindowText(hwndAutoview, pszBuf);
    509                 free(pszBuf);
     510                xfree(pszBuf);
    510511              }
    511512            }
     
    541542              rc = DosQueryPathInfo((CHAR *) mp1, FIL_QUERYEASFROMLIST,
    542543                                    (PVOID) & eaop, (ULONG) sizeof(EAOP2));
    543               free(pgealist);
     544              xfree(pgealist);
    544545              if (!rc) {
    545546                pfea = &eaop.fpFEA2List->list[0];
     
    591592                      }
    592593                      WinSetWindowText(hwndAutoMLE, pszBuf);
    593                       free(pszBuf);
     594                      xfree(pszBuf);
    594595                    }
    595596                  }
     
    605606                MLEsetreadonly(hwndAutoMLE, FALSE);
    606607              }
    607               free(pfealist);
     608              xfree(pfealist);
    608609            }
    609610          }
    610611        }
    611612      }
    612       free((CHAR *) mp1);
     613      xfree((CHAR *) mp1);
    613614    }
    614615    return 0;
     
    786787              PutComments(hwnd, currfile, ea);
    787788              PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_RESCAN, 0), MPVOID);
    788               free(ea);
     789              xfree(ea);
    789790            }
    790791          }
     
    836837          stopflag++;
    837838          if (!PostMsg(hwndAutoObj, UM_LOADFILE, MPFROMP(cf), MPVOID))
    838             free(cf);
     839            xfree(cf);
    839840        }
    840841      }
  • trunk/dll/avl.c

    r907 r985  
    3030  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
    3131  25 Aug 07 SHL load_archivers: add missing close on error path
     32  29 Feb 08 GKY Use xfree where appropriate
    3233
    3334***********************************************************************/
     
    236237    xfree(pat->createwdirs);
    237238    xfree(pat->movewdirs);
    238     free(pat);
     239    xfree(pat);
    239240  }
    240241}
     
    822823                         ArcReviewDlgProc,
    823824                         FM3ModHandle, AD_FRAME, MPFROMP(&ad))) {
    824             free(ad.info);
     825            xfree(ad.info);
    825826          }
    826827          else {
  • trunk/dll/avv.c

    r959 r985  
    2424  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
    2525  06 Jan 08 GKY Use NormalizeCmdLine to check program strings on entry
     26  29 Feb 08 GKY Changes to enable user settable command line length
    2627
    2728***********************************************************************/
     
    9394static PSZ free_and_strdup_quoted_from_window(HWND hwnd, USHORT id, PSZ pszDest)
    9495{ // fixme for command line limit
    95   CHAR szCmdLine[MAXCOMLINESTRG];
    96 
     96  CHAR *szCmdLine;
     97
     98  szCmdLine = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__);
     99        if (!szCmdLine)
     100          return NULL; //already complained
    97101  xfree(pszDest);
    98102  WinQueryDlgItemText(hwnd, id, sizeof(szCmdLine), szCmdLine);
    99103  if (*szCmdLine){
    100104    PSZ pszWorkBuf;
    101     pszWorkBuf = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__);
     105    pszWorkBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__);
    102106    if (pszWorkBuf) {
    103107      NormalizeCmdLine(pszWorkBuf, szCmdLine);
     
    110114  else
    111115    pszDest = NULL;
     116  xfree(szCmdLine);
    112117  return pszDest;
    113118}
  • trunk/dll/cmdline.c

    r907 r985  
    1616  16 Jun 07 SHL Update for OpenWatcom
    1717  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
     18  29 Feb 08 GKY Use xfree where appropriate
    1819
    1920***********************************************************************/
     
    7879          info->cl = xstrdup(s, pszSrcFile, __LINE__);
    7980          if (!info->cl)
    80             free(info);
     81            xfree(info);
    8182          else {
    8283            info->next = NULL;
     
    155156    info->cl = xstrdup(cl, pszSrcFile, __LINE__);
    156157    if (!info->cl)
    157       free(info);
     158      xfree(info);
    158159    else {
    159160      info->next = NULL;
     
    165166        info = clhead;
    166167        clhead = clhead->next;
    167         free(info);
     168        xfree(info);
    168169      }
    169170      if (big)
     
    193194      else
    194195        clhead = info->next;
    195       free(info->cl);
    196       free(info);
     196      xfree(info->cl);
     197      xfree(info);
    197198      if (big)
    198199        clbig = clhead;
     
    215216  while (info) {
    216217    next = info->next;
    217     free(info->cl);
    218     free(info);
     218    xfree(info->cl);
     219    xfree(info);
    219220    info = next;
    220221  }
  • trunk/dll/collect.c

    r958 r985  
    4747  15 Feb 08 GKY Fix attempt to free container items that were never inserted
    4848  15 Feb 08 GKY Fix "collect" so it updates recollected files and unhides them if needed
     49  29 Feb 08 GKY Use xfree where appropriate
    4950
    5051***********************************************************************/
     
    898899            Runtime_Error(pszSrcFile, __LINE__,
    899900                          GetPString(IDS_COULDNTSTARTTHREADTEXT));
    900             free(wk);
     901            xfree(wk);
    901902            FreeListInfo((LISTINFO *) mp1);
    902903          }
     
    926927            Runtime_Error(pszSrcFile, __LINE__,
    927928                          GetPString(IDS_COULDNTSTARTTHREADTEXT));
    928             free(wk);
     929            xfree(wk);
    929930            FreeListInfo((LISTINFO *) mp1);
    930931          }
     
    951952      WinSendMsg(dcd->hwndCnr, UM_CLOSE, MPVOID, MPVOID);
    952953      FreeList(dcd->lastselection);
    953       free(dcd);
     954      xfree(dcd);
    954955    }
    955956    DosPostEventSem(CompactSem);
     
    14461447    if (mp1) {
    14471448      if (!dcd) {
    1448         free(mp1);
     1449        xfree(mp1);
    14491450        Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
    14501451      }
     
    14521453        if (!PostMsg(dcd->hwndObject, UM_COLLECTFROMFILE, mp1, mp2)) {
    14531454          Runtime_Error(pszSrcFile, __LINE__, "PostMsg");
    1454           free(mp1);
     1455          xfree(mp1);
    14551456        }
    14561457      }
     
    15781579            if (p) {
    15791580              if (!PostMsg(hwnd, UM_COLLECTFROMFILE, MPFROMP(p), MPVOID))
    1580                 free(p);
     1581                xfree(p);
    15811582            }
    15821583          }
     
    20882089            }
    20892090            else
    2090               free(li);
     2091              xfree(li);
    20912092          }
    20922093        }
     
    28372838                   IDS_WINCREATEWINDOW);
    28382839        PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID);
    2839         free(dcd);
     2840        xfree(dcd);
    28402841        hwndFrame = (HWND) 0;
    28412842      }
  • trunk/dll/command.c

    r959 r985  
    2222  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
    2323  06 Jan 08 GKY Use NormalizeCmdLine to check program strings on entry
     24  29 Feb 08 GKY Changes to enable user settable command line length
     25  29 Feb 08 GKY Use xfree where appropriate
    2426
    2527***********************************************************************/
     
    4446typedef struct
    4547{
    46   CHAR cl[MAXCOMLINESTRG];
     48  PSZ pszCmdLine;
    4749  INT flags;
    4850  CHAR title[34];
     
    307309    xfree(info->title);
    308310    xfree(info->cl);
    309     free(info);
     311    xfree(info);
    310312    info = next;
    311313  }
     
    355357          xfree(info->cl);
    356358          xfree(info->title);
    357           free(info);
     359          xfree(info);
    358360          break;
    359361        }
     
    404406  LINKCMDS *info;
    405407
    406   if (!addme || !*addme->cl || !*addme->title)
     408  if (!addme || !*addme->pszCmdLine || !*addme->title)
    407409    return NULL;                        // No data
    408410  info = cmdhead;
     
    415417  if (!info)
    416418    return NULL;
    417   info->cl = xstrdup(addme->cl, pszSrcFile, __LINE__);
     419  info->cl = xstrdup(addme->pszCmdLine, pszSrcFile, __LINE__);
    418420  info->title = xstrdup(addme->title, pszSrcFile, __LINE__);
    419421  if (addme->flags)
     
    422424    xfree(info->cl);
    423425    xfree(info->title);
    424     free(info);
     426    xfree(info);
    425427    return NULL;
    426428  }
     
    459461        xfree(info->cl);
    460462        xfree(info->title);
    461         free(info);
     463        xfree(info);
    462464        return TRUE;
    463465      }
     
    622624        APIRET ret;
    623625
    624         pszWorkBuf = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__);
    625         if (!pszWorkBuf)
     626        memset(&temp, 0, sizeof(COMMAND));
     627        temp.pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
     628        if (!temp.pszCmdLine)
    626629          break; //already complained
    627         memset(&temp, 0, sizeof(COMMAND));
    628         WinQueryDlgItemText(hwnd, CMD_CL, sizeof(temp.cl), temp.cl);
    629         NormalizeCmdLine(pszWorkBuf, temp.cl);
    630         memcpy(temp.cl, pszWorkBuf, strlen(pszWorkBuf) + 1);
     630        pszWorkBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__);
     631        if (!pszWorkBuf) {
     632          xfree(temp.pszCmdLine);
     633          break; //already complained
     634        }
     635        WinQueryDlgItemText(hwnd, CMD_CL, MaxComLineStrg, temp.pszCmdLine);
     636        NormalizeCmdLine(pszWorkBuf, temp.pszCmdLine);
     637        memcpy(temp.pszCmdLine, pszWorkBuf, strlen(pszWorkBuf) + 1);
    631638        xfree(pszWorkBuf);
    632         if (!strchr(temp.cl, '%')){
     639        if (!strchr(temp.pszCmdLine, '%')){
    633640          ret = saymsg(MB_YESNO,
    634641                       HWND_DESKTOP,
     
    636643                       GetPString(IDS_TOACTONSELECTEDTEXT));
    637644          if (ret == MBID_YES)
    638             strcat(temp.cl, " %a");
     645            strcat(temp.pszCmdLine, " %a");
    639646        }
    640647        WinQueryDlgItemText(hwnd, CMD_TITLE, sizeof(temp.title), temp.title);
     
    657664        if (fCancelAction){
    658665          fCancelAction = FALSE;
     666          xfree(temp.pszCmdLine);
    659667          break;
    660668        }
     
    676684          bstripcr(env);
    677685          if (*env) {
    678             PrfWriteProfileString(fmprof, FM3Str, temp.cl, env);
     686            PrfWriteProfileString(fmprof, FM3Str, temp.pszCmdLine, env);
    679687          }
    680688          x = (SHORT) WinSendDlgItemMsg(hwnd,
     
    694702            save_commands();
    695703          }
    696         }
     704        }
     705        xfree(temp.pszCmdLine);
    697706      }
    698707      x = (SHORT) WinSendDlgItemMsg(hwnd,
    699708                                    CMD_LISTBOX,
    700709                                    LM_QUERYSELECTION,
    701                                     MPFROMSHORT(LIT_FIRST), MPVOID);
     710                                    MPFROMSHORT(LIT_FIRST), MPVOID);
    702711      WinDismissDlg(hwnd, 0);
    703712      break;
     
    720729        APIRET ret;
    721730
    722         pszWorkBuf = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__);
    723         if (!pszWorkBuf)
     731        memset(&temp, 0, sizeof(COMMAND));
     732        temp.pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
     733        if (!temp.pszCmdLine)
    724734          break; //already complained
    725         memset(&temp, 0, sizeof(COMMAND));
    726         WinQueryDlgItemText(hwnd, CMD_CL, sizeof(temp.cl), temp.cl);
    727         NormalizeCmdLine(pszWorkBuf, temp.cl);
    728         memcpy(temp.cl, pszWorkBuf, strlen(pszWorkBuf) + 1);
     735        pszWorkBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__);
     736        if (!pszWorkBuf) {
     737          xfree(temp.pszCmdLine);
     738          break; //already complained
     739        }
     740        WinQueryDlgItemText(hwnd, CMD_CL, MaxComLineStrg, temp.pszCmdLine);
     741        NormalizeCmdLine(pszWorkBuf, temp.pszCmdLine);
     742        memcpy(temp.pszCmdLine, pszWorkBuf, strlen(pszWorkBuf) + 1);
    729743        xfree(pszWorkBuf);
    730         if (!strchr(temp.cl, '%')){
     744        if (!strchr(temp.pszCmdLine, '%')){
    731745          ret = saymsg(MB_YESNO,
    732746                       HWND_DESKTOP,
     
    734748                       GetPString(IDS_TOACTONSELECTEDTEXT));
    735749          if (ret == MBID_YES)
    736             strcat(temp.cl, " %a");
     750            strcat(temp.pszCmdLine, " %a");
    737751        }
    738752        WinQueryDlgItemText(hwnd, CMD_TITLE, sizeof(temp.title), temp.title);
     
    755769        if (fCancelAction){
    756770          fCancelAction = FALSE;
     771          xfree(temp.pszCmdLine);
    757772          break;
    758773        }
     
    770785          bstripcr(env);
    771786          if (*env) {
    772             PrfWriteProfileString(fmprof, FM3Str, temp.cl, env);
     787            PrfWriteProfileString(fmprof, FM3Str, temp.pszCmdLine, env);
    773788          }
    774789          x = (SHORT) WinSendDlgItemMsg(hwnd,
     
    788803            save_commands();
    789804          }
    790         }
     805        }
     806        xfree(temp.pszCmdLine);
    791807      }
    792808      break;
     
    818834      }
    819835      break;
     836
    820837    case CMD_REPLACE:
    821838      { //Delete first
     
    824841        APIRET ret;
    825842
    826         pszWorkBuf = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__);
    827         if (!pszWorkBuf)
     843        pszWorkBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__);
     844        if (!pszWorkBuf) {
    828845          break; //already complained
    829         memset(&temp, 0, sizeof(COMMAND));
    830         WinQueryDlgItemText(hwnd, CMD_CL, sizeof(temp.cl), temp.cl);
    831         NormalizeCmdLine(pszWorkBuf, temp.cl);
    832         memcpy(temp.cl, pszWorkBuf, strlen(pszWorkBuf) + 1);
     846        }
     847        memset(&temp, 0, sizeof(COMMAND));
     848        temp.pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
     849        if (!temp.pszCmdLine) {
     850          xfree(pszWorkBuf);
     851          break; //already complained
     852        }
     853        WinQueryDlgItemText(hwnd, CMD_CL, MaxComLineStrg, temp.pszCmdLine);
     854        NormalizeCmdLine(pszWorkBuf, temp.pszCmdLine);
     855        memcpy(temp.pszCmdLine, pszWorkBuf, strlen(pszWorkBuf) + 1);
    833856        xfree(pszWorkBuf);
    834857        if (fCancelAction){
    835858          fCancelAction = FALSE;
     859          xfree(temp.pszCmdLine);
    836860          break;
    837861        }
    838         if (!strchr(temp.cl, '%')){
     862        if (!strchr(temp.pszCmdLine, '%')){
    839863          ret = saymsg(MB_YESNO,
    840864                       HWND_DESKTOP,
     
    842866                       GetPString(IDS_TOACTONSELECTEDTEXT));
    843867          if (ret == MBID_YES)
    844             strcat(temp.cl, " %a");
     868            strcat(temp.pszCmdLine, " %a");
    845869        }
    846870        //remember item location in the list
     
    896920          bstripcr(env);
    897921          if (*env) {
    898             PrfWriteProfileString(fmprof, FM3Str, temp.cl, env);
     922            PrfWriteProfileString(fmprof, FM3Str, temp.pszCmdLine, env);
    899923          } //put item back in original place
    900924          x = (SHORT) WinSendDlgItemMsg(hwnd,
     
    947971          }
    948972        }
     973        xfree(temp.pszCmdLine);
    949974      }
    950975      break;
  • trunk/dll/common.c

    r959 r985  
    2020  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
    2121  26 Aug 07 SHL Change to DosSleep(0)
     22  29 Feb 08 GKY Use xfree where appropriate
    2223
    2324***********************************************************************/
     
    745746          Broadcast(WinQueryAnchorBlock(hwnd),
    746747                    dcd->hwndParent, UM_UPDATERECORD, mp2, MPVOID);
    747           free(mp2);
     748          xfree(mp2);
    748749        }
    749750      }
  • trunk/dll/comp.c

    r959 r985  
    5151  18 Jan 08 SHL Honor filters in actions
    5252  20 Jan 08 GKY Compare dialog now saves and restores size and position
     53  29 Feb 08 GKY Use xfree where appropriate
     54  29 Feb 08 GKY Refactor global command line variables to notebook.h
    5355
    5456***********************************************************************/
     
    7678#include "comp.h"
    7779#include "fm3dll.h"
     80#include "notebook.h"                   // External compare/dircompare
    7881
    7982typedef struct
     
    140143        DosFindClose(hdir);
    141144      }
    142       free(mask);
     145      xfree(mask);
    143146    }
    144     free(pffb);
     147    xfree(pffb);
    145148  }
    146149}
     
    174177      }
    175178    }
    176     free(sf);
     179    xfree(sf);
    177180  }
    178181}
     
    678681    WinTerminate(hab);
    679682  }
    680   free(cmp);
     683  xfree(cmp);
    681684}
    682685
     
    735738    WinTerminate(hab);
    736739  }
    737   free(cmp);
     740  xfree(cmp);
    738741}
    739742
     
    780783  pciSa = xmalloc(sizeof(PCNRITEM) * numS, pszSrcFile, __LINE__);
    781784  if (!pciSa) {
    782     free(pciDa);
     785    xfree(pciDa);
    783786    return;
    784787  }
     
    813816      goto Restart;
    814817    }
    815     free(pciDa);
    816     free(pciSa);
     818    xfree(pciDa);
     819    xfree(pciSa);
    817820    Runtime_Error(pszSrcFile, __LINE__, "numD %u != x %lu", numD, x);
    818821    return;
     
    840843      goto Restart;
    841844    }
    842     free(pciSa);
    843     free(pciDa);
     845    xfree(pciSa);
     846    xfree(pciDa);
    844847    Runtime_Error(pszSrcFile, __LINE__, "numS (%lu) != x (%lu)", numS, x);
    845848    return;
     
    12841287  }
    12851288
    1286   free(pciSa);
    1287   free(pciDa);
     1289  xfree(pciSa);
     1290  xfree(pciDa);
    12881291
    12891292  if (fUpdateHideButton) {
     
    13251328  pffbArray = xmalloc(ulBufBytes, pszSrcFile, __LINE__);
    13261329  if (!pffbArray) {
    1327     free(maskstr);
     1330    xfree(maskstr);
    13281331    return;
    13291332  }
     
    13931396  }
    13941397
    1395   free(maskstr);
    1396   free(pffbArray);
     1398  xfree(maskstr);
     1399  xfree(pffbArray);
    13971400
    13981401  // DbgMsg(pszSrcFile, __LINE__, "FillDirList finish %s", str);
     
    19751978        } // if insufficient resources
    19761979
    1977         if (filesl)
    1978           free(filesl);                 // Free header - have already freed elements
     1980          xfree(filesl);                        // Free header - have already freed elements
    19791981        filesl = NULL;
    1980         if (filesr)
    1981           free(filesr);
     1982          xfree(filesr);
    19821983        filesr = NULL;
    19831984
     
    20462047    WinTerminate(hab);
    20472048  }
    2048   free(cmp);
     2049  xfree(cmp);
    20492050  DosPostEventSem(CompactSem);
    20502051
     
    26072608                        GetPString(IDS_COULDNTSTARTTHREADTEXT));
    26082609          WinDismissDlg(hwnd, 0);
    2609           free(forthread);
     2610          xfree(forthread);
    26102611        }
    26112612        else {
     
    28872888              Runtime_Error(pszSrcFile, __LINE__,
    28882889                            GetPString(IDS_COULDNTSTARTTHREADTEXT));
    2889               free(sf);
     2890              xfree(sf);
    28902891            }
    28912892          }
     
    29392940            Runtime_Error(pszSrcFile, __LINE__,
    29402941                          GetPString(IDS_COULDNTSTARTTHREADTEXT));
    2941             free(forthread);
     2942            xfree(forthread);
    29422943          }
    29432944          else {
     
    30623063            Runtime_Error(pszSrcFile, __LINE__,
    30633064                          GetPString(IDS_COULDNTSTARTTHREADTEXT));
    3064             free(forthread);
     3065            xfree(forthread);
    30653066          }
    30663067          else {
     
    32183219          WinSendMsg(cmp->dcd.hwndObject, WM_CLOSE, MPVOID, MPVOID);
    32193220      }
    3220       free(cmp);
     3221      xfree(cmp);
    32213222    }
    32223223    EmptyCnr(hwndLeft);
  • trunk/dll/copyf.c

    r959 r985  
    1818  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
    1919  01 Sep 07 GKY Use xDosSetPathInfo to fix case where FS3 buffer crosses 64k boundry
     20  29 Feb 08 GKY Use xfree where appropriate
    2021
    2122***********************************************************************/
     
    236237          longname[CCHMAXPATH - 1] = 0;
    237238        }
    238         free(pfealist);
    239       }
    240       free(pgealist);
     239        xfree(pfealist);
     240      }
     241      xfree(pgealist);
    241242    }
    242243  }
     
    711712        /* under no circumstances! */
    712713        Runtime_Error(pszSrcFile, __LINE__, "bad name %s", str);
    713         free(str);
     714        xfree(str);
    714715        return -1;
    715716      }
     
    738739    xfree(ss);
    739740    xfree(f);
    740     free(str);
     741    xfree(str);
    741742    return -1;
    742743  }
     
    785786  xfree(f);
    786787  xfree(ss);
    787   free(str);
     788  xfree(str);
    788789  return 0;
    789790}
     
    832833    xfree(ss);
    833834    xfree(f);
    834     free(str);
     835    xfree(str);
    835836    return -1;
    836837  }
     
    858859  xfree(f);
    859860  xfree(ss);
    860   free(str);
     861  xfree(str);
    861862  return 0;
    862863}
  • trunk/dll/defview.c

    r907 r985  
    1717  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
    1818  20 Dec 07 GKY Open jpg files with OS2 object default since image.exe fails
     19  29 Feb 08 GKY Refactor global command line variables to notebook.h
    1920
    2021***********************************************************************/
     
    3435#include "arccnrs.h"                    // StartArcCnr
    3536#include "errutil.h"                    // Dos_Error...
     37#include "notebook.h"                   // external viewers
    3638#include "fm3dll.h"
    3739
  • trunk/dll/dirsize.c

    r959 r985  
    3131  13 Aug 07 SHL Move #pragma alloc_text to end for OpenWatcom compat
    3232  26 Aug 07 GKY DosSleep(1) in loops changed to (0)
     33  29 Feb 08 GKY Use xfree where appropriate
     34  29 Feb 08 GKY Add presparams & update appearence of "Sizes" dialog
    3335
    3436***********************************************************************/
     
    150152      strlen(pszFileName) < 4) {
    151153    if (*pchStopFlag) {
    152       free(pffbArray);
     154      xfree(pffbArray);
    153155      return FALSE;
    154156    }
     
    157159    if (!pci) {
    158160      Win_Error(hwndCnr, HWND_DESKTOP, pszSrcFile, __LINE__, "CM_ALLOCRECORD");
    159       free(pffbArray);
     161      xfree(pffbArray);
    160162      return FALSE;
    161163    }
     
    173175  else {
    174176    // No match
    175     free(pffbArray);
     177    xfree(pffbArray);
    176178    Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
    177179              GetPString(IDS_CANTFINDDIRTEXT), pszFileName);
     
    216218  ri.fInvalidateRecord = TRUE;
    217219  if (!WinSendMsg(hwndCnr, CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri))) {
    218     free(pffbArray);
     220    xfree(pffbArray);
    219221    return FALSE;
    220222  }
     
    278280  }
    279281
    280   free(pffbArray);
     282  xfree(pffbArray);
    281283
    282284  pci->cbFile = ullCurDirBytes;
     
    456458  PostMsg(WinQueryWindow(hwndCnr, QW_PARENT),
    457459          UM_CONTAINER_FILLED, MPVOID, MPVOID);
    458   free(dirsize);
     460  xfree(dirsize);
    459461}
    460462
     
    483485    {
    484486      CHAR s[CCHMAXPATH + 81];
    485 
     487      RestorePresParams(hwnd, "DirSizes");
    486488      sprintf(s, GetPString(IDS_DIRSIZETITLETEXT), pState->szDirName);
    487489      WinSetWindowText(hwnd, s);
     490    }
     491    {
     492      SWP swp;
     493      ULONG size = sizeof(SWP);
     494
     495      PrfQueryProfileData(fmprof, FM3Str, "DirSizes.Position", (PVOID) &swp, &size);
     496      WinSetWindowPos(hwnd,
     497                      HWND_TOP,
     498                      swp.x,
     499                      swp.y,
     500                      swp.cx,
     501                      swp.cy,
     502                      swp.fl);
    488503    }
    489504    {
     
    502517        Runtime_Error(pszSrcFile, __LINE__,
    503518                      GetPString(IDS_COULDNTSTARTTHREADTEXT));
    504         free(dirsize);
     519        xfree(dirsize);
    505520        WinDismissDlg(hwnd, 0);
    506521        break;
     
    614629    return 0;
    615630
     631  case WM_PRESPARAMCHANGED:
     632    PresParamChanged(hwnd, "DirSizes", mp1, mp2);
     633    break;
     634
    616635  case WM_DRAWITEM:
    617636    if (mp2) {
     
    638657            p = strchr(pci->pszFileName, '\r');
    639658            if (p) {
    640               // draw text
    641               if (!pci->cbFile)         // no size
     659              // draw text
     660              if (*(pci->pszLongName + 1) == 1)  // is root record
     661                GpiSetColor(oi->hps, CLR_DARKRED);
     662              else if (!pci->cbFile)            // no size
    642663                GpiSetColor(oi->hps, CLR_DARKGRAY);
    643664              else if (!pci->easize)    // no size below
     
    654675                              pci->pszFileName, TXTBOX_COUNT, aptl);
    655676              boxHeight = aptl[TXTBOX_TOPRIGHT].y - aptl[TXTBOX_BOTTOMRIGHT].y;
    656               boxHeight -= 6;
     677              boxHeight -= 4;
    657678
    658679              // Calculate nominal baseline of graph box
     
    662683              // Place text above graph box with a bit of whitespace between
    663684              ptl.x = oi->rclItem.xLeft;
    664               ptl.y = yBottom + boxHeight + 8;  // 03 Aug 07 SHL
     685              ptl.y = yBottom + boxHeight + 6;  // 03 Aug 07 SHL
    665686              // GpiMove(oi->hps, &ptl);
    666687              GpiCharStringAt(oi->hps, &ptl, strlen(pci->pszFileName),
     
    676697              ptl.y = yBottom + 2;
    677698              GpiMove(oi->hps, &ptl);
    678               ptl.x = oi->rclItem.xLeft + 101;
     699              ptl.x = oi->rclItem.xLeft + 201;
    679700              ptl.y = yBottom + boxHeight;
    680701              GpiBox(oi->hps, DRO_OUTLINE, &ptl, 0, 0);
     
    684705              ptl.y = yBottom + 3;
    685706              GpiMove(oi->hps, &ptl);
    686               ptl.x = oi->rclItem.xLeft + 100;
     707              ptl.x = oi->rclItem.xLeft + 200;
    687708              ptl.y = yBottom + boxHeight - 1;
    688709              GpiBox(oi->hps, DRO_OUTLINEFILL, &ptl, 0, 0);
     
    693714              ptl.y = yBottom + 3;
    694715              GpiMove(oi->hps, &ptl);
    695               ptl.x = oi->rclItem.xLeft + 100;
     716              ptl.x = oi->rclItem.xLeft + 200;
    696717              GpiLine(oi->hps, &ptl);
    697718              ptl.y = yBottom + boxHeight - 1;
     
    710731              ptl.y = yBottom + boxHeight;
    711732              GpiMove(oi->hps, &ptl);
    712               ptl.x = oi->rclItem.xLeft + 103;
     733              ptl.x = oi->rclItem.xLeft + 203;
    713734              GpiLine(oi->hps, &ptl);
    714735              ptl.y = yBottom + boxHeight - 2;
     
    727748                else
    728749                  GpiSetColor(oi->hps, CLR_RED);
    729                 ptl.x = oi->rclItem.xLeft + 1;
     750                ptl.x = oi->rclItem.xLeft + 2;
    730751                ptl.y = yBottom + 3;
    731752                GpiMove(oi->hps, &ptl);
    732                 ptl.x = oi->rclItem.xLeft + pci->flags;
     753                ptl.x = oi->rclItem.xLeft + pci->flags * 2;
    733754                ptl.y = yBottom + boxHeight - 1;
    734755                GpiBox(oi->hps, DRO_OUTLINEFILL, &ptl, 0, 0);
     
    750771                  GpiMove(oi->hps, &ptl);
    751772                }
    752                 ptl.x = oi->rclItem.xLeft + pci->flags;
     773                ptl.x = oi->rclItem.xLeft + pci->flags * 2;
    753774                GpiLine(oi->hps, &ptl);
    754775                if (*(pci->pszLongName + 1) != 1) {
     
    757778                  ptl.y = yBottom + 3;
    758779                  GpiMove(oi->hps, &ptl);
    759                   ptl.x = oi->rclItem.xLeft + pci->flags;
     780                  ptl.x = oi->rclItem.xLeft + pci->flags * 2;
    760781                  GpiLine(oi->hps, &ptl);
    761782                }
     
    765786              GpiSetColor(oi->hps, CLR_WHITE);
    766787              clr = CLR_WHITE;
    767               for (x = 1; x < 10; x++) {
    768                 if (clr == CLR_WHITE && x * 10 > pci->flags) {
     788              for (x = 1; x < 20; x++) {
     789                if (clr == CLR_WHITE && x * 10 > pci->flags * 2) {
    769790                  clr = CLR_BLACK;
    770791                  GpiSetColor(oi->hps, CLR_BLACK);
     
    775796                switch (x) {
    776797                case 1:
    777                 case 3:
     798                case 3:
     799                case 5:
    778800                case 7:
    779                 case 9:
     801                case 9:
     802                case 11:
     803                case 13:
     804                case 15:
     805                case 17:
     806                case 19:
    780807                  ptl.y -= 1;
    781808                  break;
    782                 case 5:
     809                case 10:
    783810                  ptl.y -= 4;
    784811                  break;
     
    786813                case 4:
    787814                case 6:
    788                 case 8:
     815                case 8:
     816                case 12:
     817                case 14:
     818                case 16:
     819                case 18:
    789820                  ptl.y -= 2;
    790821                  break;
     
    943974    case DID_OK:
    944975    case DID_CANCEL:
     976      {
     977        SWP swp;
     978        ULONG size = sizeof(SWP);
     979
     980        WinQueryWindowPos(hwnd, &swp);
     981        PrfWriteProfileData(fmprof, FM3Str, "DirSizes.Position", (PVOID) &swp,
     982                            size);
     983      }
    945984      pState = INSTDATA(hwnd);
    946985      if (!pState)
     
    9731012        WinDestroyPointer(pState->hptr);
    9741013      DosSleep(16); //05 Aug 07 GKY 33
    975       free(pState);                     // Let's hope no one is still looking
     1014      xfree(pState);                    // Let's hope no one is still looking
    9761015    }
    9771016    DosPostEventSem(CompactSem);
  • trunk/dll/draglist.c

    r959 r985  
    1919  21 Apr 07 SHL Avoid odd first time drag failure
    2020  12 May 07 SHL Use dcd->ulItemsToUnHilite
    21   05 Jul 07 FreeDragInfoData: suppress PMERR_SOURCE_SAME_AS_TARGET notices
     21  05 Jul 07 SHL FreeDragInfoData: suppress PMERR_SOURCE_SAME_AS_TARGET notices
    2222  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
     23  29 Feb 08 GKY Use xmallocz where appropriate
    2324
    2425***********************************************************************/
     
    305306        ulNumDIAlloc += 4L;
    306307      }
    307       pDItem = xmalloc(sizeof(DRAGITEM), pszSrcFile, __LINE__);
     308      // Create & Initialize DRAGITEM
     309      pDItem = xmallocz(sizeof(DRAGITEM), pszSrcFile, __LINE__);
    308310      if (!pDItem)
    309311        break;                          // Already complained
     
    322324        pDImg->cyOffset = 0 + (ulNumfiles * 6);
    323325      }
    324       // Initialize DRAGITEM
    325       memset(pDItem, 0, sizeof(DRAGITEM));
    326326      pDItem->hwndItem = (hwndObj) ? hwndObj : hwndCnr;
    327327      pDItem->hwndItem = hwndCnr;
     
    394394        ulNumDIAlloc += 5L;
    395395      }
    396       pDItem = xmalloc(sizeof(DRAGITEM), pszSrcFile, __LINE__);
     396      // Create & Initialize DRAGITEM
     397      pDItem = xmallocz(sizeof(DRAGITEM), pszSrcFile, __LINE__);
    397398      if (!pDItem)
    398399        break;
    399400      ppDItem[ulNumfiles] = pDItem;
    400401      dimgFakeIcon.hImage = hptrFile;
    401       // Initialize DRAGITEM
    402       memset(pDItem, 0, sizeof(DRAGITEM));
    403402      pDItem->hwndItem = (hwndObj) ? hwndObj : hwndCnr;
    404403      pDItem->hwndItem = hwndCnr;
     
    435434      pDItem->fsSupportedOps = DO_COPYABLE;
    436435      ulNumfiles++;
    437 
    438       pDItem = xmalloc(sizeof(DRAGITEM), pszSrcFile, __LINE__);
     436      // Create & Initialize DRAGITEM
     437      pDItem = xmallocz(sizeof(DRAGITEM), pszSrcFile, __LINE__);
    439438      if (pDItem) {
    440439        ppDItem[ulNumfiles] = pDItem;
    441440        dimgFakeIcon.hImage = hptrFile;
    442         // Initialize DRAGITEM
    443         memset(pDItem, 0, sizeof(DRAGITEM));
    444441        pDItem->hwndItem = (hwndObj) ? hwndObj : hwndCnr;
    445442        pDItem->hwndItem = hwndCnr;
     
    641638        ulNumDIAlloc += 4L;
    642639      }
    643       pDItem = xmalloc(sizeof(DRAGITEM), pszSrcFile, __LINE__);
     640      // Create & Initialize DRAGITEM
     641      pDItem = xmallocz(sizeof(DRAGITEM), pszSrcFile, __LINE__);
    644642      if (!pDItem)
    645643        break;
     
    656654        pDImg->cyOffset = 0 + (ulNumfiles * 6);
    657655      }
    658       memset(pDItem, 0, sizeof(DRAGITEM));
    659656      pDItem->hwndItem = (hwndObj) ? hwndObj : hwnd;
    660       // pDItem->hwndItem = hwnd;
    661657      pDItem->ulItemID = (ULONG) ulSelect;
    662658      pDItem->hstrType = DrgAddStrHandle(DRT_UNKNOWN);
  • trunk/dll/eas.c

    r907 r985  
    2121  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
    2222  01 Sep 07 GKY Use xDosSetPathInfo to fix case where FS3 buffer crosses 64k boundry
     23  29 Feb 08 GKY Use xfree where appropriate
    2324
    2425***********************************************************************/
     
    866867                    memcpy(pfea, pfealist->list,
    867868                           pfealist->cbList - sizeof(ULONG));
    868                     free(eap->current->pfea);
     869                    xfree(eap->current->pfea);
    869870                    eap->current->pfea = pfea;
    870871                    eap->current->name = eap->current->pfea->szName;
     
    880881                }
    881882              }
    882               free(s);
     883              xfree(s);
    883884            }
    884885          }
     
    911912          rc = xDosSetPathInfo(eap->filename, FIL_QUERYEASIZE,
    912913                               &eaop, sizeof(eaop), DSPI_WRTTHRU);
    913           free(pfealist);
     914          xfree(pfealist);
    914915          if (rc)
    915916            Dos_Error(MB_CANCEL, rc, hwnd, pszSrcFile, __LINE__,
     
    919920            if (eap->current == eap->head) {
    920921              eap->head = eap->head->next;
    921               free(eap->current->pfea);
    922               free(eap->current);
     922              xfree(eap->current->pfea);
     923              xfree(eap->current);
    923924              eap->current = NULL;
    924925            }
     
    929930                  sSelect++;
    930931                  info->next = eap->current->next;
    931                   free(eap->current->pfea);
    932                   free(eap->current);
     932                  xfree(eap->current->pfea);
     933                  xfree(eap->current);
    933934                  eap->current = NULL;
    934935                  break;
     
    986987      if (eap->head)
    987988        Free_FEAList(eap->head);
    988       free(eap);
     989      xfree(eap);
    989990      if (hptrIcon)
    990991        WinDestroyPointer(hptrIcon);
     
    12751276                }
    12761277              }
    1277               free(pfealist);
     1278              xfree(pfealist);
    12781279            }
    1279             free(pgealist);
     1280            xfree(pgealist);
    12801281          }
    12811282          ulEntry += ulCount;
    12821283        } // while
    1283         free(pdena);
     1284        xfree(pdena);
    12841285        DosPostEventSem(CompactSem);
    12851286      }
     
    13491350                }
    13501351                else
    1351                   free(pfealist);
     1352                  xfree(pfealist);
    13521353              }
    13531354              else {
    1354                 free(pfealist);
     1355                xfree(pfealist);
    13551356                if (!silentfail) {
    13561357                  if (rc == ERROR_ACCESS_DENIED
     
    13621363                             pdena->szName);
    13631364                    if (rc == MBID_CANCEL) {
    1364                       free(pgealist);
     1365                      xfree(pgealist);
    13651366                      break;
    13661367                    }
     
    13771378              }
    13781379            }
    1379             free(pgealist);
     1380            xfree(pgealist);
    13801381          }
    13811382          ulEntry += ulCount;
    13821383        } // while
    1383         free(pdena);
     1384        xfree(pdena);
    13841385        DosPostEventSem(CompactSem);
    13851386      }
     
    13981399    /* Free linked list */
    13991400    next = pFEA->next;
    1400     free(pFEA->pfea);
    1401     free(pFEA);
     1401    xfree(pFEA->pfea);
     1402    xfree(pFEA);
    14021403    pFEA = next;
    14031404  }
  • trunk/dll/filldir.c

    r924 r985  
    4040  13 Aug 07 SHL Move #pragma alloc_text to end for OpenWatcom compat
    4141  04 Nov 07 GKY Use commaFmtULL to display large file sizes
     42  29 Feb 08 GKY Use xfree where appropriate
    4243
    4344***********************************************************************/
     
    306307            pci->pszSubject = xstrdup(value + (sizeof(USHORT) * 2), pszSrcFile, __LINE__);
    307308        }
    308         free(pfealist);
    309       }
    310       free(pgealist);
     309        xfree(pfealist);
     310      }
     311      xfree(pgealist);
    311312    }
    312313  }
     
    353354            pci->pszLongName = xstrdup(value + (sizeof(USHORT) * 2), pszSrcFile, __LINE__);
    354355        }
    355         free(pfealist);
    356       }
    357       free(pgealist);
     356        xfree(pfealist);
     357      }
     358      xfree(pgealist);
    358359    }
    359360  }
     
    535536            pci->pszSubject = xstrdup(value + (sizeof(USHORT) * 2), pszSrcFile, __LINE__);
    536537        }
    537         free(pfealist);
    538       }
    539       free(pgealist);
     538        xfree(pfealist);
     539      }
     540      xfree(pgealist);
    540541    }
    541542  }
     
    583584          }
    584585        }
    585         free(pfealist);
    586       }
    587       free(pgealist);
     586        xfree(pfealist);
     587      }
     588      xfree(pgealist);
    588589    }
    589590  }
     
    903904
    904905      DosFindClose(hdir);
    905 
    906       if (paffbFound) {
    907         free(paffbFound);
    908         paffbFound = NULL;
    909       }
    910       if (papffbSelected) {
    911         free(papffbSelected);
    912         papffbSelected = NULL;
    913       }
     906      xfree(paffbFound);
     907      paffbFound = NULL;
     908      xfree(papffbSelected);
     909      papffbSelected = NULL;
    914910
    915911      if (ulTotal && paffbTotal) {
     
    998994  }
    999995Abort:
    1000   if (paffbTotal)
    1001     free(paffbTotal);
    1002   if (pszFileSpec)
    1003     free(pszFileSpec);
    1004   if (paffbFound)
    1005     free(paffbFound);
    1006   if (papffbSelected)
    1007     free(papffbSelected);
     996  xfree(paffbTotal);
     997  xfree(pszFileSpec);
     998  xfree(paffbFound);
     999  xfree(papffbSelected);
    10081000
    10091001  if (recurse) {
  • trunk/dll/filter.c

    r907 r985  
    1414  22 Mar 07 GKY Use QWL_USER
    1515  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
     16  29 Feb 08 GKY Use xfree where appropriate
    1617
    1718***********************************************************************/
     
    153154          }
    154155          else
    155             free(info);
     156            xfree(info);
    156157        }
    157158      }
     
    217218    }
    218219    else
    219       free(info);
     220      xfree(info);
    220221  }
    221222}
     
    237238      else
    238239        maskhead = info->next;
    239       free(info->mask);
    240       free(info);
     240      xfree(info->mask);
     241      xfree(info);
    241242      break;
    242243    }
  • trunk/dll/flesh.c

    r924 r985  
    1919  06 Aug 07 GKY Reduce DosSleep times (ticket 148)
    2020  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
     21  29 Feb 08 GKY Use xfree where appropriate
    2122
    2223***********************************************************************/
     
    134135      }
    135136    }
    136     if (var)
    137       free(var);
     137    xfree(var);
    138138    pciL = (PCNRITEM) WinSendMsg(hwndCnr,
    139139                                 CM_QUERYRECORD,
  • trunk/dll/fm3dlg.h

    r917 r985  
    1919  21 Aug 07 GKY Make Subject column in dircnr sizable and movable from the right to the left pane
    2020  11 Jan 08 SHL Correct all to 3 column tabs since dialog editors assume this
     21  29 Feb 08 GKY Changes to enable user settable command line length 
    2122
    2223***********************************************************************/
     
    635636#define CFGG_CONFIRMTARGET                                                              25214
    636637#define CFGG_TARGETDIR                                                                  25215
    637 
    638 #define CFGB_FRAME                                                                              25250
     638#define CFGG_CMDLNLNGTH                                                                 25216
     639
     640#define CFGB_FRAME                                                                      25250
    639641#define CFGB_TOOLBARHELP                                                                25251
    640642#define CFGB_DRIVEBARHELP                                                               25252
  • trunk/dll/fm3dll.h

    r953 r985  
    7878  12 Jan 08 SHL Localize SpecialSelect to comp.c
    7979  14 Feb 08 SHL Refactor CfgDlgProc to notebook.h
     80  29 Feb 08 GKY Refactor global command line variables to notebook.h
    8081
    8182***********************************************************************/
     
    687688HAPP Exec(HWND hwndNotify, BOOL child, char *startdir, char *env,
    688689          PROGTYPE * progt, ULONG fl, char *formatstring, ...);
    689 #define MAXCOMLINESTRG (2048)                   /* used to build command line strings */
    690690#define RUNTYPE_MASK  0xf
    691691#define SYNCHRONOUS   1
     
    11791179  *WPProgram, *FM3Folder, *FM3Tools;
    11801180DATADEF RGB2 RGBGREY, RGBBLACK;
    1181 DATADEF CHAR archiverbb2[CCHMAXPATH], StopPrinting, profile[CCHMAXPATH];
     1181DATADEF CHAR archiverbb2[CCHMAXPATH], StopPrinting, profile[CCHMAXPATH], extractpath[CCHMAXPATH],
     1182  lastextractpath[CCHMAXPATH];
    11821183DATADEF CHAR appname[12], realappname[12];
    1183 DATADEF CHAR editor[MAXCOMLINESTRG], viewer[MAXCOMLINESTRG], virus[MAXCOMLINESTRG],
    1184   compare[MAXCOMLINESTRG], extractpath[CCHMAXPATH],
    1185   lastextractpath[CCHMAXPATH], lasttoolbox[CCHMAXPATH],
    1186   HomePath[CCHMAXPATH], SwapperDat[CCHMAXPATH],
    1187   binview[MAXCOMLINESTRG], bined[MAXCOMLINESTRG], printer[CCHMAXPATH],
    1188   dircompare[MAXCOMLINESTRG], szDefArc[CCHMAXPATH],
    1189   ftprun[MAXCOMLINESTRG], ftprundir[CCHMAXPATH], httprun[MAXCOMLINESTRG],
    1190   httprundir[CCHMAXPATH], mailrundir[CCHMAXPATH],
    1191   mailrun[MAXCOMLINESTRG], targetdir[CCHMAXPATH];
     1184DATADEF CHAR  lasttoolbox[CCHMAXPATH], HomePath[CCHMAXPATH],
     1185  SwapperDat[CCHMAXPATH], printer[CCHMAXPATH], szDefArc[CCHMAXPATH];
    11921186DATADEF HMODULE FM3DllHandle, FM3ModHandle;
    11931187DATADEF CHAR *quicktool[50];
  • trunk/dll/fm3res.dlg

    r929 r985  
    3131  21 Aug 07 GKY Make Subject column in dircnr sizable and movable from the rigth to the left pane
    3232  12 Jan 08 SHL Rework WALK_FRAME
     33  29 Feb 08 GKY Changes to enable user settable command line length
     34  29 Feb 08 GKY Add presparams & update appearence of "Sizes" dialog
    3335
    3436***********************************************************************/
     
    25382540        PUSHBUTTON      "~Expand", DSZ_EXPAND, 48, 4, 44, 14,
    25392541                        BS_NOPOINTERFOCUS
    2540         PUSHBUTTON      "~Help", IDM_HELP, 96, 4, 40, 14, BS_NOPOINTERFOCUS
    2541         PUSHBUTTON      "~Collapse", DSZ_COLLAPSE, 140, 4, 44, 14,
    2542                         BS_NOPOINTERFOCUS
    2543         PUSHBUTTON      "~Save", DSZ_PRINT, 188, 4, 44, 14,
     2542        PUSHBUTTON      "~Help", IDM_HELP, 192, 4, 40, 14, BS_NOPOINTERFOCUS
     2543        PUSHBUTTON      "~Collapse", DSZ_COLLAPSE, 96, 4, 44, 14,
     2544                        BS_NOPOINTERFOCUS
     2545        PUSHBUTTON      "~Save", DSZ_PRINT, 144, 4, 44, 14,
    25442546                        BS_NOPOINTERFOCUS
    25452547        PUSHBUTTON      "Cancel", DID_CANCEL, 337, 4, 40, 14,
     
    27642766        AUTOCHECKBOX    "FM/~2 deletes dragged items", CFGG_FM2DELETES, 122,
    27652767                        68, 130, 10
     2768        LTEXT           "Command line length", -1, 122, 56, 60, 10, NOT WS_GROUP
     2769        CONTROL         "", CFGG_CMDLNLNGTH, 184, 56, 44, 10, WC_SPINBUTTON,
     2770                        SPBS_NUMERICONLY | SPBS_MASTER | SPBS_SERVANT |
     2771                        SPBS_JUSTCENTER | WS_TABSTOP | SPBS_FASTSPIN |
     2772                        WS_VISIBLE
    27662773        PUSHBUTTON      "~Help", IDM_HELP, 4, 4, 40, 14, BS_NOPOINTERFOCUS |
    27672774                        WS_GROUP
  • trunk/dll/grep.c

    r948 r985  
    2828  21 Sep 07 GKY Fix trap on search that includes filenames that exceed maxpath
    2929  07 Feb 08 SHL Use ITIMER_DESC to control sleeps and reporting
     30  29 Feb 08 GKY Use xfree where appropriate
    3031
    3132***********************************************************************/
     
    578579            // Complain if pathnames exceeds max
    579580            DosFindClose(findHandle);
    580             free(pffbArray);
     581            xfree(pffbArray);
    581582            if (!fDone) {
    582583              fDone = TRUE;
     
    607608            else if (!InsertDupe(grep, szFindPath, pffbFile)) {
    608609              DosFindClose(findHandle);
    609               free(pffbArray);
     610              xfree(pffbArray);
    610611              return 1;
    611612            }
     
    633634  }
    634635
    635   free(pffbArray);
     636  xfree(pffbArray);
    636637  return 0;
    637638}
     
    762763                             pszSrcFile, __LINE__);
    763764        if (!grep->dir) {
    764           free(grep->insertffb);
     765          xfree(grep->insertffb);
    765766          return FALSE;
    766767        }
     
    775776      grep->dir[grep->toinsert] = xstrdup(szDirectory, pszSrcFile, __LINE__);
    776777      if (!grep->dir) {
    777         free(grep->insertffb[grep->toinsert]);
     778        xfree(grep->insertffb[grep->toinsert]);
    778779        return FALSE;
    779780      }
     
    992993        fclose(inputFile);
    993994      }
    994       free(input);
     995      xfree(input);
    995996      // DosSleep(1);                   // 07 Feb 08 SHL
    996997    }
     
    11061107      // DosSleep(1);                   // 07 Feb 08 SHL
    11071108    }
    1108     free(buffer);
     1109    xfree(buffer);
    11091110  }
    11101111  return CRC;
     
    11241125  }
    11251126  grep->dupehead = grep->dupelast = NULL;
    1126   if (grep->dupenames)
    1127     free(grep->dupenames);
    1128   if (grep->dupesizes)
    1129     free(grep->dupesizes);
     1127  xfree(grep->dupenames);
     1128  xfree(grep->dupesizes);
    11301129  grep->dupesizes = grep->dupenames = NULL;
    11311130}
     
    14741473        WinSetWindowText(hwndStatus, GetPString(IDS_GREPDUPECOMPARINGTEXT));
    14751474      x = y = 0;
    1476       if (grep->dupenames) {
    1477         free(grep->dupenames);
    1478         grep->dupenames = NULL;
    1479       }
    1480       if (grep->dupesizes) {
    1481         free(grep->dupesizes);
    1482         grep->dupesizes = NULL;
    1483       }
     1475      xfree(grep->dupenames);
     1476      grep->dupenames = NULL;
     1477      xfree(grep->dupesizes);
     1478      grep->dupesizes = NULL;
    14841479
    14851480      InitITimer(pitdSleep, 0);         // Reset rate estimator
     
    15951590    info->name = xstrdup(dir, pszSrcFile, __LINE__);
    15961591    if (!info->name) {
    1597       free(info);
     1592      xfree(info);
    15981593      return FALSE;
    15991594    }
  • trunk/dll/grep2.c

    r948 r985  
    2020  06 Aug 07 GKY Reduce DosSleep times (ticket 148)
    2121  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
     22  29 Feb 08 GKY Use xfree where appropriate
    2223
    2324  fixme for more excess locals to be gone
     
    823824          DosBeep(50, 100);
    824825          WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, GREP_MASK));
    825           free(p);
     826          xfree(p);
    826827          break;
    827828        }
     
    922923          Runtime_Error(pszSrcFile, __LINE__,
    923924                        GetPString(IDS_COULDNTSTARTTHREADTEXT));
    924           free(p);
     925          xfree(p);
    925926          WinDismissDlg(hwnd, 0);
    926927          break;
    927928        }
    928929        DosSleep(100); //05 Aug 07 GKY 128
    929         free(p);
     930        xfree(p);
    930931      }
    931932      if (changed) {
  • trunk/dll/info.c

    r907 r985  
    2424  27 Sep 07 SHL Correct ULONGLONG size formatting
    2525  30 Dec 07 GKY Use CommaFmtULL
     26  29 Feb 08 GKY Use xfree where appropriate
    2627
    2728***********************************************************************/
     
    463464      if (pis->lasthwndMenu)
    464465        WinDestroyWindow(pis->lasthwndMenu);
    465       free(pis);
     466      xfree(pis);
    466467      return oldproc(hwnd, msg, mp1, mp2);
    467468    }
     
    882883  case WM_DESTROY:
    883884    pfs = WinQueryWindowPtr(hwnd, QWL_USER);
    884     if (pfs)
    885       free(pfs);
     885    xfree(pfs);
    886886    break;
    887887  }
  • trunk/dll/inis.c

    r914 r985  
    2525  09 Jan 08 SHL Standardize PrfOpenProfile return checks
    2626  09 Jan 08 SHL Use CloseProfile to avoid spurious system INI closes
     27  29 Feb 08 GKY Use xfree where appropriate
    2728
    2829***********************************************************************/
     
    212213                                                        app2 : inirec->app),
    213214                                                pCurrentK, pData, ulSize);
    214                           free(pData);  /* free data */
     215                          xfree(pData); /* free data */
    215216                        }
    216217                      }
     
    220221                    }
    221222                  }
    222                   free(pDataK);         /* free keynames */
     223                  xfree(pDataK);                /* free keynames */
    223224                }
    224225              }
     
    256257                                         inirec->key2 : inirec->key),
    257258                                        pData, ulSize);
    258                   free(pData);          /* free data */
     259                  xfree(pData);         /* free data */
    259260                }
    260261              }
     
    291292      PostMsg(inirec->hwndSource, WM_COMMAND, MPFROM2SHORT(INI_REFRESH, 0),
    292293              MPVOID);
    293     free(inirec);
     294    xfree(inirec);
    294295  }
    295296}
     
    316317      WinTerminate(hab2);
    317318    }
    318     free(inirec);
     319    xfree(inirec);
    319320  }
    320321}
     
    402403                                                      pCurrentK, pData,
    403404                                                      ulSize);
    404                                 free(pData);    /* free data */
     405                                xfree(pData);   /* free data */
    405406                              }
    406407                            }
     
    410411                          }
    411412                        }
    412                         free(pDataK);   /* free keynames */
     413                        xfree(pDataK);  /* free keynames */
    413414                      }
    414415                    }
     
    418419                  }
    419420                }
    420                 free(pDataA);           /* free applnames */
     421                xfree(pDataA);          /* free applnames */
    421422              }
    422423            }
     
    430431      WinTerminate(hab2);
    431432    }
    432     free(prfp->pszUserName);
    433     free(prfp->pszSysName);
    434     free(prfp);
     433    xfree(prfp->pszUserName);
     434    xfree(prfp->pszSysName);
     435    xfree(prfp);
    435436  }
    436437}
     
    465466        WinEnableWindowUpdate(hwndList, TRUE);
    466467      }
    467       free(pData);
     468      xfree(pData);
    468469    }
    469470  }
     
    524525        Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
    525526                  "PrfQueryProfileString");
    526         free(pData);
     527        xfree(pData);
    527528      }
    528529      else {
     
    13151316            fixup(inidata->data, p, l, inidata->datalen);
    13161317            WinSetDlgItemText(hwnd, IAD_DATA, p);
    1317             free(p);
     1318            xfree(p);
    13181319          }
    13191320        }
     
    14781479    hINI = PrfOpenProfile(useHab, filename);
    14791480    if (hINI == NULLHANDLE) {
    1480       free(filename);
     1481      xfree(filename);
    14811482      return (HWND) 0;
    14821483    }
     
    15281529      PostMsg(hwndClient, UM_INITIALSIZE, MPVOID, MPVOID);
    15291530  }
    1530   else if (filename)
    1531     free(filename);
     1531  else
     1532    xfree(filename);
    15321533  return hwndFrame;
    15331534}
     
    20262027        inidata->hini = PrfOpenProfile(WinQueryAnchorBlock(hwnd),
    20272028                                       inidata->ininame);
    2028         free(mp1);
     2029        xfree(mp1);
    20292030      }
    20302031      else
     
    21562157            strcpy(inidata->keyname, keyname);
    21572158            strcpy(inidata->applname, applname);
    2158             if (inidata->data)
    2159               free(inidata->data);
     2159            xfree(inidata->data);
    21602160            inidata->data = GetKeyData(WinWindowFromID(hwnd,
    21612161                                                       INI_DATALIST),
     
    23442344            Runtime_Error(pszSrcFile, __LINE__,
    23452345                          GetPString(IDS_COULDNTSTARTTHREADTEXT));
    2346             free(inirec);
     2346            xfree(inirec);
    23472347          }
    23482348        }
     
    23642364            Runtime_Error(pszSrcFile, __LINE__,
    23652365                          GetPString(IDS_COULDNTSTARTTHREADTEXT));
    2366             free(inirec);
     2366            xfree(inirec);
    23672367          }
    23682368        }
     
    24042404                         IntraIniProc,
    24052405                         FM3ModHandle, INII_FRAME, (PVOID) inirec)) {
    2406             free(inirec);
     2406            xfree(inirec);
    24072407            break;
    24082408          }
     
    24102410            Runtime_Error(pszSrcFile, __LINE__,
    24112411                          GetPString(IDS_COULDNTSTARTTHREADTEXT));
    2412             free(inirec);
     2412            xfree(inirec);
    24132413          }
    24142414        }
     
    24482448              xstrdup(inidata->ininame, pszSrcFile, __LINE__);
    24492449            if (!prfp->pszUserName)
    2450               free(prfp);
     2450              xfree(prfp);
    24512451            else {
    24522452              prfp->cchUserName = strlen(prfp->pszUserName);
    24532453              prfp->pszSysName = xstrdup(filename, pszSrcFile, __LINE__);
    24542454              if (!prfp->pszSysName) {
    2455                 free(prfp->pszUserName);
    2456                 free(prfp);
     2455                xfree(prfp->pszUserName);
     2456                xfree(prfp);
    24572457              }
    24582458              else {
     
    24622462                  Runtime_Error(pszSrcFile, __LINE__,
    24632463                                GetPString(IDS_COULDNTSTARTTHREADTEXT));
    2464                   free(prfp->pszSysName);
    2465                   free(prfp->pszUserName);
    2466                   free(prfp);
     2464                  xfree(prfp->pszSysName);
     2465                  xfree(prfp->pszUserName);
     2466                  xfree(prfp);
    24672467                }
    24682468                else
     
    27632763        if (inidata->hini != NULLHANDLE && *inidata->ininame)
    27642764          CloseProfile(inidata->hini, FALSE);
    2765         if (inidata->data)
    2766           free(inidata->data);
     2765        xfree(inidata->data);
    27672766        if (inidata->hwndPopup)
    27682767          WinDestroyWindow(inidata->hwndPopup);
    2769         free(inidata);
     2768        xfree(inidata);
    27702769      }
    27712770      if (!dontclose &&
  • trunk/dll/init.c

    r952 r985  
    4141  13 Jan 08 GKY Get Subjectwidth/Subjectleft working in the collector.
    4242  12 Feb 08 SHL Compile OpenWatcom version into binary
     43  29 Feb 08 GKY Changes to enable user settable command line length
     44  29 Feb 08 GKY Refactor global command line variables to notebook.h
    4345
    4446***********************************************************************/
     
    7173#include "strutil.h"                    // GetPString
    7274#include "fm3dll.h"
     75#include "notebook.h"                   // command line variables (editor etc)
    7376
    7477#ifdef __IBMC__
     
    9093
    9194static PSZ pszSrcFile = __FILE__;
     95
     96BOOL CheckFileHeader(CHAR *filespec, CHAR *signature, LONG offset);
    9297
    9398VOID FindSwapperDat(VOID)
     
    709714    }
    710715    else {
     716      if (!CheckFileHeader(inipath, "\xff\xff\xff\xff\x14\x00\x00\x00", 0L))
     717        saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING, "Check INI header failed");
    711718      fIniExisted = TRUE;
    712719      if (fs3.attrFile & (FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM)) {
     
    951958  ulCnrType = CCS_EXTENDSEL;
    952959  FilesToGet = FILESTOGET_MIN;
     960  MaxComLineStrg = MAXCOMLINESTRGDEFAULT;
    953961  AutoviewHeight = 48;
    954962  strcpy(printer, "PRN");
     
    975983
    976984  // load preferences from profile (INI) file
     985  size = sizeof(ULONG);
     986  PrfQueryProfileData(fmprof, appname, "MaxComLineStrg", &MaxComLineStrg, &size);
     987  if (MaxComLineStrg < CMDLNLNGTH_MIN)
     988    MaxComLineStrg = CMDLNLNGTH_MIN;
     989  else if (MaxComLineStrg > CMDLNLNGTH_MAX)
     990    MaxComLineStrg = CMDLNLNGTH_MAX;
     991  editor = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
     992  if (!editor)
     993    return 0; //already complained
     994  viewer = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
     995  if (!viewer)
     996    return 0; //already complained
     997  virus = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
     998  if (!virus)
     999    return 0; //already complained
     1000  compare = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
     1001  if (!compare)
     1002    return 0; //already complained
     1003  binview = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
     1004  if (!binview)
     1005    return 0; //already complained
     1006  bined = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
     1007  if (!bined)
     1008    return 0; //already complained
     1009  dircompare = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
     1010  if (!dircompare)
     1011    return 0; //already complained
     1012  ftprun = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
     1013  if (!ftprun)
     1014    return 0; //already complained
     1015  httprun = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
     1016  if (!httprun)
     1017    return 0; //already complained
     1018  mailrun = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
     1019  if (!mailrun)
     1020    return 0; //already complained
    9771021  size = sizeof(BOOL);
    9781022  PrfQueryProfileData(fmprof, appname, "ShowTarget", &fShowTarget, &size);
     
    11861230  size = sizeof(printer);
    11871231  PrfQueryProfileData(fmprof, appname, "Printer", printer, &size);
    1188   size = sizeof(dircompare);
     1232  size = MaxComLineStrg;
    11891233  PrfQueryProfileData(fmprof, appname, "DirCompare", dircompare,
    11901234                      &size);
    1191   size = sizeof(viewer);
     1235  size = MaxComLineStrg;
    11921236  PrfQueryProfileData(fmprof, appname, "Viewer", viewer, &size);
    1193   size = sizeof(editor);
     1237  size = MaxComLineStrg;
    11941238  PrfQueryProfileData(fmprof, appname, "Editor", editor, &size);
    1195   size = sizeof(binview);
     1239  size = MaxComLineStrg;
    11961240  PrfQueryProfileData(fmprof, appname, "BinView", binview, &size);
    1197   size = sizeof(bined);
     1241  size = MaxComLineStrg;
    11981242  PrfQueryProfileData(fmprof, appname, "BinEd", bined, &size);
    1199   size = sizeof(compare);
     1243  size = MaxComLineStrg;
    12001244  PrfQueryProfileData(fmprof, appname, "Compare", compare, &size);
    1201   size = sizeof(virus);
     1245  size = MaxComLineStrg;
    12021246  PrfQueryProfileData(fmprof, appname, "Virus", virus, &size);
    12031247  size = sizeof(BOOL);
    12041248  PrfQueryProfileData(fmprof, appname, "FtpRunWPSDefault", &fFtpRunWPSDefault, &size);
    1205   size = sizeof(ftprun);
     1249  size = MaxComLineStrg;
    12061250  PrfQueryProfileData(fmprof, appname, "FTPRun", ftprun, &size);
    12071251  if (!*ftprun)
     
    12091253  size = sizeof(BOOL);
    12101254  PrfQueryProfileData(fmprof, appname, "HttpRunWPSDefault", &fHttpRunWPSDefault, &size);
    1211   size = sizeof(httprun);
     1255  size = MaxComLineStrg;
    12121256  PrfQueryProfileData(fmprof, appname, "HTTPRun", httprun, &size);
    12131257  if (!*httprun)
    12141258    fHttpRunWPSDefault = TRUE;
    1215   size = sizeof(mailrun);
     1259  size = MaxComLineStrg;
    12161260  PrfQueryProfileData(fmprof, appname, "MailRun", mailrun, &size);
    12171261  size = sizeof(ftprundir);
     
    14421486}
    14431487
     1488BOOL CheckFileHeader(CHAR *filespec, CHAR *signature, LONG offset)
     1489{
     1490  HFILE handle;
     1491  ULONG action;
     1492  ULONG len = strlen(signature);
     1493  ULONG l;
     1494  // CHAR buffer[80];
     1495  CHAR buffer[4096];                    // 06 Oct 07 SHL Protect against NTFS defect
     1496  BOOL ret = FALSE;
     1497
     1498  DosError(FERR_DISABLEHARDERR);
     1499  if (DosOpen(filespec,
     1500              &handle,
     1501              &action,
     1502              0,
     1503              0,
     1504              OPEN_ACTION_FAIL_IF_NEW |
     1505              OPEN_ACTION_OPEN_IF_EXISTS,
     1506              OPEN_FLAGS_FAIL_ON_ERROR |
     1507              OPEN_FLAGS_NOINHERIT |
     1508              OPEN_FLAGS_RANDOMSEQUENTIAL |
     1509              OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY, 0))
     1510    ret = FALSE;
     1511  else {
     1512    // Try signature match
     1513    l = len;
     1514    l = min(l, 79);
     1515    if (!DosChgFilePtr(handle,
     1516                       abs(offset),
     1517                       (offset >= 0) ?
     1518                       FILE_BEGIN : FILE_END, &len)) {
     1519      if (!DosRead(handle, buffer, l, &len) && len == l) {
     1520        if (!memcmp(signature, buffer, l))
     1521          ret = TRUE;                   // Matched
     1522      }
     1523    }
     1524  }
     1525  DosClose(handle);                     /* Either way, we're done for now */
     1526  return ret;                           /* Return TRUE if matched */
     1527}
     1528
    14441529int CheckVersion(int vermajor, int verminor)
    14451530{
  • trunk/dll/ipf/context.ipf

    r555 r985  
    1010.* 01 Sep 06 GKY ADD new partition disks information
    1111.* 03 Mar 07 GKY Update that file systems other than HPFS support long names
     12.* 29 Feb 08 GKY Document unhide menu item
    1213.*
    1314.***********************************************************************
     
    188189:hp6.Hide objects:ehp6. hides objects (removes them from view in the
    189190container) until you rescan, use the :link reftype=hd res=93400.Filter
    190 dialog:elink. or switch directories.
    191 :artwork runin name='\bitmaps\file.bmp'. :artwork runin name='\bitmaps\fldr.bmp'. :artwork runin name='\bitmaps\drive.bmp'.
     191dialog:elink. or switch directories or use Unhide (see below).
     192:artwork runin name='\bitmaps\file.bmp'. :artwork runin name='\bitmaps\fldr.bmp'.
     193:p.
     194:hp6.Unhide objects:ehp6. unhides objects (restores them from view in the container)
     195Unhide doesn't unhide items that are filtered by the current mask or attribute filters
     196:artwork runin name='\bitmaps\file.bmp'. :artwork runin name='\bitmaps\fldr.bmp'.
    192197:p.
    193198:artwork name='..\..\bitmaps\playmm.bmp' align=center.
  • trunk/dll/literal.c

    r959 r985  
    1717  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
    1818  16 Nov 07 SHL Report fixup buffer overflow
     19  29 Feb 08 GKY Use xfree where appropriate
    1920
    2021***********************************************************************/
     
    192193  cBufBytes = pszOut - pszWork;                /* Calc string length excluding terminator */
    193194  memcpy(pszBuf, pszWork, cBufBytes + 1);        /* Overwrite including terminator */
    194   free(pszWork);
     195  xfree(pszWork);
    195196
    196197  return cBufBytes;                        /* Return string length */
  • trunk/dll/mainwnd.c

    r981 r985  
    5454  19 Feb 08 JBS Stop deleting "State at last FM/2 Close" from INI file so it be accessed from States combo box.
    5555  22 Feb 08 JBS Ticket 230: Fix/improve various code related to state or presparam values in the INI file.
     56  29 Feb 08 GKY Use xfree where appropriate
    5657
    5758***********************************************************************/
     
    180181      WinEnableWindow(WinQueryWindow(hwndMain, QW_PARENT), TRUE);
    181182      fNoTileUpdate = FALSE;
    182       if (mp1)
    183         free((char *)mp1);
     183      xfree((char *)mp1);
    184184      if (fAutoTile)
    185185        TileChildren(hwndMain, TRUE);
     
    510510      WinSetMultWindowPos(WinQueryAnchorBlock(hwnd), &swp[2], numtools);
    511511    }
    512     free(swp);
     512    xfree(swp);
    513513  }
    514514  WinInvalidateRect(hwnd, NULL, TRUE);
     
    10041004              }
    10051005            }
    1006             free(s);
     1006            xfree(s);
    10071007          }
    10081008        }
     
    16061606                                   SEPARATEKEEP : SEPARATE),
    16071607                       directory, list, NULL, pszSrcFile, __LINE__);
    1608             if (list)
    1609               free(list);
     1608            xfree(list);
    16101609            WinDestroyWindow(hwnd);
    16111610            break;
     
    62346233                                  MPFROMP(pszStateName),
    62356234                                  MPVOID)) {
    6236                   free(pszStateName);
     6235                  xfree(pszStateName);
    62376236                }
    62386237              }
     
    63086307        if (!PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMP(pszDefaultStateName), MPVOID))
    63096308          // 05 Feb 08 SHL fixme to complain?
    6310           free(pszDefaultStateName);
     6309          xfree(pszDefaultStateName);
    63116310      }
    63126311    }
  • trunk/dll/mainwnd2.c

    r953 r985  
    2323  19 Jan 08 GKY Rework Utilities menu
    2424  14 Feb 08 SHL Rework to support settings menu conditional cascade
     25  29 Feb 08 GKY Use xfree where appropriate
    2526
    2627***********************************************************************/
     
    13471348    hwndMain = (HWND) 0;
    13481349    pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
    1349     if (pd)
    1350       free(pd);
     1350    xfree(pd);
    13511351    if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
    13521352      WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
  • trunk/dll/makelist.c

    r907 r985  
    1414  06 Apr 07 GKY Work around PM DragInfo and DrgFreeDISH limits
    1515  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
     16  29 Feb 08 GKY Use xfree where appropriate
    1617
    1718***********************************************************************/
     
    6869{
    6970  if (li) {
    70     if (li->ulitemID)
    71       free(li->ulitemID);
    72     if (li->cbFile)
    73       free(li->cbFile);
     71    xfree(li->ulitemID);
     72    xfree(li->cbFile);
    7473    if (li->list)
    7574      FreeList(li->list);
    76     free(li);
     75    xfree(li);
    7776  }
    7877}
     
    9291    _heap_check();
    9392#endif
    94     free(list);
     93    xfree(list);
    9594  }
    9695  DosPostEventSem(CompactSem);
  • trunk/dll/menu.c

    r907 r985  
    1313  29 Jul 06 SHL Use xfgets_bstripcr
    1414  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
     15  29 Feb 08 GKY Use xfree where appropriate
    1516
    1617***********************************************************************/
     
    6768  while (info) {
    6869    next = info->next;
    69     if (info->text)
    70       free(info->text);
    71     free(info);
     70    xfree(info->text);
     71    xfree(info);
    7272    info = next;
    7373  }
     
    107107          info->text = xstrdup(tokens[2], pszSrcFile, __LINE__);
    108108          if (!info->text)
    109             free(info);
     109            xfree(info);
    110110          else {
    111111            if (!stricmp(tokens[0], "MENUITEM"))
     
    115115            else {
    116116              /* error! */
    117               free(info->text);
    118               free(info);
     117              xfree(info->text);
     118              xfree(info);
    119119              info = NULL;
    120120            }
  • trunk/dll/misc.c

    r960 r985  
    4040  xx Jan 08 JBS Ticket 150: fix/improve save and restore of dir cnr state at FM/2 close/reopen
    4141  21 Jan 08 GKY Stop reallocating NullStr by direct editing of empty subject and longname strings.
     42  29 Feb 08 GKY Use xfree where appropriate
    4243
    4344***********************************************************************/
     
    225226        }
    226227      }
    227       free(s);
     228      xfree(s);
    228229    }
    229230    if (releaseme)
     
    844845                  if (!PostMsg(hwnd,
    845846                               UM_FIXEDITNAME, MPVOID, MPFROMP(filename)))
    846                     free(filename);
     847                    xfree(filename);
    847848                }
    848849                if (stricmp(testname, pci->pszFileName)) {
     
    852853                    if (!PostMsg(hwnd,
    853854                                 UM_FIXEDITNAME, MPVOID, MPFROMP(filename)))
    854                       free(filename);
     855                      xfree(filename);
    855856                  }
    856857                }
     
    20122013                                  GetPString(IDS_SUBJ) : GetPString(IDS_NAME));
    20132014    WinSetWindowText(hwnd, s);
    2014     free(s);
     2015    xfree(s);
    20152016  }
    20162017}
     
    20312032             !(flWindowAttr & CV_TEXT)) ? GetPString(IDS_MINI) : NullStr);
    20322033    WinSetWindowText(hwnd, s);
    2033     free(s);
     2034    xfree(s);
    20342035  }
    20352036}
     
    20512052      sprintf(s, "F:%s", GetPString(IDS_ALLTEXT));
    20522053    WinSetWindowText(hwnd, s);
    2053     free(s);
     2054    xfree(s);
    20542055  }
    20552056}
     
    21962197      }
    21972198      numswitches = y;
    2198       free(pswb);
     2199      xfree(pswb);
    21992200      DosPostEventSem(CompactSem);
    22002201    }
  • trunk/dll/mkdir.c

    r907 r985  
    1010
    1111  01 Aug 04 SHL Baseline
     12  29 Feb 08 GKY Refactor global command line variables to notebook.h
    1213
    1314***********************************************************************/
     
    2425#include "errutil.h"                    // Dos_Error...
    2526#include "strutil.h"                    // GetPString
     27#include "notebook.h"                   // targetdirectoy
    2628#include "fm3dll.h"
    2729
  • trunk/dll/mle.c

    r907 r985  
    1818  26 Aug 07 GKY DosSleep(1) in loops changed to (0)
    1919  17 Dec 07 GKY Make WPURLDEFAULTSETTINGS the fall back for ftp/httprun
     20  29 Feb 08 GKY Refactor global command line variables to notebook.h
     21  29 Feb 08 GKY Use xfree where appropriate
    2022
    2123***********************************************************************/
     
    3638#include "errutil.h"                    // Dos_Error...
    3739#include "strutil.h"                    // GetPString
     40#include "notebook.h"                   // httprun etc
    3841#include "fm3dll.h"
    3942
     
    247250    Dos_Error(MB_CANCEL, rc, h, pszSrcFile, __LINE__,
    248251              GetPString(IDS_OUTOFMEMORY));
    249     free(sel);
     252    xfree(sel);
    250253    DosPostEventSem(CompactSem);
    251254    return FALSE;
     
    264267    if (sellen < 1) {
    265268      Runtime_Error(pszSrcFile, __LINE__, "len < 1");
    266       free(sel);
     269      xfree(sel);
    267270      DosPostEventSem(CompactSem);
    268271      return FALSE;
     
    278281    SaveToClip(h, sel, TRUE);
    279282    DosFreeMem(temp);
    280     free(sel);
     283    xfree(sel);
    281284    MLEenable(h);
    282285    DosPostEventSem(CompactSem);
     
    299302#endif
    300303      DosFreeMem(temp);
    301       free(sel);
     304      xfree(sel);
    302305      MLEenable(h);
    303306      DosPostEventSem(CompactSem);
     
    372375#endif
    373376    DosFreeMem(temp);
    374     free(sel);
     377    xfree(sel);
    375378    DosPostEventSem(CompactSem);
    376379    MLEenable(h);
     
    405408#endif
    406409  DosFreeMem(temp);
    407   free(sel);
     410  xfree(sel);
    408411  DosPostEventSem(CompactSem);
    409412  return TRUE;
     
    571574          else
    572575            ret = FALSE;
    573           free(buffer);
     576          xfree(buffer);
    574577        }
    575578        DosFreeMem(hexbuff);
     
    767770        _heap_check();
    768771#endif
    769         free(bkg);
     772        xfree(bkg);
    770773        WinDestroyMsgQueue(thmq);
    771774      }
  • trunk/dll/newview.c

    r946 r985  
    2929  28 Dec 07 GKY Add mailrun to allow mailto by clicking on an email address in the viewer
    3030  29 Dec 07 GKY Formated email address using "<mailto:"
     31  29 Feb 08 GKY Use xfree where appropriate
     32  29 Feb 08 GKY Refactor global command line variables to notebook.h
    3133
    3234***********************************************************************/
     
    4951#include "errutil.h"                    // Dos_Error...
    5052#include "strutil.h"                    // GetPString
     53#include "notebook.h"                   // httprun etc
    5154#include "fm3dll.h"
    5255
     
    638641  if (ad) {
    639642    ad->selected = ad->textsize = ad->numlines = ad->numalloc = 0;
    640     if (ad->text)
    641       free(ad->text);
    642     if (ad->lines)
    643       free(ad->lines);
    644     if (ad->markedlines)
    645       free(ad->markedlines);
     643    xfree(ad->text);
     644    xfree(ad->lines);
     645    xfree(ad->markedlines);
    646646    ad->text = NULL;
    647647    ad->lines = NULL;
     
    12021202            ad->found = 0;
    12031203            ad->selected = ad->numlines = ad->numalloc = 0;
    1204             if (ad->lines)
    1205               free(ad->lines);
    1206             if (ad->markedlines)
    1207               free(ad->markedlines);
     1204            xfree(ad->lines);
     1205            xfree(ad->markedlines);
    12081206            ad->lines = NULL;
    12091207            ad->markedlines = NULL;
     
    13141312            }
    13151313            if (ad->numlines) {
    1316               ad->markedlines = xmalloc(ad->numlines, pszSrcFile, __LINE__);
     1314              ad->markedlines = xmallocz(ad->numlines, pszSrcFile, __LINE__);
    13171315              if (ad->markedlines) {
    1318                 memset(ad->markedlines, 0, ad->numlines);
    13191316                ad->selected = 0;
    13201317              }
     
    13721369          priority_normal();
    13731370          if (*ad->filename) {
    1374             if (ad->text)
    1375               free(ad->text);
    1376             if (ad->lines)
    1377               free(ad->lines);
    1378             if (ad->markedlines)
    1379               free(ad->markedlines);
     1371            xfree(ad->text);
     1372            xfree(ad->lines);
     1373            xfree(ad->markedlines);
    13801374            ad->text = NULL;
    13811375            ad->lines = NULL;
     
    14261420                              __LINE__,
    14271421                              GetPString(IDS_ERRORREADINGTEXT), ad->filename);
    1428                     free(ad->text);
     1422                    xfree(ad->text);
    14291423                    ad->text = NULL;
    14301424                    ad->textsize = 0;
     
    23812375              switch (ret) {
    23822376              case 0:
    2383                 free(urld);
     2377                xfree(urld);
    23842378                goto NoAdd;
    23852379              case 1:
     
    24072401                            "%s %s", httprun, urld->url);
    24082402                }
    2409                 free(urld);
     2403                xfree(urld);
    24102404                goto NoAdd;
    24112405              case 2:
     
    24332427                            "%s %s", ftprun, urld->url);
    24342428                }
     2429                xfree(urld);
     2430                goto NoAdd;
    24352431              case 3:
    24362432                if (*urld->url){
     
    24412437                          "%s %s", mailrun, urld->url);
    24422438                }
    2443                 free(urld);
     2439                xfree(urld);
    24442440                goto NoAdd;
    24452441              default:
    24462442                break;
    24472443              }
    2448               free(urld);
     2444              xfree(urld);
    24492445            }
    24502446          }
     
    25242520                                  MPFROMLONG(whichline));
    25252521            }
    2526             free(s);
     2522            xfree(s);
    25272523          }
    25282524        }
     
    39373933        FreeViewerMem(hwnd);
    39383934        WinSetWindowPtr(hwnd, QWL_USER, NULL);
    3939         free(ad);
     3935        xfree(ad);
    39403936      }
    39413937      if (hwndRestore && hwndRestore != HWND_DESKTOP) {
  • trunk/dll/notebook.c

    r972 r985  
    2929  16 Feb 08 SHL Restore SaveDirCnrState internal state save logic - accidentally removed
    3030  22 Feb 08 JBS Ticket 230: Fix/improve various code related to state or presparam values in the INI file.
     31  29 Feb 08 GKY Changes to enable user settable command line length
     32  29 Feb 08 GKY Use xfree where appropriate
    3133
    3234***********************************************************************/
     
    201203    PrfWriteProfileString(fmprof, appname, "DefArc", szDefArc);
    202204    {
    203       CHAR szCLBuf[MAXCOMLINESTRG], szPathBuf[CCHMAXPATH];
     205      CHAR *szCLBuf;
     206      CHAR szPathBuf[CCHMAXPATH];
    204207      PSZ pszWorkBuf;
    205208
    206       pszWorkBuf = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__);
    207       if (!pszWorkBuf)
     209      szCLBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__);
     210        if (!szCLBuf)
     211          return 0; //already complained
     212      pszWorkBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__);
     213      if (!pszWorkBuf) {
     214        xfree(szCLBuf);
    208215        return 0; //already complained
    209       WinQueryDlgItemText(hwnd, CFGA_VIRUS, MAXCOMLINESTRG, szCLBuf);
    210       szCLBuf[MAXCOMLINESTRG - 1] = 0;
     216      }
     217      WinQueryDlgItemText(hwnd, CFGA_VIRUS, MaxComLineStrg, szCLBuf);
     218      szCLBuf[MaxComLineStrg - 1] = 0;
    211219      if (strcmp(szCLBuf, virus)){
    212220        NormalizeCmdLine(pszWorkBuf, szCLBuf);
    213221        memcpy(virus, pszWorkBuf, strlen(pszWorkBuf) + 1);
    214         xfree(pszWorkBuf);
     222        xfree(pszWorkBuf);
     223        xfree(szCLBuf);
    215224        if (!strchr(virus, '%') && strlen(virus) > 3)
    216225          strcat(virus, " %p");
     
    376385  case WM_INITDLG:
    377386    WinSendDlgItemMsg(hwnd, CFGV_VIEWER, EM_SETTEXTLIMIT,
    378                       MPFROM2SHORT(MAXCOMLINESTRG, 0), MPVOID);
     387                      MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
    379388    WinSendDlgItemMsg(hwnd, CFGV_EDITOR, EM_SETTEXTLIMIT,
    380                       MPFROM2SHORT(MAXCOMLINESTRG, 0), MPVOID);
     389                      MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
    381390    WinSendDlgItemMsg(hwnd, CFGV_BINVIEW, EM_SETTEXTLIMIT,
    382                       MPFROM2SHORT(MAXCOMLINESTRG, 0), MPVOID);
     391                      MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
    383392    WinSendDlgItemMsg(hwnd, CFGV_BINED, EM_SETTEXTLIMIT,
    384                       MPFROM2SHORT(MAXCOMLINESTRG, 0), MPVOID);
     393                      MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
    385394    WinEnableWindow(WinWindowFromID(hwnd, CFGV_FIND), FALSE);
    386395    PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID);
     
    468477  case WM_CLOSE:
    469478    {
    470       CHAR szCLBuf[MAXCOMLINESTRG];
     479      CHAR *szCLBuf;
    471480      PSZ pszWorkBuf;
    472481
    473       pszWorkBuf = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__);
    474       if (!pszWorkBuf)
     482      szCLBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__);
     483        if (!szCLBuf)
     484          return 0; //already complained
     485      pszWorkBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__);
     486      if (!pszWorkBuf) {
     487        xfree(szCLBuf);
    475488        return 0; //already complained
    476       WinQueryDlgItemText(hwnd, CFGV_VIEWER, MAXCOMLINESTRG, szCLBuf);
    477       szCLBuf[MAXCOMLINESTRG - 1] = 0;
     489      }
     490      WinQueryDlgItemText(hwnd, CFGV_VIEWER, MaxComLineStrg, szCLBuf);
     491      szCLBuf[MaxComLineStrg - 1] = 0;
    478492      if (strcmp(szCLBuf, viewer)){
    479493        NormalizeCmdLine(pszWorkBuf, szCLBuf);
     
    482496          strcat(viewer, " %a");
    483497      }
    484       WinQueryDlgItemText(hwnd, CFGV_EDITOR, MAXCOMLINESTRG, szCLBuf);
    485       szCLBuf[MAXCOMLINESTRG - 1] = 0;
     498      WinQueryDlgItemText(hwnd, CFGV_EDITOR, MaxComLineStrg, szCLBuf);
     499      szCLBuf[MaxComLineStrg - 1] = 0;
    486500      if (strcmp(szCLBuf, editor)){
    487501        NormalizeCmdLine(pszWorkBuf, szCLBuf);
     
    490504          strcat(editor, " %a");
    491505      }
    492       WinQueryDlgItemText(hwnd, CFGV_BINVIEW, MAXCOMLINESTRG, szCLBuf);
    493       szCLBuf[MAXCOMLINESTRG - 1] = 0;
     506      WinQueryDlgItemText(hwnd, CFGV_BINVIEW, MaxComLineStrg, szCLBuf);
     507      szCLBuf[MaxComLineStrg - 1] = 0;
    494508      if (strcmp(szCLBuf, binview)){
    495509        NormalizeCmdLine(pszWorkBuf, szCLBuf);
     
    498512          strcat(binview, " %a");
    499513      }
    500       WinQueryDlgItemText(hwnd, CFGV_BINED, MAXCOMLINESTRG, szCLBuf);
    501       szCLBuf[MAXCOMLINESTRG - 1] = 0;
     514      WinQueryDlgItemText(hwnd, CFGV_BINED, MaxComLineStrg, szCLBuf);
     515      szCLBuf[MaxComLineStrg - 1] = 0;
    502516      if (strcmp(szCLBuf, bined)){
    503517        NormalizeCmdLine(pszWorkBuf, szCLBuf);
     
    507521      }
    508522      xfree(pszWorkBuf);
     523      xfree(szCLBuf);
    509524      PrfWriteProfileString(fmprof, appname, "Viewer", viewer);
    510525      PrfWriteProfileString(fmprof, appname, "Editor", editor);
     
    547562                      MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
    548563    WinSendDlgItemMsg(hwnd, CFGH_FTPRUN, EM_SETTEXTLIMIT,
    549                       MPFROM2SHORT(MAXCOMLINESTRG, 0), MPVOID);
     564                      MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
    550565    WinSendDlgItemMsg(hwnd, CFGH_HTTPRUN, EM_SETTEXTLIMIT,
    551                       MPFROM2SHORT(MAXCOMLINESTRG, 0), MPVOID);
     566                      MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
    552567    WinSendDlgItemMsg(hwnd, CFGH_MAILRUN, EM_SETTEXTLIMIT,
    553                       MPFROM2SHORT(MAXCOMLINESTRG, 0), MPVOID);
     568                      MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
    554569    WinSendDlgItemMsg(hwnd, CFGH_RUNMAILWORKDIR, EM_SETTEXTLIMIT,
    555570                      MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
     
    664679  case WM_CLOSE:
    665680    {
    666       CHAR szCLBuf[MAXCOMLINESTRG], szPathBuf[CCHMAXPATH];
     681      CHAR *szCLBuf;
     682      CHAR szPathBuf[CCHMAXPATH];
    667683      PSZ pszWorkBuf;
    668684
    669       pszWorkBuf = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__);
    670       if (!pszWorkBuf)
     685      szCLBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__);
     686        if (!szCLBuf)
     687          return 0; //already complained
     688      pszWorkBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__);
     689      if (!pszWorkBuf) {
     690        xfree(szCLBuf);
    671691        return 0; //already complained
     692      }
    672693      WinQueryDlgItemText(hwnd, CFGH_RUNHTTPWORKDIR, CCHMAXPATH, szPathBuf);
    673694      szPathBuf[CCHMAXPATH - 1] = 0;
     
    682703      bstrip(szPathBuf);
    683704      memcpy(mailrundir, szPathBuf, strlen(szPathBuf) + 1);
    684       WinQueryDlgItemText(hwnd, CFGH_FTPRUN, MAXCOMLINESTRG, szCLBuf);
    685       szCLBuf[MAXCOMLINESTRG - 1] = 0;
     705      WinQueryDlgItemText(hwnd, CFGH_FTPRUN, MaxComLineStrg, szCLBuf);
     706      szCLBuf[MaxComLineStrg - 1] = 0;
    686707      if (strcmp(szCLBuf, ftprun)){
    687708        NormalizeCmdLine(pszWorkBuf, szCLBuf);
    688709        memcpy(ftprun, pszWorkBuf, strlen(pszWorkBuf) + 1);
    689710      }
    690       WinQueryDlgItemText(hwnd, CFGH_HTTPRUN, MAXCOMLINESTRG, szCLBuf);
    691       szCLBuf[MAXCOMLINESTRG - 1] = 0;
     711      WinQueryDlgItemText(hwnd, CFGH_HTTPRUN, MaxComLineStrg, szCLBuf);
     712      szCLBuf[MaxComLineStrg - 1] = 0;
    692713      if (strcmp(szCLBuf, httprun)){
    693714        NormalizeCmdLine(pszWorkBuf, szCLBuf);
    694715        memcpy(httprun, pszWorkBuf, strlen(pszWorkBuf) + 1);
    695716      }
    696       WinQueryDlgItemText(hwnd, CFGH_MAILRUN, MAXCOMLINESTRG, szCLBuf);
    697       szCLBuf[MAXCOMLINESTRG - 1] = 0;
     717      WinQueryDlgItemText(hwnd, CFGH_MAILRUN, MaxComLineStrg, szCLBuf);
     718      szCLBuf[MaxComLineStrg - 1] = 0;
    698719      if (strcmp(szCLBuf, mailrun)){
    699720        NormalizeCmdLine(pszWorkBuf, szCLBuf);
     
    701722      }
    702723      xfree(pszWorkBuf);
     724      xfree(szCLBuf);
    703725      PrfWriteProfileString(fmprof, appname, "HttpRunDir", httprundir);
    704726      PrfWriteProfileString(fmprof, appname, "FtpRunDir", ftprundir);
     
    10651087  switch (msg) {
    10661088  case WM_INITDLG:
     1089    WinSendDlgItemMsg(hwnd, CFGG_CMDLNLNGTH, SPBM_SETTEXTLIMIT,
     1090                      MPFROMSHORT(8), MPVOID);
     1091    WinSendDlgItemMsg(hwnd, CFGG_CMDLNLNGTH, SPBM_OVERRIDESETLIMITS,
     1092                      MPFROMLONG(CMDLNLNGTH_MAX), MPFROMLONG(CMDLNLNGTH_MIN));
    10671093    PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID);
    10681094    break;
     
    10861112    WinCheckButton(hwnd, CFGG_CONFIRMTARGET, fConfirmTarget);
    10871113    WinSetDlgItemText(hwnd, CFGG_TARGETDIR, targetdir);
     1114    WinSendDlgItemMsg(hwnd, CFGG_CMDLNLNGTH, SPBM_SETCURRENTVALUE,
     1115                      MPFROMLONG(MaxComLineStrg), MPVOID);
    10881116    return 0;
    10891117
     
    11891217    fConfirmTarget = WinQueryButtonCheckstate(hwnd, CFGG_CONFIRMTARGET);
    11901218    PrfWriteProfileData(fmprof, appname, "ConfirmTarget",
    1191                         &fConfirmTarget, sizeof(BOOL));
     1219                        &fConfirmTarget, sizeof(BOOL));
     1220    {
     1221      WinSendDlgItemMsg(hwnd, CFGG_CMDLNLNGTH, SPBM_QUERYVALUE,
     1222                        MPFROMP(&MaxComLineStrg), MPFROM2SHORT(0, SPBQ_DONOTUPDATE));
     1223      if (MaxComLineStrg < CMDLNLNGTH_MIN)
     1224        MaxComLineStrg = CMDLNLNGTH_MIN;
     1225      else if (MaxComLineStrg > CMDLNLNGTH_MAX)
     1226        MaxComLineStrg = CMDLNLNGTH_MAX;
     1227      PrfWriteProfileData(fmprof,
     1228                          appname, "MaxComLineStrg", &MaxComLineStrg, sizeof(ULONG));
     1229    }
    11921230    break;
    11931231  }
     
    12001238  case WM_INITDLG:
    12011239    WinSendDlgItemMsg(hwnd, CFGC_COMPARE, EM_SETTEXTLIMIT,
    1202                       MPFROM2SHORT(MAXCOMLINESTRG, 0), MPVOID);
     1240                      MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
    12031241    WinSendDlgItemMsg(hwnd, CFGC_DIRCOMPARE, EM_SETTEXTLIMIT,
    1204                       MPFROM2SHORT(MAXCOMLINESTRG, 0), MPVOID);
     1242                      MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
    12051243    WinEnableWindow(WinWindowFromID(hwnd, CFGC_FIND), FALSE);
    12061244    PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID);
     
    12781316  case WM_CLOSE:
    12791317    {
    1280       CHAR szCLBuf[MAXCOMLINESTRG];
     1318      CHAR *szCLBuf;
    12811319      PSZ pszWorkBuf;
    12821320
    1283       pszWorkBuf = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__);
    1284       if (!pszWorkBuf)
     1321      szCLBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__);
     1322        if (!szCLBuf)
     1323          return 0; //already complained
     1324      pszWorkBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__);
     1325      if (!pszWorkBuf) {
     1326        xfree(szCLBuf);
    12851327        return 0; //already complained
    1286       WinQueryDlgItemText(hwnd, CFGC_DIRCOMPARE, MAXCOMLINESTRG, szCLBuf);
    1287         szCLBuf[MAXCOMLINESTRG - 1] = 0;
     1328      }
     1329      WinQueryDlgItemText(hwnd, CFGC_DIRCOMPARE, MaxComLineStrg, szCLBuf);
     1330        szCLBuf[MaxComLineStrg - 1] = 0;
    12881331        if (strcmp(szCLBuf, dircompare)){
    12891332          NormalizeCmdLine(pszWorkBuf, szCLBuf);
     
    12931336        }
    12941337      PrfWriteProfileString(fmprof, appname, "DirCompare", dircompare);
    1295       WinQueryDlgItemText(hwnd, CFGC_COMPARE, MAXCOMLINESTRG, szCLBuf);
    1296         szCLBuf[MAXCOMLINESTRG - 1] = 0;
    1297         if (strcmp(szCLBuf, compare)){
    1298           NormalizeCmdLine(pszWorkBuf, szCLBuf);
    1299           memcpy(compare, pszWorkBuf, strlen(pszWorkBuf) + 1);
    1300           if (!strchr(compare, '%') && strlen(compare) > 3)
    1301             strcat(compare, " %a");
    1302         }
     1338      WinQueryDlgItemText(hwnd, CFGC_COMPARE, MaxComLineStrg, szCLBuf);
     1339      szCLBuf[MaxComLineStrg - 1] = 0;
     1340      if (strcmp(szCLBuf, compare)){
     1341        NormalizeCmdLine(pszWorkBuf, szCLBuf);
     1342        memcpy(compare, pszWorkBuf, strlen(pszWorkBuf) + 1);
     1343        if (!strchr(compare, '%') && strlen(compare) > 3)
     1344          strcat(compare, " %a");
     1345      }
    13031346      xfree(pszWorkBuf);
     1347      xfree(szCLBuf);
    13041348      PrfWriteProfileString(fmprof, appname, "Compare", compare);
    13051349      break;
  • trunk/dll/notebook.h

    r953 r985  
    1010
    1111  14 Feb 08 SHL Refactor from fm3dll.h
     12  29 Feb 08 GKY Refactor global command line variables to notebook.h
    1213
    1314***********************************************************************/
     
    2930VOID CfgMenuInit(HWND hwndMenu, BOOL fIsLite);
    3031
     32#ifdef DEFINE_GLOBALS
     33#define DATADEF
     34#else
     35#define DATADEF extern
     36#endif
     37
     38DATADEF CHAR *editor, *viewer, *virus, *compare, *binview, *bined,
     39  *dircompare, *ftprun, *httprun, *mailrun;
     40DATADEF CHAR ftprundir[CCHMAXPATH], httprundir[CCHMAXPATH],
     41  mailrundir[CCHMAXPATH], targetdir[CCHMAXPATH];
     42
    3143#endif // NOTEBOOK_H
  • trunk/dll/notify.c

    r907 r985  
    1414  06 Aug 07 GKY Reduce DosSleep times (ticket 148)
    1515  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
     16  29 Feb 08 GKY Use xfree where appropriate
    1617
    1718
     
    190191
    191192    if (p != str)
    192       free(p);
     193      xfree(p);
    193194    if (id > NOTE_MAX)
    194195      id = NOTE_FRAME;
     
    254255                          LM_INSERTITEM, MPFROM2SHORT(LIT_END, 0), mp2);
    255256        PostMsg(hwndNotify, UM_NOTIFY, MPVOID, MPVOID);
    256         free((CHAR *) mp2);
     257        xfree((CHAR *) mp2);
    257258      }
    258259      WinDismissDlg(hwnd, 0);
     
    271272                        NOTE_LISTBOX,
    272273                        LM_INSERTITEM, MPFROM2SHORT(LIT_END, 0), mp2);
    273       free((CHAR *) mp2);
     274      xfree((CHAR *) mp2);
    274275    }
    275276    {
     
    472473          }
    473474        }
    474         free(s);
     475        xfree(s);
    475476      }
    476477    }
  • trunk/dll/objcnr.c

    r907 r985  
    2121  13 Aug 07 SHL Move #pragma alloc_text to end for OpenWatcom compat
    2222  14 Aug 07 SHL Revert ProcessDir DosSleep to 0
     23  29 Feb 08 GKY Use xfree where appropriate
    2324
    2425***********************************************************************/
     
    106107    if (!pciP) {
    107108      Win_Error(hwndCnr, HWND_DESKTOP, pszSrcFile, __LINE__, "CM_ALLOCRECORD");
    108       free(pffbArray);
     109      xfree(pffbArray);
    109110      return;
    110111    }
     
    131132  }
    132133  else {
    133     free(pffbArray);
     134    xfree(pffbArray);
    134135    Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
    135136              GetPString(IDS_CANTFINDDIRTEXT), filename);
     
    152153  ri.fInvalidateRecord = TRUE;
    153154  if (!WinSendMsg(hwndCnr, CM_INSERTRECORD, MPFROMP(pciP), MPFROMP(&ri))) {
    154     free(pffbArray);
     155    xfree(pffbArray);
    155156    return;
    156157  }
     
    201202  }
    202203
    203   free(pffbArray);
     204  xfree(pffbArray);
    204205  WinSendMsg(hwndCnr, CM_INVALIDATERECORD, MPFROMP(&pciP),
    205206             MPFROM2SHORT(1, 0));
     
    233234  PostMsg(WinQueryWindow(dirsize->hwndCnr, QW_PARENT), UM_CONTAINER_FILLED,
    234235          MPVOID, MPVOID);
    235   free(dirsize);
     236  xfree(dirsize);
    236237}
    237238
     
    279280        Runtime_Error(pszSrcFile, __LINE__,
    280281                      GetPString(IDS_COULDNTSTARTTHREADTEXT));
    281         free(dirsize);
     282        xfree(dirsize);
    282283        WinDismissDlg(hwnd, 0);
    283284        break;
     
    425426    objcnrwnd = (HWND) 0;
    426427    data = INSTDATA(hwnd);
    427     if (data)
    428       free(data);
     428    xfree(data);
    429429    break;
    430430  }
  • trunk/dll/pathutil.c

    r928 r985  
    1111  05 Jan 08 SHL Move from arccnrs.c and comp.c to here
    1212  06 Jan 08 GKY Add NormalizeCmdLine to check program strings on entry
     13  29 Feb 08 GKY Use xfree where appropriate
     14  29 Feb 08 GKY Changes to enable user settable command line length
    1315
    1416***********************************************************************/
     
    2527#include "errutil.h"                    // Dos_Error...
    2628#include "strutil.h"                    // GetPString
     29
     30static PSZ pszSrcFile = __FILE__;
    2731
    2832// #pragma data_seg(DATA1)
     
    105109 * no space between exe and args etc)
    106110 * Command line passed as pszCmdLine_
    107  * A pointer to a buffer of the size MAXCOMLINESTRG should be supplied in
     111 * A pointer to a buffer of the size MaxComLineStrg should be supplied in
    108112 * pszWorkBuf. This is where the quoted etc as necessary command
    109113 * line string will be returned.
     
    112116PCSZ NormalizeCmdLine(PSZ pszWorkBuf, PSZ pszCmdLine_)
    113117{
    114   char szCmdLine[MAXCOMLINESTRG], szArgs[MAXCOMLINESTRG];
     118  char *szCmdLine, *szArgs;
    115119  char *offset = '\0', *offsetexe, *offsetcom, *offsetcmd, *offsetbtm, *offsetbat;
    116120  APIRET ret;
     
    123127  PSZ pszNewCmdLine = pszWorkBuf;
    124128
     129  szCmdLine = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__);
     130  if (!szCmdLine)
     131    return pszCmdLine_; //already complained
     132  szArgs = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__);
     133  if (!szArgs) {
     134    xfree(szCmdLine);
     135    return pszCmdLine_; //already complained
     136  }
    125137  bstrip(pszCmdLine_);
    126   memset(pszWorkBuf, 0, MAXCOMLINESTRG);
     138  memset(pszWorkBuf, 0, MaxComLineStrg);
    127139  strcpy(szCmdLine, pszCmdLine_);
    128140  if (szCmdLine[0] != '\0') {
     
    317329    }
    318330  }
     331  xfree(szArgs);
     332  xfree(szCmdLine);
    319333  return pszWorkBuf;
    320334}
  • trunk/dll/pathutil.h

    r920 r985  
    1010
    1111  05 Jan 08 SHL Move from fm3dll.h to here
     12  29 Feb 08 GKY Changes to enable user settable command line length
    1213
    1314***********************************************************************/
     
    2728PCSZ NormalizeCmdLine(PSZ pszWorkBuf, PSZ pszCmdLine_);
    2829
     30#define MAXCOMLINESTRGDEFAULT (2048)                    /* used to build command line strings */
     31#define CMDLNLNGTH_MIN (299)
     32#define CMDLNLNGTH_MAX (32768)
     33
     34#ifdef DEFINE_GLOBALS
     35#define DATADEF
     36#else
     37#define DATADEF extern
     38#endif
     39
     40DATADEF ULONG MaxComLineStrg;
     41
    2942#endif // PATHUTIL_H
  • trunk/dll/presparm.c

    r928 r985  
    1313  22 Nov 07 GKY Use CopyPresParams to fix presparam inconsistencies in menus
    1414  10 Dec 07 GKY Updated CopyPresParams to copy all parameter types
     15  29 Feb 08 GKY Use xfree where appropriate
    1516
    1617***********************************************************************/
     
    307308                        appname, tagname, ppresparams, ppresparams->cb + 4);
    308309
    309   free(ppresparams);
     310  xfree(ppresparams);
    310311}
    311312
  • trunk/dll/remap.c

    r907 r985  
    1313  31 Aug 06 SHL Use _fsopen to avoid noise complaints
    1414  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
     15  29 Feb 08 GKY Use xfree where appropriate
    1516
    1617***********************************************************************/
     
    8384          info->res = xstrdup(s, pszSrcFile, __LINE__);
    8485          if (!info->res)
    85             free(info);
     86            xfree(info);
    8687          else {
    8788            x++;
     
    151152    info->res = xstrdup(res, pszSrcFile, __LINE__);
    152153    if (!info->res)
    153       free(info);
     154      xfree(info);
    154155    else {
    155156      info->next = NULL;
     
    161162        info = reshead;
    162163        reshead = reshead->next;
    163         free(info);
     164        xfree(info);
    164165      }
    165166      return TRUE;
     
    184185      else
    185186        reshead = info->next;
    186       free(info->res);
    187       free(info);
     187      xfree(info->res);
     188      xfree(info);
    188189      return TRUE;
    189190    }
     
    201202  while (info) {
    202203    next = info->next;
    203     free(info->res);
    204     free(info);
     204    xfree(info->res);
     205    xfree(info);
    205206    info = next;
    206207  }
     
    439440                   "%s", GetPString(IDS_CANTSTARTNETUSETEXT));
    440441          if (!mp2 || (ULONG) mp2 == 1041 || info->failedonce)
    441             free(info);
     442            xfree(info);
    442443          break;
    443444        }
     
    728729      while (info) {
    729730        next = info->next;
    730         free(info);
     731        xfree(info);
    731732        info = next;
    732733      }
  • trunk/dll/saveclip.c

    r957 r985  
    2222  30 Dec 07 GKY Use CommaFmtULL
    2323  16 Feb 08 GKY Changed _fsopen flag so a new list file can be created
     24  29 Feb 08 GKY Use xfree where appropriate
    2425
    2526***********************************************************************/
     
    186187          p = strchr(pp, '\n');
    187188      }
    188       free(text);
     189      xfree(text);
    189190    }
    190191  }
     
    839840                        subject[1023] = 0;
    840841                      }
    841                       free(pfealist);
     842                      xfree(pfealist);
    842843                    }
    843                     free(pgealist);
     844                    xfree(pgealist);
    844845                  }
    845846                }
     
    882883                        longname[CCHMAXPATHCOMP - 1] = 0;
    883884                      }
    884                       free(pfealist);
     885                      xfree(pfealist);
    885886                    }
    886                     free(pgealist);
     887                    xfree(pgealist);
    887888                  }
    888889                }
  • trunk/dll/seeall.c

    r961 r985  
    3434  30 Dec 07 GKY Use TestFDates for comparing by date
    3535  15 Feb 08 GKY Prevent trap on scan of drive containing files that exceed maxpath
     36  29 Feb 08 GKY Use xfree where appropriate
     37  29 Feb 08 GKY Refactor global command line variables to notebook.h
    3638
    3739***********************************************************************/
     
    5456#include "errutil.h"                    // Dos_Error...
    5557#include "strutil.h"                    // GetPString
     58#include "notebook.h"                   // targetdirectory
    5659#include "fm3dll.h"
    5760
     
    13001303  if (ad->afhead && ad->afheadcnt) {
    13011304    for (x = 0; x < ad->afheadcnt; x++) {
    1302       if (ad->afhead[x].fullname)
    1303         free(ad->afhead[x].fullname);
    1304     }
    1305     free(ad->afhead);
     1305      xfree(ad->afhead[x].fullname);
     1306    }
     1307    xfree(ad->afhead);
    13061308    ad->afhead = NULL;
    1307     if (ad->afindex)
    1308       free(ad->afindex);
     1309    xfree(ad->afindex);
    13091310    ad->afindex = NULL;
    13101311  }
     
    18601861          pAD->ullSelectedBytes -= pAD->afhead[y].cbFile;
    18611862        }
    1862         free(pAD->afhead[y].fullname);
     1863        xfree(pAD->afhead[y].fullname);
    18631864      }
    18641865      memmove(&(pAD->afhead[x]), &(pAD->afhead[y]),
     
    19191920  pffbArray = xmalloc(ulBufBytes, pszSrcFile, __LINE__);
    19201921  if (!pffbArray) {
    1921     free(filename);
     1922    xfree(filename);
    19221923    return;
    19231924  }
     
    19571958            // Complain if pathnames exceeds max
    19581959            DosFindClose(hdir);
    1959             free(pffbArray);
    1960             free(filename);
     1960            xfree(pffbArray);
     1961            xfree(filename);
    19611962            if (!fDone) {
    19621963              fDone = TRUE;
     
    20252026  }
    20262027
    2027   free(pffbArray);
    2028   free(filename);
     2028  xfree(pffbArray);
     2029  xfree(filename);
    20292030}
    20302031
     
    42664267      }
    42674268      FreeAllFilesList(hwnd);
    4268       free(pAD);
     4269      xfree(pAD);
    42694270    }
    42704271    break;
     
    43234324#pragma alloc_text(SEEALL,InitWindow,PaintLine,SeeAllWndProc)
    43244325#pragma alloc_text(SEEALL,UpdateList,CollectList,ReSort,Mark)
    4325 #pragma alloc_text(SEEALL,BuildAList,RemoveDeleted,SeeFrameWndProc,FilterList)
     4326#pragma alloc_text(SEEALL,BuildAList,RemoveDeleted,SeeFrameWndProc,FilterList,FilterAll)
    43264327#pragma alloc_text(SEEALL2,SeeObjWndProc,MakeSeeObjWinThread,FindDupesThread,DupeDlgProc)
    43274328#pragma alloc_text(SEEALL3,FreeAllFilesList,DoADir,FindAllThread,AFDrvsWndProc)
  • trunk/dll/select.c

    r924 r985  
    2929  26 Aug 07 GKY DosSleep(1) in loops changed to (0)
    3030  12 Jan 08 SHL Localize SpecialSelect in comp.c
     31  29 Feb 08 GKY Use xfree where appropriate
    3132
    3233***********************************************************************/
     
    257258            fclose(inputFile);
    258259          }
    259           free(input);
     260          xfree(input);
    260261          DosSleep(1);
    261262        }
     
    360361            fclose(inputFile);
    361362          }
    362           free(input);
     363          xfree(input);
    363364          DosSleep(1);
    364365        }
     
    611612
    612613  for (z = 0; z < numw; z++) {
    613     if (Cnrs[z].ss)
    614       free(Cnrs[z].ss);
    615   }
    616   free(Cnrs);
     614    xfree(Cnrs[z].ss);
     615  }
     616  xfree(Cnrs);
    617617  DosPostEventSem(CompactSem);
    618618}
  • trunk/dll/seticon.c

    r907 r985  
    1212  22 Mar 06 GKY Use QWL_USER
    1313  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
     14  29 Feb 08 GKY Use xfree where appropriate
    1415
    1516***********************************************************************/
     
    9293          Win_Error(hwnd, hwnd, pszSrcFile, __LINE__, "WinSetSysPointerData");
    9394        }
    94         if (buff)
    95           free(buff);
     95        xfree(buff);
    9696      }
    9797      WinDismissDlg(hwnd, 1);
  • trunk/dll/shadow.c

    r907 r985  
    1313  06 Aug 07 SHL Use BldFullPathName
    1414  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
     15  29 Feb 08 GKY Use xfree where appropriate
    1516
    1617***********************************************************************/
     
    5657              (path) ? ";STARTUPDIR=" : "", (path) ? path : "", objtitle);
    5758      WinSetObjectData(obj, s);
    58       free(s);
     59      xfree(s);
    5960    }
    6061  }
     
    157158                          objtitle,
    158159                          s, (location) ? location : cnr, CO_FAILIFEXISTS);
    159     free(s);
     160    xfree(s);
    160161  }
    161162  return obj;
  • trunk/dll/subj.c

    r907 r985  
    1414  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
    1515  01 Sep 07 GKY Use xDosSetPathInfo to fix case where FS3 buffer crosses 64k boundry
     16  29 Feb 08 GKY Use xfree where appropriate
    1617
    1718***********************************************************************/
     
    5657    pfealist = xmallocz(1024, pszSrcFile, __LINE__);
    5758    if (pfealist)
    58       free(pgealist);
     59    xfree(pgealist);
    5960    else {
    6061      pfealist->cbList = 1024;
     
    6465      rc = DosQueryPathInfo(filename, FIL_QUERYEASFROMLIST,
    6566                            (PVOID) & eaop, (ULONG) sizeof(EAOP2));
    66       free(pgealist);
     67      xfree(pgealist);
    6768      if (!rc) {
    6869        pfea = &eaop.fpFEA2List->list[0];
     
    7374        subject[1023] = 0;
    7475      }
    75       free(pfealist);
     76      xfree(pfealist);
    7677      if (rc == ERROR_SHARING_VIOLATION || rc == ERROR_ACCESS_DENIED) {
    7778        saymsg(MB_CANCEL,
  • trunk/dll/systemf.c

    r920 r985  
    2020  06 Aug 07 GKY Reduce DosSleep times (ticket 148)
    2121  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
     22  29 Feb 08 GKY Use xfree where appropriate
     23  29 Feb 08 GKY Changes to enable user settable command line length
     24  29 Feb 08 GKY Refactor global command line variables to notebook.h
    2225
    2326***********************************************************************/
     
    3740#include "errutil.h"                    // Dos_Error...
    3841#include "strutil.h"                    // GetPString
     42#include "notebook.h"                   //targetdirectory
    3943#include "pathutil.h"
    4044#include "fm3dll.h"
     
    8084  /* executes the command once for all files in list */
    8185
    82   char path[CCHMAXPATH], commandline[MAXCOMLINESTRG], modpath[CCHMAXPATH], listfile[CCHMAXPATH],
     86  char path[CCHMAXPATH], *commandline, modpath[CCHMAXPATH], listfile[CCHMAXPATH],
    8387       *p, *pp, drive, *file, *ext, *dot;
    8488  register int x;
     
    8993    return -1;
    9094  }
     95  commandline = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__);
     96  if (!commandline)
     97    return -1; //already complained
    9198  *listfile = 0;
    9299  bstrip(command);
     
    590597      ret = WinDlgBox(HWND_DESKTOP, hwnd, CmdLineDlgProc, FM3ModHandle,
    591598                      EXEC_FRAME, &ex);
    592       if (ret != 1)
    593         return (ret == 0) ? -1 : -2;
     599      if (ret != 1) {
     600        xfree(commandline);
     601        return (ret == 0) ? -1 : -2;
     602      }
    594603    }
    595604    else
     
    673682
    674683  rc = DosAllocMem((PVOID)&pszPgm,
    675                    MAXCOMLINESTRG,
     684                   MaxComLineStrg,
    676685                   PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
    677686  if (rc) {
     
    718727      if (temp) {
    719728        rc = DosAllocMem((PVOID)&pszArgs,
    720                          MAXCOMLINESTRG * 2,
     729                         MaxComLineStrg * 2,
    721730                         PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
    722731        if (rc)
     
    851860      if (~type & FULLSCREEN)
    852861        type |= WINDOWED;
    853       rc = DosAllocMem((PVOID) & pszArgs, MAXCOMLINESTRG * 2,
     862      rc = DosAllocMem((PVOID) & pszArgs, MaxComLineStrg * 2,
    854863                       PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
    855864      if (rc) {
     
    12341243    ulOptions |= SAF_STARTCHILDAPP;
    12351244
    1236   executable = xmallocz(MAXCOMLINESTRG, pszSrcFile, __LINE__);
     1245  executable = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__);
    12371246  if (executable) {
    12381247    va_start(parguments, formatstring);
     
    12411250    strip_lead_char(" \t", executable);
    12421251    if (*executable) {
    1243       parameters = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__);
     1252      parameters = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__);
    12441253      if (parameters) {
    12451254        p = executable;
     
    12931302              strcpy(executable, GetCmdSpec(FALSE));
    12941303            }
    1295             free(temp);
     1304            xfree(temp);
    12961305          }
    12971306        }
     
    13071316        pgd.swpInitial.hwndInsertBehind = HWND_TOP;
    13081317        happ = WinStartApp(hwndNotify, &pgd, NULL, NULL, ulOptions);
    1309         free(parameters);
     1318        xfree(parameters);
    13101319      }
    13111320    }
    1312     free(executable);
     1321    xfree(executable);
    13131322  }
    13141323  return happ;
  • trunk/dll/tools.c

    r907 r985  
    1717  05 Sep 06 SHL Sync with standard source formatting
    1818  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
     19  29 Feb 08 GKY Use xfree where appropriate
    1920
    2021***********************************************************************/
     
    5152  qtloaded = TRUE;
    5253  for (x = 0; x < 50 && quicktool[x]; x++) {
    53     free(quicktool[x]);
     54    xfree(quicktool[x]);
    5455    quicktool[x] = NULL;
    5556  }
     
    265266        if (prev)
    266267          prev->next = info->next;
    267         if (info->help)
    268           free(info->help);
    269         if (info->text)
    270           free(info->text);
    271         free(info);
     268        xfree(info->help);
     269        xfree(info->text);
     270        xfree(info);
    272271        fToolsChanged = TRUE;
    273272        break;
     
    365364  while (tool) {
    366365    next = tool->next;
    367     if (tool->help)
    368       free(tool->help);
    369     if (tool->text)
    370       free(tool->text);
    371     free(tool);
     366    xfree(tool->help);
     367    xfree(tool->text);
     368    xfree(tool);
    372369    tool = next;
    373370  }
     
    716713        if (tool) {                     /* just editing strings... */
    717714          istext = ((tool->flags & T_TEXT) != 0);
    718           if (tool->help)
    719             free(tool->help);
     715          xfree(tool->help);
    720716          tool->help = NULL;
    721           if (tool->text)
    722             free(tool->text);
     717          xfree(tool->text);
    723718          tool->text = NULL;
    724719          if (*help)
  • trunk/dll/treecnr.c

    r954 r985  
    4646  15 Feb 08 SHL Sync with settings menu rework
    4747  15 Feb 08 SHL Avoid death if tree container 0 width
     48  29 Feb 08 GKY Use xfree where appropriate
    4849
    4950***********************************************************************/
     
    565566          fTopDir = temptop;
    566567      }
    567       free((CHAR *) mp1);
     568      xfree((CHAR *) mp1);
    568569    }
    569570    return 0;
     
    797798            Runtime_Error(pszSrcFile, __LINE__,
    798799                          GetPString(IDS_COULDNTSTARTTHREADTEXT));
    799             free(wk);
     800            xfree(wk);
    800801            FreeListInfo((LISTINFO *) mp1);
    801802          }
     
    828829            Runtime_Error(pszSrcFile, __LINE__,
    829830                          GetPString(IDS_COULDNTSTARTTHREADTEXT));
    830             free(wk);
     831            xfree(wk);
    831832            FreeListInfo((LISTINFO *) mp1);
    832833          }
     
    846847      WinSendMsg(dcd->hwndCnr,
    847848                 UM_CLOSE, MPFROMLONG(dcd->dontclose != FALSE), MPVOID);
    848       free(dcd);
     849      xfree(dcd);
    849850    }
    850851    DosPostEventSem(CompactSem);
     
    17171718      if (dir) {
    17181719        if (!PostMsg(dcd->hwndObject, UM_SHOWME, MPFROMP(dir), MPVOID))
    1719           free(dir);
     1720          xfree(dir);
    17201721      }
    17211722    }
     
    21572158      ret = StartMLEEditor(dcd->hwndParent, (INT) mp1, (CHAR *) mp2,
    21582159                           dcd->hwndFrame);
    2159       if (mp2)
    2160         free((CHAR *) mp2);
     2160      xfree((CHAR *) mp2);
    21612161      return MRFROMLONG(ret);
    21622162    }
     
    22272227          if (apptail == info)
    22282228            apptail = info->prev;
    2229           free(info);
     2229          xfree(info);
    22302230          break;
    22312231        }
     
    27482748            li->list = BuildList(hwnd);
    27492749            if (!li->list || !li->list[0]) {
    2750               free(li);
     2750              xfree(li);
    27512751              break;
    27522752            }
     
    29162916      while (info) {
    29172917        next = info->next;
    2918         free(info);
     2918        xfree(info);
    29192919        info = next;
    29202920      }
     
    30543054                   IDS_WINCREATEWINDOW);
    30553055        PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID);
    3056         free(dcd);
     3056        xfree(dcd);
    30573057        hwndFrame = (HWND) 0;
    30583058      }
  • trunk/dll/undel.c

    r907 r985  
    1414  06 Aug 07 GKY Reduce DosSleep times (ticket 148)
    1515  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
     16  29 Feb 08 GKY Use xfree where appropriate
    1617
    1718***********************************************************************/
     
    146147  }
    147148  DosForceDelete("$UDELETE.#$#");
    148   if (undelinfo)
    149     free(undelinfo);
     149  xfree(undelinfo);
    150150  if (thmq) {
    151151    PostMsg(hwnd, UM_CONTAINER_FILLED, MPVOID, MPVOID);
     
    221221          Runtime_Error(pszSrcFile, __LINE__,
    222222                        GetPString(IDS_COULDNTSTARTTHREADTEXT));
    223           free(undelinfo);
     223          xfree(undelinfo);
    224224          listdone = TRUE;
    225225          WinDismissDlg(hwnd, 0);
  • trunk/dll/update.c

    r907 r985  
    1919  02 Aug 07 SHL Sync with CNRITEM mods
    2020  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
     21  29 Feb 08 GKY Use xfree where appropriate
    2122
    2223***********************************************************************/
     
    642643  PostMsg(hwndCnr, UM_RESCAN, MPVOID, MPVOID);
    643644  if (pciList) {
    644     free(pciList);
     645    xfree(pciList);
    645646    DosPostEventSem(CompactSem);
    646647  }
  • trunk/dll/viewer.c

    r907 r985  
    1616  26 Nov 07 GKY Allow open of readonly files in the editor with warning
    1717  26 Nov 07 GKY Add "Save as" menu option to editor
     18  29 Feb 08 GKY Use xfree where appropriate
     19  29 Feb 08 GKY Refactor global command line variables to notebook.h
    1820
    1921***********************************************************************/
     
    3234#include "errutil.h"                    // Dos_Error...
    3335#include "strutil.h"                    // GetPString
     36#include "notebook.h"                   // External viewers
    3437#include "fm3dll.h"
    3538
     
    12501253          }
    12511254        }
    1252         free(vw);
     1255        xfree(vw);
    12531256      }
    12541257      if (!dontclose &&
  • trunk/dll/viewinf.c

    r907 r985  
    1414  03 Nov 06 SHL Count thread usage
    1515  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
     16  29 Feb 08 GKY Use xfree where appropriate
    1617
    1718***********************************************************************/
     
    157158            p = strtok(NULL, ";");
    158159          }
    159           free(holdenv);
     160          xfree(holdenv);
    160161        NoEnv:
    161162          if (WinIsWindow(hab2, hwnd) && !repeating) {
     
    173174                  Win_Error(hwnd, hwnd, pszSrcFile, __LINE__,
    174175                            "PrfQueryProfileData");
    175                   free(holdenv);
     176                  xfree(holdenv);
    176177                }
    177178                else
     
    188189    WinTerminate(hab2);
    189190  }
    190   free(dummy);
     191  xfree(dummy);
    191192}
    192193
     
    266267          Runtime_Error(pszSrcFile, __LINE__,
    267268                        GetPString(IDS_COULDNTSTARTTHREADTEXT));
    268           free(d);
     269          xfree(d);
    269270          WinDismissDlg(hwnd, 0);
    270271          return 0;
  • trunk/dll/walkem.c

    r966 r985  
    2525  20 Jan 08 GKY Walk & walk2 dialogs now save and restore size and position
    2626  19 Feb 08 JBS Add "State at last FM/2 close" to the states combo box
     27  29 Feb 08 GKY Use xfree where appropriate
     28  29 Feb 08 GKY Refactor global command line variables to notebook.h
    2729
    2830***********************************************************************/
     
    4345#include "errutil.h"                    // Dos_Error...
    4446#include "strutil.h"                    // GetPString
     47#include "notebook.h"                   // targetdirectory
    4548#include "fm3dll.h"
    4649
     
    337340          info->path = xstrdup(s, pszSrcFile, __LINE__);
    338341          if (!info->path)
    339             free(info);
     342            xfree(info);
    340343          else {
    341344            info->next = NULL;
     
    430433            else
    431434              ldirhead = info->next;
    432             free(info->path);
    433             free(info);
     435            xfree(info->path);
     436            xfree(info);
    434437            break;
    435438          }
     
    443446        info->path = xstrdup(path, pszSrcFile, __LINE__);
    444447        if (!info->path)
    445           free(info);
     448          xfree(info);
    446449        else {
    447450          info->next = NULL;
     
    484487        else
    485488          udirhead = info->next;
    486         free(info->path);
    487         free(info);
     489        xfree(info->path);
     490        xfree(info);
    488491        fUdirsChanged = TRUE;
    489492        return TRUE;
     
    501504        else
    502505          ldirhead = info->next;
    503         free(info->path);
    504         free(info);
     506        xfree(info->path);
     507        xfree(info);
    505508        return TRUE;
    506509      }
     
    525528        else
    526529          ldirhead = info->next;
    527         free(info->path);
    528         free(info);
     530        xfree(info->path);
     531        xfree(info);
    529532        return TRUE;
    530533      }
     
    11951198      if (wa->changed)
    11961199        WinSendMsg(hwnd, UM_SETUP3, MPVOID, MPVOID);
    1197       free(wa);
     1200      xfree(wa);
    11981201      WinDismissDlg(hwnd, 0);
    11991202      break;
  • trunk/dll/winlist.c

    r907 r985  
    1212  22 Jul 06 SHL Check more run time errors
    1313  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
     14  29 Feb 08 GKY Use xfree where appropriate
    1415
    1516***********************************************************************/
     
    119120            y++;
    120121          }
    121           free(pswb);
     122          xfree(pswb);
    122123          DosPostEventSem(CompactSem);
    123124        }
  • trunk/dll/worker.c

    r907 r985  
    2424  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
    2525  26 Aug 07 SHL Revert to DosSleep(0)
     26  29 Feb 08 GKY Use xfree where appropriate
     27  29 Feb 08 GKY Refactor global command line variables to notebook.h
    2628
    2729***********************************************************************/
     
    4749#include "errutil.h"                    // Dos_Error...
    4850#include "strutil.h"                    // GetPString
     51#include "notebook.h"                   // External viewers
    4952#include "fm3dll.h"
    5053
     
    9598                            GetPString(IDS_COULDNTSTARTTHREADTEXT));
    9699              FreeListInfo(wk->li);
    97               free(wk);
     100              xfree(wk);
    98101            }
    99102          }
     
    253256                    if (!PostMsg(Collector,
    254257                                 UM_COLLECTFROMFILE, MPFROMP(temp), MPVOID))
    255                       free(temp);
     258                      xfree(temp);
    256259                  }
    257260                }
     
    961964    if (wk->li)
    962965      FreeListInfo(wk->li);
    963     free(wk);
     966    xfree(wk);
    964967    DosPostEventSem(CompactSem);
    965968  }
     
    11161119              for (x = 0; wk->li->list[x]; x++) {
    11171120                strcpy(p, wk->li->list[x]);
    1118                 free(wk->li->list[x]);
     1121                xfree(wk->li->list[x]);
    11191122                wk->li->list[x] = xstrdup(szBuffer, pszSrcFile, __LINE__);
    11201123              }
     
    12961299                               UM_LOADFILE,
    12971300                               MPFROMLONG(5 + viewtype), MPFROMP(temp)))
    1298                     free(temp);
     1301                    xfree(temp);
    12991302                }
    13001303                DosSleep(1);
     
    13411344                               UM_LOADFILE,
    13421345                               MPFROMLONG(4 + viewtype), MPFROMP(temp)))
    1343                     free(temp);
     1346                    xfree(temp);
    13441347                }
    13451348                DosSleep(1);
     
    16041607    if (wk->li)
    16051608      FreeListInfo(wk->li);
    1606     free(wk);
     1609    xfree(wk);
    16071610    DosPostEventSem(CompactSem);
    16081611  }
Note: See TracChangeset for help on using the changeset viewer.