* common/buffer.c: Include inttypes.h and stdint.h.
	(buffer_xml_printf): Use PRId64, PRIu64, PRIx64 and PRIo64.
This commit is contained in:
Jan Kratochvil 2012-06-28 17:07:34 +00:00
parent 6034aab8a1
commit da2d6d3da4
2 changed files with 15 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2012-06-28 Jan Kratochvil <jan.kratochvil@redhat.com>
* common/buffer.c: Include inttypes.h and stdint.h.
(buffer_xml_printf): Use PRId64, PRIu64, PRIx64 and PRIo64.
2012-06-28 Jan Kratochvil <jan.kratochvil@redhat.com> 2012-06-28 Jan Kratochvil <jan.kratochvil@redhat.com>
Pedro Alves <palves@redhat.com> Pedro Alves <palves@redhat.com>

View File

@ -25,10 +25,12 @@
#include "xml-utils.h" #include "xml-utils.h"
#include "buffer.h" #include "buffer.h"
#include "inttypes.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <stdint.h>
void void
buffer_grow (struct buffer *buffer, const char *data, size_t size) buffer_grow (struct buffer *buffer, const char *data, size_t size)
@ -139,16 +141,20 @@ buffer_xml_printf (struct buffer *buffer, const char *format, ...)
switch (*f) switch (*f)
{ {
case 'd': case 'd':
sprintf (str, "%lld", va_arg (ap, long long)); sprintf (str, "%" PRId64,
(int64_t) va_arg (ap, long long));
break; break;
case 'u': case 'u':
sprintf (str, "%llu", va_arg (ap, unsigned long long)); sprintf (str, "%" PRIu64,
(uint64_t) va_arg (ap, unsigned long long));
break; break;
case 'x': case 'x':
sprintf (str, "%llx", va_arg (ap, unsigned long long)); sprintf (str, "%" PRIx64,
(uint64_t) va_arg (ap, unsigned long long));
break; break;
case 'o': case 'o':
sprintf (str, "%llo", va_arg (ap, unsigned long long)); sprintf (str, "%" PRIo64,
(uint64_t) va_arg (ap, unsigned long long));
break; break;
default: default:
str = 0; str = 0;