Changeset 1438


Ignore:
Timestamp:
Jun 28, 2009, 10:47:00 PM (16 years ago)
Author:
Gregg Young
Message:

Improved drivebar changes; Added AddBackslashToPath() to remove repeatative code. replaced "
" with PCSZ variable; ANY_OBJ added the DosAlloc... (experimental)

Location:
trunk/dll
Files:
49 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/arccnrs.c

    r1413 r1438  
    36613661          strcpy(dcd->workdir, pFM2SaveDirectory);
    36623662        MakeTempName(dcd->workdir, ArcTempRoot, 2);
    3663 #if 0 // 06 Sep 08 SHL fixme to be gone
    3664         if (dcd->workdir[strlen(dcd->workdir) - 1] != '\\')
    3665             strcat(dcd->workdir, "\\");
    3666           sprintf(dcd->workdir + strlen(dcd->workdir), "%s.%03x",
    3667                   ArcTempRoot, (clock() & 4095));
    3668         else
    3669           sprintf(dcd->workdir, "%s.%03x",
    3670                   ArcTempRoot, (clock() & 4095));
    3671 #endif // 06 Sep 08 SHL fixme to be gone
    36723663        strcpy(dcd->arcname, fullname);
    36733664        if (*extractpath) {
  • trunk/dll/autoview.c

    r1400 r1438  
    136136  }
    137137
    138   rc = DosAllocMem((PPVOID) & pfealist, ealen, PAG_COMMIT | PAG_READ |
    139                    PAG_WRITE | OBJ_TILE);
     138  rc = xDosAllocMem((PPVOID) & pfealist, ealen, PAG_COMMIT | PAG_READ |
     139                    PAG_WRITE | OBJ_TILE);
    140140  if (rc || !pfealist)
    141141    Dos_Error(MB_CANCEL, rc, hwnd, pszSrcFile, __LINE__,
     
    329329    stopflag--;
    330330    if (fAutoView) {
    331       WinSetWindowText((fComments) ? hwndAutoMLE : hwndAutoview, "");
     331      WinSetWindowText((fComments) ? hwndAutoMLE : hwndAutoview, NullStr);
    332332      MLEsetreadonly(hwndAutoMLE, TRUE);
    333333      MLEsetchanged(hwndAutoMLE, FALSE);
     
    394394                      if (info) {
    395395                        sprintf(p, "**%s%s%s\n",
    396                                 info->id ? info->id : "",
    397                                 info->id ? " " : "",
     396                                info->id ? info->id : NullStr,
     397                                info->id ? " " : NullStr,
    398398                                GetPString(IDS_ARCHIVETEXT));
    399399                        p += strlen(p);
     
    511511                            "%s%-*.*s  %-8s  [%s%s%s%s]  %s "
    512512                              "%02lu%s%02lu%s%02lu\r",
    513                             pffbFile->attrFile & FILE_DIRECTORY ? "\\" : " ",
     513                            pffbFile->attrFile & FILE_DIRECTORY ? PCSZ_BACKSLASH : " ",
    514514                            ml,
    515515                            ml,
  • trunk/dll/avl.c

    r1402 r1438  
    650650          ditem.hstrType = DrgAddStrHandle(DRT_UNKNOWN);
    651651          ditem.hstrRMF = DrgAddStrHandle(DRMDRF_LBOX);
    652           ditem.hstrContainerName = DrgAddStrHandle("");
    653           ditem.hstrSourceName = DrgAddStrHandle("");
    654           ditem.hstrTargetName = DrgAddStrHandle("");
     652          ditem.hstrContainerName = DrgAddStrHandle(NullStr);
     653          ditem.hstrSourceName = DrgAddStrHandle(NullStr);
     654          ditem.hstrTargetName = DrgAddStrHandle(NullStr);
    655655          // ditem.fsControl = 0;
    656656          ditem.fsSupportedOps = DO_MOVEABLE;
  • trunk/dll/cmdline.c

    r1398 r1438  
    2020  19 Jul 08 GKY Replace save_dir2(dir) with pFM2SaveDirectory and use BldFullPathName
    2121  24 Aug 08 GKY Warn full drive on save of .DAT file; prevent loss of existing file
     22  28 Jun 09 GKY Added AddBackslashToPath() to remove repeatative code.
    2223
    2324***********************************************************************/
     
    403404        return 0;
    404405      if (*ex->path) {
    405         strcpy(executable, ex->path);
    406         if (executable[strlen(executable) - 1] != '\\')
    407           strcat(executable, "\\");
     406        strcpy(executable, ex->path);
     407        AddBackslashToPath(executable);
     408        //if (executable[strlen(executable) - 1] != '\\')
     409        //  strcat(executable, "\\");
    408410      }
    409411      else
  • trunk/dll/common.c

    r1400 r1438  
    518518                             (swp->cy -
    519519                              WinQuerySysValue(HWND_DESKTOP,
    520                                                SV_CYSIZEBORDER)) - 30,
     520                                               SV_CYSIZEBORDER)) -
     521                             (DRIVE_BUTTON_HEIGHT),
    521522                             swp->cx -
    522523                             (WinQuerySysValue(HWND_DESKTOP,
    523524                                               SV_CXSIZEBORDER) * 2),
    524                              30,
     525                             DRIVE_BUTTON_HEIGHT,
    525526                             hwndFrame, HWND_TOP, MAIN_DRIVES, NULL, NULL);
    526527
     
    859860            (*s) ? s : NullStr, (*s) ? " " : NullStr,
    860861            directory,
    861             (directory[strlen(directory) - 1] == '\\') ? "\\" : NullStr);
     862            (directory[strlen(directory) - 1] == '\\') ? PCSZ_BACKSLASH : NullStr);
    862863  }
    863864  return hwndDir;
  • trunk/dll/comp.c

    r1409 r1438  
    6666  08 Mar 09 GKY Additional strings move to PCSZs in init.c & String Table
    6767  15 Mar 09 GKY Use WriteDetailsSwitchs to save detail switch changes to the ini file.
     68  28 Jun 09 GKY Added AddBackslashToPath() to remove repeatative code.
    6869
    6970***********************************************************************/
     
    28992900            strcpy(ofile, cmp->rightdir);
    29002901          else
    2901             strcpy(ofile, cmp->leftdir);
    2902           if (ofile[strlen(ofile) - 1] != '\\')
    2903             strcat(ofile, "\\");
     2902            strcpy(ofile, cmp->leftdir);
     2903          AddBackslashToPath(ofile);
     2904          //if (ofile[strlen(ofile) - 1] != '\\')
     2905          //  strcat(ofile, "\\");
    29042906          strcat(ofile, pci->pszDisplayName);
    29052907          if (*compare) {
  • trunk/dll/copyf.c

    r1402 r1438  
    2121  19 Jul 08 GKY Modify MakeTempName for use making temp directory names
    2222  08 Mar 09 GKY Removed variable aurguments from docopyf and unlinkf (not used)
     23  28 Jun 09 GKY Added AddBackslashToPath() to remove repeatative code.
    2324
    2425***********************************************************************/
     
    5051#include "wrappers.h"                   // xDosSetPathInfo
    5152#include "strips.h"                     // bstrip
    52 #include "fortify.h"
     53#include "fortify.h"                   
     54#include "pathutil.h"                   // AddBackslashToPath
    5355
    5456static PSZ pszSrcFile = __FILE__;
     
    7577  char *p, *o;
    7678
    77   if (strlen(buffer) > 3 && buffer[strlen(buffer) - 1] != '\\')
    78     strcat(buffer, "\\");
     79
     80  if (strlen(buffer) > 3) // && buffer[strlen(buffer) - 1] != '\\')
     81    AddBackslashToPath(buffer);
     82    //strcat(buffer, "\\");
    7983  p = o = buffer + strlen(buffer);
    8084  switch (type) {
     
    282286BOOL ZapLongName(char *filename)
    283287{
    284   return WriteLongName(filename, "");
     288  return WriteLongName(filename, NullStr);
    285289}
    286290
     
    308312  else
    309313    ealen = sizeof(FEALIST) + 10;
    310   rc = DosAllocMem((PPVOID) & pfealist,
    311                    ealen + 32L, OBJ_TILE | PAG_COMMIT | PAG_READ | PAG_WRITE);
     314  rc = xDosAllocMem((PPVOID) & pfealist,
     315                    ealen + 32L, OBJ_TILE | PAG_COMMIT | PAG_READ | PAG_WRITE);
    312316  if (rc)
    313317    Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
     
    536540      if (IsFile(newname) != -1 && stricmp(oldname, newname)) {
    537541        strcpy(dir, newname);
    538         p = strrchr(dir, '\\');
    539         if (p)
    540           *p = 0;
    541         strcat(dir, "\\");
     542        AddBackslashToPath(dir);
     543        //p = strrchr(dir, '\\');
     544        //if (p)
     545        //  *p = 0;
     546        //strcat(dir, "\\");
    542547        MakeTempName(dir, NULL, 0);
    543548        if (DosMove(newname, dir))
  • trunk/dll/datamin.c

    r1400 r1438  
    852852        APIRET rc;
    853853
    854         rc = DosAllocMem((PVOID)&pbh, USHRT_MAX + 4096,
    855                         PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
     854        rc = xDosAllocMem((PVOID)&pbh, USHRT_MAX + 4096,
     855                          PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
    856856        if (rc)
    857857          Dos_Error(MB_CANCEL, rc, hwnd, pszSrcFile, __LINE__,
     
    891891        APIRET rc;
    892892
    893         rc = DosAllocMem((PVOID) & pbh, USHRT_MAX + 4096,
    894                          PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
     893        rc = xDosAllocMem((PVOID) & pbh, USHRT_MAX + 4096,
     894                          PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
    895895        if (rc)
    896896          Dos_Error(MB_CANCEL, rc, hwnd, pszSrcFile, __LINE__,
  • trunk/dll/dircnrs.c

    r1412 r1438  
    6464  29 Mar 09 SHL Keep more keys away from PM if extended search in progress
    6565  29 Mar 09 SHL Increase extended search timeout to 3 seconds
     66  28 Jun 09 GKY Added AddBackslashToPath() to remove repeatative code.
    6667
    6768***********************************************************************/
     
    141142#include "fortify.h"
    142143#include "excputil.h"                   // 06 May 08 SHL added
     144#include "pathutil.h"                   // AddBackslashToPath
    143145
    144146// Data definitions
     
    18151817              PCNRITEM pci;
    18161818
    1817               strcpy(newfile, dcd->directory);
    1818               if (newfile[strlen(newfile) - 1] != '\\')
    1819                 strcat(newfile, "\\");
     1819              strcpy(newfile, dcd->directory);
     1820              AddBackslashToPath(newfile);
     1821              //if (newfile[strlen(newfile) - 1] != '\\')
     1822              //  strcat(newfile, "\\");
    18201823              strcat(newfile, sip.ret);
    18211824              test = IsFile(newfile);
     
    24402443          CHAR tempname1[CCHMAXPATH], tempname2[CCHMAXPATH];
    24412444
    2442           strcpy(tempname1, dcd->directory);
    2443           if (tempname1[strlen(tempname1) - 1] != '\\')
    2444             strcat(tempname1, "\\");
     2445          strcpy(tempname1, dcd->directory);
     2446          AddBackslashToPath(tempname1);
     2447          //if (tempname1[strlen(tempname1) - 1] != '\\')
     2448          //  strcat(tempname1, "\\");
    24452449          strcat(tempname1, "..");
    24462450          DosError(FERR_DISABLEHARDERR);
  • trunk/dll/dirs.c

    r1346 r1438  
    8989      if ((CHAR) ((CHAR) curdrive + '@') != (CHAR) toupper(*HomePath) &&
    9090          (CHAR) ((CHAR) curdrive + '@') != (CHAR) toupper(*path))
    91         DosChDir("\\");
     91        DosChDir(PCSZ_BACKSLASH);
    9292    }
    9393    ret = DosSelectDisk(toupper(*path) - '@');
  • trunk/dll/dirsize.c

    r1435 r1438  
    4545  08 Mar 09 GKY Renamed commafmt.h i18nutil.h
    4646  08 Mar 09 GKY Additional strings move to PCSZs in init.c
     47  28 Jun 09 GKY Added AddBackslashToPath() to remove repeatative code.
    4748
    4849***********************************************************************/
     
    8586#include "fortify.h"
    8687#include "excputil.h"                   // xbeginthread
     88#include "pathutil.h"                   // AddBackslashToPath
    8789
    8890typedef struct
     
    151153
    152154  strcpy(maskstr, pszFileName);
    153   if (maskstr[strlen(maskstr) - 1] != '\\')
    154     strcat(maskstr, "\\");
     155  AddBackslashToPath(maskstr);
     156  //if (maskstr[strlen(maskstr) - 1] != '\\')
     157  //  strcat(maskstr, "\\");
    155158  pEndMask = &maskstr[strlen(maskstr)]; // Point after last backslash
    156159  strcat(maskstr, "*");
     
    873876            memset(szTemp, 0, sizeof(szTemp));
    874877            strcpy(szTemp, pci->pszFileName);
    875             strrev(szTemp);
    876             if (*szFileName && *szTemp != '\\')
    877               strcat(szFileName, "\\");
     878            strrev(szTemp);
     879            AddBackslashToPath(szFileName);
     880            //if (*szFileName && *szTemp != '\\')
     881            //  strcat(szFileName, "\\");
    878882            strcat(szFileName, szTemp);
    879883            pci = WinSendDlgItemMsg(hwnd, DSZ_CNR, CM_QUERYRECORD,
     
    951955        else
    952956          strcpy(szFileName, pFM2SaveDirectory);
    953         sprintf(&szFileName[strlen(szFileName)], "\\%csizes.Rpt",
     957        sprintf(&szFileName[strlen(szFileName)], "%s%csizes.Rpt", PCSZ_BACKSLASH,
    954958                (pState) ? toupper(*pState->szDirName) : '+');
    955959        if (export_filename(hwnd, szFileName, FALSE) && *szFileName) {
  • trunk/dll/draglist.c

    r1402 r1438  
    152152        p++;
    153153        strcpy(szFile, p);
    154         strcat(szDir, "\\");
     154        strcat(szDir, PCSZ_BACKSLASH);
    155155      }
    156156      else {
     
    809809          p++;
    810810          strcpy(szFile, p);
    811           strcat(szDir, "\\");
     811          strcat(szDir, PCSZ_BACKSLASH);
    812812        }
    813813        else {
  • trunk/dll/eas.c

    r1402 r1438  
    198198
    199199            ealen = sizeof(FEA2LIST) + strlen(s) + 64;
    200             rc = DosAllocMem((PPVOID) & pfealist, ealen + 1,
    201                              OBJ_TILE | PAG_COMMIT | PAG_READ | PAG_WRITE);
     200            rc = xDosAllocMem((PPVOID) & pfealist, ealen + 1,
     201                              OBJ_TILE | PAG_COMMIT | PAG_READ | PAG_WRITE);
    202202            if (rc)
    203203              Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
     
    10641064  }
    10651065
    1066   rc = DosAllocMem((PPVOID) & pfealist, ealen,
    1067                    OBJ_TILE | PAG_COMMIT | PAG_READ | PAG_WRITE);
     1066  rc = xDosAllocMem((PPVOID) & pfealist, ealen,
     1067                    OBJ_TILE | PAG_COMMIT | PAG_READ | PAG_WRITE);
    10681068  if (rc)
    10691069    Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
  • trunk/dll/filldir.c

    r1435 r1438  
    7070  14 Mar 09 GKY Prevent execution of UM_SHOWME while drive scan is occuring
    7171  06 Jun 09 GKY Add option to show file system type or drive label in tree
     72  28 Jun 09 GKY Added AddBackslashToPath() to remove repeatative code.
    7273
    7374***********************************************************************/
     
    110111#include "excputil.h"                   // xbeginthread
    111112#include "fm3dlg.h"                     // INFO_LABEL
     113#include "pathutil.h"                   // AddBackslashToPath
    112114
    113115VOID StubbyScanThread(VOID * arg);
     
    968970
    969971  PSZ pszFileSpec;
    970   INT t;
     972  //INT t;
    971973  PFILEFINDBUF4L paffbFound;
    972974  PFILEFINDBUF4L *papffbSelected;
     
    983985  ULONG ulReturnFiles = 0;
    984986  ULONGLONG ullReturnBytes = 0;
    985   PCH pchEndPath;
     987  //PCH pchEndPath;
    986988  APIRET rc;
    987989  PCNRITEM pci;
     
    10131015
    10141016  if (paffbFound && papffbSelected && pszFileSpec) {
    1015     t = strlen(szDirBase);
    1016     memcpy(pszFileSpec, szDirBase, t + 1);
    1017     pchEndPath = pszFileSpec + t;
    1018     if (*(pchEndPath - 1) != '\\') {
    1019       memcpy(pchEndPath, "\\", 2);
    1020       pchEndPath++;
    1021     }
    1022     memcpy(pchEndPath, "*", 2);
     1017    //t = strlen(szDirBase);
     1018    strcpy(pszFileSpec, szDirBase);
     1019    AddBackslashToPath(pszFileSpec);
     1020    //pchEndPath = pszFileSpec + t;
     1021    //if (*(pchEndPath - 1) != '\\') {
     1022    //  memcpy(pchEndPath, "\\", 2);
     1023    //  pchEndPath++;
     1024    //}
     1025    strcat(pszFileSpec, "*");
    10231026    DosError(FERR_DISABLEHARDERR);
    10241027    ulFindCnt = ulFindMax;
     
    10331036                       FIL_QUERYEASIZEL);
    10341037    priority_normal();
    1035     *pchEndPath = 0;                    // Chop off wildcard
     1038    pszFileSpec[strlen(pszFileSpec) - 1] = 0;     // Chop off wildcard
     1039    //*pchEndPath = 0;                 
    10361040    if (!rc) {
    10371041      do {
     
    14571461            }
    14581462          }
    1459           if (strcmp(volser.volumelabel, "") != 0 && FSInfo && fShowDriveLabelInTree)
     1463          if (strcmp(volser.volumelabel, NullStr) != 0 && FSInfo && fShowDriveLabelInTree)
    14601464            strcpy(szFSType, volser.volumelabel);
    14611465          pci->rc.flRecordAttr |= CRA_RECORDREADONLY;
  • trunk/dll/fm2cmd.c

    r1402 r1438  
    1010
    1111  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
     12  28 Jun 09 GKY Added AddBackslashToPath() to remove repeatative code.
    1213
    1314***********************************************************************/
     
    3132#include "misc.h"                       // PostMsg
    3233#include "delims.h"                     // skip_delim
     34#include "pathutil.h"                   // AddBackslashToPath
    3335
    3436
     
    5557    if (*name != '\\' && *name != '/') {
    5658      strcpy(temp, directory);
    57       if (directory[strlen(directory) - 1] != '\\')
    58         strcat(temp, "\\");
     59      AddBackslashToPath(directory);
     60      //if (directory[strlen(directory) - 1] != '\\')
     61      //  strcat(temp, "\\");
    5962    }
    6063    else {
  • trunk/dll/fortify.c

    r1078 r1438  
    15711571                }
    15721572
    1573                 sprintf(st_Buffer, "%02x%s", *ptr, ((column % 4) == 3) ? " " : "");
     1573                sprintf(st_Buffer, "%02x%s", *ptr, ((column % 4) == 3) ? " " : NullStr);
    15741574                st_Output(st_Buffer);
    15751575
  • trunk/dll/getnames.c

    r1402 r1438  
    1212  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
    1313  08 Mar 09 GKY Removed variable aurguments from docopyf and unlinkf (not used)
     14  28 Jun 09 GKY Added AddBackslashToPath() to remove repeatative code.
    1415
    1516***********************************************************************/
     
    3839#include "misc.h"                       // PaintRecessedWindow
    3940#include "wrappers.h"                   // xDosFindFirst
     41#include "pathutil.h"                   // AddBackslashToPath
    4042
    4143#pragma data_seg(DATA1)
     
    179181                              MPFROM2SHORT(sSelect,
    180182                                           CCHMAXPATH), MPFROMP(szBuffer));
    181             if (*szBuffer) {
    182               if (szBuffer[strlen(szBuffer) - 1] != '\\')
    183                 strcat(szBuffer, "\\");
     183            if (*szBuffer) {
     184              AddBackslashToPath(szBuffer);
     185              //if (szBuffer[strlen(szBuffer) - 1] != '\\')
     186              //  strcat(szBuffer, "\\");
    184187              *szTemp = 0;
    185188              WinQueryDlgItemText(hwnd, 258, CCHMAXPATH, szTemp);
  • trunk/dll/grep.c

    r1402 r1438  
    3232  07 Feb 09 GKY Allow user to turn off alert and/or error beeps in settings notebook.
    3333  08 Mar 09 GKY Additional strings move to String Table
     34  28 Jun 09 GKY Added AddBackslashToPath() to remove repeatative code.
    3435
    3536***********************************************************************/
     
    475476
    476477  // add a mask to search path
    477   if (searchPath[strlen(searchPath) - 1] != '\\')
    478     strcat(searchPath, "\\");
     478  AddBackslashToPath(searchPath);
     479  //if (searchPath[strlen(searchPath) - 1] != '\\')
     480  //  strcat(searchPath, "\\");
    479481  strcat(searchPath, "*");
    480482  // step through all subdirectories
  • trunk/dll/grep2.c

    r1400 r1438  
    367367          strcpy(simple, p);
    368368        else if (*s) {
    369           strcpy(simple, "\\");
     369          strcpy(simple, PCSZ_BACKSLASH);
    370370          strcat(simple, s);
    371371          *s = 0;
     
    590590              if (s[strlen(s) - 1] != '\\') {
    591591                lLen++;
    592                 strcat(s, "\\");
     592                strcat(s, PCSZ_BACKSLASH);
    593593              }
    594594              rstrip(s);
     
    647647          if (s[strlen(s) - 1] != '\\') {
    648648            lLen++;
    649             strcat(s, "\\");
     649            strcat(s, PCSZ_BACKSLASH);
    650650          }
    651651          rstrip(s);
  • trunk/dll/init.c

    r1436 r1438  
    8080                saved drive containers.
    8181  06 Jun 09 GKY Add option to show file system type or drive label in tree
     82  28 Jun 09 GKY Added AddBackslashToPath() to remove repeatative code.
    8283
    8384***********************************************************************/
     
    281282PCSZ PCSZ_FILLDIRQCURERRTEXT = "DosQCurDisk";
    282283PCSZ PCSZ_NODATA  =  "No Data";
     284PCSZ PCSZ_BACKSLASH     = "\\";
    283285PCSZ PCSZ_STARDOTEXE    =  "*.EXE";
    284286PCSZ PCSZ_STARDOTINI    =  "*.INI";
     
    520522  fcloseall();
    521523  save_dir(s);
    522   if (s[strlen(s) - 1] != '\\')
    523     strcat(s, "\\");
     524  AddBackslashToPath(s);
     525  //if (s[strlen(s) - 1] != '\\')
     526  //  strcat(s, "\\");
    524527  enddir = &s[strlen(s)];
    525528  if (*ArcTempRoot) {
     
    552555  else
    553556    strcpy(s, pFM2SaveDirectory);
    554   if (s[strlen(s) - 1] != '\\')
    555     strcat(s, "\\");
     557  AddBackslashToPath(s);
     558  //if (s[strlen(s) - 1] != '\\')
     559  //  strcat(s, "\\");
    556560  enddir = &s[strlen(s)];
    557561  strcat(s, "$FM2LI$T.");
     
    699703
    700704      strcpy(szTempName, env);
    701       if (szTempName[strlen(szTempName) - 1] != '\\')
    702         strcat(szTempName, "\\");
     705      AddBackslashToPath(szTempName);
     706      //if (szTempName[strlen(szTempName) - 1] != '\\')
     707      //  strcat(szTempName, "\\");
    703708      enddir = &szTempName[strlen(szTempName)];
    704709      strcat(szTempName, "$FM2????.");
  • trunk/dll/init.h

    r1436 r1438  
    107107extern PCSZ PCSZ_FILLDIRQCURERRTEXT;
    108108extern PCSZ PCSZ_NODATA;
     109extern PCSZ PCSZ_BACKSLASH;
    109110extern PCSZ PCSZ_STARDOTEXE;
    110111extern PCSZ PCSZ_STARDOTINI;
  • trunk/dll/instant.c

    r1398 r1438  
    3434#include "systemf.h"                    // runemf2
    3535#include "strips.h"                     // bstrip
     36#include "wrappers.h"                   // xDosAllocMem
     37#include "init.h"                       // Strings
    3638
    3739#pragma data_seg(DATA1)
     
    101103        mem = MLEgetlen(hwndMLE);
    102104        if (mem) {
    103           rc = DosAllocMem((PVOID) & bat, mem,
    104                            PAG_COMMIT | PAG_READ | PAG_WRITE);
     105          rc = xDosAllocMem((PVOID) & bat, mem,
     106                            PAG_COMMIT | PAG_READ | PAG_WRITE);
    105107          if (rc || !bat) {
    106108            Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
     
    132134            else {
    133135              sprintf(s, "%s%sFMTMP%d.CMD", path,
    134                       (path[strlen(path) - 1] == '\\') ? "" : "\\",
     136                      (path[strlen(path) - 1] == '\\') ? NullStr : PCSZ_BACKSLASH,
    135137                      batches++);
    136138              fp = fopen(s, "w");
     
    144146                fprintf(fp, "%s%c:%s\n", rexx, toupper(*path), rexx);
    145147                fprintf(fp, "%sCD \"%s%s\"%s\n", rexx, path,
    146                         (strlen(path) < 3) ? "\\" : "", rexx);
     148                        (strlen(path) < 3) ? PCSZ_BACKSLASH : NullStr, rexx);
    147149                fprintf(fp, "%s", bat);
    148150                fprintf(fp, "\n%sDEL \"%s\"%s\n", rexx, s, rexx);
     
    169171                  GetPString(IDS_INSTANTHELPTITLETEXT),
    170172                  GetPString(IDS_INSTANTHELPTEXT),
    171                   path, (strlen(path) < 3) ? "\\" : "", path,
    172                   (path[strlen(path) - 1] == '\\') ? "" : "\\", batches);
     173                  path, (strlen(path) < 3) ? PCSZ_BACKSLASH : NullStr, path,
     174                  (path[strlen(path) - 1] == '\\') ? NullStr : PCSZ_BACKSLASH, batches);
    173175      if (rc == MBID_YES)
    174176        runemf2(WINDOWED | INVISIBLE | BACKGROUND,
  • trunk/dll/killproc.c

    r1402 r1438  
    116116
    117117  WinSendDlgItemMsg(hwnd, KILL_LISTBOX, LM_DELETEALL, MPVOID, MPVOID);
    118   rc = DosAllocMem((PVOID) & pbh, USHRT_MAX + 4096,
    119                    PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
     118  rc = xDosAllocMem((PVOID) & pbh, USHRT_MAX + 4096,
     119                    PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
    120120  if (rc)
    121121    Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
     
    185185
    186186  WinSendDlgItemMsg(hwnd, KILL_LISTBOX, LM_DELETEALL, MPVOID, MPVOID);
    187   rc = DosAllocMem((PVOID) & pbh, USHRT_MAX + 4096,
    188                    PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
     187  rc = xDosAllocMem((PVOID) & pbh, USHRT_MAX + 4096,
     188                    PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
    189189  if (rc)
    190190    Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
  • trunk/dll/literal.c

    r1416 r1438  
    3535#include "wrappers.h"                   // xmalloc
    3636#include "fortify.h"
     37#include "init.h"                       // Strings
    3738
    3839static PSZ pszSrcFile = __FILE__;
     
    321322        }
    322323        else {
    323           sprintf(pchOut, "\\x%02x", (UCHAR)*pchIn);
     324          sprintf(pchOut, "%sx%02x", PCSZ_BACKSLASH, (UCHAR)*pchIn);
    324325          pchOut += 4;
    325326        }
  • trunk/dll/loadbmp.c

    r1209 r1438  
    4545
    4646  strcpy(s, pFM2SaveDirectory);
    47   sprintf(s + strlen(s), "\\%u.BMP", id);
     47  sprintf(s + strlen(s), "%s%u.BMP", PCSZ_BACKSLASH, id);
    4848  return LoadBitmapFromFile(s);
    4949}
  • trunk/dll/mainwnd.c

    r1436 r1438  
    18911891    {
    18921892      HPS hps;
    1893       POINTL aptl[4] = { 0, 0, DRIVE_BUTTON_WIDTH - 1, DRIVE_BUTTON_HEIGTH - 1,
    1894       0, 0, 27, 20}; //The last 2 numbers should be the width and heigth of the bitmap
     1893      POINTL aptl[4] = {0, 0, DRIVE_BUTTON_WIDTH - 1, DRIVE_BUTTON_HEIGHT - 1,
     1894      0, 0, DRIVE_BUTTON_WIDTH - 1, DRIVE_BUTTON_HEIGHT - 1};
     1895      //The last 2 numbers should be the width and height of the bitmap
    18951896      HBITMAP hbm;
     1897      PBITMAPINFOHEADER    pbmpData;
    18961898      POINTL ptlStart;
    18971899      ULONG x, iconid;
     
    19201922        }
    19211923        else
    1922           iconid = FLOPPY_ICON;
     1924          iconid = FLOPPY_ICON;
    19231925      hps = WinBeginPaint(hwnd, (HPS) 0, NULL);
    19241926      if (hps) {
    19251927        hbm = GpiLoadBitmap(hps, 0, iconid, 0, 0);
    1926         if (hbm)
     1928        if (hbm) {
     1929          pbmpData = xmallocz(sizeof(PBITMAPINFOHEADER), pszSrcFile, __LINE__);
     1930          if (pbmpData) {
     1931            GpiQueryBitmapParameters(hbm, pbmpData);
     1932            aptl[1].x = pbmpData->cx;
     1933            aptl[1].y = pbmpData->cy;
     1934            aptl[3].x = pbmpData->cx;
     1935            aptl[3].y = pbmpData->cy;
     1936            free(pbmpData);
     1937          }
    19271938          GpiWCBitBlt(hps, hbm, 4L, aptl, ROP_SRCCOPY, BBO_PAL_COLORS);
    1928           memset(&fat, 0, sizeof(fat));
    1929           fat.usRecordLength = sizeof(FATTRS);
    1930           fat.fsSelection = FATTR_SEL_BOLD ;
    1931           fat.usCodePage = 850;
    1932           fat.fsFontUse = FATTR_FONTUSE_NOMIX;
    1933           strcpy(fat.szFacename , FNT_HELVETICA);
     1939        }
     1940        memset(&fat, 0, sizeof(fat));
     1941        fat.usRecordLength = sizeof(FATTRS);
     1942        fat.fsSelection = FATTR_SEL_BOLD ;
     1943        fat.usCodePage = 850;
     1944        fat.fsFontUse = FATTR_FONTUSE_NOMIX;
     1945        strcpy(fat.szFacename , FNT_HELVETICA);
    19341946        x = GpiCreateLogFont(hps, NULL, DRIVEBAR_FONT_LCID, &fat);
    19351947        if (x != GPI_ERROR) {
     
    19401952          GpiSetColor(hps, iconid == RAMDISK_ICON ? CLR_YELLOW : CLR_DARKBLUE);
    19411953          ptlStart.x = 1L;  //Char box position
    1942           ptlStart.y = 7L;
     1954          ptlStart.y = 8L;
    19431955          GpiCharStringAt(hps, &ptlStart, strlen(szDrv), szDrv);
    19441956          GpiDeleteSetId(hps, DRIVEBAR_FONT_LCID);
     
    19892001        UINT iDrv;
    19902002
    1991         strcat(szDrv, "\\");
     2003        strcat(szDrv, PCSZ_BACKSLASH);
    19922004        MakeValidDir(szDrv);
    19932005        // Disable menus if MakeValidDir changes drive letter fixme this section doesn't do anything see treecnt.c
     
    20362048    strcpy(szDrv + 1, ":");
    20372049    if (isalpha(*szDrv)) {
    2038       strcat(szDrv, "\\");
     2050      strcat(szDrv, PCSZ_BACKSLASH);
    20392051      if (!FindDirCnrByName(szDrv, TRUE))
    20402052        OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, szDrv);
     
    20512063    strcpy(szDrv + 1, ":");
    20522064    if (isalpha(*szDrv)) {
    2053       strcat(szDrv, "\\");
     2065      strcat(szDrv, PCSZ_BACKSLASH);
    20542066      CommonDriveCmd(hwnd, szDrv, SHORT1FROMMP(mp1));
    20552067    }
     
    21202132      if (li) {
    21212133        strcpy(li->targetpath, szDrv);
    2122         strcat(li->targetpath, "\\");
     2134        strcat(li->targetpath, PCSZ_BACKSLASH);
    21232135        if (li->list && li->list[0] && IsRoot(li->list[0]))
    21242136          li->type = DO_LINK;
     
    22822294                                0,
    22832295                                DRIVE_BUTTON_WIDTH,
    2284                                 DRIVE_BUTTON_HEIGTH,
     2296                                DRIVE_BUTTON_HEIGHT,
    22852297                                hwndT, HWND_TOP, x + IDM_DRIVEA, NULL, NULL);
    22862298        if (!hwndB)
     
    22992311VOID ResizeDrives(HWND hwndT, long xwidth)
    23002312{
    2301   register ULONG ctrlxpos = 2, ctrlypos = 0, ctrlxsize;
     2313  register ULONG ctrlxpos = 1, ctrlypos = 0, ctrlxsize;
    23022314  HENUM henum;
    23032315  HWND hwndB;
     
    23102322    WinQueryWindowRect(hwndT, &rcl);
    23112323    xwidth = rcl.xRight - ((WinQuerySysValue(HWND_DESKTOP,
    2312                                              SV_CYSIZEBORDER) * 2) + 2);
     2324                                             SV_CYSIZEBORDER) * 2) + 1);
    23132325  }
    23142326  henum = WinBeginEnumWindows(hwndT);
     
    23172329    WinSetWindowPos(hwndB,
    23182330                    HWND_TOP,
    2319                     ctrlxpos, ctrlypos, ctrlxsize, DRIVE_BUTTON_HEIGTH, SWP_MOVE | SWP_SHOW);
     2331                    ctrlxpos, ctrlypos, ctrlxsize, DRIVE_BUTTON_HEIGHT, SWP_MOVE | SWP_SHOW);
    23202332    ctrlxpos += (ctrlxsize + 2);
    2321     if (ctrlxpos + (DRIVE_BUTTON_WIDTH + 4 + ((fShowTarget && DriveLines == 0) ?
     2333    if (ctrlxpos + (DRIVE_BUTTON_WIDTH + 2 + ((fShowTarget && DriveLines == 0) ?
    23222334                          256 : 0)) > xwidth) {
    2323       ctrlxpos = 2;
    2324       ctrlypos += DRIVE_BUTTON_HEIGTH;
     2335      ctrlxpos = 1;
     2336      ctrlypos += DRIVE_BUTTON_HEIGHT;
    23252337      DriveLines++;
    23262338    }
     
    39984010                           (WinQuerySysValue(HWND_DESKTOP,
    39994011                                             SV_CYSIZEBORDER) * 2)) - 4));
    4000             prectl->yTop -= (16 * (DriveLines * DRIVE_BUTTON_HEIGTH));
     4012            prectl->yTop -= (16 * (DriveLines * DRIVE_BUTTON_HEIGHT));
    40014013          }
    40024014          if (fUserComboBox) {
     
    40274039      PSWP pswp, pswpClient, pswpNew;
    40284040      SWP swpClient;
    4029       LONG theight = 48L, dheight = DRIVE_BUTTON_HEIGTH + 2, width, sheight = 20, bheight = 20;
     4041      LONG theight = 48L, dheight = DRIVE_BUTTON_HEIGHT, width, sheight = 20, bheight = 20;
    40304042
    40314043      sCount = (SHORT) oldproc(hwnd, msg, mp1, mp2);
     
    41364148        pswpNew->hwndInsertBehind = HWND_BOTTOM;
    41374149        pswpNew->x = swpClient.x + 2;
    4138         dheight += ((dheight - 2) * DriveLines);
    4139         pswpNew->y = (swpClient.y + swpClient.cy) - (dheight - 2);
     4150        dheight += ((dheight) * DriveLines);
     4151        pswpNew->y = (swpClient.y + swpClient.cy) - (dheight);
    41404152        if (fToolbar)
    41414153          pswpNew->y -= theight;
    41424154        pswpNew->cx = swpClient.cx - 4;
    4143         pswpNew->cy = dheight - 4;
     4155        pswpNew->cy = dheight;
    41444156        pswpClient->cy -= dheight;
    41454157        sCount++;
  • trunk/dll/mainwnd.h

    r1437 r1438  
    2424
    2525#define DRIVE_BUTTON_WIDTH 28
    26 #define DRIVE_BUTTON_HEIGTH 21
     26#define DRIVE_BUTTON_HEIGHT 21
    2727
    2828void BubbleHelp(HWND hwnd, BOOL other, BOOL data, BOOL above, PCSZ help);
  • trunk/dll/mainwnd2.c

    r1437 r1438  
    224224      PSWP pswp, pswpClient, pswpNew;
    225225      SWP swpClient;
    226       ULONG theight = 48L, dheight = DRIVE_BUTTON_HEIGTH + 2, bheight = 20, sheight = 20;
     226      ULONG theight = 48L, dheight = DRIVE_BUTTON_HEIGHT, bheight = 20, sheight = 20;
    227227      LONG width, lastx;
    228228
     
    310310      pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_DRIVES);
    311311      pswpNew->x = swpClient.x + 2;
    312       dheight += ((dheight - 2) * DriveLines);
    313       pswpNew->y = (swpClient.y + swpClient.cy) - (dheight - 2);
     312      dheight += ((dheight) * DriveLines);
     313      pswpNew->y = (swpClient.y + swpClient.cy) - (dheight);
    314314      if (fToolbar)
    315315        pswpNew->y -= theight;
    316316      pswpNew->cx = swpClient.cx - 4;
    317       pswpNew->cy = dheight - 4;
     317      pswpNew->cy = dheight;
    318318      pswpClient->cy -= dheight;
    319319      pswpClient->cy -= 2;
  • trunk/dll/misc.c

    r1410 r1438  
    845845          else
    846846            ealen = sizeof(FEALIST) + 9;
    847           rc = DosAllocMem((PPVOID) & pfealist, ealen + 64,
    848                            OBJ_TILE | PAG_COMMIT | PAG_READ | PAG_WRITE);
     847          rc = xDosAllocMem((PPVOID) & pfealist, ealen + 64,
     848                            OBJ_TILE | PAG_COMMIT | PAG_READ | PAG_WRITE);
    849849          if (rc)
    850850            Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile,
  • trunk/dll/mkdir.c

    r1402 r1438  
    1313  19 Jul 08 GKY Replace save_dir2(dir) with pFM2SaveDirectory
    1414  25 Dec 08 GKY Add code to allow write verify to be turned off on a per drive basis
     15  28 Jun 09 GKY Added AddBackslashToPath() to remove repeatative code.
    1516
    1617***********************************************************************/
     
    4041#include "dirs.h"                       // save_dir2
    4142#include "input.h"                      // InputDlgProc
     43#include "pathutil.h"                   // AddBackslashToPath
    4244
    4345// Data definitions
     
    185187    strcpy(szBuff, pFM2SaveDirectory);
    186188  MakeValidDir(szBuff);
    187   if (*szBuff && szBuff[strlen(szBuff) - 1] != '\\')
    188     strcat(szBuff, "\\");
     189  AddBackslashToPath(szBuff);
     190  //if (*szBuff && szBuff[strlen(szBuff) - 1] != '\\')
     191  //  strcat(szBuff, "\\");
    189192  sip.prompt = GetPString(IDS_MKDIRPROMPTTEXT);
    190193  sip.inputlen = CCHMAXPATH - 1;
     
    257260              "%s%s%s%s",
    258261              GetPString(IDS_TARGETDIRTITLETEXT),
    259               (*targetdir) ? "" : "<",
     262              (*targetdir) ? NullStr : "<",
    260263              (*targetdir) ?
    261               targetdir : GetPString(IDS_NONE), (*targetdir) ? "" : ">");
     264              targetdir : GetPString(IDS_NONE), (*targetdir) ? NullStr : ">");
    262265    else
    263266      *temp = 0;
  • trunk/dll/mle.c

    r1402 r1438  
    180180  if (len) {
    181181    len++;
    182     rc = DosAllocMem((PVOID) & temp, 4096,
    183                      PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
     182    rc = xDosAllocMem((PVOID) & temp, 4096,
     183                      PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
    184184    if (rc || !temp)
    185185      Dos_Error(MB_CANCEL, rc, h, pszSrcFile, __LINE__,
     
    263263  if (!sel)
    264264    return FALSE;
    265   rc = DosAllocMem((PVOID) & temp, 32768L,
    266                    PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
     265  rc = xDosAllocMem((PVOID) & temp, 32768L,
     266                    PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
    267267  if (rc || !temp) {
    268268    Dos_Error(MB_CANCEL, rc, h, pszSrcFile, __LINE__,
     
    535535    DosChgFilePtr(handle, 0, FILE_BEGIN, &action);
    536536    if (len) {
    537       rc = DosAllocMem((PVOID) & hexbuff, 50001,
    538                        PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
     537      rc = xDosAllocMem((PVOID) & hexbuff, 50001,
     538                        PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
    539539      if (rc || !hexbuff) {
    540540        Dos_Error(MB_CANCEL, rc, h, pszSrcFile, __LINE__,
     
    664664    fseek(fp, 0L, SEEK_SET);
    665665    if (len && len != -1) {
    666       rc = DosAllocMem((PVOID) & buffer,
    667                        50000L, PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
     666      rc = xDosAllocMem((PVOID) & buffer,
     667                        50000L, PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
    668668      if (rc || !buffer) {
    669669        Dos_Error(MB_CANCEL, rc, h, pszSrcFile, __LINE__,
     
    916916  }
    917917
    918   rc = DosAllocMem((PVOID) & buffer, 4096L,
    919                    PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
     918  rc = xDosAllocMem((PVOID) & buffer, 4096L,
     919                    PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
    920920  if (rc || !buffer) {
    921921    Dos_Error(MB_CANCEL, rc, h, pszSrcFile, __LINE__,
  • trunk/dll/objcnr.c

    r1402 r1438  
    2424  10 Dec 08 SHL Integrate exception handler support
    2525  08 Mar 09 GKY Additional strings move to PCSZs
     26  28 Jun 09 GKY Added AddBackslashToPath() to remove repeatative code.
    2627
    2728***********************************************************************/
     
    5657#include "fortify.h"
    5758#include "excputil.h"                   // xbeginthread
     59#include "pathutil.h"                   // AddBackslashToPath
    5860
    5961typedef struct
     
    100102    return;                             // Error already reported
    101103  strcpy(maskstr, filename);
    102   if (maskstr[strlen(maskstr) - 1] != '\\')
    103     strcat(maskstr, "\\");
     104  AddBackslashToPath(maskstr);
     105  //if (maskstr[strlen(maskstr) - 1] != '\\')
     106  //  strcat(maskstr, "\\");
    104107  endpath = &maskstr[strlen(maskstr)];
    105108  strcat(maskstr, "*");
  • trunk/dll/pathutil.c

    r1402 r1438  
    4040
    4141static PSZ pszSrcFile = __FILE__;
     42
     43PSZ AddBackslashToPath(PSZ pszPathName)
     44{
     45  if (pszPathName[strlen(pszPathName) - 1] != '\\')
     46    strcat(pszPathName,  PCSZ_BACKSLASH);
     47  return pszPathName;
     48}
    4249
    4350// #pragma data_seg(DATA1)
  • trunk/dll/pathutil.h

    r1398 r1438  
    1111  05 Jan 08 SHL Move from fm3dll.h to here
    1212  29 Feb 08 GKY Changes to enable user settable command line length
     13  28 Jun 09 GKY Added AddBackslashToPath() to remove repeatative code.
    1314
    1415***********************************************************************/
     
    2223#endif
    2324
     25PSZ AddBackslashToPath(PSZ pszPathName);
    2426PSZ BldFullPathName(PSZ pszFullPathName, PCSZ pszPathName, PCSZ pszFileName);
    2527PSZ BldQuotedFullPathName(PSZ pszFullPathName, PCSZ pszPathName, PCSZ pszFileName);
  • trunk/dll/saveclip.c

    r1402 r1438  
    100100        if (clip)
    101101          len += strlen(clip) + 1;
    102         if (!DosAllocSharedMem((PPVOID) & hold, (PSZ) NULL, len, PAG_COMMIT |
     102        if (!xDosAllocSharedMem((PPVOID) &hold, (PSZ) NULL, len, PAG_COMMIT |
    103103                               OBJ_GIVEABLE | PAG_READ | PAG_WRITE)) {
    104104          *hold = 0;
     
    169169      }
    170170      if (WinOpenClipbrd(hab)) {
    171         if (!DosAllocSharedMem((PPVOID) & text, (PSZ) NULL, len, PAG_COMMIT |
    172                                OBJ_GIVEABLE | PAG_READ | PAG_WRITE)) {
     171        if (!xDosAllocSharedMem((PPVOID) &text, (PSZ) NULL, len, PAG_COMMIT |
     172                                OBJ_GIVEABLE | PAG_READ | PAG_WRITE)) {
    173173          *text = 0;
    174174          if (clip && clip[0]) {
     
    242242{
    243243  HWND hwndCnr;
    244   CHAR savename[CCHMAXPATH] = "", pattern[81];
     244  CHAR savename[CCHMAXPATH] = "";
     245  CHAR pattern[81];
    245246
    246247  switch (msg) {
     
    602603
    603604  CHAR **list;
    604   CHAR savename[CCHMAXPATH] = "", pattern[81];
     605  CHAR savename[CCHMAXPATH] = "";
     606  CHAR pattern[81];
    605607
    606608  switch (msg) {
  • trunk/dll/seeall.c

    r1433 r1438  
    4848  08 Mar 09 GKY Additional strings move to PCSZs in init.c
    4949  08 Mar 09 GKY Removed variable aurguments from docopyf and unlinkf (not used)
     50  28 Jun 09 GKY Added AddBackslashToPath() to remove repeatative code.
    5051
    5152***********************************************************************/
     
    647648              GetPString(IDS_MOVEDTEXT) : GetPString(IDS_COPIEDTEXT);
    648649            if (*path) {
    649               strcpy(newname, path);
    650               if (newname[strlen(newname) - 1] != '\\')
    651                 strcat(newname, "\\");
     650              strcpy(newname, path);
     651              AddBackslashToPath(newname);
     652              //if (newname[strlen(newname) - 1] != '\\')
     653              //  strcat(newname, "\\");
    652654              if (plen)
    653655                p = list[x] + plen;
     
    10581060                                        (*list[x] &&
    10591061                                         list[x][strlen(list[x]) - 1] !=
    1060                                          '\\') ? "\\" : NullStr);
     1062                                         '\\') ? PCSZ_BACKSLASH : NullStr);
    10611063              DosError(FERR_DISABLEHARDERR);
    10621064              if (!error)
  • trunk/dll/shadow.c

    r1402 r1438  
    7171      sprintf(s,
    7272              "EXENAME=%s%s%s%s%s;PARAMETERS=%%*;OBJECTID=<FM2_%s>",
    73               (path) ? path : "",
    74               (path) ? "\\" : "",
     73              (path) ? path : NullStr,
     74              (path) ? PCSZ_BACKSLASH : NullStr,
    7575              objtitle,
    76               (path) ? ";STARTUPDIR=" : "", (path) ? path : "", objtitle);
     76              (path) ? ";STARTUPDIR=" : NullStr, (path) ? path : NullStr, objtitle);
    7777      WinSetObjectData(obj, s);
    7878      free(s);
     
    112112            "%s%s%sOBJECTID=<FM2_%s>",
    113113            objtitle,
    114             (p == type[1]) ? "ICONFILE=" : "",
    115             (p == type[1]) ? s : "", (p == type[1]) ? ";" : "", objtitle);
     114            (p == type[1]) ? "ICONFILE=" : NullStr,
     115            (p == type[1]) ? s : NullStr, (p == type[1]) ? ";" : NullStr, objtitle);
    116116    WinSetObjectData(obj, s2);
    117117  }
     
    150150    sprintf(s,
    151151            "SHADOWID=%s%s%s",
    152             (path) ? path : "", (path) ? "\\" : "", objtitle);
     152            (path) ? path : NullStr, (path) ? PCSZ_BACKSLASH : NullStr, objtitle);
    153153    {                                   /* find an icon for it if possible */
    154154      CHAR *p, temp[CCHMAXPATH + 1];
     
    166166      sprintf(&s[strlen(s)],
    167167              ";EXENAME=%s%s%s%s%s;PARAMETERS=%%*",
    168               (path) ? path : "",
    169               (path) ? "\\" : "",
    170               objtitle, (path) ? ";STARTUPDIR=" : "", (path) ? path : "");
     168              (path) ? path : NullStr,
     169              (path) ? PCSZ_BACKSLASH : NullStr,
     170              objtitle, (path) ? ";STARTUPDIR=" : NullStr, (path) ? path : NullStr);
    171171    strcat(s, ";NODELETE=NO;TEMPLATE=NO;NOCOPY=NO;NOMOVE=NO");
    172172    sprintf(&s[strlen(s)], ";OBJECTID=<FM2_%s>", objtitle);
  • trunk/dll/srchpath.c

    r1398 r1438  
    133133
    134134  if (!filename)
    135     return "";
     135    return NullStr;
    136136  found = searchapath(PCSZ_PATH, filename);
    137137  if (!*found) {
  • trunk/dll/subj.c

    r1402 r1438  
    125125      else
    126126        ealen = sizeof(FEALIST) + 9;
    127       rc = DosAllocMem((PPVOID) & pfealist, ealen + 1L,
    128                        OBJ_TILE | PAG_COMMIT | PAG_READ | PAG_WRITE);
     127      rc = xDosAllocMem((PPVOID) & pfealist, ealen + 1L,
     128                        OBJ_TILE | PAG_COMMIT | PAG_READ | PAG_WRITE);
    129129      if (rc)
    130130        Dos_Error(MB_CANCEL, rc, hwnd, pszSrcFile, __LINE__,
  • trunk/dll/systemf.c

    r1402 r1438  
    201201            strcpy(listfile, pTmpDir ? pTmpDir : pFM2SaveDirectory);
    202202            MakeTempName(listfile, "$FM2LI$T", 2);
    203             /*if (listfile[strlen(listfile) - 1] != '\\')
    204               strcat(listfile, "\\");
    205             sprintf(&listfile[strlen(listfile)], "%s.%03x",
    206                     LISTTEMPROOT, (clock() & 4095));*/
    207203            fp = xfopen(listfile, "w",pszSrcFile,__LINE__);
    208204            if (fp) {
     
    670666  PID sessPID;
    671667  BOOL wasquote;
    672   char *pszPgm, *pszArgs = NULL;
    673   char szObject[32] = "", *p, szSavedir[CCHMAXPATH];
     668  char *p, *pszPgm, *pszArgs = NULL;
     669  char szObject[32] = "";
     670  char szSavedir[CCHMAXPATH];
    674671  BOOL useTermQ = FALSE;
    675672  char szTempdir[CCHMAXPATH];
     
    704701    hwnd = HWND_DESKTOP;
    705702
    706   rc = DosAllocMem((PVOID)&pszPgm,
    707                    MaxComLineStrg,
    708                    PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
     703  rc = xDosAllocMem((PVOID)&pszPgm,
     704                    MaxComLineStrg,
     705                    PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
    709706  if (rc) {
    710707    Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,GetPString(IDS_OUTOFMEMORY));
     
    752749      temp = *p;
    753750      if (temp) {
    754         rc = DosAllocMem((PVOID)&pszArgs,
    755                          MaxComLineStrg * 2,
    756                          PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
     751        rc = xDosAllocMem((PVOID)&pszArgs,
     752                          MaxComLineStrg * 2,
     753                          PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
    757754        if (rc)
    758755          Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,GetPString(IDS_OUTOFMEMORY));
     
    886883      if (~type & FULLSCREEN)
    887884        type |= WINDOWED;
    888       rc = DosAllocMem((PVOID) & pszArgs, MaxComLineStrg * 2,
    889                        PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
     885      rc = xDosAllocMem((PVOID) & pszArgs, MaxComLineStrg * 2,
     886                        PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
    890887      if (rc) {
    891888        Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,GetPString(IDS_OUTOFMEMORY));
  • trunk/dll/treecnr.c

    r1434 r1438  
    799799              if (CheckDrive(toupper(*pci->pszFileName), FileSystem, &type) == -1 ||
    800800                  fShowFSTypeInTree)
    801                 strcpy(FileSystem, "");
     801                strcpy(FileSystem, NullStr);
    802802              if (fShowDriveLabelInTree)
    803                 strcpy(szTmpLabel, "");
     803                strcpy(szTmpLabel, NullStr);
    804804              else
    805805                strcpy(szTmpLabel, volser.volumelabel);
  • trunk/dll/undel.c

    r1402 r1438  
    1919  08 Mar 09 GKY Removed variable aurguments from docopyf and unlinkf (not used)
    2020  08 Mar 09 GKY Additional strings move to PCSZs
     21  28 Jun 09 GKY Added AddBackslashToPath() to remove repeatative code.
    2122
    2223***********************************************************************/
     
    208209
    209210      strcpy(s, (CHAR *)mp2);
    210       if (s[strlen(s) - 1] != '\\')
    211         strcat(s, "\\");
     211      AddBackslashToPath(s);
     212      //if (s[strlen(s) - 1] != '\\')
     213      //  strcat(s, "\\");
    212214      strcat(s, "*");
    213215      WinSetDlgItemText(hwnd, UNDEL_ENTRY, s);
  • trunk/dll/uudecode.c

    r1398 r1438  
    4343#include "misc.h"                       // PaintRecessedWindow
    4444#include "wrappers.h"                   // xfgets
     45#include "init.h"                       // Strings
    4546
    4647static PSZ pszSrcFile = __FILE__;
     
    9899    }
    99100    else
    100       strcat(build, "\\");
     101      strcat(build, PCSZ_BACKSLASH);
    101102    strncat(build, dest, CCHMAXPATH - strlen(dest));
    102103    strcpy(dest, build);
  • trunk/dll/valid.c

    r1402 r1438  
    5757#include "strips.h"                     // bstrip
    5858#include "init.h"                       // GetTidForWindow
     59#include "wrappers.h"                    // xDosAllocMem
    5960
    6061
     
    295296
    296297# define BUFFER_BYTES 8192
    297   rc = DosAllocMem(&pvBuffer, BUFFER_BYTES,
    298                 PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
     298  rc = xDosAllocMem(&pvBuffer, BUFFER_BYTES,
     299                    PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
    299300  if (rc) {
    300301    Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
  • trunk/dll/viewinf.c

    r1400 r1438  
    2020  07 Feb 09 GKY Allow user to turn off alert and/or error beeps in settings notebook.
    2121  08 Mar 09 GKY Additional strings move to PCSZs in init.c
     22  28 Jun 09 GKY Added AddBackslashToPath() to remove repeatative code.
    2223
    2324***********************************************************************/
     
    121122
    122123              strcpy(mask, p);
    123               if (mask[strlen(mask) - 1] != '\\')
    124                 strcat(mask, "\\");
     124              AddBackslashToPath(mask);
     125              //if (mask[strlen(mask) - 1] != '\\')
     126              //  strcat(mask, "\\");
    125127              enddir = mask + strlen(mask);
    126128              if (dummy->help)
  • trunk/dll/walkem.c

    r1402 r1438  
    3434  19 Jul 08 GKY Replace save_dir2(dir) with pFM2SaveDirectory and use BldFullPathName
    3535  24 Aug 08 GKY Warn full drive on save of .DAT file; prevent loss of existing file
     36  28 Jun 09 GKY Added AddBackslashToPath() to remove repeatative code.
    3637
    3738***********************************************************************/
     
    681682    sprintf(szTemp,
    682683            "%s%s*",
    683             pszPath, (pszPath[strlen(pszPath) - 1] == '\\') ? "" : "\\");
     684            pszPath, (pszPath[strlen(pszPath) - 1] == '\\') ? NullStr : PCSZ_BACKSLASH);
    684685    DosError(FERR_DISABLEHARDERR);
    685686    if (!DosFindFirst(szTemp,
     
    11461147        bstrip(szBuffer);
    11471148        if (*szBuffer) {
    1148           strcpy(szBuff, wa->szCurrentPath);
    1149           if (szBuff[strlen(szBuff) - 1] != '\\')
    1150             strcat(szBuff, "\\");
     1149          strcpy(szBuff, wa->szCurrentPath);
     1150          AddBackslashToPath(szBuff);
     1151          //if (szBuff[strlen(szBuff) - 1] != '\\')
     1152          //  strcat(szBuff, "\\");
    11511153          strcat(szBuff, szBuffer);
    11521154          MakeFullName(szBuff);
     
    15391541        bstrip(szBuffer);
    15401542        if (*szBuffer) {
    1541           strcpy(szBuff, wa->szCurrentPath1);
    1542           if (szBuff[strlen(szBuff) - 1] != '\\')
    1543             strcat(szBuff, "\\");
     1543          strcpy(szBuff, wa->szCurrentPath1);
     1544          AddBackslashToPath(szBuff);
     1545          //if (szBuff[strlen(szBuff) - 1] != '\\')
     1546          //  strcat(szBuff, "\\");
    15441547          strcat(szBuff, szBuffer);
    15451548          MakeFullName(szBuff);
     
    16041607        bstrip(szBuffer);
    16051608        if (*szBuffer) {
    1606           strcpy(szBuff, wa->szCurrentPath2);
    1607           if (szBuff[strlen(szBuff) - 1] != '\\')
    1608             strcat(szBuff, "\\");
     1609          strcpy(szBuff, wa->szCurrentPath2);
     1610          AddBackslashToPath(szBuff);
     1611          //if (szBuff[strlen(szBuff) - 1] != '\\')
     1612          //  strcat(szBuff, "\\");
    16091613          strcat(szBuff, szBuffer);
    16101614          MakeFullName(szBuff);
  • trunk/dll/worker.c

    r1402 r1438  
    4141  08 Mar 09 GKY Removed variable aurguments from docopyf and unlinkf (not used)
    4242  08 Mar 09 GKY Additional strings move to PCSZs
     43  28 Jun 09 GKY Added AddBackslashToPath() to remove repeatative code.
    4344
    4445***********************************************************************/
     
    230231            }
    231232            else
    232               strcat(wk->li->targetpath, "\\");
     233              strcat(wk->li->targetpath, PCSZ_BACKSLASH);
    233234            sprintf(wk->li->targetpath + strlen(wk->li->targetpath),
    234235                    "MERGE.%03x", (clock() & 4095L));
     
    708709                      GetPString(IDS_MOVEDTEXT) : GetPString(IDS_COPIEDTEXT);
    709710                    if (*wk->li->targetpath) {
    710                       strcpy(newname, wk->li->targetpath);
    711                       if (newname[strlen(newname) - 1] != '\\')
    712                         strcat(newname, "\\");
     711                      strcpy(newname, wk->li->targetpath);
     712                      AddBackslashToPath(newname);
     713                      //if (newname[strlen(newname) - 1] != '\\')
     714                      //  strcat(newname, "\\");
    713715                      if (plen)
    714716                        p = wk->li->list[x] + plen;
     
    12091211              if (wk->li->type == IDM_MCIPLAY)
    12101212                break;
    1211               strcpy(szBuffer, wk->li->targetpath);
    1212               if (wk->li->targetpath[strlen(wk->li->targetpath) - 1] != '\\')
    1213                 strcat(szBuffer, "\\");
     1213              strcpy(szBuffer, wk->li->targetpath);
     1214              AddBackslashToPath(wk->li->targetpath);
     1215              //if (wk->li->targetpath[strlen(wk->li->targetpath) - 1] != '\\')
     1216              //  strcat(szBuffer, "\\");
    12141217              p = szBuffer + strlen(szBuffer);
    12151218              for (x = 0; wk->li->list[x]; x++) {
     
    12701273              }
    12711274              else {
    1272                 if (*wk->li->targetpath && !IsFile(wk->li->targetpath))
    1273                   if (wk->li->targetpath[strlen(wk->li->targetpath) - 1] !=
    1274                       '\\')
    1275                     strcat(wk->li->targetpath, "\\");
     1275                if (*wk->li->targetpath && !IsFile(wk->li->targetpath))
     1276                  AddBackslashToPath(wk->li->targetpath);
     1277                  //if (wk->li->targetpath[strlen(wk->li->targetpath) - 1] !=
     1278                  //    '\\')
     1279                  //  strcat(wk->li->targetpath, "\\");
    12761280                ad.namecanchange = 1;
    12771281              }
     
    12981302                break;
    12991303              if (!*wk->li->targetpath && *wk->directory) {
    1300                 strcpy(ad.arcname, wk->directory);
    1301                 if (ad.arcname[strlen(ad.arcname) - 1] != '\\')
    1302                   strcat(ad.arcname, "\\");
     1304                strcpy(ad.arcname, wk->directory);
     1305                AddBackslashToPath(ad.arcname);
     1306                //if (ad.arcname[strlen(ad.arcname) - 1] != '\\')
     1307                //  strcat(ad.arcname, "\\");
    13031308              }
    13041309              if (!WinDlgBox(HWND_DESKTOP, wk->hwndFrame, ArchiveDlgProc, FM3ModHandle,
     
    16361641                                             wk->li->
    16371642                                             list[x][strlen(wk->li->list[x]) - 1]
    1638                                              != '\\') ? "\\" : NullStr);
     1643                                             != '\\') ? PCSZ_BACKSLASH : NullStr);
    16391644                  DosError(FERR_DISABLEHARDERR);
    16401645                  if (!error)
  • trunk/dll/wrappers.c

    r1432 r1438  
    5151#pragma data_seg(GLOBAL1)
    5252BOOL fNoLargeFileSupport;
     53
     54APIRET xDosAllocSharedMem(PPVOID ppb,
     55                          PSZ pszName,
     56                          ULONG cb,
     57                          ULONG flag)
     58{
     59  APIRET rc; ;
     60
     61  rc = DosAllocSharedMem(ppb, pszName, cb, flag | OBJ_ANY);
     62  DbgMsg(pszSrcFile, __LINE__, "ppb %p", *ppb);
     63  if (rc)
     64    rc = DosAllocSharedMem(ppb, pszName, cb, flag);
     65  return rc;
     66}
     67
     68APIRET xDosAllocMem(PPVOID ppb,
     69                    ULONG cb,
     70                    ULONG flag)
     71{
     72  APIRET rc;
     73
     74  rc = DosAllocMem(ppb, cb, flag | OBJ_ANY);
     75  DbgMsg(pszSrcFile, __LINE__, "ppb %p %x", *ppb, rc);
     76  if (rc)
     77    rc = DosAllocMem(ppb, cb, flag);
     78  DbgMsg(pszSrcFile, __LINE__, "ppb %p", *ppb);
     79  return rc;
     80}
    5381
    5482APIRET xDosFindFirst(PSZ pszFileSpec,
  • trunk/dll/wrappers.h

    r1327 r1438  
    1919#include <os2.h>
    2020#endif
     21
     22APIRET xDosAllocSharedMem(PPVOID ppb,
     23                          PSZ pszName,
     24                          ULONG cb,
     25                          ULONG flag);
     26
     27APIRET xDosAllocMem(PPVOID ppb,
     28                    ULONG cb,
     29                    ULONG flag);
    2130
    2231APIRET xDosFindFirst(PSZ pszFileSpec,
Note: See TracChangeset for help on using the changeset viewer.