comparison src/xxd/xxd.c @ 4958:0a379dea13c9 v7.3.1224

updated for version 7.3.1224 Problem: Clang gives warnings on xxd. Solution: Change how to use part of a string. (Dominique Pelle) Also avoid warning for return not reached.
author Bram Moolenaar <bram@vim.org>
date Fri, 21 Jun 2013 18:31:23 +0200
parents d356b5ce84ce
children 6c94cedccda4
comparison
equal deleted inserted replaced
4957:9608d9953dc2 4958:0a379dea13c9
720 p = 0; 720 p = 0;
721 c = 0; 721 c = 0;
722 while ((length < 0 || p < length) && (c = getc(fp)) != EOF) 722 while ((length < 0 || p < length) && (c = getc(fp)) != EOF)
723 { 723 {
724 if (fprintf(fpo, (hexx == hexxa) ? "%s0x%02x" : "%s0X%02X", 724 if (fprintf(fpo, (hexx == hexxa) ? "%s0x%02x" : "%s0X%02X",
725 (p % cols) ? ", " : ",\n "+2*!p, c) < 0) 725 (p % cols) ? ", " : &",\n "[2*!p], c) < 0)
726 die(3); 726 die(3);
727 p++; 727 p++;
728 } 728 }
729 if (c == EOF && ferror(fp)) 729 if (c == EOF && ferror(fp))
730 die(2); 730 die(2);
731 731
732 if (p && fputs("\n", fpo) == EOF) 732 if (p && fputs("\n", fpo) == EOF)
733 die(3); 733 die(3);
734 if (fputs("};\n" + 3 * (fp == stdin), fpo) == EOF) 734 if (fputs(&"};\n"[3 * (fp == stdin)], fpo) == EOF)
735 die(3); 735 die(3);
736 736
737 if (fp != stdin) 737 if (fp != stdin)
738 { 738 {
739 if (fprintf(fpo, "unsigned int %s", isdigit((int)argv[1][0]) ? "__" : "") < 0) 739 if (fprintf(fpo, "unsigned int %s", isdigit((int)argv[1][0]) ? "__" : "") < 0)