From 3459e4f432cdde1bb57603eeab7fdf68ed8c3a6e Mon Sep 17 00:00:00 2001 From: Chris Allegretta Date: Thu, 24 Feb 2011 02:47:25 +0000 Subject: [PATCH] 2011-02-23 Chris Allegretta * Fix some more severe warnings from 'g++ -pedantic', from patch originally by Eitan Adler git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4534 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 4 ++++ src/chars.c | 6 +++--- src/files.c | 15 +++++++-------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 640e704a..42fb0ae1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2011-02-23 Chris Allegretta + * Fix some more severe warnings from 'g++ -pedantic', from patch originally + by Eitan Adler + 2011-02-23 Kamil Dudka * doc/man/nanorc.5: Fix small typo diff --git a/src/chars.c b/src/chars.c index a401dc5a..3ed88b00 100644 --- a/src/chars.c +++ b/src/chars.c @@ -630,7 +630,7 @@ char *mbstrcasestr(const char *haystack, const char *needle) return NULL; } else #endif - return strcasestr(haystack, needle); + return (char *) strcasestr(haystack, needle); } #if !defined(NANO_TINY) || !defined(DISABLE_TABCOMP) @@ -820,7 +820,7 @@ char *mbstrchr(const char *s, const char *c) return (char *)q; } else #endif - return strchr(s, *c); + return (char *) strchr(s, *c); } #endif /* !NANO_TINY || !DISABLE_JUSTIFY */ @@ -840,7 +840,7 @@ char *mbstrpbrk(const char *s, const char *accept) return NULL; } else #endif - return strpbrk(s, accept); + return (char *) strpbrk(s, accept); } /* This function is equivalent to strpbrk(), except in that it scans the diff --git a/src/files.c b/src/files.c index b1095987..430caf1d 100644 --- a/src/files.c +++ b/src/files.c @@ -2690,7 +2690,7 @@ const char *tail(const char *foo) /* Return the constructed dorfile path, or NULL if we can't find the home * directory. The string is dynamically allocated, and should be * freed. */ -char *construct_filename(char *str) +char *construct_filename(const char *str) { char *newstr = NULL; @@ -2708,7 +2708,7 @@ char *construct_filename(char *str) char *histfilename(void) { - return construct_filename( "/.nano/search_history"); + return construct_filename("/.nano/search_history"); } /* Construct the legacy history filename @@ -2721,7 +2721,7 @@ char *legacyhistfilename(void) char *poshistfilename(void) { - return construct_filename( "/.nano/filepos_history"); + return construct_filename("/.nano/filepos_history"); } @@ -2770,8 +2770,7 @@ void load_history(void) struct stat hstat; - if (histfilename && stat(legacyhist, &hstat) != -1 - && stat(nanohist, &hstat) == -1) { + if (stat(legacyhist, &hstat) != -1 && stat(nanohist, &hstat) == -1) { if (rename(legacyhist, nanohist) == -1) history_error(N_("Detected a legacy nano history file (%s) which I tried to move\nto the preferred location (%s) but encountered an error: %s"), legacyhist, nanohist, strerror(errno)); @@ -2939,7 +2938,7 @@ void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos) /* Didn't find it, make a new node yo! */ - posptr = nmalloc(sizeof(poshiststruct)); + posptr = (poshiststruct *) nmalloc(sizeof(poshiststruct)); posptr->filename = mallocstrcpy(NULL, fullpath); posptr->lineno = lineno; posptr->xno = xpos; @@ -3015,7 +3014,7 @@ void load_poshistory(void) lineno = atoi(lineptr); xno = atoi(xptr); if (poshistory == NULL) { - poshistory = nmalloc(sizeof(poshiststruct)); + poshistory = (poshiststruct *) nmalloc(sizeof(poshiststruct)); poshistory->filename = mallocstrcpy(NULL, line); poshistory->lineno = lineno; poshistory->xno = xno; @@ -3023,7 +3022,7 @@ void load_poshistory(void) } else { for (posptr = poshistory; posptr->next != NULL; posptr = posptr->next) ; - posptr->next = nmalloc(sizeof(poshiststruct)); + posptr->next = (poshiststruct *) nmalloc(sizeof(poshiststruct)); posptr->next->filename = mallocstrcpy(NULL, line); posptr->next->lineno = lineno; posptr->next->xno = xno; -- 2.39.5