Changeset 1184 in kBuild
- Timestamp:
- Oct 5, 2007 10:25:54 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kObjCache/kObjCache.c
r1095 r1184 1 1 /* $Id$ */ 2 2 /** @file 3 *4 3 * kObjCache - Object Cache. 5 * 4 */ 5 6 /* 6 7 * Copyright (c) 2007 knut st. osmundsen <[email protected]> 7 *8 8 * 9 9 * This file is part of kBuild. … … 21 21 * You should have received a copy of the GNU General Public License 22 22 * along with kBuild; if not, write to the Free Software 23 * Foundation, Inc., 5 9 Temple Place, Suite 330, Boston, MA 02111-1307USA23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 24 24 * 25 25 */ … … 59 59 # ifndef _P_WAIT 60 60 # define _P_WAIT P_WAIT 61 # endif 61 # endif 62 62 # ifndef _P_NOWAIT 63 63 # define _P_NOWAIT P_NOWAIT … … 749 749 size_t cb = cbBuf >= 128*1024 ? 128*1024 : cbBuf; 750 750 pSum->crc32 = crc32(pSum->crc32, pb, cb); 751 MD5Update(&pCtx->MD5Ctx, pb, cb);751 MD5Update(&pCtx->MD5Ctx, pb, (unsigned)cb); 752 752 cbBuf -= cb; 753 753 } … … 1925 1925 1926 1926 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; 1928 1928 cbLeft = cbAlloc; 1929 1929 pEntry->New.pszCppMapping = psz = xmalloc(cbAlloc); … … 2053 2053 pEntry->New.pszCppName, pEntry->pszDir, strerror(errno)); 2054 2054 psz = pEntry->New.pszCppMapping; 2055 cbLeft = pEntry->New.cbCpp;2055 cbLeft = (long)pEntry->New.cbCpp; 2056 2056 while (cbLeft > 0) 2057 2057 { … … 2095 2095 { 2096 2096 const char *psz = pEntry->New.pszCppMapping; 2097 long cbLeft = pEntry->New.cbCpp;2097 long cbLeft = (long)pEntry->New.cbCpp; 2098 2098 while (cbLeft > 0) 2099 2099 { … … 2177 2177 2178 2178 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; 2180 2180 cbLeft = cbAlloc; 2181 2181 pEntry->New.pszCppMapping = psz = xmalloc(cbAlloc); … … 3631 3631 * @returns 0. 3632 3632 */ 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"); 3633 static 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"); 3653 3654 return 0; 3654 3655 } … … 3696 3697 */ 3697 3698 if (argc <= 1) 3698 return usage( );3699 return usage(stderr); 3699 3700 for (i = 1; i < argc; i++) 3700 3701 { … … 3724 3725 enmMode = kOC_Options; 3725 3726 else if (!strcmp(argv[i], "--help")) 3726 return usage( );3727 return usage(stderr); 3727 3728 else if (enmMode != kOC_Options) 3728 3729 { … … 3782 3783 else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "-?") 3783 3784 || !strcmp(argv[i], "/h") || !strcmp(argv[i], "/?") || !strcmp(argv[i], "/help")) 3784 return usage(); 3785 { 3786 usage(stdout); 3787 return 0; 3788 } 3785 3789 else if (!strcmp(argv[i], "-V") || !strcmp(argv[i], "--version")) 3786 3790 { 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); 3788 3794 return 0; 3789 3795 }
Note:
See TracChangeset
for help on using the changeset viewer.