Commit 718f35cf authored by Federico Vaga's avatar Federico Vaga

oldtools: fix compiler warning/errors

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent a454f72a
...@@ -60,7 +60,7 @@ int main(int argc, char **argv) ...@@ -60,7 +60,7 @@ int main(int argc, char **argv)
err++; err++;
} }
if (err) { if (err) {
fprintf(stderr, "%s: got %i errors reading %i attributes\n", fprintf(stderr, "%s: got %i errors reading %zu attributes\n",
argv[0], err, ARRAY_SIZE(words)); argv[0], err, ARRAY_SIZE(words));
} }
printf("%i.%09li\n", words[1].val, (long)words[2].val * 8); printf("%i.%09li\n", words[1].val, (long)words[2].val * 8);
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <time.h> #include <time.h>
#include <inttypes.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/select.h> #include <sys/select.h>
#include <sys/types.h> #include <sys/types.h>
...@@ -98,18 +99,18 @@ void event(uint32_t *a, char *name, int *seq, int modemask, long double *t1, ...@@ -98,18 +99,18 @@ void event(uint32_t *a, char *name, int *seq, int modemask, long double *t1,
if (delta < 0) if (delta < 0)
delta += 1000LL * 1000 * 1000 * 1000; delta += 1000LL * 1000 * 1000 * 1000;
if (*p1) { if (*p1) {
printf(" %012lli - delta %012lli", p2, delta); printf(" %012"PRIu64" - delta %012"PRIu64"", p2, delta);
if (expect) { if (expect) {
guess += expect; guess += expect;
if (guess > 1000LL * 1000 * 1000 * 1000) if (guess > 1000LL * 1000 * 1000 * 1000)
guess -= 1000LL * 1000 * 1000 * 1000; guess -= 1000LL * 1000 * 1000 * 1000;
printf(" - error %6i", (int)(p2 - guess)); printf(" - error %6i", (int)(p2 - guess));
} }
putchar('\n'); putchar('\n');
} }
else { else {
printf(" %012lli\n", p2); printf(" %012"PRIu64"\n", p2);
if (expect) if (expect)
guess = p2; guess = p2;
} }
*p1 = p2; *p1 = p2;
...@@ -229,8 +230,8 @@ int main(int argc, char **argv) ...@@ -229,8 +230,8 @@ int main(int argc, char **argv)
/* Ok, it's there: read and decode */ /* Ok, it's there: read and decode */
j = read(fd[i], &ctrl, sizeof(ctrl)); j = read(fd[i], &ctrl, sizeof(ctrl));
if (j != sizeof(ctrl)) { if (j != sizeof(ctrl)) {
fprintf(stderr, "%s: read(): got %i not %i\n", fprintf(stderr, "%s: read(): got %i not %zu\n",
argv[0], j, sizeof(ctrl)); argv[0], j, sizeof(ctrl));
exit(1); exit(1);
} }
attrs = ctrl.attr_channel.ext_val; attrs = ctrl.attr_channel.ext_val;
......
...@@ -41,7 +41,7 @@ int main(int argc, char **argv) ...@@ -41,7 +41,7 @@ int main(int argc, char **argv)
glob("/dev/zio/zio-fd-*-1-0-ctrl", GLOB_APPEND, NULL, &glob_buf); glob("/dev/zio/zio-fd-*-1-0-ctrl", GLOB_APPEND, NULL, &glob_buf);
if (glob_buf.gl_pathc != 1) { if (glob_buf.gl_pathc != 1) {
fprintf(stderr, "%s: found %i devices, need 1 only\n", fprintf(stderr, "%s: found %zu devices, need 1 only\n",
argv[0], glob_buf.gl_pathc); argv[0], glob_buf.gl_pathc);
exit(1); exit(1);
} }
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <inttypes.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/select.h> #include <sys/select.h>
#include <sys/types.h> #include <sys/types.h>
...@@ -69,8 +70,8 @@ static void perf_one(struct fd_perf *p, uint32_t *a /* attrs */) ...@@ -69,8 +70,8 @@ static void perf_one(struct fd_perf *p, uint32_t *a /* attrs */)
/* count hardware-reported pico */ /* count hardware-reported pico */
diff = pico - p->pico_prev; diff = pico - p->pico_prev;
if (0) { if (0) {
printf("%lli = %f - %f\n", diff, printf("%"PRIi64" = %f - %f\n", diff,
pico/1000000.0, p->pico_prev/1000000.0); pico/1000000.0, p->pico_prev/1000000.0);
} }
if (diff < 0) if (diff < 0)
diff += 1000LL * 1000 * 1000 * 1000; diff += 1000LL * 1000 * 1000 * 1000;
...@@ -107,7 +108,7 @@ static void perf_report_clean(struct fd_perf *p) ...@@ -107,7 +108,7 @@ static void perf_report_clean(struct fd_perf *p)
printf("%i pulses (%i lost)\n", p->nev, p->lost); printf("%i pulses (%i lost)\n", p->nev, p->lost);
printf(" hw: %llips (%fkHz) -- min %lli max %lli delta %lli\n", printf(" hw: %"PRIi64"ps (%fkHz) -- min %"PRIi64" max %"PRIi64" delta %"PRIi64"\n",
p->pico_avg, 1000.0 * 1000 * 1000 / p->pico_avg, p->pico_avg, 1000.0 * 1000 * 1000 / p->pico_avg,
p->pico_min, p->pico_max, p->pico_max - p->pico_min); p->pico_min, p->pico_max, p->pico_max - p->pico_min);
printf(" sw: %ius (%fkHz) -- min %i max %i delta %i\n", printf(" sw: %ius (%fkHz) -- min %i max %i delta %i\n",
...@@ -208,7 +209,7 @@ int main(int argc, char **argv) ...@@ -208,7 +209,7 @@ int main(int argc, char **argv)
/* Ok, it's there: read and decode */ /* Ok, it's there: read and decode */
j = read(fd[i], &ctrl, sizeof(ctrl)); j = read(fd[i], &ctrl, sizeof(ctrl));
if (j != sizeof(ctrl)) { if (j != sizeof(ctrl)) {
fprintf(stderr, "%s: read(): got %i not %i\n", fprintf(stderr, "%s: read(): got %i not %zu\n",
argv[0], j, sizeof(ctrl)); argv[0], j, sizeof(ctrl));
exit(1); exit(1);
} }
......
...@@ -72,7 +72,7 @@ int main(int argc, char **argv) ...@@ -72,7 +72,7 @@ int main(int argc, char **argv)
err++; err++;
} }
if (err) { if (err) {
fprintf(stderr, "%s: got %i errors writing %i attributes\n", fprintf(stderr, "%s: got %i errors writing %zu attributes\n",
argv[0], err, ARRAY_SIZE(words)); argv[0], err, ARRAY_SIZE(words));
} }
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment