Changeset 1545 for trunk/dll


Ignore:
Timestamp:
Oct 24, 2010, 12:00:47 AM (15 years ago)
Author:
Gregg Young
Message:

Added ForwardslashToBackslash function to streamline code.

Location:
trunk/dll
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/arccnrs.c

    r1544 r1545  
    8383  17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR CONSTANT * as CHAR *.
    8484  15 Apr 10 JBS Ticket 422: Stop hang when open archive gets deleted or moved
     85  23 Oct 10 GKY Add ForwardslashToBackslash function to streamline code
    8586
    8687***********************************************************************/
     
    16241625            memmove(s, p + 1, strlen(p + 1));
    16251626        }
    1626         sprintf(WaitChild->filename, "%s\\%s", dcd->workdir, s);
    1627         p = WaitChild->filename;
    1628         while (*p) {
    1629           if (*p == '/')
    1630             *p = '\\';
    1631           p++;
    1632         }
     1627        sprintf(WaitChild->filename, "%s\\%s", dcd->workdir, s);
     1628        ForwardslashToBackslash(WaitChild->filename);
    16331629        free(s);
    16341630        WaitChild->RunFlags = SEPARATE | ASYNCHRONOUS | WAIT |
     
    19231919                CHAR *temp, *p;
    19241920
    1925                 temp = li->list[x];
    1926                 p = temp;
    1927                 while (*p) {
    1928                   if (*p == '/')
    1929                     *p = '\\';
    1930                   p++;
    1931                 }
     1921                temp = li->list[x];
     1922                ForwardslashToBackslash(temp);
    19321923                p = xmalloc(strlen(temp) + strlen(li->targetpath) + 2,
    19331924                            pszSrcFile, __LINE__);
     
    21612152            CHAR **list2 = NULL, fullname[CCHMAXPATH * 2], *p;
    21622153
    2163             for (x = 0; li->list[x]; x++) {
    2164               p = li->list[x];
    2165               while (*p) {
    2166                 if (*p == '/')
    2167                   *p = '\\';
    2168                 p++;
    2169               }
     2154            for (x = 0; li->list[x]; x++) {
     2155              ForwardslashToBackslash(li->list[x]);
    21702156              BldFullPathName(fullname, dcd->directory, li->list[x]);
    21712157              if (IsFile(fullname) != -1)
     
    36223608                         FIL_QUERYFULLNAME, fullname, sizeof(fullname)))
    36233609      strcpy(fullname, arcname);
    3624     p = fullname;
    3625     while (*p) {
    3626       if (*p == '/')
    3627         *p = '\\';
    3628       p++;
    3629     }
     3610    ForwardslashToBackslash(fullname);
    36303611    if (!info)
    36313612      info = find_type(fullname, arcsighead);
  • trunk/dll/chklist.c

    r1498 r1545  
    1515  29 Nov 08 GKY Add flag to tell CheckListProc file is in an archive so it won't try to open it.
    1616  17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR CONSTANT * as CHAR *.
     17  23 Oct 10 GKY Add ForwardslashToBackslash function to streamline code
    1718
    1819***********************************************************************/
     
    4243#include "walkem.h"                     // WalkAllDlgProc
    4344#include "misc.h"                       // PaintRecessedWindow
     45#include "pathutil.h"                   // ForwardslashToBackslash
    4446
    4547#pragma data_seg(DATA1)
     
    474476                                      filename, sizeof(filename))) {
    475477                  if (!DosQueryPathInfo(filename,
    476                                         FIL_STANDARD, &fs3, sizeof(fs3))) {
    477                     p = filename;
    478                     while (*p) {
    479                       if (*p == '/')
    480                         *p = '\\';
    481                       p++;
    482                     }
     478                                        FIL_STANDARD, &fs3, sizeof(fs3))) {
     479                    ForwardslashToBackslash(filename);
    483480                    strcpy(cl->prompt, filename);
    484481                    PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID);
  • trunk/dll/comp.c

    r1544 r1545  
    7474  27 Sep 09 SHL Drop unused reset logic
    7575  17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR CONSTANT * as CHAR *.
     76  23 Oct 10 GKY Add ForwardslashToBackslash function to streamline code
    7677
    7778***********************************************************************/
     
    220221  SNAPSTUFF *sf = (SNAPSTUFF *)pargs;
    221222  FILE *fp;
    222   CHAR *p;
    223223  CHAR *modew = "w";
    224224
     
    226226    if (*sf->dirname && *sf->filename) {
    227227      priority_normal();
    228       p = sf->dirname;
    229       while (*p) {
    230         if (*p == '/')
    231           *p = '\\';
    232         p++;
    233       }
    234       if (*(p - 1) != '\\') {
    235         *p = '\\';
    236         p++;
    237       }
     228      ForwardslashToBackslash(sf->dirname);
     229      AddBackslashToPath(sf->dirname);
    238230      fp = xfopen(sf->filename, modew, pszSrcFile, __LINE__, FALSE);
    239231      if (fp) {
  • trunk/dll/draglist.c

    r1533 r1545  
    2626                items from a pmmail mail message (PMERR_INVALID_PARAMETER)
    2727  17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR CONSTANT * as CHAR *.
     28  23 Oct 10 GKY Add ForwardslashToBackslash function to streamline code
    2829
    2930***********************************************************************/
     
    4950#include "wrappers.h"                   // xrealloc
    5051#include "fortify.h"
     52#include "pathutil.h"                   // ForwardslashToBackslash
    5153
    5254// Data definitions
     
    158160        !DosQueryPathInfo(filename, FIL_STANDARD, &fs3, sizeof(fs3))) {
    159161      strcpy(szDir, filename);
    160       p = szDir;
    161       while (*p) {
    162         if (*p == '/')
    163           *p = '\\';
    164         p++;
    165       }
     162      ForwardslashToBackslash(szDir);
    166163      p = strrchr(szDir, '\\');
    167164      if (p) {
     
    814811        pdinfoCurrent = pdinfoOld = DrgAllocDraginfo(1);
    815812      if (pdinfoCurrent) {
    816         strcpy(szDir, pci->pszFileName);
    817         p = szDir;
    818         while (*p) {
    819           if (*p == '/')
    820             *p = '\\';
    821           p++;
    822         }
     813        strcpy(szDir, pci->pszFileName);
     814        ForwardslashToBackslash(szDir);
    823815        p = strrchr(szDir, '\\');
    824816        if (p) {
  • trunk/dll/getnames.c

    r1498 r1545  
    1414  28 Jun 09 GKY Added AddBackslashToPath() to remove repeatative code.
    1515  17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR CONSTANT * as CHAR *.
     16  23 Oct 10 GKY Add ForwardslashToBackslash function to streamline code
    1617
    1718***********************************************************************/
     
    316317      return FALSE;
    317318  }
    318   p = filename;
    319   while (*p) {
    320     if (*p == '/')
    321       *p = '\\';
    322     p++;
    323   }
     319  ForwardslashToBackslash(filename);
    324320  if (*filename)
    325321    strcpy(lastfilename, filename);
     
    397393    }
    398394  }
    399   p = filename;
    400   while (*p) {
    401     if (*p == '/')
    402       *p = '\\';
    403     p++;
    404   }
     395  ForwardslashToBackslash(filename);
    405396  if (*filename)
    406397    strcpy(lastfilename, filename);
  • trunk/dll/inis.c

    r1544 r1545  
    3737  12 Sep 09 GKY Add FM3.INI User ini and system ini to submenu for view ini
    3838  17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR CONSTANT * as CHAR *.
     39  23 Oct 10 GKY Add ForwardslashToBackslash function to streamline code
    3940
    4041***********************************************************************/
     
    10021003        ininame = INSTDATA(hwnd);
    10031004        if (ininame && *ininame) {
    1004           strcpy(filename, ininame);
    1005           p = filename;
    1006           while (*p) {
    1007             if (*p == '/')
    1008               *p = '\\';
    1009             p++;
    1010           }
     1005          strcpy(filename, ininame);
     1006          ForwardslashToBackslash(filename);
    10111007          p = strrchr(filename, '\\');
    10121008          if (p) {
     
    11111107        ininame = INSTDATA(hwnd);
    11121108        if (ininame && *ininame) {
    1113           strcpy(filename, ininame);
    1114           p = filename;
    1115           while (*p) {
    1116             if (*p == '/')
    1117               *p = '\\';
    1118             p++;
    1119           }
     1109          strcpy(filename, ininame);
     1110          ForwardslashToBackslash(filename);
    11201111          p = strrchr(filename, '\\');
    11211112          if (p) {
     
    25122503        // 09 Jan 08 SHL fixme to complain
    25132504        CHAR filename[CCHMAXPATH], *p;
    2514 
    2515         strcpy(filename, inidata->ininame);
    2516         p = filename;
    2517         while (*p) {
    2518           if (*p == '/')
    2519             *p = '\\';
    2520           p++;
    2521         }
     2505        strcpy(filename, inidata->ininame);
     2506        ForwardslashToBackslash(filename);
    25222507        p = strrchr(filename, '\\');
    25232508        if (p) {
     
    26542639        HINI hINI;
    26552640
    2656         strcpy(filename, inidata->ininame);
    2657         p = filename;
    2658         while (*p) {
    2659           if (*p == '/')
    2660             *p = '\\';
    2661           p++;
    2662         }
     2641        strcpy(filename, inidata->ininame);
     2642        ForwardslashToBackslash(filename);
    26632643        p = strrchr(filename, '\\');
    26642644        if (p) {
  • trunk/dll/mkdir.c

    r1438 r1545  
    1414  25 Dec 08 GKY Add code to allow write verify to be turned off on a per drive basis
    1515  28 Jun 09 GKY Added AddBackslashToPath() to remove repeatative code.
     16  23 Oct 10 GKY Add ForwardslashToBackslash function to streamline code
    1617
    1718***********************************************************************/
     
    5758  if (DosQueryPathInfo(dir, FIL_QUERYFULLNAME, s, sizeof(s)))
    5859    strcpy(s, dir);
    59   p = s;
    60   while (*p) {
    61     if (*p == '/')
    62       *p = '\\';
    63     p++;
    64   }
     60  ForwardslashToBackslash(s);
    6561  p = s;
    6662  do {
  • trunk/dll/pathutil.c

    r1480 r1545  
    1717  28 Jun 09 GKY Added AddBackslashToPath() to remove repeatative code
    1818  12 Jul 09 GKY Add xDosQueryAppType and xDosAlloc... to allow FM/2 to load in high memory
     19  23 Oct 10 GKY Add ForwardslashToBackslash function to streamline code
    1920
    2021***********************************************************************/
     
    4243
    4344static PSZ pszSrcFile = __FILE__;
     45
     46PSZ ForwardslashToBackslash(PSZ pszPathName)
     47{
     48  CHAR *p;
     49
     50  p = pszPathName;
     51  while (*p) {
     52    if (*p == '/')
     53      *p = '\\';
     54    p++;
     55  }
     56  return pszPathName;
     57}
    4458
    4559PSZ AddBackslashToPath(PSZ pszPathName)
  • trunk/dll/pathutil.h

    r1438 r1545  
    1212  29 Feb 08 GKY Changes to enable user settable command line length
    1313  28 Jun 09 GKY Added AddBackslashToPath() to remove repeatative code.
     14  23 Oct 10 GKY Add ForwardslashToBackslash function to streamline code
    1415
    1516***********************************************************************/
     
    2324#endif
    2425
     26PSZ ForwardslashToBackslash(PSZ pszPathName);
    2527PSZ AddBackslashToPath(PSZ pszPathName);
    2628PSZ BldFullPathName(PSZ pszFullPathName, PCSZ pszPathName, PCSZ pszFileName);
  • trunk/dll/rename.c

    r1544 r1545  
    1919  08 Mar 09 GKY Removed variable aurguments from docopyf and unlinkf (not used)
    2020  17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR CONSTANT * as CHAR *.
     21  23 Oct 10 GKY Add ForwardslashToBackslash function to streamline code
    2122
    2223***********************************************************************/
     
    4546#include "info.h"                       // driveflags
    4647#include "wrappers.h"                   // xfopen
     48#include "pathutil.h"                   // ForwardslashToBackslash
    4749
    4850static PSZ pszSrcFile = __FILE__;
     
    9799        INT sourceexists = 0, targetexists = 0,
    98100            sourcenewer = 0, sourcesmaller = 0;
    99 
    100         p = mv->target;
    101         while (*p) {
    102           if (*p == '/')
    103             *p = '\\';
    104           p++;
    105         }
     101        ForwardslashToBackslash(mv->target);
    106102        if (!MakeFullName(mv->target))
    107103          WinSetDlgItemText(hwnd, REN_TARGET, mv->target);
Note: See TracChangeset for help on using the changeset viewer.