pkgsrc/games/craft/patches/patch-ah
dholland a2c55dd58b Assorted fixes and cleanup.
- if we're going to supply the build makefile, it shouldn't require gmake.
 - don't install executable html or gif files
 - add patch comments
 - const correctness for string constants, as demanded by gcc 4.5
 - avoid needing -lcompat
 - fix a y2038 issue

PKGREVISION -> 2
2011-12-20 16:18:16 +00:00

132 lines
3.3 KiB
Text

$NetBSD: patch-ah,v 1.2 2011/12/20 16:18:16 dholland Exp $
- handle platforms where char is unsigned (XXX looks suspicious to me)
- const correctness demanded by recent gcc
--- xfile.hc.orig 2011-12-20 15:13:53.000000000 +0000
+++ xfile.hc
@@ -12,10 +12,10 @@
/*----------------------------------------------------------------------*/
struct conv
- {char b0;
- char b1;
- char b2;
- char b3;
+ {signed char b0;
+ signed char b1;
+ signed char b2;
+ signed char b3;
};
union conv_data
@@ -29,7 +29,7 @@ union conv_data
/* General functions */
/*----------------------------------------------------------------------*/
-bool f_exists (char file_name [])
+bool f_exists (const char file_name [])
{FILE *f;
bool is_error;
@@ -60,7 +60,7 @@ double d_get (FILE *f, bool &is_eof)
}
-void f_open (FILE *&f, char name [], char mode [])
+void f_open (FILE *&f, const char name [], const char mode [])
{f = fopen (name, mode);
check_error;
@@ -74,7 +74,7 @@ void f_open (FILE *&f, char name [], cha
}
-void f_open_with_extend (FILE *&f, char name [], char mode [], int max_no)
+void f_open_with_extend (FILE *&f, const char name [], const char mode [], int max_no)
{int version;
char v_name [128];
@@ -113,7 +113,7 @@ char *f_getline (FILE *f, char record []
return r;
}
-time_t f_date (char file_name [])
+time_t f_date (const char file_name [])
{
}
/*
@@ -124,7 +124,7 @@ time_t f_date (char file_name [])
}
*/
-char *f_name (char full_path [])
+char *f_name (const char full_path [])
{static char r [1024];
int i;
@@ -136,7 +136,7 @@ char *f_name (char full_path [])
return r;
}
-char *f_path (char full_path [])
+char *f_path (const char full_path [])
{static char r [1024];
int p = 0;
@@ -150,7 +150,7 @@ char *f_path (char full_path [])
return r;
}
-char *f_tail (char full_path [])
+char *f_tail (const char full_path [])
{static char r [1024];
if (f_is_dir (full_path))
@@ -168,30 +168,30 @@ char *f_tail (char full_path [])
}
-char *f_home_dir (char full_name [])
+char *f_home_dir (const char full_name [])
{static char result [512];
sprintf (result, "/home/%s", &full_name [1]);
return result;
}
-bool f_is_pattern (char f_name [])
+bool f_is_pattern (const char f_name [])
{return (strstr (f_name, "*") != NULL);
}
-bool f_is_dir (char file_name [])
+bool f_is_dir (const char file_name [])
{return (file_name [strlen (file_name)-1] == '/' ||
file_name [strlen (file_name)-1] == '.');
}
-bool f_is_home_dir (char full_name [])
+bool f_is_home_dir (const char full_name [])
{return full_name [0] == '~';
}
-bool sel_get_name (char name [],
+bool sel_get_name (const char name [],
char f_name [],
- char f_pattern [],
- char mode [])
+ const char f_pattern [],
+ const char mode [])
{char pat [256];
file_selector *fsel;
@@ -260,7 +260,7 @@ bool sel_get_name (char name [],
}
-char *complete (char name [], char tail [])
+char *complete (const char name [], const char tail [])
{static char r [256];
strcpy (r, name);