From: Dan Nicolaescu Date: Sun, 3 Oct 2010 23:35:22 +0000 (-0700) Subject: Fix compilation warnings. X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~438^2~46^2~200 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=728a982db42d06c3c9db5f920336709387a54cda;p=emacs.git Fix compilation warnings. * lib-src/test-distrib.c (cool_read): * lib-src/movemail.c (main, concat): * lib-src/make-docfile.c (scan_file, write_c_args): * emacsclient.c (get_server_config): Fix -Wconversion warning. (egetenv): Move conditional definition earlier. (progname): Use const. * lib-src/sorted-doc.c (xstrdup): Use const. --- diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index cca90f9a8a9..6d5bf6c4e5b 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,5 +1,13 @@ 2010-10-03 Dan Nicolaescu + * test-distrib.c (cool_read): + * movemail.c (main, concat): + * make-docfile.c (scan_file, write_c_args): + * emacsclient.c (get_server_config): Fix -Wconversion warning. + (egetenv): Move conditional definition earlier. + (progname): Use const. + * sorted-doc.c (xstrdup): Use const. + * Makefile.in: Remove ^L, old makes choke on it. 2010-10-02 Wolfgang Schnerring (tiny change) diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index d3d6f1cacd8..b20710e110c 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -39,6 +39,9 @@ along with GNU Emacs. If not, see . */ # define CLOSE_SOCKET closesocket # define INITIALIZE() (initialize_sockets ()) +char *w32_getenv (char *); +#define egetenv(VAR) w32_getenv(VAR) + #else /* !WINDOWSNT */ # include "syswait.h" @@ -62,6 +65,8 @@ along with GNU Emacs. If not, see . */ # define WCONTINUED 8 # endif +#define egetenv(VAR) getenv(VAR) + #endif /* !WINDOWSNT */ #undef signal @@ -86,13 +91,6 @@ char *getenv (const char *), *getwd (char *); char *(getcwd) (char *, size_t); #endif -#ifdef WINDOWSNT -char *w32_getenv (char *); -#define egetenv(VAR) w32_getenv(VAR) -#else -#define egetenv(VAR) getenv(VAR) -#endif - #ifndef VERSION #define VERSION "unspecified" #endif @@ -119,7 +117,7 @@ char *w32_getenv (char *); /* Name used to invoke this program. */ -char *progname; +const char *progname; /* The second argument to main. */ char **main_argv; @@ -752,7 +750,7 @@ send_to_emacs (HSOCKET s, const char *data) { while (data) { - int dlen = strlen (data); + size_t dlen = strlen (data); if (dlen + sblen >= SEND_BUFFER_SIZE) { int part = SEND_BUFFER_SIZE - sblen; diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c index 4824731672b..e2dc99214d2 100644 --- a/lib-src/make-docfile.c +++ b/lib-src/make-docfile.c @@ -204,7 +204,8 @@ put_filename (char *filename) int scan_file (char *filename) { - int len = strlen (filename); + + size_t len = strlen (filename); put_filename (filename); if (len > 4 && !strcmp (filename + len - 4, ".elc")) @@ -442,7 +443,7 @@ write_c_args (FILE *out, char *func, char *buf, int minargs, int maxargs) register char *p; int in_ident = 0; char *ident_start; - int ident_length = 0; + size_t ident_length = 0; fprintf (out, "(fn"); diff --git a/lib-src/movemail.c b/lib-src/movemail.c index 4ccdc93688c..f300942427e 100644 --- a/lib-src/movemail.c +++ b/lib-src/movemail.c @@ -169,7 +169,7 @@ main (int argc, char **argv) { char *inname, *outname; int indesc, outdesc; - int nread; + ssize_t nread; int status; int c, preserve_mail = 0; @@ -551,8 +551,7 @@ main (int argc, char **argv) string-comparing the two paths, because one or both of them might be symbolic links pointing to some other directory. */ static char * -mail_spool_name (inname) - char *inname; +mail_spool_name (char *inname) { struct stat stat1, stat2; char *indir, *fname; @@ -632,7 +631,7 @@ pfatal_and_delete (char *name) static char * concat (const char *s1, const char *s2, const char *s3) { - int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3); + size_t len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3); char *result = (char *) xmalloc (len1 + len2 + len3 + 1); strcpy (result, s1); diff --git a/lib-src/sorted-doc.c b/lib-src/sorted-doc.c index db3f3029532..4fe830e4013 100644 --- a/lib-src/sorted-doc.c +++ b/lib-src/sorted-doc.c @@ -93,7 +93,7 @@ xmalloc (int size) } char * -xstrdup (char *str) +xstrdup (const char *str) { char *buf = xmalloc (strlen (str) + 1); (void) strcpy (buf, str); diff --git a/lib-src/test-distrib.c b/lib-src/test-distrib.c index 880bd115882..1487c2bab57 100644 --- a/lib-src/test-distrib.c +++ b/lib-src/test-distrib.c @@ -52,9 +52,10 @@ char buf[300]; /* Like `read' but keeps trying until it gets SIZE bytes or reaches eof. */ int -cool_read (int fd, char *buf, int size) +cool_read (int fd, char *buf, size_t size) { - int num, sofar = 0; + ssize_t num; + size_t sofar = 0; while (1) {