diff options
| author | Charles <sircharlesaze@gmail.com> | 2019-10-30 18:07:21 +0100 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2019-10-30 18:07:21 +0100 |
| commit | 22f334a19cabebf10727d7894102946ba23d0e37 (patch) | |
| tree | fd323ff0dbb8fc06a00c8c26dfc6fbd3b5ae0910 /convert_int.c | |
| parent | 001786c8ec464b1ae3e6321acfd984227cb1bbee (diff) | |
| download | ft_printf-22f334a19cabebf10727d7894102946ba23d0e37.tar.gz ft_printf-22f334a19cabebf10727d7894102946ba23d0e37.tar.bz2 ft_printf-22f334a19cabebf10727d7894102946ba23d0e37.zip | |
Fixed %d segfault, merge hex_* in hex, fixed c = 0
Diffstat (limited to 'convert_int.c')
| -rw-r--r-- | convert_int.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/convert_int.c b/convert_int.c index 8bc0b1a..ebc360a 100644 --- a/convert_int.c +++ b/convert_int.c @@ -26,14 +26,18 @@ char *convert_int(va_list ap, t_pformat *pformat) str = handle_precision(pformat, str); if (pformat->flags & FLAG_ZERO_PADDING) { - if (is_neg || pformat->flags & FLAG_SIGNED || pformat->flags & FLAG_SPACE) + if (is_neg || pformat->flags & (FLAG_SIGNED | FLAG_SPACE)) pformat->min_width--; /* pformat->min_width--; */ str = handle_padding(pformat, str); } + /* str[ft_strlen(str)] = 0; */ if (is_neg) + { tmp = ft_strjoin("-", str); - else if (pformat->flags & FLAG_SIGNED || pformat->flags & FLAG_SPACE) + /* printf("%s\n", str); */ + } + else if (pformat->flags & (FLAG_SIGNED | FLAG_SPACE)) tmp = ft_strjoin(pformat->flags & FLAG_SPACE ? " " : "+", str); else tmp = ft_strdup(str); |
