1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

WIP to make dtbuilder work on 64bit.

Fixes many, though not all 64bit-warnings.  In lots of places, pointers are
cast to ints to be then used as array subscripts.  The only way to deal with
this is to change them to long.  Additionally, use calloc() to allocate the
int_array in istr.c and drop the (wrong) macro patch to istr.h.  Should make
dtbuilder work on 32bit again.
This commit is contained in:
Pascal Stumpf 2012-08-13 17:35:34 +02:00 committed by Jon Trulson
parent 50e6c86bf4
commit 1177e21080
29 changed files with 138 additions and 134 deletions

View file

@ -110,7 +110,7 @@ abobj_calculate_new_layout(
Position x, y;
Dimension width, height;
Dimension p_width, p_height;
int gridpos;
long gridpos;
if ((attachments = obj->attachments) == NULL)
return -1;

View file

@ -258,7 +258,7 @@ static void set_attach_values(
PropOptionsSetting objlist_setting,
int offset_value,
int position_value,
int objlist_value
XtPointer objlist_value
);
static void change_attach_type(
@ -2642,7 +2642,7 @@ set_attach_values(
PropOptionsSetting objlist_setting,
int offset_value,
int position_value,
int objlist_value
XtPointer objlist_value
)
{
switch (attach_type)
@ -2945,7 +2945,7 @@ convert_offset_position(
/*
set_attach_values(attach_type,
offset_setting, position_setting, objlist_setting,
offset_value, position_value, (int)sibling_obj);
offset_value, position_value, (XtPointer)sibling_obj);
*/
*ret_offset = offset_value;
@ -3068,7 +3068,7 @@ change_attach_type(
*/
set_attach_values(attach_type,
offset_setting, position_setting, objlist_setting,
offset, position, (int)attach_obj);
offset, position, (XtPointer)attach_obj);
}
@ -3263,7 +3263,7 @@ change_opp_attach_type(
*/
set_attach_values(opp_attach_type,
opp_offset_setting, opp_position_setting, opp_objlist_setting,
offset, position, (int)attach_obj);
offset, position, (XtPointer)attach_obj);
}
}
@ -3335,7 +3335,7 @@ attach_obj_changed(
&offset, &position);
set_attach_values(attach_type,
offset_setting, position_setting, objlist_setting,
offset, position, (int)attach_obj);
offset, position, (XtPointer)attach_obj);
}
}

View file

@ -108,7 +108,7 @@ extern char ** connP_get_when_labels(
extern char ** connP_get_act_labels(
int *num_labels
);
extern int connP_get_obj_type_index(
extern long connP_get_obj_type_index(
AB_OBJECT_TYPE ab_type,
int ab_subtype
);
@ -181,7 +181,7 @@ extern int connP_objtype_needs_subtype(
AB_OBJECT_TYPE obj_type,
int obj_subtype
);
extern int connP_obj_enabled(
extern long connP_obj_enabled(
AB_OBJECT_TYPE obj_type,
int obj_subtype
);

View file

@ -926,7 +926,7 @@ connP_make_conn_string(
)
{
register int i;
int si;
long si;
static char conn_string[BUFSIZ];
char buf[BUFSIZ];
AB_ACTION_INFO *action_info;
@ -1041,13 +1041,13 @@ connP_make_conn_string(
return(conn_string);
}
extern int
extern long
connP_get_obj_type_index(
AB_OBJECT_TYPE ab_type,
int ab_subtype
)
{
register int i;
register long i;
if (connP_objtype_needs_subtype(ab_type, ab_subtype))
{
@ -1093,8 +1093,8 @@ connP_guess_when_action(
AB_BUILTIN_ACTION *act_ret
)
{
int i = connP_get_obj_type_index(source_type, source_subtype);
int j = connP_get_obj_type_index(target_type, target_subtype);
long i = connP_get_obj_type_index(source_type, source_subtype);
long j = connP_get_obj_type_index(target_type, target_subtype);
if (ConnP_conn_objs[i].when_list != NULL)
*when_ret = ConnP_conn_objs[i].default_when;
@ -1197,7 +1197,7 @@ assign_when_list(
int source_subtype
)
{
int i;
long i;
int n;
ConnObj *src_conn_obj;
@ -1232,7 +1232,7 @@ assign_action_list(
int target_subtype
)
{
int i;
long i;
int n;
ConnObj *trg_conn_obj;
@ -1286,7 +1286,7 @@ connP_objtype_needs_subtype(
return(0);
}
extern int
extern long
connP_obj_enabled(
AB_OBJECT_TYPE obj_type,
int obj_subtype

View file

@ -129,7 +129,7 @@ static Widget exec_code_dialog = NULL;
static Widget exec_code_textpane = NULL;
static Widget ConnP_view_source_obj = NULL; /* View:'s "Source Object" PushButton */
static int ConnP_view_filter = -1;
static long ConnP_view_filter = -1;
static STRING CodeFragBuf = NULL;
static STRING action_type_labels[ACTION_TYPE_NUM_VALUES];
@ -496,7 +496,7 @@ populate_view_menu(
XtPointer call_data
)
{
int i;
long i;
Widget w;
@ -526,7 +526,7 @@ setup_source(
ABObj source
)
{
int i = connP_get_obj_type_index(source_type, source_subtype);
long i = connP_get_obj_type_index(source_type, source_subtype);
if (i < 0) return;
@ -544,7 +544,7 @@ setup_target(
ABObj target
)
{
int i = connP_get_obj_type_index(target_type, target_subtype);
long i = connP_get_obj_type_index(target_type, target_subtype);
if (i < 0) return;
@ -949,9 +949,9 @@ set_view_filter(
XtPointer call_data
)
{
if (ConnP_view_filter != (int)client_data)
if (ConnP_view_filter != (long)client_data)
{
ConnP_view_filter = (int)client_data;
ConnP_view_filter = (long)client_data;
populate_connection_list(NULL);
}
}
@ -1551,7 +1551,7 @@ set_standard_action_type(
)
{
XmString xm_label_str;
int i = 0;
long i = 0;
BOOL found = FALSE;
connP_set_action_type(AB_FUNC_BUILTIN);
@ -3832,7 +3832,7 @@ update_conn_ed_controls(void)
int source_subtype = -1;
AB_OBJECT_TYPE target_type = AB_TYPE_UNDEF;
int target_subtype = -1;
int i = -1, j = -1;
long i = -1, j = -1;
source_type = connP_get_source_type();
source_subtype = connP_get_source_subtype();

View file

@ -877,7 +877,7 @@ typeCB(
}
/* Set the default button to be Action1 */
if ((int)prop_options_get_value(&(mes->default_btn)) != AB_DEFAULT_BTN_ACTION1)
if ((XtPointer)prop_options_get_value(&(mes->default_btn)) != AB_DEFAULT_BTN_ACTION1)
{
prop_options_set_value(&(mes->default_btn),
(XtPointer)AB_DEFAULT_BTN_ACTION1, True);
@ -928,7 +928,7 @@ typeCB(
}
/* Set the default button to be Cancel */
if ((int)prop_options_get_value(&(mes->default_btn)) != AB_DEFAULT_BTN_CANCEL)
if ((XtPointer)prop_options_get_value(&(mes->default_btn)) != AB_DEFAULT_BTN_CANCEL)
{
prop_options_set_value(&(mes->default_btn),
(XtPointer)AB_DEFAULT_BTN_CANCEL, True);
@ -979,7 +979,7 @@ typeCB(
}
/* Set the default button to be Action2 */
if ((int)prop_options_get_value(&(mes->default_btn)) != AB_DEFAULT_BTN_ACTION2)
if ((XtPointer)prop_options_get_value(&(mes->default_btn)) != AB_DEFAULT_BTN_ACTION2)
{
prop_options_set_value(&(mes->default_btn),
(XtPointer)AB_DEFAULT_BTN_ACTION2, True);
@ -1031,7 +1031,7 @@ typeCB(
}
/* Set the default button to be Action1 */
if ((int)prop_options_get_value(&(mes->default_btn)) != AB_DEFAULT_BTN_ACTION1)
if ((XtPointer)prop_options_get_value(&(mes->default_btn)) != AB_DEFAULT_BTN_ACTION1)
{
prop_options_set_value(&(mes->default_btn),
(XtPointer)AB_DEFAULT_BTN_ACTION1, True);
@ -1079,7 +1079,7 @@ typeCB(
}
/* Set the default button to be Action1 */
if ((int)prop_options_get_value(&(mes->default_btn)) != AB_DEFAULT_BTN_ACTION1)
if ((XtPointer)prop_options_get_value(&(mes->default_btn)) != AB_DEFAULT_BTN_ACTION1)
{
prop_options_set_value(&(mes->default_btn),
(XtPointer)AB_DEFAULT_BTN_ACTION1, True);

View file

@ -174,6 +174,7 @@ nl_catd Dtb_project_catd;
/* ARGSUSED */
int
main(int argc, STRING *argv)
{
int exitValue = 0;
@ -939,7 +940,7 @@ mark_modules_to_load_and_write(
{
fileName = strlist_get_str(fileNames, i, &wasFoundVoidPtr);
assert(fileName != NULL);
wasFound = (BOOL)(unsigned)wasFoundVoidPtr;
wasFound = (BOOL)(unsigned long)wasFoundVoidPtr;
if (!wasFound)
{
util_printf_err("module not found in project: %s\n", fileName);

View file

@ -162,7 +162,7 @@ typedef CGenAnyData CGenData;
#define mfobj_set_proj_data(_obj,_data) \
( mfobj_set_flags(_obj, CGenFlagDataIsProj), \
((int)(mfobj_data(_obj)->info.proj = (_data))) \
((long)(mfobj_data(_obj)->info.proj = (_data))) \
)
#define mfobj_get_proj_data(obj) \

View file

@ -1485,7 +1485,7 @@ get_wclass_and_res_value(
BOOL foundEm = FALSE;
*wClassOut = NULL;
*resValueOut = NULL;
*resValueOut = 0;
if (wClass == NULL)
{

View file

@ -205,7 +205,7 @@ abmfP_get_connect_includes(StringList includeFiles, ABObj projOrModule)
assert(project != NULL);
if (project == NULL)
{
return NULL;
return 0;
}
for (trav_open(&trav, projOrModule, AB_TRAV_ACTIONS_FOR_OBJ);

View file

@ -282,7 +282,7 @@ printf_setval(GenCodeInfo genCodeInfo, ABObj obj, ...)
#if defined(__osf__) || defined(linux) || defined(CSRG_BASED)
/* OSF/1 define va_list in <va_list.h> as structure of char ** and int
* Sun define va_list as void * */
va_list paramList = { NULL, 0 };
va_list paramList = { 0, 0 };
#else
va_list paramList = NULL;
#endif /* __osf__ */

View file

@ -605,7 +605,7 @@ widget_into_module(
/*
* Store ABObj reference in uil widget node
*/
uil_widget->header.user_data = (int)ab_widget;
uil_widget->header.user_data = (long)ab_widget;
/*
* Populate arguments and callbacks
@ -630,7 +630,7 @@ widget_into_module(
/*
* Store ABObj reference in uil widget node
*/
uil_widget->header.user_data = (int)ab_widget;
uil_widget->header.user_data = (long)ab_widget;
}

View file

@ -3355,7 +3355,7 @@ attach_context_store(
AttachmentContext *attach_context = (AttachmentContext *)context;
STRING attach_str;
AB_ATTACH_TYPE att_type;
int att_pos = 0, att_off = 0, offset = 0;
long att_pos = 0, att_off = 0, offset = 0;
void *value = NULL;
BOOL need_val = TRUE;
ObjRef *obj_ref;
@ -3480,7 +3480,7 @@ val_set_rows_proc(
XtPointer res_value
)
{
if(obj_set_num_rows(obj,(int)res_value)) return(FALSE);
if(obj_set_num_rows(obj,(long)res_value)) return(FALSE);
else return(TRUE);
}
@ -3492,7 +3492,7 @@ val_set_columns_proc(
XtPointer res_value
)
{
if(obj_set_num_columns(obj,(int)res_value)) return(FALSE);
if(obj_set_num_columns(obj,(long)res_value)) return(FALSE);
else return(TRUE);
}
@ -3504,7 +3504,7 @@ val_set_maximum_proc(
XtPointer res_value
)
{
if(obj_set_max_value(obj,(int)res_value)) return(FALSE);
if(obj_set_max_value(obj,(long)res_value)) return(FALSE);
else return(TRUE);
}
@ -3516,7 +3516,7 @@ val_set_minimum_proc(
XtPointer res_value
)
{
if(obj_set_min_value(obj,(int)res_value)) return(FALSE);
if(obj_set_min_value(obj,(long)res_value)) return(FALSE);
else return(TRUE);
}
@ -3528,7 +3528,7 @@ val_set_numcols_proc(
XtPointer res_value
)
{
if(obj_set_num_columns(obj,(int)res_value)) return(FALSE);
if(obj_set_num_columns(obj,(long)res_value)) return(FALSE);
else return(TRUE);
}
@ -3697,7 +3697,7 @@ val_set_maxlen_proc(
XtPointer res_value
)
{
if(obj_set_max_length(obj,(int)res_value)) return(FALSE);
if(obj_set_max_length(obj,(long)res_value)) return(FALSE);
else return(TRUE);
}
@ -3709,7 +3709,7 @@ val_set_panemax_proc(
XtPointer res_value
)
{
if(obj_set_pane_max(obj,(int)res_value)) return(FALSE);
if(obj_set_pane_max(obj,(long)res_value)) return(FALSE);
else return(TRUE);
}
@ -3721,7 +3721,7 @@ val_set_panemin_proc(
XtPointer res_value
)
{
if(obj_set_pane_min(obj,(int)res_value)) return(FALSE);
if(obj_set_pane_min(obj,(long)res_value)) return(FALSE);
else return(TRUE);
}
@ -3733,7 +3733,7 @@ val_set_intvalue_proc(
XtPointer res_value
)
{
if(obj_set_initial_value_int(obj,(int)res_value)) return(FALSE);
if(obj_set_initial_value_int(obj,(long)res_value)) return(FALSE);
else return(TRUE);
}
@ -3757,7 +3757,7 @@ val_set_increment_proc(
XtPointer res_value
)
{
if(obj_set_increment(obj,(int)res_value)) return(FALSE);
if(obj_set_increment(obj,(long)res_value)) return(FALSE);
else return(TRUE);
}
@ -3769,7 +3769,7 @@ val_set_decpts_proc(
XtPointer res_value
)
{
if(obj_set_decimal_points(obj,(int)res_value)) return(FALSE);
if(obj_set_decimal_points(obj,(long)res_value)) return(FALSE);
else return(TRUE);
}

View file

@ -826,7 +826,7 @@ common_special_type:
get_charset_text(az_value_entry->b_charset));
else
printf(" font charset: userdefined(%x)",
get_charset_text((int) az_value_entry->az_charset_value));
get_charset_text((long) az_value_entry->az_charset_value));
goto check_for_table_value;

View file

@ -1275,22 +1275,22 @@ static BOOL bil_token_table_inited = FALSE;
/*
* Compares to entries (for qsort)
*/
static int
static long
bil_token_entry_compare(const void *leftEntry, const void *rightEntry)
{
return ((int)(((BilTokenIndexEntry)leftEntry)->string))
- ((int)(((BilTokenIndexEntry)rightEntry)->string));
return ((long)(((BilTokenIndexEntry)leftEntry)->string))
- ((long)(((BilTokenIndexEntry)rightEntry)->string));
}
/*
* Compares a key to an entry (for bsearch)
*/
static int
static long
bil_token_key_compare(const void *voidIstr, const void *voidEntry)
{
return ((int)((ISTRING)(voidIstr)))
- ((int)(((BilTokenIndexEntry)voidEntry)->string));
return ((long)((ISTRING)(voidIstr)))
- ((long)(((BilTokenIndexEntry)voidEntry)->string));
}
@ -1720,9 +1720,9 @@ BIL_TOKEN
bilP_string_to_token(STRING strToken)
{
ISTRING istrToken = istr_create(strToken);
register int midDiff;
register int midIndex;
int minIndex, maxIndex;
register long midDiff;
register long midIndex;
long minIndex, maxIndex;
bil_token_table_check_init();
/*
@ -1733,8 +1733,8 @@ bilP_string_to_token(STRING strToken)
while (minIndex < maxIndex)
{
midIndex = ((minIndex + maxIndex)>>1);
midDiff = (((int)bil_token_table_index[midIndex].string)
- ((int)istrToken));
midDiff = (((long)bil_token_table_index[midIndex].string)
- ((long)istrToken));
if (midDiff < 0)
{
/* mid is too small - take upper half */

View file

@ -2417,7 +2417,7 @@ bilP_load_attachment_value(BIL_TOKEN valueToken)
{
ABObj target = NULL;
STRING name = NULL;
int value = 0;
long value = 0;
AB_COMPASS_POINT cp = AB_CP_UNDEF;
util_dprintf(3, "bilP_load_attachment_value: %d/%s\n\t%d/%s\n",

View file

@ -2304,7 +2304,7 @@ store_attribute(
{
AB_ARG_TYPE type = AB_ARG_UNDEF;
if ((type = obj_get_arg_type(obj)) != NULL)
if ((type = obj_get_arg_type(obj)) != 0)
{
switch (type)
{
@ -2382,7 +2382,7 @@ store_attribute(
break;
case AB_ATTACH_GRIDLINE:
case AB_ATTACH_CENTER_GRIDLINE:
abio_put_integer(outFile, (int)obj_get_attach_value(obj, AB_CP_NORTH));
abio_put_integer(outFile, (long)obj_get_attach_value(obj, AB_CP_NORTH));
break;
case AB_ATTACH_POINT:
case AB_ATTACH_NONE:
@ -2415,7 +2415,7 @@ store_attribute(
break;
case AB_ATTACH_GRIDLINE:
case AB_ATTACH_CENTER_GRIDLINE:
abio_put_integer(outFile, (int)obj_get_attach_value(obj, AB_CP_SOUTH));
abio_put_integer(outFile, (long)obj_get_attach_value(obj, AB_CP_SOUTH));
break;
default:
abio_put_integer(outFile, 0);
@ -2447,7 +2447,7 @@ store_attribute(
break;
case AB_ATTACH_GRIDLINE:
case AB_ATTACH_CENTER_GRIDLINE:
abio_put_integer(outFile, (int)obj_get_attach_value(obj, AB_CP_EAST));
abio_put_integer(outFile, (long)obj_get_attach_value(obj, AB_CP_EAST));
break;
default:
abio_put_integer(outFile, 0);
@ -2479,7 +2479,7 @@ store_attribute(
break;
case AB_ATTACH_GRIDLINE:
case AB_ATTACH_CENTER_GRIDLINE:
abio_put_integer(outFile, (int)obj_get_attach_value(obj, AB_CP_WEST));
abio_put_integer(outFile, (long)obj_get_attach_value(obj, AB_CP_WEST));
break;
default:
abio_put_integer(outFile, 0);

View file

@ -116,7 +116,7 @@ gilP_load_object2(FILE * inFile, ABObj obj, ABObj parent)
attr = gilP_string_to_att(istr_string(keyword));
if ((rc = gilP_load_attribute_value(
inFile, obj, attr, parent)) != NULL)
inFile, obj, attr, parent)) != 0)
{
return_value = rc;
goto epilogue;

View file

@ -2443,7 +2443,7 @@ obj_set_to(ABObj obj, ABObj to)
if (!obj_is_action(obj))
{
member_error(obj, "to");
return NULL;
return 0;
}
obj->info.action.to = to;
return 0;
@ -2468,7 +2468,7 @@ obj_set_from(ABObj obj, ABObj from)
if (!obj_is_action(obj))
{
member_error(obj, "from");
return NULL;
return 0;
}
obj->info.action.from = from;
return 0;
@ -2686,7 +2686,7 @@ obj_set_when(ABObj obj, AB_WHEN when)
if (obj->type != AB_TYPE_ACTION)
{
member_error(obj, "when");
return NULL;
return 0;
}
obj->info.action.when = when;
return 0;
@ -2978,7 +2978,7 @@ obj_get_attach_offset(
default:
if (util_get_verbosity() > 0)
fprintf(stderr, "obj_get_attach_offset: invalid direction\n");
return NULL;
return 0;
}
}
@ -3879,6 +3879,8 @@ obj_set_help_button(ABObj obj, BOOL has_button)
obj->info.message.help_button = has_button;
return 0;
}
int
obj_set_tooltalk_level(ABObj obj, AB_TOOLTALK_LEVEL tt_level)
{
verify_for_write(obj);

View file

@ -74,7 +74,7 @@ static int objlistP_build_user_data_array(
((((_list)->user_datas == NULL) && ((_data) != NULL))? \
objlistP_build_user_data_array(_list, _index, _data) \
: \
((int)((_list)->user_datas[(_index)] = (_data))) \
((long)((_list)->user_datas[(_index)] = (_data))) \
)
*/
@ -85,7 +85,7 @@ static int objlistP_build_user_data_array(
: \
objlistP_build_user_data_array(_list, _index, _data)) \
: \
((int)((_list)->user_datas[(_index)] = (_data))) \
((long)((_list)->user_datas[(_index)] = (_data))) \
)
#define objlistP_get_user_data(_list,_index) \
@ -260,7 +260,7 @@ objlist_add_obj(ABObjList list, ABObj obj, void *clientData)
*/
if (list->unique)
{
int index = objlist_get_obj_index(list, obj);
long index = objlist_get_obj_index(list, obj);
if (index >= 0)
{
objlistP_add_user_data(list, index, clientData);

View file

@ -176,7 +176,7 @@ objP_tree_add_to_names_list(ABObj tree)
}
if (names == NULL)
{
return NULL;
return 0;
}
for (trav_open(&trav, tree, AB_TRAV_ALL);
@ -207,7 +207,7 @@ objP_tree_remove_from_names_list(ABObj tree)
}
if (names == NULL)
{
return NULL;
return 0;
}
for (trav_open(&trav, tree, AB_TRAV_ALL);

View file

@ -115,7 +115,7 @@ obj_scoped_find_by_name(ABObj searchFirstObj, STRING objName)
moduleNameEndChar = *moduleNameEndPtr;
*moduleNameEndPtr = 0;
}
while (((*objNamePtr) != NULL) && (isspace(*objNamePtr)))
while (((*objNamePtr) != 0) && (isspace(*objNamePtr)))
{
++objNamePtr;
}

View file

@ -196,7 +196,7 @@ ab_ident_is_ok(STRING ident)
{
return FALSE;
}
for (cp = ident; *cp != NULL; ++cp)
for (cp = ident; *cp != 0; ++cp)
{
if (isspace(*cp))
{
@ -789,7 +789,7 @@ obj_scoped_name_split(
moduleNameEndChar = *module_name_end_ptr;
*module_name_end_ptr = 0;
}
while (((*obj_name_ptr) != NULL) && (isspace(*obj_name_ptr)))
while (((*obj_name_ptr) != 0) && (isspace(*obj_name_ptr)))
{
++obj_name_ptr;
}
@ -1146,7 +1146,7 @@ obj_verify(ABObj obj)
obj_name, (_fieldName)))
#define check_str(obj, _field) \
( ((int)(last_field = #_field)), \
( ((long)(last_field = #_field)), \
(istr_verify(obj->_field) >= 0)? \
(0) \
: \

View file

@ -1382,7 +1382,7 @@ objxm_dump_arglist_indented(
case AB_ARG_WIDGET:
if (cgen_args)
{
util_dprintf(0,"%s ", args[i].value != NULL?
util_dprintf(0,"%s ", args[i].value != 0?
istr_string((ISTRING)(args[i].value)) : "NULL");
}
else

View file

@ -68,7 +68,7 @@
*/
typedef struct
{
int rec_num; /* record # (offset) in table */
long rec_num; /* record # (offset) in table */
} TableIndexEntryRec, *TableIndexEntry, *TableIndex;
@ -519,7 +519,7 @@ objxm_get_enum_xmdef(
ISTRING strdef
)
{
unsigned char xmdef = NULL;
unsigned char xmdef = 0;
int i;
ObjxmEnumTable *enum_table = NULL;
ISTRING istr_xmname = istr_dup_existing(xmname);
@ -1052,12 +1052,12 @@ load_res_table(
}
static int
static long
xm_res_table_entry_xmname_compare(const void *leftEntry, const void *rightEntry)
{
return
((int)xm_res_table[((TableIndexEntry)leftEntry)->rec_num].xmname)
- ((int)xm_res_table[((TableIndexEntry)rightEntry)->rec_num].xmname);
((long)xm_res_table[((TableIndexEntry)leftEntry)->rec_num].xmname)
- ((long)xm_res_table[((TableIndexEntry)rightEntry)->rec_num].xmname);
}
@ -1115,7 +1115,7 @@ find_res_entry_by_xmname(ISTRING istr_xmname)
midIndex = ((minIndex + maxIndex)>>1);
entry = get_indexed_entry(
xm_res_table,xm_res_table_xmname_index,midIndex);
midDiff = ((int)(entry->xmname)) - ((int)istr_xmname);
midDiff = ((long)(entry->xmname)) - ((long)istr_xmname);
if (midDiff < 0)
{
/* mid is too small - take upper half */

View file

@ -142,7 +142,7 @@ objxm_color_exists(
String colorname
)
{
static Colormap colormap = NULL;
static Colormap colormap = 0;
static Display *display = NULL;
XColor color;
XColor exact_color;
@ -194,7 +194,7 @@ objxm_filebase_to_pixmap(
if (util_strempty(filebase))
return ERR_BAD_PARAM2;
*pixmap_p = NULL;
*pixmap_p = 0;
/* Use Pixmap conversion callback if it exists */
if (ObjxmP_filename_to_pixmap_cb != NULL)
@ -308,7 +308,7 @@ convert_file_to_pixmap(
Pixel fgPixel = 0;
Pixel bgPixel = 0;
*pixmap_p = NULL;
*pixmap_p = 0;
/*
* Get default values
@ -329,7 +329,7 @@ convert_file_to_pixmap(
* In CDE, XmGetPixmap handles .xpm files, as well.
*/
*pixmap_p = XmGetPixmap(screen, filename, fgPixel, bgPixel);
if ((*pixmap_p == NULL) || (*pixmap_p == XmUNSPECIFIED_PIXMAP))
if ((*pixmap_p == 0) || (*pixmap_p == XmUNSPECIFIED_PIXMAP))
{
return -1;
}

View file

@ -85,7 +85,7 @@ typedef struct BUCKET
*/
STRING Istr_null_string= "(nil)";
STRN *int_array= NULL; /* unique number array */
int num_count = 1; /* unique number counter */
long num_count = 1; /* unique number counter */
static BucketRec hashtable[NUMBUCKETS];
@ -94,10 +94,10 @@ STRN *debug_istr= NULL; /* debugging shortcut for clients (see */
/* comment at top of this file) */
#endif /* DEBUG */
static int *freelist; /* freelist for unused numbers */
static long *freelist; /* freelist for unused numbers */
static int freecount = 0; /* freelist count */
static int hash_count = 0; /* total number that has been inserted */
static long freecount = 0; /* freelist count */
static long hash_count = 0; /* total number that has been inserted */
static unsigned hashing(
char *p
@ -125,7 +125,7 @@ static int istrP_errmsg_noexist(int istr_value);
#define int_array_set(ptr) (int_array = (ptr))
#endif
#define istrP_int_to_client(intVal) ((ISTRING)(intVal))
#define istrP_client_to_int(istrVal) ((int)(istrVal))
#define istrP_client_to_int(istrVal) ((long)(istrVal))
#define return_istr(x) return istrP_int_to_client(x)
/*****************************************************************************/
@ -142,7 +142,7 @@ istr_create (
)
{
int hashval;
int str_exists;
long str_exists;
Bucket new_bucket;
int i;
Bucket entry;
@ -310,7 +310,7 @@ istrP_create_alloced_impl(
)
{
int hashval;
int str_exists;
long str_exists;
Bucket new_bucket;
int i;
Bucket entry;
@ -487,7 +487,7 @@ istr_create_const(
)
{
int hashval;
int str_exists;
long str_exists;
Bucket new_bucket;
int i;
Bucket entry;
@ -668,7 +668,7 @@ istr_dup_existing(
)
{
int hashval;
int str_exists;
long str_exists;
if (string == NULL)
{
@ -696,7 +696,7 @@ istrP_destroy_impl(
ISTRING *istringClientPtr
)
{
int istring = (int)(*istringClientPtr);
long istring = (long)(*istringClientPtr);
int val; /* hashing value */
int i;
Bucket entry;
@ -712,7 +712,7 @@ istrP_destroy_impl(
(int_array[istring].read_const == 0)))
{
istrP_errmsg_noexist(istring);
return NULL;
return 0;
}
if (int_array[istring].read_const == 1) /* const entry */
{
@ -752,13 +752,13 @@ istrP_destroy_impl(
/* put unused int_array location of the freelist */
if(free_num == 0)
{
freelist = (int *)malloc(ARRAYSIZE * sizeof(int));
freelist = (long *)malloc(ARRAYSIZE * sizeof(long));
if (freelist == NULL)
{
fprintf(stderr,
catgets(UTIL_MESSAGE_CATD, UTIL_MESSAGE_SET, 3,
"ISTR: error in allocating memory\n") );
return NULL ;
return 0 ;
}
free_num = 1;
}
@ -771,15 +771,15 @@ istrP_destroy_impl(
else /* need more freelist space */
{
free_num++;
freelist = (int *)realloc(freelist,
(ARRAYSIZE * free_num) * sizeof(int));
freelist = (long *)realloc(freelist,
(ARRAYSIZE * free_num) * sizeof(long));
assert(freelist != NULL);
if (freelist == NULL)
{
fprintf(stderr,
catgets(UTIL_MESSAGE_CATD, UTIL_MESSAGE_SET, 3,
"ISTR: error in allocating memory\n") );
return NULL ;
return 0 ;
}
freelist[freecount] = istring;
freecount++;
@ -789,7 +789,7 @@ istrP_destroy_impl(
/*
* Set the client's variable to NULL
*/
istring = NULL;
istring = 0;
(*istringClientPtr) = istrP_int_to_client(istring);
return 1;
}
@ -804,7 +804,7 @@ istr_dup(
ISTRING istringClientVal
)
{
int istring= istrP_client_to_int(istringClientVal);
long istring= istrP_client_to_int(istringClientVal);
if(istring == 0)
{
@ -831,7 +831,7 @@ istrP_get_string_verify(
ISTRING istringClientVal
)
{
int istring = istrP_client_to_int(istringClientVal);
long istring = istrP_client_to_int(istringClientVal);
if(istring == 0)
{
@ -932,13 +932,13 @@ insert_array(
if(hash_count == 0)
{
int_array_set((STRN *)malloc(ARRAYSIZE * sizeof(STRN)));
int_array_set((STRN *)calloc(ARRAYSIZE, sizeof(STRN)));
if (int_array == NULL)
{
fprintf(stderr,
catgets(UTIL_MESSAGE_CATD, UTIL_MESSAGE_SET, 3,
"ISTR: error in allocating memory\n") );
return NULL ;
return 0 ;
}
array_num = 1;
}
@ -973,7 +973,7 @@ insert_array(
fprintf(stderr,
catgets(UTIL_MESSAGE_CATD, UTIL_MESSAGE_SET, 3,
"ISTR: error in allocating memory\n") );
return NULL ;
return 0 ;
}
int_array[val].refcount =1;
if (flag == 1)

View file

@ -69,7 +69,7 @@ static int strlistP_build_user_data_array(
((((_list)->user_datas == NULL) && ((_data) != NULL))? \
strlistP_build_user_data_array(_list, _index, _data) \
: \
((int)((_list)->user_datas[(_index)] = (_data))) \
((long)((_list)->user_datas[(_index)] = (_data))) \
)
@ -189,10 +189,10 @@ strlist_istr_exists(StringList list, ISTRING istring)
}
int
long
strlist_set_istr_data(StringList list, ISTRING istring, void *data)
{
int index = strlist_get_istr_index(list, istring);
long index = strlist_get_istr_index(list, istring);
if (index < 0)
{
return index;
@ -215,10 +215,10 @@ strlist_get_istr_data(StringList list, ISTRING istring)
/*
* Returns the index of the given string, or -1 if it doesn't exist
*/
int
long
strlist_get_istr_index(StringList list, ISTRING string)
{
int index = -1;
long index = -1;
int i = 0;
int num_strings = list->num_strings;
@ -293,10 +293,10 @@ epilogue:
}
int
long
strlist_remove_istr(StringList list, ISTRING istring)
{
int index = strlist_get_istr_index(list, istring);
long index = strlist_get_istr_index(list, istring);
if (index < 0)
{
return 0;
@ -485,10 +485,10 @@ strlist_str_exists(StringList list, STRING string)
}
int
long
strlist_get_str_index(StringList list, STRING string)
{
int index = -1;
long index = -1;
ISTRING istring = istr_create(string);
if (istring != NULL)
{
@ -506,10 +506,10 @@ strlist_get_str(StringList list, int whichString, void **clientDataOut)
}
int
long
strlist_remove_str(StringList list, STRING string)
{
int return_value = 0;
long return_value = 0;
ISTRING istring = istr_dup_existing(string);
if (istring != NULL)
{
@ -520,10 +520,10 @@ strlist_remove_str(StringList list, STRING string)
}
int
long
strlist_set_str_data(StringList list, STRING string, void *data)
{
int return_value = 0;
long return_value = 0;
ISTRING istring = istr_dup_existing(string);
if (istring != NULL)
{
@ -571,6 +571,7 @@ strlist_dup(StringList list)
**************************************************************************/
int
strlistP_shrink_array(StringList list, int sizeDiff)
{
int return_value = 0;

View file

@ -104,12 +104,12 @@ int strlist_dump(StringList list);
* STRING interfaces
*/
int strlist_add_str(StringList, STRING s, void *userData);
int strlist_remove_str(StringList, STRING s);
long strlist_remove_str(StringList, STRING s);
BOOL strlist_str_exists(StringList list, STRING s);
int strlist_get_str_index(StringList list, STRING s);
long strlist_get_str_index(StringList list, STRING s);
STRING strlist_get_str(StringList,
int whichString, void **userDataOut);
int strlist_set_str_data(StringList, STRING string, void *data);
long strlist_set_str_data(StringList, STRING string, void *data);
void *strlist_get_str_data(StringList, STRING string);
StringList strlist_dup(StringList);
@ -120,14 +120,14 @@ StringList strlist_dup(StringList);
* The STRINGs and ISTRING are kept in the same list, and behave identically
*/
int strlist_add_istr(StringList, ISTRING s, void *userData);
int strlist_add_index_istr(StringList,
long strlist_add_index_istr(StringList,
int index, ISTRING s, void *userData);
BOOL strlist_istr_exists(StringList list, ISTRING s);
int strlist_get_istr_index(StringList list, ISTRING s);
long strlist_get_istr_index(StringList list, ISTRING s);
ISTRING strlist_get_istr(StringList,
int whichString, void **userDataOut);
int strlist_set_istr_data(StringList, ISTRING istring, void *data);
long strlist_set_istr_data(StringList, ISTRING istring, void *data);
void *strlist_get_istr_data(StringList, ISTRING istring);
int strlist_remove_istr(StringList, ISTRING s);
long strlist_remove_istr(StringList, ISTRING s);
#endif /* _ABUTIL_STRLIST_H_ */