007-008.diff.bz2
patches · 2.3 KB · 2010-03-30
Download « Back to the patches list
diff -buraP 007/HACKLOG 008/HACKLOG
--- 007/HACKLOG 2008-10-08 12:40:28.000000000 -0400
+++ 008/HACKLOG 2008-10-08 12:42:18.000000000 -0400
@@ -299,3 +299,59 @@
Added defines for true/false if we're not C++
+081006 Quixadhal
+ 2255 Trying to compile with g++ 2.95 now....wheeee!
+ act_info.c: In function `void do_password(CHAR_DATA *, char *)':
+ act_info.c:2726: implicit declaration of function `int crypt(...)'
+ act_info.c:2726: passing `int' to argument 1 of `strcmp(const char *, const char *)' lacks a cast
+ act_info.c:2743: assignment to `char *' from `int' lacks a cast
+
+ Ok, this is because the man page for crypt() LIES! Yes, that's right....
+ according to man(3), crypt() is defined in unistd.h, but it's actually
+ split off into crypt.h (at least on linux systems).
+
+ So, I've included <crypt.h> in act_info.c and comm.c.
+
+ handler.c: In function `char * item_name(int)':
+ handler.c:188: warning: declaration of `item_type' shadows global declaration
+ handler.c: In function `char * weapon_name(int)':
+ handler.c:198: warning: declaration of `weapon_type' shadows global declaration
+
+ *chocking noises come from the console...*
+ Ok, newer gcc's don't complain here, because they distinguish
+ between functions, type definitions, and variables. However,
+ I think (a) having any of those with the same name is asking
+ for trouble (unless it's a constructor), and (b) having a
+ a variable named "type" is as bad as one named "class".
+
+ Lines like item_type == item_table[type].type make my eyes bleed.
+
+ In file included from save.c:38:
+ /usr/include/stdlib.h:584: warning: redundant redeclaration of `malloc(unsigned int)' in same scope
+ /usr/include/malloc.h:118: warning: previous declaration of `malloc(unsigned int)'
+ /usr/include/stdlib.h:587: warning: redundant redeclaration of `calloc(unsigned int, unsigned int)' in same scope
+ /usr/include/malloc.h:122: warning: previous declaration of `calloc(unsigned int, unsigned int)'
+ /usr/include/stdlib.h:595: warning: redundant redeclaration of `realloc(void *, unsigned int)' in same scope
+ /usr/include/malloc.h:128: warning: previous declaration of `realloc(void *, unsigned int)'
+ /usr/include/stdlib.h:597: warning: redundant redeclaration of `free(void *)' in same scope
+ /usr/include/malloc.h:131: warning: previous declaration of `free(void *)'
+ /usr/include/stdlib.h:602: warning: redundant redeclaration of `cfree(void *)' in same scope
+ /usr/include/malloc.h:134: warning: previous declaration of `cfree(void *)'
+ In file included from save.c:38:
+ /usr/include/stdlib.h:611: warning: redundant redeclaration of `valloc(unsigned int)' in same scope
+ /usr/include/malloc.h:140: warning: previous declaration of `valloc(unsigned int)'
+
+ Hmmmm, ok. I'm guessing 2.95 was more picky about the order of
+ include files. Commenting out malloc.h should do the trick!
+
+ Interesting! Switching from g++-2.95 to gcc-2.95 reveals a few new errors too!
+
+ act_info.c: In function `do_exits':
+ act_info.c:1324: warning: redundant redeclaration of `dir_name' in same scope
+ merc.h:1916: warning: previous declaration of `dir_name'
+
+ Several more too.... apparently, the merc folks added extern
+ declarations inside their function bodies... and when the
+ functions got moved around, they shadowed the actual declarations
+ since they now shared the same file.
+
diff -buraP 007/src/Makefile 008/src/Makefile
--- 007/src/Makefile 2008-10-08 12:40:28.000000000 -0400
+++ 008/src/Makefile 2008-10-08 12:42:18.000000000 -0400
@@ -1,5 +1,8 @@
CC = g++
+# Comment out the -Wmissing-format-attribute flag if you're using gcc 2.95
+# or upgrade!
+
W_FORMAT = -Wformat -Wformat-security -Wmissing-format-attribute
W_NITPICK = -Wpointer-arith -Winline
W_MESSY = -Wmissing-braces -Wparentheses -Wshadow -Wredundant-decls
diff -buraP 007/src/act_info.c 008/src/act_info.c
--- 007/src/act_info.c 2008-10-08 12:14:23.000000000 -0400
+++ 008/src/act_info.c 2008-10-08 12:42:18.000000000 -0400
@@ -37,6 +37,7 @@
#include <ctype.h>
#include <time.h>
#include <unistd.h>
+#include <crypt.h>
#include "merc.h"
#include "interp.h"
@@ -1320,7 +1321,7 @@
*/
void do_exits( CHAR_DATA *ch, char *argument )
{
- extern char * const dir_name[];
+ /* extern char * const dir_name[]; */
char buf[MAX_STRING_LENGTH];
EXIT_DATA *pexit;
bool found;
diff -buraP 007/src/comm.c 008/src/comm.c
--- 007/src/comm.c 2008-10-08 12:33:39.000000000 -0400
+++ 008/src/comm.c 2008-10-08 12:42:18.000000000 -0400
@@ -57,6 +57,7 @@
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
+#include <crypt.h>
#include "merc.h"
#include "interp.h"
@@ -1219,7 +1220,7 @@
*/
bool process_output( DESCRIPTOR_DATA *d, bool fPrompt )
{
- extern bool merc_down;
+ /* extern bool merc_down; */
/*
* Bust a prompt.
diff -buraP 007/src/db.c 008/src/db.c
--- 007/src/db.c 2008-10-08 12:40:28.000000000 -0400
+++ 008/src/db.c 2008-10-08 12:42:18.000000000 -0400
@@ -1098,7 +1098,7 @@
*/
void fix_exits( void )
{
- extern const sh_int rev_dir [];
+ /* extern const sh_int rev_dir []; */
char buf[MAX_STRING_LENGTH];
ROOM_INDEX_DATA *pRoomIndex;
ROOM_INDEX_DATA *to_room;
diff -buraP 007/src/handler.c 008/src/handler.c
--- 007/src/handler.c 2008-10-08 12:33:39.000000000 -0400
+++ 008/src/handler.c 2008-10-08 12:42:18.000000000 -0400
@@ -184,22 +184,22 @@
return -1;
}
-char *item_name(int item_type)
+char *item_name(int target_type)
{
int type;
for (type = 0; item_table[type].name != NULL; type++)
- if (item_type == item_table[type].type)
+ if (target_type == item_table[type].type)
return item_table[type].name;
return "none";
}
-char *weapon_name( int weapon_type)
+char *weapon_name( int target_type)
{
int type;
for (type = 0; weapon_table[type].name != NULL; type++)
- if (weapon_type == weapon_table[type].type)
+ if (target_type == weapon_table[type].type)
return weapon_table[type].name;
return "exotic";
}
diff -buraP 007/src/save.c 008/src/save.c
--- 007/src/save.c 2008-10-08 12:40:28.000000000 -0400
+++ 008/src/save.c 2008-10-08 12:42:18.000000000 -0400
@@ -34,7 +34,7 @@
#include <stdio.h>
#include <string.h>
#include <time.h>
-#include <malloc.h>
+/* #include <malloc.h> */
#include <stdlib.h>
#include "merc.h"
#include "recycle.h"
diff -buraP 007/src/scan.c 008/src/scan.c
--- 007/src/scan.c 2008-10-08 12:14:23.000000000 -0400
+++ 008/src/scan.c 2008-10-08 12:42:18.000000000 -0400
@@ -47,7 +47,7 @@
sh_int depth, sh_int door));
void do_scan(CHAR_DATA *ch, char *argument)
{
- extern char *const dir_name[];
+ /* extern char *const dir_name[]; */
char arg1[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH];
ROOM_INDEX_DATA *scan_room;
EXIT_DATA *pExit;
@@ -110,7 +110,7 @@
void scan_char(CHAR_DATA *victim, CHAR_DATA *ch, sh_int depth, sh_int door)
{
- extern char *const dir_name[];
+ /* extern char *const dir_name[]; */
char buf[MAX_INPUT_LENGTH], buf2[MAX_INPUT_LENGTH];
buf[0] = '\0';