Message ID | 158e520ae5748a6e32eeefad99dea0395dd4c2a7.1303202005.git.ext-andriy.shevchenko@nokia.com |
---|---|
State | New, archived |
Headers | show |
On Tue, Apr 19, 2011 at 04:34, Andy Shevchenko wrote: > - fprintf(stderr, "Image size %ld bytes is not a multiple of erasesize %d bytes\n", > - st.st_size, erasesize); > + fprintf(stderr, "Image size %" PRIu64 " bytes is not a multiple of " > + "erasesize %d bytes\n", st.st_size, erasesize); i think we want to avoid splitting string constants -mike
On Tue, 2011-04-19 at 10:26 -0400, ext Mike Frysinger wrote: > On Tue, Apr 19, 2011 at 04:34, Andy Shevchenko wrote: > > - fprintf(stderr, "Image size %ld bytes is not a multiple of erasesize %d bytes\n", > > - st.st_size, erasesize); > > + fprintf(stderr, "Image size %" PRIu64 " bytes is not a multiple of " > > + "erasesize %d bytes\n", st.st_size, erasesize); > > i think we want to avoid splitting string constants I looked to many other places in the code where it has split in string constants. So, this is an irrelevant issue. However, I could join back the strings which I touch in patches.
On Tue, Apr 19, 2011 at 10:32, Andy Shevchenko wrote: > On Tue, 2011-04-19 at 10:26 -0400, ext Mike Frysinger wrote: >> On Tue, Apr 19, 2011 at 04:34, Andy Shevchenko wrote: >> > - fprintf(stderr, "Image size %ld bytes is not a multiple of erasesize %d bytes\n", >> > - st.st_size, erasesize); >> > + fprintf(stderr, "Image size %" PRIu64 " bytes is not a multiple of " >> > + "erasesize %d bytes\n", st.st_size, erasesize); >> >> i think we want to avoid splitting string constants > > I looked to many other places in the code where it has split in string > constants. So, this is an irrelevant issue. > However, I could join back the strings which I touch in patches. the current code base has a lot of ugly code. but that doesnt mean we should introduce more, and since you're changing things, it doesnt make it an irrelevant issue. -mike
diff --git a/serve_image.c b/serve_image.c index f8f28a1..0e7980f 100644 --- a/serve_image.c +++ b/serve_image.c @@ -2,7 +2,6 @@ #define _POSIX_C_SOURCE 199309 #include <time.h> - #include <errno.h> #include <error.h> #include <netdb.h> @@ -18,6 +17,8 @@ #include <netinet/in.h> #include <sys/time.h> #include <crc32.h> +#include <inttypes.h> + #include "mcast_image.h" int tx_rate = 80000; @@ -126,8 +127,8 @@ int main(int argc, char **argv) } if (st.st_size % erasesize) { - fprintf(stderr, "Image size %ld bytes is not a multiple of erasesize %d bytes\n", - st.st_size, erasesize); + fprintf(stderr, "Image size %" PRIu64 " bytes is not a multiple of " + "erasesize %d bytes\n", st.st_size, erasesize); exit(1); } image = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, rfd, 0);
The argument type of printf is __off64_t, meanwhile the classifier is "%ld". We agreed to use PRIu64 in such case. Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com> --- serve_image.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-)