aboutsummaryrefslogtreecommitdiff
path: root/convert_ptr.c
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2019-11-04 19:24:45 +0100
committerCharles <sircharlesaze@gmail.com>2019-11-04 19:24:45 +0100
commite6d8f543af4c1a45f30495b90a3912b1c75f2be7 (patch)
tree3654b9df8d7bb3c341218f901712bdb257d7d486 /convert_ptr.c
parenteca117f28afac2ee258d9e9454ff63c6dec5b58f (diff)
downloadft_printf-e6d8f543af4c1a45f30495b90a3912b1c75f2be7.tar.gz
ft_printf-e6d8f543af4c1a45f30495b90a3912b1c75f2be7.tar.bz2
ft_printf-e6d8f543af4c1a45f30495b90a3912b1c75f2be7.zip
Handled short convertions for unsigned int and hex
Diffstat (limited to 'convert_ptr.c')
-rw-r--r--convert_ptr.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/convert_ptr.c b/convert_ptr.c
index aa24cb5..8c0797a 100644
--- a/convert_ptr.c
+++ b/convert_ptr.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/30 23:24:08 by cacharle #+# #+# */
-/* Updated: 2019/10/30 23:25:33 by cacharle ### ########.fr */
+/* Updated: 2019/11/04 01:41:49 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -20,8 +20,13 @@ char *convert_ptr(va_list ap, t_pformat *pformat)
str = ITOA_HEX_LOW((long long unsigned int)va_arg(ap, void*));
str = handle_precision(pformat, str);
- str = add_hex_prefix(str);
+ if (!(pformat->flags & FLAG_ZERO_PADDING))
+ str = add_hex_prefix(str);
+ if (pformat->flags & FLAG_ZERO_PADDING)
+ pformat->min_width -= 2;
str = handle_padding(pformat, str);
+ if (pformat->flags & FLAG_ZERO_PADDING)
+ str = add_hex_prefix(str);
return (str);
}