[Mesa-dev] [PATCH 3/8] mesa: use PRIu64 for printing 64-bit uints
Brian Paul
brianp at vmware.com
Mon Aug 11 08:23:56 PDT 2014
On 08/11/2014 09:10 AM, Roland Scheidegger wrote:
> Am 11.08.2014 15:29, schrieb Brian Paul:
>> On 08/08/2014 06:15 PM, Roland Scheidegger wrote:
>>> Am 08.08.2014 23:20, schrieb Brian Paul:
>>>> Silences MinGW warnings:
>>>> warning: unknown conversion type character ‘l’ in format [-Wformat]
>>>> warning: too many arguments for format [-Wformat-extra-args]
>>>> ---
>>>> src/mesa/main/bufferobj.c | 33 +++++++++++++++++----------------
>>>> src/mesa/main/varray.c | 13 ++++++++-----
>>>> 2 files changed, 25 insertions(+), 21 deletions(-)
>>>>
>>>> diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
>>>> index 1dfcda3..d59e63c 100644
>>>> --- a/src/mesa/main/bufferobj.c
>>>> +++ b/src/mesa/main/bufferobj.c
>>>> @@ -31,6 +31,7 @@
>>>> */
>>>>
>>>> #include <stdbool.h>
>>>> +#include <inttypes.h> /* for PRIu64 macro */
>>>> #include "glheader.h"
>>>> #include "enums.h"
>>>> #include "hash.h"
>>>> @@ -2824,8 +2825,8 @@ bind_buffers_check_offset_and_size(struct
>>>> gl_context *ctx,
>>>> * value in <offsets> is less than zero (per binding)."
>>>> */
>>>> _mesa_error(ctx, GL_INVALID_VALUE,
>>>> - "glBindBuffersRange(offsets[%u]=%lld < 0)",
>>>> - index, (long long int) offsets[index]);
>>>> + "glBindBuffersRange(offsets[%u]=%" PRIu64 " < 0)",
>>>> + index, (uint64_t) offsets[index]);
>>> Shouldn't that be printed with PRId64 instead (casting to int64_t)? Same
>>> for all others (and same in 4/8).
>>
>> I used 'u' since buffer sizes and offsets always positive values in
>> practice. But if you'd prefer signed I can change that. It doesn't
>> really matter to me.
>>
>> -Brian
>>
>
> Well I was mostly looking at what the code did before and what the type
> actually is, but for instance this one will print an error only if the
> value is below zero, so it imho makes more sense to print the value as a
> signed value.
Good point. I'll post updated patches.
-Brian
More information about the mesa-dev
mailing list