Fix several compiler warnings in C sources.
authorSteve Youngs <steve@sxemacs.org>
Mon, 14 Mar 2011 07:36:18 +0000 (17:36 +1000)
committerSteve Youngs <steve@sxemacs.org>
Mon, 14 Mar 2011 07:36:18 +0000 (17:36 +1000)
This takes care of most of the compiler warnings that have crept back into
the C sources.  There are a couple more left, but they will require us to
catch up with current versions of libpng and ffmpeg, so not quite as
trivial as the rest of this patch.

* modules/ase/ase-metric.c (ase_metric_prnt): Don't try to cast
XASE_METRIC_DIST to unsigned int, use %p printf mask instead.
Prevents compiler warning about casting pointer to int of
different size.

* src/ui/TTY/terminfo.c (emacs_tparam): cast string to char* to
keep tparm/ncurses happy.
Prevents compiler warning.

* src/ui/X11/glyphs-x.c (x_subwindow_query_geometry): Cast dx, dy
to int.
Prevents a compiler warning about wrong types.

* src/media/sound-alsa.h (sound_alsa_aj_data_s): samplerate is an
unsigned int.
Prevents a compiler warning.

Signed-off-by: Steve Youngs <steve@sxemacs.org>
modules/ase/ase-metric.c
src/media/sound-alsa.h
src/ui/TTY/terminfo.c
src/ui/X11/glyphs-x.c

index 68c8171..b61c0ee 100644 (file)
@@ -72,8 +72,7 @@ ase_metric_prnt(Lisp_Object obj, Lisp_Object pcf, int unused)
        {
                char addr[64];
                if (NILP(XASE_METRIC_LDIST(obj))) {
-                       snprintf(addr, 63, " 0x%x",
-                                (unsigned int)XASE_METRIC_DIST(obj));
+                       snprintf(addr, 63, " %p", XASE_METRIC_DIST(obj));
                } else {
                        Lisp_Object ldist = XASE_METRIC_LDIST(obj);
                        if (SYMBOLP(ldist)) {
index ef7f496..61bd4f6 100644 (file)
@@ -45,7 +45,7 @@ struct sound_alsa_data_s {
 
 struct sound_alsa_aj_data_s {
        /* stream props */
-       size_t samplerate;      /* rate used on the device */
+       unsigned int samplerate;        /* rate used on the device */
        unsigned int channels;  /* channels used on the device */
        size_t framesize;       /* resulting framesize */
        snd_pcm_format_t format;
index 1df88a4..e822587 100644 (file)
@@ -85,7 +85,7 @@ char *emacs_tparam(const char *string, char *outstring, int len, int arg1,
 {
        char *temp;
 
-       temp = (char *)tparm(string, arg1, arg2, arg3, arg4, arg5, arg6, arg7,
+       temp = (char *)tparm((char *)string, arg1, arg2, arg3, arg4, arg5, arg6, arg7,
                             arg8, arg9);
        if (outstring == 0) {
                outstring = (char *)xmalloc_atomic(strlen(temp) + 1);
index 6667f7d..8d44661 100644 (file)
@@ -2338,7 +2338,8 @@ x_subwindow_query_geometry(Lisp_Object image_instance,
 {
        Lisp_Image_Instance *ii = XIMAGE_INSTANCE(image_instance);
         Window droot;
-        unsigned int dx, dy, dbdw, dd, dw = 20, dh = 20;
+       int dx, dy;
+        unsigned int dbdw, dd, dw = 20, dh = 20;
 
         XGetGeometry(IMAGE_INSTANCE_X_SUBWINDOW_DISPLAY(ii),
                      (Window)IMAGE_INSTANCE_SUBWINDOW_ID(ii),