Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eblot/fd7e926a518ce8cbbc31 to your computer and use it in GitHub Desktop.
Save eblot/fd7e926a518ce8cbbc31 to your computer and use it in GitHub Desktop.
From f385e9ba2e2f293c0d6725e002b5f24b8748d65c Mon Sep 17 00:00:00 2001
From: Emmanuel Blot <eblot@moaningmarmot.info>
Date: Sat, 19 Jun 2010 22:43:48 +0200
Subject: [PATCH] Fix up string formatting for long long integers (64 bits)
---
examples/stream_test.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/examples/stream_test.c b/examples/stream_test.c
index 2c552e6..b404c09 100644
--- a/examples/stream_test.c
+++ b/examples/stream_test.c
@@ -83,7 +83,7 @@ readCallback(uint8_t *buffer, int length, FTDIProgressInfo *progress, void *user
if (start && (num != start +0x4000))
{
uint32_t delta = ((num-start)/0x4000)-1;
- fprintf(stderr, "Skip %7d blocks from 0x%08x to 0x%08x at blocks %10ld \n",
+ fprintf(stderr, "Skip %7d blocks from 0x%08x to 0x%08x at blocks %10lld \n",
delta, start -0x4000, num, blocks);
n_err++;
skips += delta;
@@ -98,7 +98,7 @@ readCallback(uint8_t *buffer, int length, FTDIProgressInfo *progress, void *user
if (start && (num != start +0x4000))
{
uint32_t delta = ((num-start)/0x4000)-1;
- fprintf(stderr, "Skip %7d blocks from 0x%08x to 0x%08x at blocks %10ld \n",
+ fprintf(stderr, "Skip %7d blocks from 0x%08x to 0x%08x at blocks %10lld \n",
delta, start -0x4000, num, blocks);
n_err++;
skips += delta;
@@ -239,7 +239,7 @@ int main(int argc, char **argv)
fclose(outputFile);
}
else if (check)
- fprintf(stderr,"%d errors of %ld blocks (%Le), %d (%Le) blocks skipped\n",
+ fprintf(stderr,"%d errors of %lld blocks (%Le), %d (%Le) blocks skipped\n",
n_err, blocks, (long double)n_err/(long double) blocks,
skips, (long double)skips/(long double) blocks);
exit (0);
@@ -328,7 +328,7 @@ void check_outfile(char *descstring)
{
if(n_shown < 30)
{
- fprintf(stderr, "Skip %7d blocks from 0x%08x to 0x%08x at blocks %10ld \n",
+ fprintf(stderr, "Skip %7d blocks from 0x%08x to 0x%08x at blocks %10lld \n",
(nread-start)/0x4000, start -0x4000, nread, blocks);
n_shown ++;
}
@@ -342,9 +342,9 @@ void check_outfile(char *descstring)
pc = pa;
}
if(n_errors)
- fprintf(stderr, "%d blocks wrong from %ld blocks read\n",
+ fprintf(stderr, "%d blocks wrong from %lld blocks read\n",
n_errors, blocks);
else
- fprintf(stderr, "%ld blocks all fine\n",blocks);
+ fprintf(stderr, "%lld blocks all fine\n",blocks);
}
}
--
1.7.0.2+GitX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment