Changeset 1175


Ignore:
Timestamp:
Sep 8, 2008, 9:18:14 PM (17 years ago)
Author:
Steven Levine
Message:

Avoid aliased pszLongName pointer in ActionCnrThread IDM_MOVE

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/comp.c

    r1157 r1175  
    5454  16 Mar 08 GKY Prevent trap caused by files that exceed maxpath length
    5555  11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating
    56                 all the details view settings (both the global variables and those in the
    57                 DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS.
     56                all the details view settings (both the global variables and those in the
     57                DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS.
     58  08 Sep 08 SHL Avoid aliased pszLongName pointer in ActionCnrThread IDM_MOVE
    5859
    5960***********************************************************************/
     
    8081#include "tmrsvcs.h"                    // IsITimerExpired
    8182#include "comp.h"
    82 #include "misc.h"                       // AddToListboxBottom, AdjustCnrColRO, AdjustCnrColVis, AdjustCnrColsForPref
    83                                         // AdjustDetailsSwitches, LoadDetailsSwitches, SetCnrCols
    84                                         // SetDetailsSwitches
     83#include "misc.h"               // AddToListboxBottom, AdjustCnrColRO, AdjustCnrColVis, AdjustCnrColsForPref
     84                                        // AdjustDetailsSwitches, LoadDetailsSwitches, SetCnrCols
     85                                        // SetDetailsSwitches
    8586#include "select.h"                     // Deselect, InvertAll
    8687#include "mkdir.h"                      // MassMkdir
     
    8889#include "walkem.h"                     // WalkTwoCmpDlgProc
    8990#include "fm3dll.h"
    90 #include "notebook.h"                   // External compare/dircompare
     91#include "notebook.h"                   // External compare/dircompare
    9192
    9293#include "fortify.h"                    // 06 May 08 SHL
     
    466467                        MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
    467468
    468       InitITimer(&itdSleep, 500);               // Sleep every 500 mSec
     469      InitITimer(&itdSleep, 500);       // Sleep every 500 mSec
    469470
    470471      while (pciS && (INT)pciS != -1 && pciD && (INT)pciD != -1) {
     
    552553                  pciD->pszDisplayName++;
    553554              }
    554               // 02 Aug 07 SHL fixme to know if LongName transfer is correct?
    555555              pciD->pszLongName = pciS->pszLongName;
     556              pciS->pszLongName = NullStr;      // 07 Sep 08 SHL avoid aliased pointer
    556557              if (pciD->pszSubject != NullStr) {
    557558                xfree(pciD->pszSubject, pszSrcFile, __LINE__);
     
    631632                             pciS->pszFileName, szNewName);
    632633              if (rc == MBID_CANCEL)
    633                 pciNextS = NULL;                // Cause loop to break
     634                pciNextS = NULL;        // Cause loop to break
    634635            }
    635636            else {
     
    891892      if (!*pciSa[x]->pszFileName || !*pciDa[x]->pszFileName) {
    892893        // 12 Jan 08 SHL clear flags
    893         pciSa[x]->flags = 0;    // File exists on one side only
     894        pciSa[x]->flags = 0;            // File exists on one side only
    894895        pciDa[x]->flags = 0;
    895896        continue;
     
    13191320                 MPFROMP(pciDa), MPFROM2SHORT((min(numD, 65535)), 0));
    13201321      numS -= min(numS, 65535);
    1321       SleepIfNeeded(&itdSleep, 0); // 12 Jan 08 SHL
     1322      SleepIfNeeded(&itdSleep, 0);      // 12 Jan 08 SHL
    13221323    } // while
    13231324  }
     
    14091410          else if (fForceLower)
    14101411            strlwr(pffbFile->achName);
    1411           memcpy(enddir, pffbFile->achName, pffbFile->cchName + 1);
    1412           if (strlen(maskstr) > CCHMAXPATH) {
     1412          memcpy(enddir, pffbFile->achName, pffbFile->cchName + 1);
     1413          if (strlen(maskstr) > CCHMAXPATH) {
    14131414            // Complain if pathnames exceeds max
    14141415            DosFindClose(hDir);
    1415             free(pffbArray);
    1416             free(maskstr);
     1416            free(pffbArray);
     1417            free(maskstr);
    14171418            if (!fDone) {
    14181419              fDone = TRUE;
     
    14211422                     GetPString(IDS_WARNINGTEXT),
    14221423                     "One or more of your files has a full path name that exceeds the OS/2 maximum");
    1423             }
    1424             return;
     1424            }
     1425            return;
    14251426          }
    14261427          if (AddToFileList(maskstr + skiplen,
     
    19651966          } // if on both sides
    19661967
    1967           if (x <= 0) {
     1968          if (x <= 0) {
    19681969            free(filesl[l++]);          // Done with item on left
    1969           }
    1970           if (x >= 0) {
    1971             free(filesr[r++]);          // Done with item on right
    1972           }
     1970          }
     1971          if (x >= 0) {
     1972            free(filesr[r++]);          // Done with item on right
     1973          }
    19731974          // Ensure empty buffers point somewhere
    19741975          if (!pcil->pszFileName) {
     
    20192020          }
    20202021          if (filesl) {
    2021             for(; filesl[l]; l++) {
    2022               free(filesl[l]);
    2023             }
     2022            for(; filesl[l]; l++) {
     2023              free(filesl[l]);
     2024            }
    20242025          }
    20252026          if (pcir) {
     
    20312032          }
    20322033          if (filesr) {
    2033             for (; filesr[r]; r++) {
    2034               free(filesr[r]);
    2035             }
     2034            for (; filesr[r]; r++) {
     2035              free(filesr[r]);
     2036            }
    20362037          }
    20372038          // Reduce count to match what is in containers
     
    20392040        } // if insufficient resources
    20402041
    2041           xfree(filesl, pszSrcFile, __LINE__);                  // Free header - have already freed elements
     2042          xfree(filesl, pszSrcFile, __LINE__);  // Free header - have already freed elements
    20422043        filesl = NULL;
    20432044          xfree(filesr, pszSrcFile, __LINE__);
     
    21462147      WinSetWindowPtr(hwnd, QWL_USER, (PVOID)cmp);
    21472148      {
    2148         SWP swp;
    2149         ULONG size = sizeof(SWP);
    2150 
    2151         PrfQueryProfileData(fmprof, FM3Str, "CompDir.Position", (PVOID) &swp, &size);
    2152         WinSetWindowPos(hwnd,
    2153                         HWND_TOP,
    2154                         swp.x,
    2155                         swp.y,
    2156                         swp.cx,
    2157                         swp.cy,
    2158                         swp.fl);
     2149        SWP swp;
     2150        ULONG size = sizeof(SWP);
     2151
     2152        PrfQueryProfileData(fmprof, FM3Str, "CompDir.Position", (PVOID) &swp, &size);
     2153        WinSetWindowPos(hwnd,
     2154                        HWND_TOP,
     2155                        swp.x,
     2156                        swp.y,
     2157                        swp.cx,
     2158                        swp.cy,
     2159                        swp.fl);
    21592160      }
    21602161      SetCnrCols(hwndLeft, TRUE);
     
    26762677                        GetPString(IDS_COULDNTSTARTTHREADTEXT));
    26772678          WinDismissDlg(hwnd, 0);
    2678           free(forthread);
    2679 #         ifdef FORTIFY
    2680           Fortify_LeaveScope();
    2681 #          endif
     2679          free(forthread);
     2680#         ifdef FORTIFY
     2681          Fortify_LeaveScope();
     2682#          endif
    26822683        }
    26832684        else {
     
    27342735      WinSetDlgItemText(hwnd, COMP_NOTE,
    27352736                        GetPString(IDS_COMPHOLDFILTERINGTEXT));
    2736       // cmp->dcd.suspendview = 1;              // 12 Jan 08 SHL appears not to be used here
     2737      // cmp->dcd.suspendview = 1;      // 12 Jan 08 SHL appears not to be used here
    27372738      priority_idle();                  // Don't hog resources
    27382739      WinSendMsg(hwndLeft, CM_FILTER, MPFROMP(Filter),
     
    27412742                 MPFROMP(&cmp->dcd.mask));
    27422743      priority_normal();
    2743       // cmp->dcd.suspendview = 0;              // 12 Jan 08 SHL appears not to be used here
     2744      // cmp->dcd.suspendview = 0;      // 12 Jan 08 SHL appears not to be used here
    27442745      if (*cmp->dcd.mask.szMask) {
    27452746        sprintf(s,
     
    27592760                                                  COMP_HIDENOTSELECTED);
    27602761
    2761       // cmp->dcd.suspendview = 1;              // 12 Jan 08 SHL appears not to be used here
     2762      // cmp->dcd.suspendview = 1;      // 12 Jan 08 SHL appears not to be used here
    27622763      if (wasHidden != 1) {
    27632764        // Hide if not selected on both sides
     
    27972798                   MPFROMP(&cmp->dcd.mask));
    27982799      }
    2799       // cmp->dcd.suspendview = 0;              // 12 Jan 08 SHL appears not to be used here
     2800      // cmp->dcd.suspendview = 0;      // 12 Jan 08 SHL appears not to be used here
    28002801      if (*cmp->dcd.mask.szMask) {
    28012802        sprintf(s,
     
    30743075    case DID_OK:
    30753076      {
    3076         SWP swp;
    3077         ULONG size = sizeof(SWP);
    3078 
    3079         WinQueryWindowPos(hwnd, &swp);
    3080         PrfWriteProfileData(fmprof, FM3Str, "CompDir.Position", (PVOID) &swp,
    3081                             size);
     3077        SWP swp;
     3078        ULONG size = sizeof(SWP);
     3079
     3080        WinQueryWindowPos(hwnd, &swp);
     3081        PrfWriteProfileData(fmprof, FM3Str, "CompDir.Position", (PVOID) &swp,
     3082                            size);
    30823083      }
    30833084      WinDismissDlg(hwnd, 0);
     
    30853086    case DID_CANCEL:
    30863087      {
    3087         SWP swp;
    3088         ULONG size = sizeof(SWP);
    3089 
    3090         WinQueryWindowPos(hwnd, &swp);
    3091         PrfWriteProfileData(fmprof, FM3Str, "CompDir.Position", (PVOID) &swp,
    3092                             size);
     3088        SWP swp;
     3089        ULONG size = sizeof(SWP);
     3090
     3091        WinQueryWindowPos(hwnd, &swp);
     3092        PrfWriteProfileData(fmprof, FM3Str, "CompDir.Position", (PVOID) &swp,
     3093                            size);
    30933094      }
    30943095      WinDismissDlg(hwnd, 1);
Note: See TracChangeset for help on using the changeset viewer.