Changeset 1069


Ignore:
Timestamp:
Jul 17, 2008, 1:53:38 AM (17 years ago)
Author:
Gregg Young
Message:

Fixes trap on viewing multiple files from an archive Ticket 248. Also includes initial code for using TMP directory for Temp files.

Location:
trunk/dll
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/arccnrs.c

    r1068 r1069  
    5454  29 Feb 08 GKY Use xfree where appropriate
    5555  14 Jul 08 JBS Ticket 126: Add support for WPS open default & open settings in arccnrs
     56  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.
    5658
    5759***********************************************************************/
     
    422424  HFILE newstdout;
    423425  CHAR s[CCHMAXPATH * 2], lonename[CCHMAXPATH + 2],
    424        *nsize, *osize, *fdate, *fname, *p, *pp, arctemp[33];
     426       *nsize, *osize, *fdate, *fname, *p, *pp, arctemp[CCHMAXPATH];
    425427  BOOL gotstart;
    426428  BOOL gotend;
     
    14981500
    14991501      if (li && li->list && li->list[0]) {
     1502        printf("%x/r", li->type); fflush(stdout);
    15001503        switch (li->type) {
    15011504        case IDM_ARCHIVE:
     
    17221725             do {
    17231726               for (x = z; li->list[x] &&
    1724                    strlen(pszCmdLine) + strlen(li->list[x]) < 999; x++) {
     1727                   strlen(pszCmdLine) + strlen(li->list[x]) < MaxComLineStrg - 1 ; x++) {
    17251728                strcat(pszCmdLine, " ");
    17261729                BldQuotedFileName(pszCmdLine + strlen(pszCmdLine), li->list[x]);
     
    17361739                      (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED) |
    17371740                      WAIT, hwnd, pszSrcFile, __LINE__,
    1738                       li->targetpath, NULL, "%s", pszCmdLine);
     1741                      li->targetpath, NULL, "%s", pszCmdLine);
    17391742              *endofit = 0;
    17401743            } while (li->list[x]);
     
    17541757                p = xmalloc(strlen(temp) + strlen(li->targetpath) + 2,
    17551758                            pszSrcFile, __LINE__);
    1756                 if (p) {
    1757                   strcpy(p, li->targetpath);
     1759                if (p) {
     1760                  BldFullPathName(p, li->targetpath, temp);
     1761                  /*strcpy(p, li->targetpath);
    17581762                  if (p[strlen(p) - 1] != '\\')
    17591763                    strcat(p, "\\");
    1760                   strcat(p, temp);
     1764                  strcat(p, temp);*/
    17611765                  li->list[x] = p;
    17621766                  free(temp);
     
    18231827                    }
    18241828                  }
    1825                 }
     1829                }
    18261830                BldFullPathName(pszCmdLine, li->targetpath, li->list[x]);
    18271831                temp = li->list[x];
    18281832                li->list[x] = xstrdup(pszCmdLine, pszSrcFile, __LINE__);
    1829                 free(pszCmdLine);
    18301833                if (!li->list[x])
    18311834                  li->list[x] = temp;
    18321835                else
    18331836                  xfree(temp, pszSrcFile, __LINE__);
    1834               }
     1837              }
     1838              free(pszCmdLine);
    18351839              if (li->type == IDM_VIEW || li->type == IDM_EDIT) {
    18361840
     
    18521856              if (li->type == IDM_MCIPLAY) {
    18531857
    1854                 FILE *fp;
    1855 
    1856                 fp = xfopen("$FM2PLAY.$$$", "w", pszSrcFile, __LINE__);
     1858                FILE *fp;
     1859                CHAR TempFile[CCHMAXPATH];
     1860
     1861                if (fUseTmp)
     1862                  BldFullPathName(TempFile, pTmpDir, "$FM2PLAY.$$$");
     1863                else
     1864                  strcpy(TempFile, "$FM2PLAY.$$$");
     1865
     1866                fp = xfopen(TempFile, "w", pszSrcFile, __LINE__);
    18571867                if (fp) {
    18581868                  fprintf(fp, "%s", ";AV/2-built FM2Play listfile\n");
     
    18601870                    fprintf(fp, "%s\n", li->list[x]);
    18611871                  fprintf(fp, ";end\n");
    1862                   fclose(fp);
    1863                   RunFM2Util("FM2PLAY.EXE", "/@$FM2PLAY.$$$");
     1872                  fclose(fp);
     1873                  strrev(TempFile);
     1874                  strcat(TempFile, "@/");
     1875                  strrev(TempFile);
     1876                  RunFM2Util("FM2PLAY.EXE", TempFile);
    18641877                }
    18651878              }
     
    19281941                  }
    19291942        }
    1930                
     1943
    19311944              }
    19321945              else {
     
    29482961      case IDM_OPENDEFAULT:
    29492962      case IDM_OPENSETTINGS:
     2963      case IDM_MCIPLAY:
    29502964        {
    29512965          LISTINFO *li;
     
    30123026            case IDM_VIRUSSCAN:
    30133027            case IDM_OPENDEFAULT:
    3014             case IDM_OPENSETTINGS:
     3028            case IDM_OPENSETTINGS:
     3029            case IDM_MCIPLAY:
    30153030              strcpy(li->targetpath, dcd->workdir);
    30163031              break;
     
    35143529        dcd->id = id;
    35153530        dcd->type = ARC_FRAME;
    3516         save_dir2(dcd->workdir);
    3517         if (dcd->workdir[strlen(dcd->workdir) - 1] != '\\')
    3518           strcat(dcd->workdir, "\\");
    3519         sprintf(dcd->workdir + strlen(dcd->workdir), "%s.%03x",
    3520                 ArcTempRoot, (clock() & 4095));
     3531        if (!fUseTmp) {
     3532          save_dir2(dcd->workdir);
     3533          if (dcd->workdir[strlen(dcd->workdir) - 1] != '\\')
     3534            strcat(dcd->workdir, "\\");
     3535          sprintf(dcd->workdir + strlen(dcd->workdir), "%s.%03x",
     3536                  ArcTempRoot, (clock() & 4095));
     3537        }
     3538        else
     3539          sprintf(dcd->workdir, "%s.%03x",
     3540                  ArcTempRoot, (clock() & 4095));
    35213541        strcpy(dcd->arcname, fullname);
    35223542        if (*extractpath) {
  • trunk/dll/filldir.c

    r1063 r1069  
    197197    char *psz;
    198198
    199     psz = getenv("TMP");
    200     if (!psz && *psz)
    201       psz = getenv("TEMP");
    202     if (psz && *psz) {
     199    if (fUseTmp) {
     200      psz = pTmpDir;
    203201      strcpy(szFileName, psz);
    204202      psz = szFileName + strlen(szFileName) - 1;
  • trunk/dll/fm3dll.h

    r1065 r1069  
    11101110             hwndLED, hwndLEDHdr, hwndAutoMLE, hwndCmdlist;
    11111111DATADEF HBITMAP hbmLEDon, hbmLEDoff;
    1112 DATADEF CHAR ArcTempRoot[9], ThousandsSeparator[2];
     1112DATADEF CHAR ArcTempRoot[CCHMAXPATH], ThousandsSeparator[2], *pTmpDir;
    11131113DATADEF HPOINTER hptrArrow, hptrBusy, hptrLast, hptrDir, hptrFile, hptrRemote,
    11141114  hptrFloppy, hptrDrive, hptrRemovable, hptrCDROM,hptrVirtual,hptrRamdisk,
     
    11431143  fFM2Deletes, fAutoAddAllDirs, fConfirmTarget, fChangeTarget,
    11441144  fFirstTime, fShowTarget, fNoFinger, fDrivebarHelp, fCheckMM,
    1145   fNoLargeFileSupport, fNoMailtoMailRun,
     1145  fNoLargeFileSupport, fNoMailtoMailRun, fUseTmp,
    11461146  fHttpRunWPSDefault, fFtpRunWPSDefault, fLibPathStrictMailRun,
    11471147  fLibPathStrictHttpRun, fLibPathStrictFtpRun, fCancelAction, fTrashCan;
  • trunk/dll/init.c

    r1065 r1069  
    650650
    651651  /* set up default root names for temp archive goodies */
    652   if (!fAmAV2)
    653     strcpy(ArcTempRoot, "$FM$ARC$");
    654   else
    655     strcpy(ArcTempRoot, "$AV$ARC$");
     652  env = getenv("TMP");
     653  if (env != NULL) {
     654    DosError(FERR_DISABLEHARDERR);
     655    rc = DosQueryPathInfo(env, FIL_STANDARD, &fs3, sizeof(fs3));
     656    if (!rc) {
     657      if (fs3.attrFile & FILE_DIRECTORY) {
     658        BldFullPathName(ArcTempRoot, env, fAmAV2 ? "$AV$ARC$" : "$FM$ARC$");
     659        pTmpDir = xstrdup(env, pszSrcFile, __LINE__);
     660        fUseTmp = TRUE;
     661      }
     662    }
     663  }
     664  else {
     665    env = getenv("TEMP");
     666    if (env != NULL) {
     667      DosError(FERR_DISABLEHARDERR);
     668      rc = DosQueryPathInfo(env, FIL_STANDARD, &fs3, sizeof(fs3));
     669      if (!rc) {
     670        if (fs3.attrFile & FILE_DIRECTORY) {
     671          BldFullPathName(ArcTempRoot, env, fAmAV2 ? "$AV$ARC$" : "$FM$ARC$");
     672          pTmpDir = xstrdup(env, pszSrcFile, __LINE__);
     673          fUseTmp = TRUE;
     674        }
     675      }
     676    }
     677  }
     678  if (!fUseTmp) {
     679    if (!fAmAV2)
     680      strcpy(ArcTempRoot, "$FM$ARC$");
     681    else
     682      strcpy(ArcTempRoot, "$AV$ARC$");
     683  }
    656684
    657685  /* initialize random number generator */
  • trunk/dll/worker.c

    r1063 r1069  
    2626  29 Feb 08 GKY Refactor global command line variables to notebook.h
    2727  22 Jun 08 GKY Made Felete move to xworkplace trash can  on systems that have it
     28  16 JUL 08 GKY Use TMP directory for temp files
    2829
    2930***********************************************************************/
     
    10671068              if (total > 1000) {
    10681069
    1069                 FILE *fp;
     1070                FILE *fp;
     1071                CHAR TempFile[CCHMAXPATH];
     1072
     1073                if (fUseTmp)
     1074                  BldFullPathName(TempFile, pTmpDir, "$FM2PLAY.$$$");
     1075                else
     1076                  strcpy(TempFile, "$FM2PLAY.$$$");
     1077
     1078                fp = xfopen(TempFile, "w", pszSrcFile, __LINE__);
     1079                if (fp) {
     1080                  fprintf(fp, "%s", ";AV/2-built FM2Play listfile\n");
     1081                  for (x = 0; wk->li->list[x]; x++)
     1082                    fprintf(fp, "%s\n", wk->li->list[x]);
     1083                  fprintf(fp, ";end\n");
     1084                  fclose(fp);
     1085                  strrev(TempFile);
     1086                  strcat(TempFile, "@/");
     1087                  strrev(TempFile);
     1088                  RunFM2Util("FM2PLAY.EXE", TempFile);
     1089                }
     1090                /*FILE *fp;
    10701091
    10711092                fp = xfopen("$FM2PLAY.$$$", "w", pszSrcFile, __LINE__);
     
    10781099                  RunFM2Util("FM2PLAY.EXE", "/#$FM2PLAY.$$$");
    10791100                  break;
    1080                 }
     1101                }*/
    10811102              }
    10821103            }
Note: See TracChangeset for help on using the changeset viewer.