[PATCH 2/3] Fix printf() format
David Sharp
whereami at gmail.com
Sun Jun 14 02:03:40 PDT 2009
On Sun, Jun 14, 2009 at 12:06 AM, Ben Gamari<bgamari.foss at gmail.com> wrote:
> Fix compiler warning:
>
> imLcIm.c:364: warning: format ‘%03x’ expects type ‘unsigned int’, but argument 6 has type ‘long unsigned int’
> imLcIm.c:367: warning: format ‘%03x’ expects type ‘unsigned int’, but argument 6 has type ‘long unsigned int’
> ---
> modules/im/ximcp/imLcIm.c | 8 ++++----
> 1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/modules/im/ximcp/imLcIm.c b/modules/im/ximcp/imLcIm.c
> index 17121b5..e398112 100644
> --- a/modules/im/ximcp/imLcIm.c
> +++ b/modules/im/ximcp/imLcIm.c
> @@ -363,11 +363,11 @@ Private int _XimCachedFileName (
> *res = Xmalloc (len + 1 + 27 + 1); /* Max VERSION 9999 */
>
> if (len == 0 || dir [len-1] != '/')
> - sprintf (*res, "%s/%c%d_%03x_%08x_%08x", dir, _XimGetMyEndian(),
> - XIM_CACHE_VERSION, sizeof (DefTree), hash, hash2);
> + sprintf (*res, "%s/%c%d_%03lx_%08x_%08x", dir, _XimGetMyEndian(),
> + XIM_CACHE_VERSION, sizeof(DefTree), hash, hash2);
This will break systems where size_t is 32 bits. 'z' is the correct
length modifier for size_t
> else
> - sprintf (*res, "%s%c%d_%03x_%08x_%08x", dir, _XimGetMyEndian(),
> - XIM_CACHE_VERSION, sizeof (DefTree), hash, hash2);
> + sprintf (*res, "%s%c%d_%03lx_%08x_%08x", dir, _XimGetMyEndian(),
> + XIM_CACHE_VERSION, sizeof(DefTree), hash, hash2);
>
> /* fprintf (stderr, "-> %s\n", *res); */
> if ( (fd = _XOpenFile (*res, O_RDONLY)) == -1)
> --
> 1.6.3.1
>
> _______________________________________________
> xorg mailing list
> xorg at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xorg
More information about the xorg
mailing list