remove pointer to long conversions - part 1 of 3 rev 2 (trunk only)

[the problem in the earlier rev was tracked to cleanup_burn(),
where arg was holding a (genericptr_t) timer id, and
passed directly to del_light_source() as is.]

P64 (Win64) has a 64 bit pointer size, but a 32 bit long size.
Remove some code that forced pointers into a long int, and
vice versa where information could be lost.

This part deals with light source functions and their
arguments mostly, and switches some arguments
from type genericptr_t to 'anything'.
This commit is contained in:
nethack.allison
2006-07-08 23:31:39 +00:00
parent 90f640a935
commit 9c79bb2758
11 changed files with 122 additions and 68 deletions

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)extern.h 3.5 2006/05/08 */
/* SCCS Id: @(#)extern.h 3.5 2006/07/08 */
/* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */
@@ -737,6 +737,11 @@ E void NDECL(drinksink);
/* ### hack.c ### */
E anything *FDECL(uint_to_any, (unsigned));
E anything *FDECL(long_to_any, (long));
E anything *FDECL(monst_to_any, (struct monst *));
E anything *FDECL(obj_to_any, (struct obj *));
E void FDECL(zero_anything, (ANY_P *));
E boolean FDECL(revive_nasty, (int,int,const char*));
E void FDECL(movobj, (struct obj *,XCHAR_P,XCHAR_P));
E boolean FDECL(may_dig, (XCHAR_P,XCHAR_P));
@@ -893,8 +898,8 @@ E int NDECL(dosuspend);
/* ### light.c ### */
E void FDECL(new_light_source, (XCHAR_P, XCHAR_P, int, int, genericptr_t));
E void FDECL(del_light_source, (int, genericptr_t));
E void FDECL(new_light_source, (XCHAR_P, XCHAR_P, int, int, ANY_P *));
E void FDECL(del_light_source, (int, ANY_P *));
E void FDECL(do_light_sources, (char **));
E struct monst *FDECL(find_mid, (unsigned, unsigned));
E void FDECL(save_light_sources, (int, int, int));
@@ -1818,7 +1823,6 @@ E void FDECL(getlev, (int,int,XCHAR_P,BOOLEAN_P));
E void FDECL(get_plname_from_file, (int, char *));
E void NDECL(minit);
E boolean FDECL(lookup_id_mapping, (unsigned, unsigned *));
E struct monst *FDECL(buffer_to_mon, (genericptr_t));
E void FDECL(mread, (int,genericptr_t,unsigned int));
#ifndef GOLDOBJ
E void FDECL(put_gold_back, (struct obj **,long *));

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)lev.h 3.5 1994/03/18 */
/* SCCS Id: @(#)lev.h 3.5 2006/07/08 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -43,7 +43,7 @@ typedef struct ls_t {
short range; /* source's current range */
short flags;
short type; /* type of light source */
genericptr_t id; /* source's identifier */
anything id; /* source's identifier */
} light_source;
#endif /* LEV_H */

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)patchlevel.h 3.5 2006/06/27 */
/* SCCS Id: @(#)patchlevel.h 3.5 2006/07/08 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -13,7 +13,7 @@
* Incrementing EDITLEVEL can be used to force invalidation of old bones
* and save files.
*/
#define EDITLEVEL 33
#define EDITLEVEL 34
#define COPYRIGHT_BANNER_A \
"NetHack, Copyright 1985-2006"

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)wintype.h 3.5 1996/02/18 */
/* SCCS Id: @(#)wintype.h 3.5 2006/07/08 */
/* Copyright (c) David Cohrs, 1991 */
/* NetHack may be freely redistributed. See license for details. */
@@ -11,6 +11,7 @@ typedef int winid; /* a window identifier */
typedef union any {
genericptr_t a_void;
struct obj *a_obj;
struct monst *a_monst;
int a_int;
char a_char;
schar a_schar;