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.
This commit is contained in:
Dan Nicolaescu 2010-10-03 16:35:22 -07:00
parent c1ae068bbb
commit 728a982db4
6 changed files with 25 additions and 18 deletions

View file

@ -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)

View file

@ -39,6 +39,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
# 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 <http://www.gnu.org/licenses/>. */
# 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;

View file

@ -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");

View file

@ -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);

View file

@ -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);

View file

@ -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)
{