Changeset 1069 for trunk/dll/arccnrs.c


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.

File:
1 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) {
Note: See TracChangeset for help on using the changeset viewer.