VirtualBox

Changeset 1046 in kBuild for trunk/src


Ignore:
Timestamp:
Jun 9, 2007 4:56:00 AM (18 years ago)
Author:
bird
Message:

Added an extension to the default cache name. changed the magic for object entry files.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kObjCache/kObjCache.c

    r1045 r1046  
    11521152         */
    11531153        if (    !fgets(g_szLine, sizeof(g_szLine), pFile)
    1154             ||  strcmp(g_szLine, "magic=kObjCache-1\n"))
     1154            ||  strcmp(g_szLine, "magic=kObjCacheEntry-v0.1.0\n"))
    11551155        {
    11561156            InfoMsg(2, "bad cache file (magic)\n");
     
    13441344        do { int cch = expr; if (cch >= KOBJCACHE_MAX_LINE_LEN) FatalDie("Line too long: %d (max %d)\nexpr: %s\n", cch, KOBJCACHE_MAX_LINE_LEN, #expr); } while (0)
    13451345
    1346     fprintf(pFile, "magic=kObjCache-1\n");
     1346    fprintf(pFile, "magic=kObjCacheEntry-v0.1.0\n");
    13471347    CHECK_LEN(fprintf(pFile, "target=%s\n", pEntry->New.pszTarget ? pEntry->New.pszTarget : pEntry->Old.pszTarget));
    13481348    CHECK_LEN(fprintf(pFile, "key=%u\n", (unsigned long)pEntry->uKey));
     
    36553655    enum { kOC_Options, kOC_CppArgv, kOC_CcArgv, kOC_BothArgv } enmMode = kOC_Options;
    36563656
     3657    size_t cch;
    36573658    char *psz;
    36583659    int i;
     
    37773778    /*
    37783779     * Calc the cache file name.
     3780     * It's a bit messy since the extension has to be replaced.
    37793781     */
    37803782    if (!pszCacheFile)
     
    37843786        if (!pszCacheName)
    37853787        {
    3786             pszCacheName = FindFilenameInPath(pszEntryFile);
    3787             if (!*pszCacheName)
     3788            psz = (char *)FindFilenameInPath(pszEntryFile);
     3789            if (!*psz)
    37883790                return SyntaxError("The cache file (-f) specifies a directory / nothing!\n");
    3789             pszCacheName = xstrdup(pszCacheName);
     3791            cch = psz - pszEntryFile;
     3792            pszCacheName = memcpy(xmalloc(cch + 5), psz, cch + 1);
    37903793            psz = strrchr(pszCacheName, '.');
    3791             if (psz > pszCacheName)
    3792                 *psz = '\0';
     3794            if (!psz || psz <= pszCacheName)
     3795                psz = (char *)pszCacheName + cch;
     3796            memcpy(psz, ".koc", sizeof(".koc") - 1);
    37933797        }
    37943798        pszCacheFile = MakePathFromDirAndFile(pszCacheName, pszCacheDir);
     
    37963800
    37973801    /*
    3798      * Create and initialize the two bojects we'll be working on.
     3802     * Create and initialize the two objects we'll be working on.
    37993803     *
    38003804     * We're supposed to be the only ones actually writing to the local file,
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette