Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Mar 2012 19:17:56 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r233195 - head/usr.sbin/dconschat
Message-ID:  <201203191917.q2JJHuKf082494@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Mon Mar 19 19:17:55 2012
New Revision: 233195
URL: http://svn.freebsd.org/changeset/base/233195

Log:
  Fix the following warning from clang trunk:
  
  usr.sbin/dconschat/dconschat.c:163:65: error: format specifies type 'size_t' (aka 'unsigned int') but the argument has type 'off_t' (aka 'long long') [-Werror,-Wformat]
          snprintf(buf, PAGE_SIZE, "\r\n[dconschat reset target(addr=0x%zx)...]\r\n", dc->reset);
                                                                       ~~^            ~~~~~~~~~
                                                                       %llx
  
  Silence this by casting dc->reset to intmax_t, and using the appropriate
  length modifier.  While here, wrap the line to a 80 character margin.
  
  MFC after:	3 days

Modified:
  head/usr.sbin/dconschat/dconschat.c

Modified: head/usr.sbin/dconschat/dconschat.c
==============================================================================
--- head/usr.sbin/dconschat/dconschat.c	Mon Mar 19 19:06:40 2012	(r233194)
+++ head/usr.sbin/dconschat/dconschat.c	Mon Mar 19 19:17:55 2012	(r233195)
@@ -42,6 +42,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <signal.h>
+#include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <termios.h>
@@ -160,7 +161,9 @@ dconschat_reset_target(struct dcons_stat
 	if (dc->reset == 0)
 		return;
 
-	snprintf(buf, PAGE_SIZE, "\r\n[dconschat reset target(addr=0x%zx)...]\r\n", dc->reset);
+	snprintf(buf, PAGE_SIZE,
+	    "\r\n[dconschat reset target(addr=0x%jx)...]\r\n",
+	    (intmax_t)dc->reset);
 	write(p->outfd, buf, strlen(buf));
 	bzero(&buf[0], PAGE_SIZE);
 	dwrite(dc, (void *)buf, PAGE_SIZE, dc->reset);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203191917.q2JJHuKf082494>