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

@@ -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;