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>



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4534 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
Chris Allegretta 2011-02-24 02:47:25 +00:00
parent 20d93295c1
commit 3459e4f432
3 changed files with 14 additions and 11 deletions

View File

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

View File

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

View File

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