소스 검색

[Fix] Fix padded numbers printing

tags/1.7.8
Vsevolod Stakhov 6 년 전
부모
커밋
3f3e6a3ebf
1개의 변경된 파일8개의 추가작업 그리고 4개의 파일을 삭제
  1. 8
    4
      src/libutil/printf.c

+ 8
- 4
src/libutil/printf.c 파일 보기

@@ -371,7 +371,7 @@ rspamd_sprintf_num (gchar *buf, gchar *last, guint64 ui64, gchar zero,
*--p = _hex[(guint32) (ui64 & 0xf)];
} while (ui64 >>= 4);

len = (temp + sizeof (temp)) - p + 1;
len = (temp + sizeof (temp)) - p;
}
else { /* hexadecimal == 2 */
p = temp + sizeof(temp);
@@ -379,13 +379,17 @@ rspamd_sprintf_num (gchar *buf, gchar *last, guint64 ui64, gchar zero,
*--p = _HEX[(guint32) (ui64 & 0xf)];
} while (ui64 >>= 4);

len = (temp + sizeof (temp)) - p + 1;
len = (temp + sizeof (temp)) - p;
}

/* zero or space padding */

while (width > 0 && buf < last) {
*buf++ = zero;
if (len < width) {
width -= len;

while (width-- > 0 && buf < last) {
*buf++ = zero;
}
}

/* number safe copy */

Loading…
취소
저장