vlc | branch: master | Rafaël Carré <[email protected]> | Mon Nov 18 18:42:28 2013 +0100| [b130680e62b99ab153e6233ef70981aa027a887b] | committer: Rafaël Carré
Print(Color)Msg: align pointers on the right Pad with 0s, remove 0x prefix > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b130680e62b99ab153e6233ef70981aa027a887b --- src/misc/messages.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/misc/messages.c b/src/misc/messages.c index bffe24f..4272f1d 100644 --- a/src/misc/messages.c +++ b/src/misc/messages.c @@ -204,6 +204,9 @@ static const char msg_type[4][9] = { "", " error", " warning", " debug" }; #define GRAY "\033[0m" static const char msg_color[4][8] = { WHITE, RED, YELLOW, GRAY }; +/* Display size of a pointer */ +static const int ptr_width = 2 * /* hex digits */ sizeof(uintptr_t); + static void PrintColorMsg (void *d, int type, const vlc_log_t *p_item, const char *format, va_list ap) { @@ -216,7 +219,7 @@ static void PrintColorMsg (void *d, int type, const vlc_log_t *p_item, int canc = vlc_savecancel (); flockfile (stream); - fprintf (stream, "["GREEN"%p"GRAY"] ", (void *)p_item->i_object_id); + fprintf (stream, "["GREEN"%0*"PRIxPTR""GRAY"] ", ptr_width, p_item->i_object_id); if (p_item->psz_header != NULL) utf8_fprintf (stream, "[%s] ", p_item->psz_header); utf8_fprintf (stream, "%s %s%s: %s", p_item->psz_module, @@ -242,7 +245,7 @@ static void PrintMsg (void *d, int type, const vlc_log_t *p_item, int canc = vlc_savecancel (); flockfile (stream); - fprintf (stream, "[%p] ", (void *)p_item->i_object_id); + fprintf (stream, "[%0*"PRIxPTR"] ", ptr_width, p_item->i_object_id); if (p_item->psz_header != NULL) utf8_fprintf (stream, "[%s] ", p_item->psz_header); utf8_fprintf (stream, "%s %s%s: ", p_item->psz_module, _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
