From 0e56e1e04d024d2aa07f67f483f838a5797e8196 Mon Sep 17 00:00:00 2001 From: Baptiste Wicht Date: Tue, 2 Aug 2016 17:34:03 +0200 Subject: [PATCH] Fix few printf bugs --- printf/include/printf_def.hpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/printf/include/printf_def.hpp b/printf/include/printf_def.hpp index 9b7f8d41..2800dcbc 100644 --- a/printf/include/printf_def.hpp +++ b/printf/include/printf_def.hpp @@ -50,10 +50,8 @@ std::string vsprintf(const std::string& format, va_list va){ } while(min_digits > 0){ - while(min_digits > 0){ - arg += '0'; - --min_digits; - } + s += '0'; + --min_digits; } } } @@ -69,10 +67,8 @@ std::string vsprintf(const std::string& format, va_list va){ if(min_digits > d){ min_digits -= d; while(min_digits > 0){ - while(min_digits > 0){ - arg += '0'; - --min_digits; - } + s += '0'; + --min_digits; } } } @@ -201,7 +197,7 @@ void printf(const std::string& format, ...){ va_list va; va_start(va, format); - printf(format, va); + vprintf(format, va); va_end(va); }