VirtualBox

Changeset 1184 in kBuild


Ignore:
Timestamp:
Oct 5, 2007 10:25:54 PM (17 years ago)
Author:
bird
Message:

Usage and version. Shut up a couple of warnings.

File:
1 edited

Legend:

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

    r1095 r1184  
    11/* $Id$ */
    22/** @file
    3  *
    43 * kObjCache - Object Cache.
    5  *
     4 */
     5
     6/*
    67 * Copyright (c) 2007 knut st. osmundsen <[email protected]>
    7  *
    88 *
    99 * This file is part of kBuild.
     
    2121 * You should have received a copy of the GNU General Public License
    2222 * along with kBuild; if not, write to the Free Software
    23  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
    2424 *
    2525 */
     
    5959# ifndef _P_WAIT
    6060#  define _P_WAIT   P_WAIT
    61 # endif 
     61# endif
    6262# ifndef _P_NOWAIT
    6363#  define _P_NOWAIT P_NOWAIT
     
    749749        size_t cb = cbBuf >= 128*1024 ? 128*1024 : cbBuf;
    750750        pSum->crc32 = crc32(pSum->crc32, pb, cb);
    751         MD5Update(&pCtx->MD5Ctx, pb, cb);
     751        MD5Update(&pCtx->MD5Ctx, pb, (unsigned)cb);
    752752        cbBuf -= cb;
    753753    }
     
    19251925
    19261926    kOCSumInitWithCtx(&pEntry->New.SumHead, &Ctx);
    1927     cbAlloc = pEntry->Old.cbCpp ? (pEntry->Old.cbCpp + 4*1024*1024 + 4096) & ~(4*1024*1024 - 1) : 4*1024*1024;
     1927    cbAlloc = pEntry->Old.cbCpp ? ((long)pEntry->Old.cbCpp + 4*1024*1024 + 4096) & ~(4*1024*1024 - 1) : 4*1024*1024;
    19281928    cbLeft = cbAlloc;
    19291929    pEntry->New.pszCppMapping = psz = xmalloc(cbAlloc);
     
    20532053                     pEntry->New.pszCppName, pEntry->pszDir, strerror(errno));
    20542054        psz = pEntry->New.pszCppMapping;
    2055         cbLeft = pEntry->New.cbCpp;
     2055        cbLeft = (long)pEntry->New.cbCpp;
    20562056        while (cbLeft > 0)
    20572057        {
     
    20952095{
    20962096    const char *psz = pEntry->New.pszCppMapping;
    2097     long cbLeft = pEntry->New.cbCpp;
     2097    long cbLeft = (long)pEntry->New.cbCpp;
    20982098    while (cbLeft > 0)
    20992099    {
     
    21772177
    21782178    kOCSumInitWithCtx(&pEntry->New.SumHead, &Ctx);
    2179     cbAlloc = pEntry->Old.cbCpp ? (pEntry->Old.cbCpp + 4*1024*1024 + 4096) & ~(4*1024*1024 - 1) : 4*1024*1024;
     2179    cbAlloc = pEntry->Old.cbCpp ? ((long)pEntry->Old.cbCpp + 4*1024*1024 + 4096) & ~(4*1024*1024 - 1) : 4*1024*1024;
    21802180    cbLeft = cbAlloc;
    21812181    pEntry->New.pszCppMapping = psz = xmalloc(cbAlloc);
     
    36313631 * @returns 0.
    36323632 */
    3633 static int usage(void)
    3634 {
    3635     printf("syntax: kObjCache [--kObjCache-options] [-v|--verbose]\n"
    3636            "            <  [-c|--cache-file <cache-file>]\n"
    3637            "             | [-n|--name <name-in-cache>] [[-d|--cache-dir <cache-dir>]] >\n"
    3638            "            <-f|--file <local-cache-file>>\n"
    3639            "            <-t|--target <target-name>>\n"
    3640            "            [-r|--redir-stdout] [-p|--passthru]\n"
    3641            "            --kObjCache-cpp <filename> <precompiler + args>\n"
    3642            "            --kObjCache-cc <object> <compiler + args>\n"
    3643            "            [--kObjCache-both [args]]\n"
    3644            "            [--kObjCache-cpp|--kObjCache-cc [more args]]\n"
    3645            "        kObjCache <-V|--version>\n"
    3646            "        kObjCache [-?|/?|-h|/h|--help|/help]\n"
    3647            "\n"
    3648            "The env.var. KOBJCACHE_DIR sets the default cache diretory (-d).\n"
    3649            "The env.var. KOBJCACHE_OPTS allow you to specifie additional options\n"
    3650            "without having to mess with the makefiles. These are appended with "
    3651            "a --kObjCache-options between them and the command args.\n"
    3652            "\n");
     3633static int usage(FILE *pOut)
     3634{
     3635    fprintf(pOut,
     3636            "syntax: kObjCache [--kObjCache-options] [-v|--verbose]\n"
     3637            "            <  [-c|--cache-file <cache-file>]\n"
     3638            "             | [-n|--name <name-in-cache>] [[-d|--cache-dir <cache-dir>]] >\n"
     3639            "            <-f|--file <local-cache-file>>\n"
     3640            "            <-t|--target <target-name>>\n"
     3641            "            [-r|--redir-stdout] [-p|--passthru]\n"
     3642            "            --kObjCache-cpp <filename> <precompiler + args>\n"
     3643            "            --kObjCache-cc <object> <compiler + args>\n"
     3644            "            [--kObjCache-both [args]]\n"
     3645            "            [--kObjCache-cpp|--kObjCache-cc [more args]]\n"
     3646            "        kObjCache <-V|--version>\n"
     3647            "        kObjCache [-?|/?|-h|/h|--help|/help]\n"
     3648            "\n"
     3649            "The env.var. KOBJCACHE_DIR sets the default cache diretory (-d).\n"
     3650            "The env.var. KOBJCACHE_OPTS allow you to specifie additional options\n"
     3651            "without having to mess with the makefiles. These are appended with "
     3652            "a --kObjCache-options between them and the command args.\n"
     3653            "\n");
    36533654    return 0;
    36543655}
     
    36963697     */
    36973698    if (argc <= 1)
    3698         return usage();
     3699        return usage(stderr);
    36993700    for (i = 1; i < argc; i++)
    37003701    {
     
    37243725            enmMode = kOC_Options;
    37253726        else if (!strcmp(argv[i], "--help"))
    3726             return usage();
     3727            return usage(stderr);
    37273728        else if (enmMode != kOC_Options)
    37283729        {
     
    37823783        else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "-?")
    37833784              || !strcmp(argv[i], "/h") || !strcmp(argv[i], "/?") || !strcmp(argv[i], "/help"))
    3784             return usage();
     3785        {
     3786            usage(stdout);
     3787            return 0;
     3788        }
    37853789        else if (!strcmp(argv[i], "-V") || !strcmp(argv[i], "--version"))
    37863790        {
    3787             printf("kObjCache v0.1.0 ($Revision$)\n");
     3791            printf("kObjCache - kBuild version %d.%d.%d ($Revision$)\n"
     3792                   "Copyright (C) 2007 Knut St. Osmundsen\n",
     3793                   KBUILD_VERSION_MAJOR, KBUILD_VERSION_MINOR, KBUILD_VERSION_PATCH);
    37883794            return 0;
    37893795        }
Note: See TracChangeset for help on using the changeset viewer.

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