Changeset 1082 for trunk/dll/arccnrs.c


Ignore:
Timestamp:
Jul 20, 2008, 12:37:36 AM (17 years ago)
Author:
Gregg Young
Message:

Changes so FM2 will use TMP/TEMP directory for all temp files; Replaced save_dir2 with global variable so BldFullPathName could easily replace code that performed the same function; Added #ifdef FORTIFY to free_ function that are only used when fortified.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/arccnrs.c

    r1078 r1082  
    5555  14 Jul 08 JBS Ticket 126: Add support for WPS open default & open settings in arccnrs
    5656  16 Jul 08 GKY Fix trap on viewing multiple files from an archive (misplaced free)
    57   16 JUL 08 GKY Use TMP directory for temp files if present.
     57  16 Jul 08 GKY Use TMP directory for temp files if present. Use MakeTempName
    5858
    5959***********************************************************************/
     
    424424  HFILE newstdout;
    425425  CHAR s[CCHMAXPATH * 2], lonename[CCHMAXPATH + 2],
    426        *nsize, *osize, *fdate, *fname, *p, *pp, arctemp[CCHMAXPATH];
     426       *nsize, *osize, *fdate, *fname, *p, *pp, *arctemp;
    427427  BOOL gotstart;
    428428  BOOL gotend;
     
    442442  if (!info)
    443443    info = find_type(arcname, NULL);
    444   for (x = 0; x < 99; x++) {
     444  arctemp = xmallocz(CCHMAXPATH, pszSrcFile, __LINE__);
     445  MakeTempName(arctemp, ArcTempRoot, 2);
     446  /*for (x = 0; x < 99; x++) {
    445447    sprintf(arctemp, "%s.%03x", ArcTempRoot, (clock() & 4095L));
    446448    if (IsFile(arctemp) == 1)
     
    448450    else
    449451      break;
    450   }
     452  } */
     453
     454  //printf("%s\r", arctemp); fflush(stdout);
    451455
    452456ReTry:
     
    508512    else {
    509513      fp = xfopen(arctemp, "w", pszSrcFile, __LINE__);
    510       if (!fp)
    511         return 0;
     514      if (!fp) {
     515        xfree(arctemp, pszSrcFile, __LINE__);
     516        return 0;
     517      }
    512518      else {
    513519        newstdout = -1;
     
    516522        if (rc) {
    517523          Dos_Error(MB_CANCEL, rc, hwndCnr, pszSrcFile, __LINE__,
    518                     "DosDupHandle");
     524                    "DosDupHandle");
     525          xfree(arctemp, pszSrcFile, __LINE__);
    519526          return 0;
    520527        }
     
    526533            Dos_Error(MB_CANCEL, rc, hwndCnr, pszSrcFile, __LINE__,
    527534                      "DosDupHandle");
    528             return 0;
     535            xfree(arctemp, pszSrcFile, __LINE__);
     536            return 0;
    529537          }
    530538          else {
     
    786794    DosError(FERR_DISABLEHARDERR);
    787795    DosForceDelete(arctemp);
     796    xfree(arctemp, pszSrcFile, __LINE__);
    788797  }
    789798
     
    14841493        free(s);
    14851494        if (IsFile(filename) == 1) {
    1486 #if 0 // 06 Oct 07 SHL fixme to be gone - set to 0 for ticket #58 testing
     1495#if 1 // 06 Oct 07 SHL fixme to be gone - set to 0 for ticket #58 testing
    14871496          if (fViewChild && fArcStuffVisible)
    14881497            DosSleep(100);  // Allow unzip session to finish closing 14 Mar 07 SHL
     
    17691778                if (p) {
    17701779                  BldFullPathName(p, li->targetpath, temp);
    1771                   /*strcpy(p, li->targetpath);
    1772                   if (p[strlen(p) - 1] != '\\')
    1773                     strcat(p, "\\");
    1774                   strcat(p, temp);*/
    17751780                  li->list[x] = p;
    17761781                  free(temp);
     
    35353540        dcd->id = id;
    35363541        dcd->type = ARC_FRAME;
    3537         if (!pTmpDir) {
    3538           save_dir2(dcd->workdir);
    3539           if (dcd->workdir[strlen(dcd->workdir) - 1] != '\\')
     3542        if (!pTmpDir)
     3543          save_dir2(dcd->workdir);
     3544        MakeTempName(dcd->workdir, ArcTempRoot, 2);
     3545          /*if (dcd->workdir[strlen(dcd->workdir) - 1] != '\\')
    35403546            strcat(dcd->workdir, "\\");
    35413547          sprintf(dcd->workdir + strlen(dcd->workdir), "%s.%03x",
    35423548                  ArcTempRoot, (clock() & 4095));
    3543         }
    35443549        else
    35453550          sprintf(dcd->workdir, "%s.%03x",
    3546                   ArcTempRoot, (clock() & 4095));
     3551                  ArcTempRoot, (clock() & 4095));*/
    35473552        strcpy(dcd->arcname, fullname);
    35483553        if (*extractpath) {
Note: See TracChangeset for help on using the changeset viewer.