changeset 110746:5c1a707ab452

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.
author Dan Nicolaescu <dann@ics.uci.edu>
date Sun, 03 Oct 2010 16:35:22 -0700
parents af2db97ca17a
children 0defef1647a5
files lib-src/ChangeLog lib-src/emacsclient.c lib-src/make-docfile.c lib-src/movemail.c lib-src/sorted-doc.c lib-src/test-distrib.c
diffstat 6 files changed, 25 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/lib-src/ChangeLog	Mon Oct 04 00:37:37 2010 +0200
+++ b/lib-src/ChangeLog	Sun Oct 03 16:35:22 2010 -0700
@@ -1,5 +1,13 @@
 2010-10-03  Dan Nicolaescu  <dann@ics.uci.edu>
 
+	* 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  <wosc@wosc.de>  (tiny change)
--- a/lib-src/emacsclient.c	Mon Oct 04 00:37:37 2010 +0200
+++ b/lib-src/emacsclient.c	Sun Oct 03 16:35:22 2010 -0700
@@ -39,6 +39,9 @@
 # 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 @@
 #  define WCONTINUED 8
 # endif
 
+#define egetenv(VAR) getenv(VAR)
+
 #endif /* !WINDOWSNT */
 
 #undef signal
@@ -86,13 +91,6 @@
 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 @@
 
 
 /* Name used to invoke this program.  */
-char *progname;
+const char *progname;
 
 /* The second argument to main. */
 char **main_argv;
@@ -752,7 +750,7 @@
 {
   while (data)
     {
-      int dlen = strlen (data);
+      size_t dlen = strlen (data);
       if (dlen + sblen >= SEND_BUFFER_SIZE)
 	{
 	  int part = SEND_BUFFER_SIZE - sblen;
--- a/lib-src/make-docfile.c	Mon Oct 04 00:37:37 2010 +0200
+++ b/lib-src/make-docfile.c	Sun Oct 03 16:35:22 2010 -0700
@@ -204,7 +204,8 @@
 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 @@
   register char *p;
   int in_ident = 0;
   char *ident_start;
-  int ident_length = 0;
+  size_t ident_length = 0;
 
   fprintf (out, "(fn");
 
--- a/lib-src/movemail.c	Mon Oct 04 00:37:37 2010 +0200
+++ b/lib-src/movemail.c	Sun Oct 03 16:35:22 2010 -0700
@@ -169,7 +169,7 @@
 {
   char *inname, *outname;
   int indesc, outdesc;
-  int nread;
+  ssize_t nread;
   int status;
   int c, preserve_mail = 0;
 
@@ -551,8 +551,7 @@
    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 @@
 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);
--- a/lib-src/sorted-doc.c	Mon Oct 04 00:37:37 2010 +0200
+++ b/lib-src/sorted-doc.c	Sun Oct 03 16:35:22 2010 -0700
@@ -93,7 +93,7 @@
 }
 
 char *
-xstrdup (char *str)
+xstrdup (const char *str)
 {
   char *buf = xmalloc (strlen (str) + 1);
   (void) strcpy (buf, str);
--- a/lib-src/test-distrib.c	Mon Oct 04 00:37:37 2010 +0200
+++ b/lib-src/test-distrib.c	Sun Oct 03 16:35:22 2010 -0700
@@ -52,9 +52,10 @@
 
 /* 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)
     {