diff --git a/ChangeLog b/ChangeLog index 640e704aae7b87b45cccb0414934d1a25af8a76a..42fb0ae185d4fdbe509312536f258d8ba19907df 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2011-02-23 Chris Allegretta <chrisa@asty.org> + * Fix some more severe warnings from 'g++ -pedantic', from patch originally + by Eitan Adler <lists@eitanadler.com> + 2011-02-23 Kamil Dudka <kdudka@redhat.com> * doc/man/nanorc.5: Fix small typo diff --git a/src/chars.c b/src/chars.c index a401dc5ab3aa4d08a628b4ea92bee1527134e7d1..3ed88b0054e86e0128ad75612bbf5ed5c43ea3c8 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 b10959871eaee2e43c53d52c62b1762f81e33290..430caf1d412b6ce66dd4c4eb6c637df2ba6f6a8c 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;