Subject: bin/6148: [PATCH] Rogue: patch to use const
To: None <gnats-bugs@gnats.netbsd.org>
From: Joseph Myers <jsm@octomino.demon.co.uk>
List: netbsd-bugs
Date: 09/13/1998 13:51:34
>Number: 6148
>Category: bin
>Synopsis: [PATCH] Rogue: patch to use const
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Sun Sep 13 07:05:03 1998
>Last-Modified:
>Originator: Joseph Samuel Myers
>Organization:
Trinity College, University of Cambridge, UK
>Release: NetBSD-current of 1998-09-12
>Environment:
[
System: Linux octomino 2.0.35 #1 Wed Aug 12 15:54:21 UTC 1998 i586 unknown
Architecture: i586
]
>Description:
The appended patch makes rogue(6) use `const' where appropriate. With
this patch, only object.c needs to be compiled with
-fwritable-strings; the other source files are clean with
-Wwrite-strings -Wcast-qual. (Without this patch, throw.c also needed
-fwritable-strings.)
The patch does not, however, change the Makefile so that only object.c
is built with -fwritable-strings, although this would be a good idea.
>How-To-Repeat:
>Fix:
diff -ruN rogue/hit.c rogue+/hit.c
--- rogue/hit.c Mon Oct 13 11:26:43 1997
+++ rogue+/hit.c Sun Sep 13 13:18:06 1998
@@ -67,7 +67,7 @@
object *monster;
{
short damage, hit_chance;
- char *mn;
+ const char *mn;
float minus;
if (fight_monster && (monster != fight_monster)) {
@@ -183,7 +183,7 @@
int
get_damage(ds, r)
- char *ds;
+ const char *ds;
boolean r;
{
int i = 0, j, n, d, total = 0;
@@ -210,7 +210,7 @@
int
get_w_damage(obj)
- object *obj;
+ const object *obj;
{
char new_damage[12];
int to_hit, damage;
@@ -230,7 +230,7 @@
int
get_number(s)
- char *s;
+ const char *s;
{
int i = 0;
int total = 0;
@@ -244,7 +244,7 @@
long
lget_number(s)
- char *s;
+ const char *s;
{
short i = 0;
long total = 0;
@@ -258,7 +258,7 @@
int
to_hit(obj)
- object *obj;
+ const object *obj;
{
if (!obj) {
return(1);
@@ -302,7 +302,7 @@
object *monster;
short damage;
{
- char *mn;
+ const char *mn;
short row, col;
monster->hp_to_kill -= damage;
@@ -440,7 +440,7 @@
int
get_hit_chance(weapon)
- object *weapon;
+ const object *weapon;
{
short hit_chance;
@@ -452,7 +452,7 @@
int
get_weapon_damage(weapon)
- object *weapon;
+ const object *weapon;
{
short damage;
diff -ruN rogue/init.c rogue+/init.c
--- rogue/init.c Mon Jul 27 11:06:03 1998
+++ rogue+/init.c Sun Sep 13 13:19:55 1998
@@ -70,8 +70,8 @@
boolean ask_quit = 1;
boolean no_skull = 0;
boolean passgo = 0;
-char *error_file = "rogue.esave";
-char *byebye_string = "Okay, bye bye!";
+const char *error_file = "rogue.esave";
+const char *byebye_string = "Okay, bye bye!";
int
init(argc, argv)
@@ -177,7 +177,7 @@
void
clean_up(estr)
- char *estr;
+ const char *estr;
{
if (save_is_interactive) {
if (init_curses) {
@@ -318,7 +318,7 @@
boolean add_blank;
{
short i = 0;
- char *t;
+ const char *t;
t = e;
@@ -341,7 +341,8 @@
void
init_str(str, dflt)
- char **str, *dflt;
+ char **str;
+ const char *dflt;
{
if (!(*str)) {
*str = md_malloc(MAX_OPT_LEN + 2);
diff -ruN rogue/inventory.c rogue+/inventory.c
--- rogue/inventory.c Mon Oct 13 11:26:47 1997
+++ rogue+/inventory.c Sun Sep 13 13:21:35 1998
@@ -60,9 +60,9 @@
#include "rogue.h"
boolean is_wood[WANDS];
-char *press_space = " --press space to continue--";
+const char *press_space = " --press space to continue--";
-char *wand_materials[WAND_MATERIALS] = {
+const char *const wand_materials[WAND_MATERIALS] = {
"steel ",
"bronze ",
"gold ",
@@ -96,7 +96,7 @@
"wooden "
};
-char *gems[GEMS] = {
+const char *const gems[GEMS] = {
"diamond ",
"stibotantalite ",
"lapi-lazuli ",
@@ -113,7 +113,7 @@
"garnet "
};
-char *syllables[MAXSYLLABLES] = {
+const char *const syllables[MAXSYLLABLES] = {
"blech ",
"foo ",
"barf ",
@@ -160,10 +160,10 @@
struct id_com_s {
short com_char;
- char *com_desc;
+ const char *com_desc;
};
-struct id_com_s com_id_tab[COMS] = {
+const struct id_com_s com_id_tab[COMS] = {
{'?', "? prints help"},
{'r', "r read scroll"},
{'/', "/ identify object"},
@@ -216,7 +216,7 @@
void
inventory(pack, mask)
- object *pack;
+ const object *pack;
unsigned short mask;
{
object *obj;
@@ -453,10 +453,10 @@
void
get_desc(obj, desc)
- object *obj;
+ const object *obj;
char *desc;
{
- char *item_name;
+ const char *item_name;
struct id *id_table;
char more_info[32];
short i;
@@ -671,7 +671,7 @@
struct id *
get_id_table(obj)
- object *obj;
+ const object *obj;
{
switch(obj->what_is) {
case SCROL:
@@ -712,7 +712,7 @@
void
id_type()
{
- char *id;
+ const char *id;
int ch;
char buf[DCOLS];
diff -ruN rogue/level.c rogue+/level.c
--- rogue/level.c Mon Oct 13 11:26:49 1997
+++ rogue+/level.c Sun Sep 13 13:22:11 1998
@@ -64,11 +64,11 @@
short cur_level = 0;
short max_level = 1;
short cur_room;
-char *new_level_message = 0;
+const char *new_level_message = 0;
short party_room = NO_ROOM;
short r_de;
-long level_points[MAX_EXP_LEVEL] = {
+const long level_points[MAX_EXP_LEVEL] = {
10L,
20L,
40L,
@@ -591,7 +591,7 @@
void
recursive_deadend(rn, offsets, srow, scol)
short rn;
- short *offsets;
+ const short *offsets;
short srow, scol;
{
short i, de;
diff -ruN rogue/machdep.c rogue+/machdep.c
--- rogue/machdep.c Mon Jul 27 11:06:03 1998
+++ rogue+/machdep.c Sun Sep 13 13:23:16 1998
@@ -192,7 +192,7 @@
int
md_get_file_id(fname)
- char *fname;
+ const char *fname;
{
struct stat sbuf;
@@ -212,7 +212,7 @@
int
md_link_count(fname)
-char *fname;
+ const char *fname;
{
struct stat sbuf;
@@ -270,7 +270,7 @@
void
md_gfmt(fname, rt_buf)
- char *fname;
+ const char *fname;
struct rogue_time *rt_buf;
{
struct stat sbuf;
@@ -302,7 +302,7 @@
boolean
md_df(fname)
- char *fname;
+ const char *fname;
{
if (unlink(fname)) {
return(0);
@@ -384,7 +384,7 @@
char *
md_getenv(name)
- char *name;
+ const char *name;
{
char *value;
@@ -495,7 +495,7 @@
void
md_shell(shell)
- char *shell;
+ const char *shell;
{
int w;
diff -ruN rogue/message.c rogue+/message.c
--- rogue/message.c Mon Oct 13 11:26:56 1997
+++ rogue+/message.c Sun Sep 13 13:24:43 1998
@@ -65,11 +65,11 @@
short msg_col = 0, imsg = -1;
boolean msg_cleared = 1, rmsg = 0;
char hunger_str[8] = "";
-char *more = "-more-";
+const char *more = "-more-";
void
message(msg, intrpt)
- char *msg;
+ const char *msg;
boolean intrpt;
{
cant_int = 1;
@@ -137,8 +137,9 @@
int
get_input_line(prompt, insert, buf, if_cancelled, add_blank, do_echo)
- char *prompt, *buf, *insert;
- char *if_cancelled;
+ const char *prompt, *insert;
+ char *buf;
+ const char *if_cancelled;
boolean add_blank;
boolean do_echo;
{
@@ -316,7 +317,7 @@
void
pad(s, n)
- char *s;
+ const char *s;
short n;
{
short i;
@@ -371,7 +372,7 @@
int
r_index(str, ch, last)
- char *str;
+ const char *str;
int ch;
boolean last;
{
diff -ruN rogue/monster.c rogue+/monster.c
--- rogue/monster.c Sat Sep 12 11:04:49 1998
+++ rogue+/monster.c Sun Sep 13 13:25:47 1998
@@ -62,7 +62,7 @@
object level_monsters;
boolean mon_disappeared;
-char *m_names[] = {
+const char *const m_names[] = {
"aquator",
"bat",
"centaur",
@@ -509,7 +509,7 @@
int
mon_can_go(monster, row, col)
- object *monster;
+ const object *monster;
short row, col;
{
object *obj;
@@ -595,9 +595,9 @@
}
}
-char *
+const char *
mon_name(monster)
- object *monster;
+ const object *monster;
{
short ch;
@@ -823,7 +823,7 @@
gr_obj_char()
{
short r;
- char *rs = "%!?]=/):*";
+ const char *rs = "%!?]=/):*";
r = get_rand(0, 8);
@@ -867,7 +867,7 @@
boolean
mon_sees(monster, row, col)
- object *monster;
+ const object *monster;
int row, col;
{
short rn, rdif, cdif, retval;
diff -ruN rogue/move.c rogue+/move.c
--- rogue/move.c Mon Oct 13 11:27:02 1997
+++ rogue+/move.c Sun Sep 13 13:25:57 1998
@@ -61,7 +61,7 @@
short m_moves = 0;
boolean jump = 0;
-char *you_can_move_again = "you can move again";
+const char *you_can_move_again = "you can move again";
int
one_move_rogue(dirch, pickup)
diff -ruN rogue/object.c rogue+/object.c
--- rogue/object.c Sat Sep 12 11:04:49 1998
+++ rogue+/object.c Sun Sep 13 13:26:51 1998
@@ -295,11 +295,11 @@
}
}
-char *
+const char *
name_of(obj)
- object *obj;
+ const object *obj;
{
- char *retstring;
+ const char *retstring;
switch(obj->what_is) {
case SCROL:
@@ -624,7 +624,7 @@
int
get_armor_class(obj)
- object *obj;
+ const object *obj;
{
if (obj) {
return(obj->class + obj->d_enchant);
diff -ruN rogue/pack.c rogue+/pack.c
--- rogue/pack.c Sat Sep 12 11:04:49 1998
+++ rogue+/pack.c Sun Sep 13 13:28:28 1998
@@ -59,7 +59,7 @@
#include "rogue.h"
-char *curse_message = "you can't, it appears to be cursed";
+const char *curse_message = "you can't, it appears to be cursed";
object *
add_to_pack(obj, pack, condense)
@@ -280,7 +280,7 @@
short
pack_letter(prompt, mask)
- char *prompt;
+ const char *prompt;
unsigned short mask;
{
short ch;
@@ -479,7 +479,7 @@
short
pack_count(new_obj)
- object *new_obj;
+ const object *new_obj;
{
object *obj;
short count = 0;
@@ -507,7 +507,7 @@
boolean
mask_pack(pack, mask)
- object *pack;
+ const object *pack;
unsigned short mask;
{
while (pack->next_object) {
diff -ruN rogue/play.c rogue+/play.c
--- rogue/play.c Mon Oct 13 11:27:09 1997
+++ rogue+/play.c Sun Sep 13 13:28:37 1998
@@ -60,7 +60,7 @@
#include "rogue.h"
boolean interrupted = 0;
-char *unknown_command = "unknown command";
+const char *unknown_command = "unknown command";
void
play_level()
diff -ruN rogue/ring.c rogue+/ring.c
--- rogue/ring.c Mon Oct 13 11:27:10 1997
+++ rogue+/ring.c Sun Sep 13 13:28:46 1998
@@ -59,8 +59,8 @@
#include "rogue.h"
-char *left_or_right = "left or right hand?";
-char *no_ring = "there's no ring on that hand";
+const char *left_or_right = "left or right hand?";
+const char *no_ring = "there's no ring on that hand";
short stealthy;
short r_rings;
short add_strength;
diff -ruN rogue/rogue.h rogue+/rogue.h
--- rogue/rogue.h Mon Jul 27 11:06:03 1998
+++ rogue+/rogue.h Sun Sep 13 13:37:26 1998
@@ -222,7 +222,7 @@
struct obj { /* comment is monster meaning */
unsigned long m_flags; /* monster flags */
- char *damage; /* damage it does */
+ const char *damage; /* damage it does */
short quantity; /* hit points to kill */
short ichar; /* 'A' is for aquatar */
short kill_exp; /* exp for killing it */
@@ -460,18 +460,18 @@
object *alloc_object __P((void));
object *check_duplicate __P((object *, object *));
-char *get_ench_color __P((void));
+const char *get_ench_color __P((void));
object *get_letter_object __P((int));
object *get_thrown_at_monster __P((object *, short, short *, short *));
object *get_zapped_monster __P((short, short *, short *));
object *gr_monster __P((object *, int));
object *gr_object __P((void));
-char *md_getenv __P((char *));
+char *md_getenv __P((const char *));
const char *
md_gln __P((void));
char *md_malloc __P((int));
-char *mon_name __P((object *));
-char *name_of __P((object *));
+const char *mon_name __P((const object *));
+const char *name_of __P((const object *));
object *object_at __P((object *, short, short));
object *pick_up __P((int, int, short *));
void add_exp __P((int, boolean));
@@ -485,13 +485,13 @@
void call_it __P((void));
boolean can_move __P((int, int, int, int));
boolean can_turn __P((int, int));
-void center __P((short, char *));
+void center __P((short, const char *));
void check_gold_seeker __P((object *));
boolean check_hunger __P((boolean));
boolean check_imitator __P((object *));
void check_message __P((void));
int check_up __P((void));
-void clean_up __P((char *));
+void clean_up __P((const char *));
void clear_level __P((void));
void cnfs __P((void));
int coin_toss __P((void));
@@ -527,26 +527,26 @@
void free_object __P((object *));
void free_stuff __P((object *));
void freeze __P((object *));
-int get_armor_class __P((object *));
+int get_armor_class __P((const object *));
int get_com_id __P((int *, short));
-int get_damage __P((char *, boolean));
-void get_desc __P((object *, char *));
+int get_damage __P((const char *, boolean));
+void get_desc __P((const object *, char *));
int get_dir __P((short, short, short, short));
void get_dir_rc __P((short, short *, short *, short));
char get_dungeon_char __P((short, short));
int get_exp_level __P((long));
void get_food __P((object *, boolean));
-int get_hit_chance __P((object *));
-int get_input_line __P((char *, char *, char *, char *, boolean, boolean));
+int get_hit_chance __P((const object *));
+int get_input_line __P((const char *, const char *, char *, const char *, boolean, boolean));
char get_mask_char __P((unsigned short));
-int get_number __P((char *));
+int get_number __P((const char *));
boolean get_oth_room __P((short, short *, short *));
int get_rand __P((int, int));
short get_room_number __P((int, int));
-int get_value __P((object *));
-int get_w_damage __P((object *));
+int get_value __P((const object *));
+int get_w_damage __P((const object *));
void get_wand_and_ring_materials __P((void));
-int get_weapon_damage __P((object *));
+int get_weapon_damage __P((const object *));
char gmc __P((object *));
char gmc_row_col __P((int, int));
void go_blind __P((void));
@@ -563,7 +563,7 @@
void gr_weapon __P((object *, int));
void hallucinate __P((void));
boolean has_amulet __P((void));
-boolean has_been_touched __P((struct rogue_time *, struct rogue_time *));
+boolean has_been_touched __P((const struct rogue_time *, const struct rogue_time *));
void heal __P((void));
void hide_boxed_passage __P((int, int, int, int, int));
void hold_monster __P((void));
@@ -575,11 +575,11 @@
void idntfy __P((void));
boolean imitating __P((int, int));
int init __P((int, char **));
-void init_str __P((char **, char *));
-void insert_score __P((char [][], char [][], char *, short, short, object *, int));
+void init_str __P((char **, const char *));
+void insert_score __P((char [][], char [][], const char *, short, short, const object *, int));
void inv_armor_weapon __P((boolean));
void inv_rings __P((void));
-void inventory __P((object *, unsigned short));
+void inventory __P((const object *, unsigned short));
boolean is_all_connected __P((void));
boolean is_digit __P((int));
boolean is_direction __P((short, short *));
@@ -587,8 +587,8 @@
boolean is_passable __P((int, int));
boolean is_vowel __P((short));
void kick_into_pack __P((void));
-void killed_by __P((object *, short));
-long lget_number __P((char *));
+void killed_by __P((const object *, short));
+long lget_number __P((const char *));
void light_passage __P((int, int));
void light_up_room __P((int));
boolean m_confuse __P((object *));
@@ -597,32 +597,32 @@
void make_party __P((void));
void make_room __P((short, short, short, short));
void make_scroll_titles __P((void));
-boolean mask_pack __P((object *, unsigned short));
+boolean mask_pack __P((const object *, unsigned short));
boolean mask_room __P((short, short *, short *, unsigned short));
void md_cbreak_no_echo_nonl __P((boolean));
-boolean md_df __P((char *));
+boolean md_df __P((const char *));
void md_exit __P((int));
void md_gct __P((struct rogue_time *));
char *md_gdtcf __P((void));
-int md_get_file_id __P((char *));
-void md_gfmt __P((char *, struct rogue_time *));
+int md_get_file_id __P((const char *));
+void md_gfmt __P((const char *, struct rogue_time *));
int md_gseed __P((void));
void md_heed_signals __P((void));
void md_ignore_signals __P((void));
-int md_link_count __P((char *));
+int md_link_count __P((const char *));
void md_lock __P((boolean));
-void md_shell __P((char *));
+void md_shell __P((const char *));
void md_sleep __P((int));
void md_slurp __P((void));
void md_tstp __P((void));
-void message __P((char *, boolean));
+void message __P((const char *, boolean));
void mix_colors __P((void));
void mix_colors __P((void));
void mix_random_rooms __P((void));
-int mon_can_go __P((object *, int, int));
+int mon_can_go __P((const object *, int, int));
int mon_damage __P((object *, short));
void mon_hit __P((object *));
-boolean mon_sees __P((object *, int, int));
+boolean mon_sees __P((const object *, int, int));
int move_confused __P((object *));
void move_mon_to __P((object *, int, int));
void move_onto __P((void));
@@ -631,19 +631,19 @@
void mv_1_monster __P((object *, int, int));
void mv_aquatars __P((void));
void mv_mons __P((void));
-int name_cmp __P((char *, char *));
+int name_cmp __P((char *, const char *));
short next_avail_ichar __P((void));
boolean next_to_something __P((int, int));
-void nickize __P((char *, char *, char *));
+void nickize __P((char *, const char *, const char *));
int no_room_for_monster __P((int));
int one_move_rogue __P((short, short));
void onintr __P((int));
void opt_erase __P((int));
void opt_go __P((int));
void opt_show __P((int));
-short pack_count __P((object *));
-short pack_letter __P((char *, unsigned short));
-void pad __P((char *, short));
+short pack_count __P((const object *));
+short pack_letter __P((const char *, unsigned short));
+void pad __P((const char *, short));
void party_monsters __P((int, int));
short party_objects __P((int));
void place_at __P((object *, int, int));
@@ -663,26 +663,26 @@
void put_objects __P((void));
void put_on_ring __P((void));
void put_player __P((short));
-void put_scores __P((object *, short));
+void put_scores __P((const object *, short));
void put_stairs __P((void));
void quaff __P((void));
void quit __P((boolean));
-int r_index __P((char *, int, boolean));
+int r_index __P((const char *, int, boolean));
void r_read __P((FILE *, char *, int));
-void r_write __P((FILE *, char *, int));
+void r_write __P((FILE *, const char *, int));
void rand_around __P((short, short *, short *));
int rand_percent __P((int));
void rand_place __P((object *));
void read_pack __P((object *, FILE *, boolean));
void read_scroll __P((void));
void read_string __P((char *, FILE *));
-void recursive_deadend __P((short, short *, short, short));
+void recursive_deadend __P((short, const short *, short, short));
boolean reg_move __P((void));
void relight __P((void));
void remessage __P((short));
void remove_ring __P((void));
void rest __P((int));
-void restore __P((char *));
+void restore __P((const char *));
int rgetchar __P((void));
void ring_stats __P((boolean));
int rogue_can_see __P((int, int));
@@ -698,7 +698,7 @@
int same_col __P((int, int));
int same_row __P((int, int));
void save_game __P((void));
-void save_into_file __P((char *));
+void save_into_file __P((const char *));
void save_screen __P((void));
void search __P((short, boolean));
boolean seek_gold __P((object *));
@@ -726,7 +726,7 @@
void tele_away __P((object *));
void throw __P((void));
boolean throw_at_monster __P((object *, object *));
-int to_hit __P((object *));
+int to_hit __P((const object *));
short trap_at __P((int, int));
void trap_player __P((int, int));
boolean try_to_cough __P((short, short, object *));
@@ -749,14 +749,14 @@
void wield __P((void));
void win __P((void));
void wizardize __P((void));
-void write_pack __P((object *, FILE *));
+void write_pack __P((const object *, FILE *));
void write_string __P((char *, FILE *));
long xxx __P((boolean));
void xxxx __P((char *, short));
void zap_monster __P((object *, unsigned short));
void zapp __P((void));
object *add_to_pack __P((object *, object *, int));
-struct id *get_id_table __P((object *));
+struct id *get_id_table __P((const object *));
unsigned short gr_what_is __P((void));
extern boolean ask_quit;
@@ -784,18 +784,18 @@
extern char hit_message[];
extern char hunger_str[];
extern char login_name[];
-extern char *byebye_string;
-extern char *curse_message;
-extern char *error_file;
+extern const char *byebye_string;
+extern const char *curse_message;
+extern const char *error_file;
extern char *fruit;
-extern char *m_names[];
-extern char *more;
-extern char *new_level_message;
+extern const char *const m_names[];
+extern const char *more;
+extern const char *new_level_message;
extern char *nick_name;
-extern char *press_space;
+extern const char *press_space;
extern char *save_file;
-extern char *you_can_move_again;
-extern long level_points[];
+extern const char *you_can_move_again;
+extern const long level_points[];
extern short add_strength;
extern short auto_search;
extern short bear_trap;
diff -ruN rogue/room.c rogue+/room.c
--- rogue/room.c Sat Sep 12 11:04:49 1998
+++ rogue+/room.c Sun Sep 13 13:37:56 1998
@@ -65,7 +65,7 @@
#define NOPTS 7
struct option {
- char *prompt;
+ const char *prompt;
boolean is_bool;
char **strval;
boolean *bval;
@@ -627,7 +627,7 @@
opt_show(i)
int i;
{
- char *s;
+ const char *s;
struct option *opt = &options[i];
opt_erase(i);
@@ -661,7 +661,7 @@
do_shell()
{
#ifdef UNIX
- char *sh;
+ const char *sh;
md_ignore_signals();
if (!(sh = md_getenv("SHELL"))) {
diff -ruN rogue/save.c rogue+/save.c
--- rogue/save.c Mon Oct 13 11:27:16 1997
+++ rogue+/save.c Sun Sep 13 13:39:38 1998
@@ -79,7 +79,7 @@
void
save_into_file(sfile)
- char *sfile;
+ const char *sfile;
{
FILE *fp;
int file_id;
@@ -149,7 +149,7 @@
void
restore(fname)
- char *fname;
+ const char *fname;
{
FILE *fp;
struct rogue_time saved_time, mod_time;
@@ -231,16 +231,16 @@
void
write_pack(pack, fp)
- object *pack;
+ const object *pack;
FILE *fp;
{
object t;
while ((pack = pack->next_object) != NULL) {
- r_write(fp, (char *) pack, sizeof(object));
+ r_write(fp, (const char *) pack, sizeof(object));
}
t.ichar = t.what_is = 0;
- r_write(fp, (char *) &t, sizeof(object));
+ r_write(fp, (const char *) &t, sizeof(object));
}
void
@@ -310,8 +310,8 @@
for (i = 0; i < n; i++) {
if (wr) {
- r_write(fp, (char *) &(id_table[i].value), sizeof(short));
- r_write(fp, (char *) &(id_table[i].id_status),
+ r_write(fp, (const char *) &(id_table[i].value), sizeof(short));
+ r_write(fp, (const char *) &(id_table[i].id_status),
sizeof(unsigned short));
write_string(id_table[i].title, fp);
} else {
@@ -375,7 +375,7 @@
void
r_write(fp, buf, n)
FILE *fp;
- char *buf;
+ const char *buf;
int n;
{
if (!write_failed) {
@@ -389,7 +389,7 @@
boolean
has_been_touched(saved_time, mod_time)
- struct rogue_time *saved_time, *mod_time;
+ const struct rogue_time *saved_time, *mod_time;
{
if (saved_time->year < mod_time->year) {
return(1);
diff -ruN rogue/score.c rogue+/score.c
--- rogue/score.c Mon Oct 13 11:27:18 1997
+++ rogue+/score.c Sun Sep 13 13:40:57 1998
@@ -63,7 +63,7 @@
void
killed_by(monster, other)
- object *monster;
+ const object *monster;
short other;
{
char buf[128];
@@ -200,7 +200,7 @@
void
put_scores(monster, other)
- object *monster;
+ const object *monster;
short other;
{
short i, n, rank = 10, x, ne = 0, found_player = -1;
@@ -329,9 +329,9 @@
insert_score(scores, n_names, n_name, rank, n, monster, other)
char scores[][82];
char n_names[][30];
- char *n_name;
+ const char *n_name;
short rank, n;
- object *monster;
+ const object *monster;
int other;
{
short i;
@@ -436,7 +436,7 @@
int
get_value(obj)
- object *obj;
+ const object *obj;
{
short wc;
int val;
@@ -507,7 +507,8 @@
int
name_cmp(s1, s2)
- char *s1, *s2;
+ char *s1;
+ const char *s2;
{
short i = 0;
int r;
@@ -558,7 +559,8 @@
void
nickize(buf, score, n_name)
- char *buf, *score, *n_name;
+ char *buf;
+ const char *score, *n_name;
{
short i = 15, j;
@@ -585,7 +587,7 @@
void
center(row, buf)
short row;
- char *buf;
+ const char *buf;
{
short margin;
diff -ruN rogue/throw.c rogue+/throw.c
--- rogue/throw.c Mon Oct 13 11:27:21 1997
+++ rogue+/throw.c Sun Sep 13 13:41:19 1998
@@ -269,7 +269,7 @@
rand_around(i, r, c)
short i, *r, *c;
{
- static char* pos = "\010\007\001\003\004\005\002\006\0";
+ static char pos[] = "\010\007\001\003\004\005\002\006\0";
static short row, col;
short j;
diff -ruN rogue/trap.c rogue+/trap.c
--- rogue/trap.c Mon Oct 13 11:27:21 1997
+++ rogue+/trap.c Sun Sep 13 13:41:37 1998
@@ -63,7 +63,7 @@
boolean trap_door = 0;
short bear_trap = 0;
-char *trap_strings[TRAPS * 2] = {
+const char *const trap_strings[TRAPS * 2] = {
"trap door",
"you fell down a trap",
"bear trap",
diff -ruN rogue/use.c rogue+/use.c
--- rogue/use.c Mon Oct 13 11:27:24 1997
+++ rogue+/use.c Sun Sep 13 13:42:10 1998
@@ -68,7 +68,7 @@
short extra_hp = 0;
boolean detect_monster = 0;
boolean con_mon = 0;
-char *strange_feeling = "you have a strange feeling for a moment, then it passes";
+const char *strange_feeling = "you have a strange feeling for a moment, then it passes";
void
quaff()
@@ -594,7 +594,7 @@
mvaddch(rogue.row, rogue.col, rogue.fchar);
}
-char *
+const char *
get_ench_color()
{
if (halluc) {
diff -ruN rogue/zap.c rogue+/zap.c
--- rogue/zap.c Mon Oct 13 11:27:26 1997
+++ rogue+/zap.c Sun Sep 13 13:42:38 1998
@@ -285,7 +285,8 @@
short ball, dir, row, col, r;
{
short orow, ocol;
- char buf[DCOLS], *s;
+ char buf[DCOLS];
+ const char *s;
short i, ch, new_dir = -1, damage;
static short btime;
>Audit-Trail:
>Unformatted: