The attached patch changes utils/utils.*:PrependHome() from using plain int to
describe the size of the buffer to size_t. The change is propagated up to
file.c where it is called.
diff -r -U3 nedit.isj8/source/file.c nedit.isj9/source/file.c
--- nedit.isj8/source/file.c 2007-10-14 13:52:50.000000000 +0200
+++ nedit.isj9/source/file.c 2007-10-16 01:06:23.000000000 +0200
@@ -90,7 +90,7 @@
static void safeClose(WindowInfo *window);
static int doOpen(WindowInfo *window, const char *name, const char *path,
int flags);
-static void backupFileName(WindowInfo *window, char *name, int len);
+static void backupFileName(WindowInfo *window, char *name, size_t len);
static int writeBckVersion(WindowInfo *window);
static int bckError(WindowInfo *window, const char *errString, const char
*file);
static int fileWasModifiedExternally(WindowInfo *window);
@@ -1149,7 +1149,7 @@
** Generate the name of the backup file for this window from the filename
** and path in the window data structure & write into name
*/
-static void backupFileName(WindowInfo *window, char *name, int len)
+static void backupFileName(WindowInfo *window, char *name, size_t len)
{
char bckname[MAXPATHLEN];
#ifdef VMS
Only in nedit.isj9: t.t
diff -r -U3 nedit.isj8/util/utils.c nedit.isj9/util/utils.c
--- nedit.isj8/util/utils.c 2006-02-11 11:37:28.000000000 +0100
+++ nedit.isj9/util/utils.c 2007-10-16 01:07:04.000000000 +0200
@@ -69,7 +69,7 @@
{
static char curdir[MAXPATHLEN];
- if (!getcwd(curdir, MAXPATHLEN)) {
+ if (!getcwd(curdir, (size_t)MAXPATHLEN)) {
perror("nedit: getcwd() fails");
strcpy(curdir, ".");
}
@@ -85,7 +85,7 @@
const char *ptr;
static char homedir[MAXPATHLEN]="";
struct passwd *passwdEntry;
- int len;
+ size_t len;
if (*homedir) {
return homedir;
@@ -206,10 +206,10 @@
** Return "" if it doesn't fit into the buffer
*/
char
-*PrependHome(const char *filename, char *buf, int buflen)
+*PrependHome(const char *filename, char *buf, size_t buflen)
{
const char *homedir;
- int home_len, file_len;
+ size_t home_len, file_len;
homedir=GetHomeDir();
home_len=strlen(homedir);
diff -r -U3 nedit.isj8/util/utils.h nedit.isj9/util/utils.h
--- nedit.isj8/util/utils.h 2006-02-11 11:37:28.000000000 +0100
+++ nedit.isj9/util/utils.h 2007-10-16 01:08:40.000000000 +0200
@@ -29,6 +29,7 @@
#define NEDIT_UTILS_H_INCLUDED
#include <sys/utsname.h>
+#include <stddef.h>
#ifdef VMS
#include "vmsparam.h"
@@ -38,7 +39,7 @@
const char *GetCurrentDir(void);
const char *GetHomeDir(void);
-char *PrependHome(const char *filename, char *buf, int buflen);
+char *PrependHome(const char *filename, char *buf, size_t buflen);
const char *GetUserName(void);
const char *GetNameOfHost(void);
int Max(int i1, int i2);
--
NEdit Develop mailing list - [email protected]
http://www.nedit.org/mailman/listinfo/develop