[PATCH 1/5] xorg: Fix a bunch of format string size warnings in debug code.

walter harms wharms at bfs.de
Tue May 6 00:12:30 PDT 2014



Am 05.05.2014 20:10, schrieb Eric Anholt:
> Signed-off-by: Eric Anholt <eric at anholt.net>
> ---
>  hw/xfree86/common/xf86Events.c           |  2 +-
>  hw/xfree86/common/xf86Helper.c           |  4 ++--
>  hw/xfree86/dri/dri.c                     |  2 +-
>  hw/xfree86/os-support/linux/lnx_video.c  |  2 +-
>  hw/xfree86/os-support/shared/bios_mmap.c |  2 +-
>  hw/xfree86/ramdac/TI.c                   |  2 +-
>  hw/xfree86/x86emu/sys.c                  | 12 ++++++------
>  7 files changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
> index 35a673d..18c37df 100644
> --- a/hw/xfree86/common/xf86Events.c
> +++ b/hw/xfree86/common/xf86Events.c
> @@ -181,7 +181,7 @@ ProcessInputEvents(void)
>  void
>  xf86ProcessActionEvent(ActionEvent action, void *arg)
>  {
> -    DebugF("ProcessActionEvent(%d,%x)\n", (int) action, arg);
> +    DebugF("ProcessActionEvent(%d,%p)\n", (int) action, arg);
>      switch (action) {
>      case ACTION_TERMINATE:
>          if (!xf86Info.dontZap) {
> diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
> index e2b32a0..1baa0ec 100644
> --- a/hw/xfree86/common/xf86Helper.c
> +++ b/hw/xfree86/common/xf86Helper.c
> @@ -1817,8 +1817,8 @@ xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type,
>      RootWinPropPtr pNewProp = NULL, pRegProp;
>      Bool existing = FALSE;
>  
> -    DebugF("xf86RegisterRootWindowProperty(%d, %ld, %ld, %d, %ld, %p)\n",
> -           ScrnIndex, property, type, format, len, value);
> +    DebugF("xf86RegisterRootWindowProperty(%d, %d, %d, %d, %ld, %p)\n",
> +           ScrnIndex, (int)property, (int)type, format, len, value);
>  
>      if (ScrnIndex < 0 || ScrnIndex >= xf86NumScreens) {
>          return BadMatch;
> diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c
> index 95828bb..6bba6ec 100644
> --- a/hw/xfree86/dri/dri.c
> +++ b/hw/xfree86/dri/dri.c
> @@ -1709,7 +1709,7 @@ DRISwapContext(int drmFD, void *oldctx, void *newctx)
>  
>      if (!newContext) {
>          DRIDrvMsg(pScreen->myNum, X_ERROR,
> -                  "[DRI] Context Switch Error: oldContext=%x, newContext=%x\n",
> +                  "[DRI] Context Switch Error: oldContext=%p, newContext=%p\n",
>                    oldContext, newContext);
>          return;
>      }
> diff --git a/hw/xfree86/os-support/linux/lnx_video.c b/hw/xfree86/os-support/linux/lnx_video.c
> index 47f5abc..cc7aafa 100644
> --- a/hw/xfree86/os-support/linux/lnx_video.c
> +++ b/hw/xfree86/os-support/linux/lnx_video.c
> @@ -454,7 +454,7 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
>          FatalError("xf86MapVidMem: Could not mmap framebuffer"
>                     " (0x%08lx,0x%lx) (%s)\n", Base, Size, strerror(errno));
>      }
> -    DebugF("base: %lx aligned base: %lx\n", base, (char *) base + alignOff);
> +    DebugF("base: %p aligned base: %p\n", base, (char *) base + alignOff);
>      return (char *) base + alignOff;
>  }
>  #endif                          /* !(__sparc__) */
> diff --git a/hw/xfree86/os-support/shared/bios_mmap.c b/hw/xfree86/os-support/shared/bios_mmap.c
> index e000dc9..2ae17c8 100644
> --- a/hw/xfree86/os-support/shared/bios_mmap.c
> +++ b/hw/xfree86/os-support/shared/bios_mmap.c
> @@ -62,7 +62,7 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
>          close(fd);
>          return -1;
>      }
> -    DebugF("xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n",
> +    DebugF("xf86ReadBIOS: BIOS at 0x%08lx has signature 0x%04x\n",
>             Base, ptr[0] | (ptr[1] << 8));
>      (void) memcpy(Buf, (void *) (ptr + Offset), Len);
>      (void) munmap((caddr_t) ptr, mlen);

i guess the caddr_t should read (void *)


> diff --git a/hw/xfree86/ramdac/TI.c b/hw/xfree86/ramdac/TI.c
> index 2492bb5..5cdf3c8 100644
> --- a/hw/xfree86/ramdac/TI.c
> +++ b/hw/xfree86/ramdac/TI.c
> @@ -114,7 +114,7 @@ TIramdacCalculateMNPForClock(unsigned long RefClock,    /* In 100Hz units */
>      VCO = 8.0 * IntRef * best_m / best_n;
>      ActualClock = VCO / (1 << p);
>  
> -    DebugF("f_out=%ld f_vco=%.1f n=%d m=%d p=%d\n",
> +    DebugF("f_out=%ld f_vco=%.1f n=%ld m=%ld p=%ld\n",
>             ActualClock, VCO, *rN, *rM, *rP);
>  
>      return ActualClock;
> diff --git a/hw/xfree86/x86emu/sys.c b/hw/xfree86/x86emu/sys.c
> index c514dde..031f44f 100644
> --- a/hw/xfree86/x86emu/sys.c
> +++ b/hw/xfree86/x86emu/sys.c
> @@ -191,7 +191,7 @@ rdb(u32 addr)
>      u8 val;
>  
>      if (addr > M.mem_size - 1) {
> -        DB(printk("mem_read: address %#lx out of range!\n", addr);
> +        DB(printk("mem_read: address %#x out of range!\n", addr);

i guess %p is ok here also ? (same for below)
Maybe you can use DebugF()  here also ?

just my 2 cents,

re,
 wh

>              )
>              HALT_SYS();
>      }
> @@ -217,7 +217,7 @@ rdw(u32 addr)
>      u16 val = 0;
>  
>      if (addr > M.mem_size - 2) {
> -        DB(printk("mem_read: address %#lx out of range!\n", addr);
> +        DB(printk("mem_read: address %#x out of range!\n", addr);
>              )
>              HALT_SYS();
>      }
> @@ -249,7 +249,7 @@ rdl(u32 addr)
>      u32 val = 0;
>  
>      if (addr > M.mem_size - 4) {
> -        DB(printk("mem_read: address %#lx out of range!\n", addr);
> +        DB(printk("mem_read: address %#x out of range!\n", addr);
>              )
>              HALT_SYS();
>      }
> @@ -282,7 +282,7 @@ wrb(u32 addr, u8 val)
>      DB(if (DEBUG_MEM_TRACE())
>         printk("%#08x 1 <- %#x\n", addr, val);)
>          if (addr > M.mem_size - 1) {
> -            DB(printk("mem_write: address %#lx out of range!\n", addr);
> +            DB(printk("mem_write: address %#x out of range!\n", addr);
>                  )
>                  HALT_SYS();
>          }
> @@ -303,7 +303,7 @@ wrw(u32 addr, u16 val)
>      DB(if (DEBUG_MEM_TRACE())
>         printk("%#08x 2 <- %#x\n", addr, val);)
>          if (addr > M.mem_size - 2) {
> -            DB(printk("mem_write: address %#lx out of range!\n", addr);
> +            DB(printk("mem_write: address %#x out of range!\n", addr);
>                  )
>                  HALT_SYS();
>          }
> @@ -331,7 +331,7 @@ wrl(u32 addr, u32 val)
>      DB(if (DEBUG_MEM_TRACE())
>         printk("%#08x 4 <- %#x\n", addr, val);)
>          if (addr > M.mem_size - 4) {
> -            DB(printk("mem_write: address %#lx out of range!\n", addr);
> +            DB(printk("mem_write: address %#x out of range!\n", addr);
>                  )
>                  HALT_SYS();
>          }


More information about the xorg-devel mailing list