[Mesa-dev] [PATCH 3/8] mesa: use PRIu64 for printing 64-bit uints
Roland Scheidegger
sroland at vmware.com
Fri Aug 8 17:15:52 PDT 2014
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).
Other than that, is there some recommendation wrt whitespace around that
ugly format specifier? Some places seem to use it, some don't. Either
way it's ugly dunno which one is worse. Would be nice though if we'd be
consistent imho.
Roland
> return false;
> }
>
> @@ -2836,8 +2837,8 @@ bind_buffers_check_offset_and_size(struct gl_context *ctx,
> * value in <sizes> is less than or equal to zero (per binding)."
> */
> _mesa_error(ctx, GL_INVALID_VALUE,
> - "glBindBuffersRange(sizes[%u]=%lld <= 0)",
> - index, (long long int) sizes[index]);
> + "glBindBuffersRange(sizes[%u]=%" PRIu64 " <= 0)",
> + index, (uint64_t) sizes[index]);
> return false;
> }
>
> @@ -3032,11 +3033,11 @@ bind_uniform_buffers_range(struct gl_context *ctx, GLuint first, GLsizei count,
> */
> if (offsets[i] & (ctx->Const.UniformBufferOffsetAlignment - 1)) {
> _mesa_error(ctx, GL_INVALID_VALUE,
> - "glBindBuffersRange(offsets[%u]=%lld is misaligned; "
> - "it must be a multiple of the value of "
> + "glBindBuffersRange(offsets[%u]=%" PRIu64
> + " is misaligned; it must be a multiple of the value of "
> "GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT=%u when "
> "target=GL_UNIFORM_BUFFER)",
> - i, (long long int) offsets[i],
> + i, (uint64_t) offsets[i],
> ctx->Const.UniformBufferOffsetAlignment);
> continue;
> }
> @@ -3270,19 +3271,19 @@ bind_xfb_buffers_range(struct gl_context *ctx,
> */
> if (offsets[i] & 0x3) {
> _mesa_error(ctx, GL_INVALID_VALUE,
> - "glBindBuffersRange(offsets[%u]=%lld is misaligned; "
> - "it must be a multiple of 4 when "
> + "glBindBuffersRange(offsets[%u]=%" PRIu64
> + " is misaligned; it must be a multiple of 4 when "
> "target=GL_TRANSFORM_FEEDBACK_BUFFER)",
> - i, (long long int) offsets[i]);
> + i, (uint64_t) offsets[i]);
> continue;
> }
>
> if (sizes[i] & 0x3) {
> _mesa_error(ctx, GL_INVALID_VALUE,
> - "glBindBuffersRange(sizes[%u]=%lld is misaligned; "
> - "it must be a multiple of 4 when "
> + "glBindBuffersRange(sizes[%u]=%" PRIu64
> + " is misaligned; it must be a multiple of 4 when "
> "target=GL_TRANSFORM_FEEDBACK_BUFFER)",
> - i, (long long int) sizes[i]);
> + i, (uint64_t) sizes[i]);
> continue;
> }
>
> @@ -3488,10 +3489,10 @@ bind_atomic_buffers_range(struct gl_context *ctx,
> */
> if (offsets[i] & (ATOMIC_COUNTER_SIZE - 1)) {
> _mesa_error(ctx, GL_INVALID_VALUE,
> - "glBindBuffersRange(offsets[%u]=%lld is misaligned; "
> - "it must be a multiple of %d when "
> + "glBindBuffersRange(offsets[%u]=%" PRIu64
> + " is misaligned; it must be a multiple of %d when "
> "target=GL_ATOMIC_COUNTER_BUFFER)",
> - i, (long long int) offsets[i], ATOMIC_COUNTER_SIZE);
> + i, (uint64_t) offsets[i], ATOMIC_COUNTER_SIZE);
> continue;
> }
>
> diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
> index 1454449..d1032d3 100644
> --- a/src/mesa/main/varray.c
> +++ b/src/mesa/main/varray.c
> @@ -24,6 +24,8 @@
> */
>
>
> +#include <inttypes.h> /* for PRIu64 macro */
> +
> #include "glheader.h"
> #include "imports.h"
> #include "bufferobj.h"
> @@ -1424,7 +1426,8 @@ _mesa_BindVertexBuffer(GLuint bindingIndex, GLuint buffer, GLintptr offset,
> */
> if (offset < 0) {
> _mesa_error(ctx, GL_INVALID_VALUE,
> - "glBindVertexBuffer(offset=%lld < 0)", (long long)offset);
> + "glBindVertexBuffer(offset=%" PRIu64 " < 0)",
> + (uint64_t) offset);
> return;
> }
>
> @@ -1550,15 +1553,15 @@ _mesa_BindVertexBuffers(GLuint first, GLsizei count, const GLuint *buffers,
> */
> if (offsets[i] < 0) {
> _mesa_error(ctx, GL_INVALID_VALUE,
> - "glBindVertexBuffer(offsets[%u]=%lldd < 0)",
> - i, (long long int) offsets[i]);
> + "glBindVertexBuffer(offsets[%u]=%" PRIu64 " < 0)",
> + i, (uint64_t) offsets[i]);
> continue;
> }
>
> if (strides[i] < 0) {
> _mesa_error(ctx, GL_INVALID_VALUE,
> - "glBindVertexBuffer(strides[%u]=%lld < 0)",
> - i, (long long int) strides[i]);
> + "glBindVertexBuffer(strides[%u]=%" PRIu64 " < 0)",
> + i, (uint64_t) strides[i]);
> continue;
> }
>
>
More information about the mesa-dev
mailing list