X-Git-Url: https://git.ao2.it/libam7xxx.git/blobdiff_plain/a878cffa75e0ce890f79ccb012775f6b23238e06..c39cfbdcd0066ab44a793046237c07de985bb048:/picoproj.c diff --git a/picoproj.c b/picoproj.c index 197d5da..32f90ea 100644 --- a/picoproj.c +++ b/picoproj.c @@ -130,6 +130,11 @@ static void dump_header(struct header *h) fflush(stdout); } +static inline unsigned int in_80chars(unsigned int i) +{ + return ((i+1) % (80/3)); +} + static void dump_buffer(uint8_t *buffer, unsigned int len) { unsigned int i; @@ -138,7 +143,7 @@ static void dump_buffer(uint8_t *buffer, unsigned int len) return; for (i = 0; i < len; i++) { - printf("%02hhX%c", buffer[i], (i < len - 1) ? ' ' : '\n'); + printf("%02hhX%c", buffer[i], (in_80chars(i) && (i < len - 1)) ? ' ' : '\n'); } fflush(stdout); } @@ -223,7 +228,7 @@ int main(int argc, char *argv[]) int width = 800; int height = 480; uint8_t *image = NULL; - int size = 59475; + unsigned int size = 59475; while ((opt = getopt(argc, argv, "f:F:W:H:h")) != -1) { switch (opt) {