On 20/10/2019 21:07, Luc Van Oostenryck wrote:
On Wed, Sep 25, 2019 at 11:00:13AM +0100, Ben Dooks wrote:
+static struct format_type *parse_printf_get_fmt(struct format_type *type, const char *msg, const char **msgout)
+{
...
+ } else if (*ptr == 'p') {
+ ptr++;
+ type->test = printf_fmt_print_pointer;
+ //todo - check if there's anything after these?
+ if (*ptr == 'x' || *ptr == 'X') {
+ ptr++;
+ } else if (isalpha(*ptr)) {
+ // probably sxomething that /is/ being de-referenced
+ ptr++;
+ type->test = printf_fmt_pointer;
+ }
This needs an explanation for the isalpha() and why x/X is special cased.
ok, added
/* check for pointer being printed as hex explicitly */
and
/* probably some extra specifiers after %p */
+ } else if (*ptr == 'z') {
+ ptr++;
+ if (*ptr == 'd') {
+ ptr++;
+ type->test = printf_fmt_numtype;
+ type->data = &long_ctype;
+ } else if (*ptr == 'u' || *ptr == 'x') {
+ ptr++;
+ type->test = printf_fmt_numtype;
+ type->data = &ulong_ctype;
These should use size_t_ctype & ssize_t_type.
They also work with 'i', 'o' & 'X'.
ok, thanks
+ } else if (is_float_spec(*ptr)) {
+ type->test = printf_fmt_numtype;
+ type->data = &double_ctype;
if (szmod == 1) type->data = &ldouble_ctype;
ok, changed.
szmod == 1 ? &ldouble_ctype : &double_ctype;
--
Ben Dooks http://www.codethink.co.uk/
Senior Engineer Codethink - Providing Genius
https://www.codethink.co.uk/privacy.html