Sat Jun 11 02:10:48 2011 UTC ()
Use %zu rather than cast


(sjg)
diff -r1.18 -r1.19 src/usr.bin/make/meta.c

cvs diff -r1.18 -r1.19 src/usr.bin/make/meta.c (expand / switch to unified diff)

--- src/usr.bin/make/meta.c 2011/06/10 23:57:39 1.18
+++ src/usr.bin/make/meta.c 2011/06/11 02:10:48 1.19
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: meta.c,v 1.18 2011/06/10 23:57:39 sjg Exp $ */ 1/* $NetBSD: meta.c,v 1.19 2011/06/11 02:10:48 sjg Exp $ */
2 2
3/* 3/*
4 * Implement 'meta' mode. 4 * Implement 'meta' mode.
5 * Adapted from John Birrell's patches to FreeBSD make. 5 * Adapted from John Birrell's patches to FreeBSD make.
6 * --sjg 6 * --sjg
7 */ 7 */
8/* 8/*
9 * Copyright (c) 2009-2010, Juniper Networks, Inc. 9 * Copyright (c) 2009-2010, Juniper Networks, Inc.
10 * Portions Copyright (c) 2009, John Birrell. 10 * Portions Copyright (c) 2009, John Birrell.
11 *  11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions  13 * modification, are permitted provided that the following conditions
14 * are met:  14 * are met:
@@ -756,28 +756,28 @@ fgetLine(char **bufp, size_t *szp, int o @@ -756,28 +756,28 @@ fgetLine(char **bufp, size_t *szp, int o
756 return x; 756 return x;
757 /* 757 /*
758 * We need to grow the buffer. 758 * We need to grow the buffer.
759 * The meta file can give us a clue. 759 * The meta file can give us a clue.
760 */ 760 */
761 if (fstat(fileno(fp), &fs) == 0) { 761 if (fstat(fileno(fp), &fs) == 0) {
762 size_t newsz; 762 size_t newsz;
763 char *p; 763 char *p;
764 764
765 newsz = ROUNDUP((fs.st_size / 2), BUFSIZ); 765 newsz = ROUNDUP((fs.st_size / 2), BUFSIZ);
766 if (newsz <= bufsz) 766 if (newsz <= bufsz)
767 newsz = ROUNDUP(fs.st_size, BUFSIZ); 767 newsz = ROUNDUP(fs.st_size, BUFSIZ);
768 if (DEBUG(META))  768 if (DEBUG(META))
769 fprintf(debug_file, "growing buffer %u -> %u\n", 769 fprintf(debug_file, "growing buffer %zu -> %zu\n",
770 (unsigned int)bufsz, (unsigned int)newsz); 770 bufsz, newsz);
771 p = bmake_realloc(buf, newsz); 771 p = bmake_realloc(buf, newsz);
772 if (p) { 772 if (p) {
773 *bufp = buf = p; 773 *bufp = buf = p;
774 *szp = bufsz = newsz; 774 *szp = bufsz = newsz;
775 /* fetch the rest */ 775 /* fetch the rest */
776 if (!fgets(&buf[x], bufsz - x, fp)) 776 if (!fgets(&buf[x], bufsz - x, fp))
777 return x; /* truncated! */ 777 return x; /* truncated! */
778 goto check_newline; 778 goto check_newline;
779 } 779 }
780 } 780 }
781 } 781 }
782 return 0; 782 return 0;
783} 783}