* skip any special chars -- save precision in
* case it's a %s format.
*/
- while (strchr(index_str + 1, *++fmt));
+ while (strchr(index_str + 1, *++fmt))
+ continue;
if (*fmt == '.' && isdigit(*++fmt)) {
prec = atoi(fmt);
while (isdigit(*++fmt))
static NOINLINE void rewrite(priv_dumper_t *dumper, FS *fs)
{
enum { NOTOKAY, USEBCNT, USEPREC } sokay;
- PR *pr, **nextpr = NULL;
FU *fu;
+ PR *pr;
char *p1, *p2, *p3;
char savech, *fmtp;
const char *byte_count_str;
* break each format unit into print units; each
* conversion character gets its own.
*/
- for (nconv = 0, fmtp = fu->fmt; *fmtp; nextpr = &pr->nextpr) {
+ for (nconv = 0, fmtp = fu->fmt; *fmtp; ) {
/* NOSTRICT */
/* DBU:[dvae@cray.com] zalloc so that forward ptrs start out NULL*/
pr = xzalloc(sizeof(PR));
if (!fu->nextpr)
fu->nextpr = pr;
- /* ignore nextpr -- its unused inside the loop and is
- * uninitialized 1st time through.
- */
/* skip preceding text and up to the next % sign */
for (p1 = fmtp; *p1 && *p1 != '%'; ++p1)
* interprets any data at all, and has no iteration count,
* repeat it as necessary.
*
- * if, rep count is greater than 1, no trailing whitespace
+ * if rep count is greater than 1, no trailing whitespace
* gets output from the last iteration of the format unit.
*/
for (fu = fs->nextfu; fu; fu = fu->nextfu) {
- if (!fu->nextfu && fs->bcnt < dumper->blocksize
- && !(fu->flags & F_SETREP) && fu->bcnt
+ if (!fu->nextfu
+ && fs->bcnt < dumper->blocksize
+ && !(fu->flags & F_SETREP)
+ && fu->bcnt
) {
fu->reps += (dumper->blocksize - fs->bcnt) / fu->bcnt;
}
- if (fu->reps > 1) {
+ if (fu->reps > 1 && fu->nextpr) {
for (pr = fu->nextpr;; pr = pr->nextpr)
if (!pr->nextpr)
break;
return;
}
}
- if (fseek(stdin, dumper->pub.dump_skip, SEEK_SET)) {
+ if (fseeko(stdin, dumper->pub.dump_skip, SEEK_SET)) {
bb_simple_perror_msg_and_die(fname);
}
dumper->address += dumper->pub.dump_skip;
p = fmt;
for (;;) {
p = skip_whitespace(p);
- if (!*p) {
+ if (*p == '\0') {
break;
}
/* skip slash and trailing white space */
if (*p == '/') {
- p = skip_whitespace(++p);
+ p = skip_whitespace(p + 1);
}
/* byte count */
}
tfu->bcnt = atoi(savep);
/* skip trailing white space */
- p = skip_whitespace(++p);
+ p = skip_whitespace(p + 1);
}
/* format */
bb_error_msg_and_die("bad format {%s}", fmt);
}
for (savep = ++p; *p != '"';) {
- if (*p++ == 0) {
+ if (*p++ == '\0') {
bb_error_msg_and_die("bad format {%s}", fmt);
}
}
/* alphabetic escape sequences have to be done in place */
for (p2 = p1;; ++p1, ++p2) {
- if (!*p1) {
+ if (*p1 == '\0') {
*p2 = *p1;
break;
}