Checked in some Alpha portability fixes.

This commit is contained in:
slidedraw 2002-05-10 16:08:58 +00:00
parent 9c1a133973
commit 2ff85e8b61
7 changed files with 27 additions and 40 deletions

View File

@ -274,7 +274,7 @@ __cole_print_tree_inroot(COLEDIR *cd, void *info, COLERRNO *colerrno)
char *entry_name;
printf ("DIR ");
printf (" %7u", cole_dir_getsize (cd));
printf (" %7zu", cole_dir_getsize (cd));
printf (" %08lx-%08lx %08lx-%08lx",
cole_dir_getdays1 (cd),
cole_dir_getsec1 (cd),
@ -315,7 +315,7 @@ __cole_print_tree_indirentry(COLEDIRENT *cde, void *info, COLERRNO *colerrno)
printf ("FILE");
else
printf ("????");
printf (" %7u", cole_direntry_getsize (cde));
printf (" %7zu", cole_direntry_getsize (cde));
printf (" %08lx-%08lx %08lx-%08lx",
cole_direntry_getdays1 (cde),
cole_direntry_getsec1 (cde),

View File

@ -658,14 +658,14 @@ nextff (cff);
{
for (i = 0; i < level * 3; i++)
printf (" ");
printf ("FILE %02lx %8ld '%c%s'\n", pps_list[entry].ppsnumber,
pps_list[entry].size, !isprint((int)pps_list[entry].name[0]) ? ' ' : pps_list[entry].name[0], pps_list[entry].name+1);
printf ("FILE %02x %8d '%c%s'\n", (int)pps_list[entry].ppsnumber,
(int)pps_list[entry].size, !isprint((int)pps_list[entry].name[0]) ? ' ' : pps_list[entry].name[0], pps_list[entry].name+1);
}
else
{
for (i = 0; i < level * 3; i++)
printf (" ");
printf ("DIR %02lx '%c%s'\n", pps_list[entry].ppsnumber,
printf ("DIR %02x '%c%s'\n", (int)pps_list[entry].ppsnumber,
!isprint((int)pps_list[entry].name[0]) ? ' ' : pps_list[entry].name[0], pps_list[entry].name+1);
verbosePPSTree (pps_list, pps_list[entry].dir, level + 1);
}

View File

@ -27,45 +27,31 @@
*/
#include <string.h>
#include "support.h"
U16
fil_sreadU16 (U8 * in)
{
#ifdef WORDS_BIGENDIAN
U16 ret;
*( (U8*)(&ret) ) = *(in+1);
*( ((U8*)(&ret)) + 1 ) = *in;
return ret;
#else /* !WORDS_BIGENDIAN */
return *((U16 *)in);
#endif
return (in[1] << 8) | in[0];
}
U32
fil_sreadU32 (U8 * in)
{
#ifdef WORDS_BIGENDIAN
U32 ret;
*( ((U8*)(&ret)) + 3 ) = *in;
*( ((U8*)(&ret)) + 2 ) = *(in+1);
*( ((U8*)(&ret)) + 1 ) = *(in+2);
*( (U8*)(&ret) ) = *(in+3);
return ret;
#else /* !WORDS_BIGENDIAN */
return *((U32 *)in);
#endif
U32 i0 = in[0], i1 = in[1], i2 = in[2], i3 = in[3];
return (i3 << 24) | (i2 << 16) | (i1 << 8) | i0;
}
F64
fil_sreadF64 (U8 * in)
{
#ifdef WORDS_BIGENDIAN
F64 ret;
#ifdef WORDS_BIGENDIAN
*( ((U8*)(&ret)) + 7 ) = *in;
*( ((U8*)(&ret)) + 6 ) = *(in+1);
*( ((U8*)(&ret)) + 5 ) = *(in+2);
@ -74,10 +60,10 @@ fil_sreadF64 (U8 * in)
*( ((U8*)(&ret)) + 2 ) = *(in+5);
*( ((U8*)(&ret)) + 1 ) = *(in+6);
*( (U8*)(&ret) ) = *(in+7);
return ret;
#else /* !WORDS_BIGENDIAN */
return *((F64 *)in);
memcpy (&ret, in, 8);
#endif
return ret;
}
@ -138,13 +124,13 @@ __cole_dump (void *_m, void *_start, int length, char *msg)
buff[8] = '-';
buff[17] = 0;
if (msg != NULL)
printf ("VERBOSE: %s (from 0x%08x length 0x%08x (%d)):\n",
printf ("VERBOSE: %s (from 0x%08tx length 0x%08x (%d)):\n",
msg, m - start, length, length);
for (pm = m; pm - m < length; pm++) {
achar = (pm - m) % 16;
/* print offset */
if (achar == 0)
printf ("%08x ", (pm - m) + (m - start));
printf ("%08tx ", (pm - m) + (m - start));
/* write char in the right column buffer */
buff[achar + (achar < 8 ? 0 : 1)] = (char)((isprint (*pm) ? *pm : '.'));
/* print next char */

View File

@ -11,6 +11,7 @@ HEAD
of <FONT>
* Made rowspan and colspan attributes instead of content of <cell>
in XML output
* Added some Alpha portability fixes.
0.5 04/13/02
* Fixed some memory leaks

View File

@ -28,6 +28,7 @@
#include "xlhtml.h"
static U16 HARD_MAX_ROWS = HARD_MAX_ROWS_97;
static char SectionName[2][12] = /* The section of the Excel Stream where the workbooks are kept */
{
@ -611,9 +612,9 @@ void scan_file(COLEDIRENT *cde, void *_info)
printf("There are %d pages total.\n", sheet_count+1);
for (i=0; i<=sheet_count; i++)
{
printf("Page:%d Name:%s MaxRow:%ld MaxCol:%d\n", i,
printf("Page:%d Name:%s MaxRow:%ld MaxCol:%ld\n", i,
ws_array[i]->ws_title.str ? (char *)ws_array[i]->ws_title.str : "(Unknown Page)",
ws_array[i]->biggest_row, ws_array[i]->biggest_col);
(long)ws_array[i]->biggest_row, (long)ws_array[i]->biggest_col);
}
}
else if (Xtract)
@ -628,9 +629,9 @@ void scan_file(COLEDIRENT *cde, void *_info)
printf("<p>There are %d pages total.</p>\n", sheet_count+1);
for (i=0; i<=sheet_count; i++)
{
printf("<p>Page:%d Name:%s MaxRow:%ld MaxCol:%d</p>\n", i,
printf("<p>Page:%d Name:%s MaxRow:%ld MaxCol:%ld</p>\n", i,
ws_array[i]->ws_title.str ? (char *)ws_array[i]->ws_title.str : "(Unknown Page)",
ws_array[i]->biggest_row, ws_array[i]->biggest_col);
(long)ws_array[i]->biggest_row, (long)ws_array[i]->biggest_col);
}
output_footer();
@ -700,7 +701,7 @@ void SetupExtraction(void)
{
if (Ascii)
fprintf(stderr, "Error - Row not in range during extraction"
" (%d or %d not in [%ld..%ld])\n", xr1, xr2, ws_array[xp]->first_row, ws_array[xp]->biggest_row);
" (%d or %d not in [%ld..%ld])\n", xr1, xr2, (long)ws_array[xp]->first_row, (long)ws_array[xp]->biggest_row);
else
{
printf("Error - Row not in range during extraction.");
@ -1496,7 +1497,7 @@ void main_line_processor(U16 opcode, U16 version, U32 count, U16 last, U8 data)
sprintf(temp, "%.15g", d / 100.0);
break;
case 2:
sprintf(temp, "%ld", (S32)n2);
sprintf(temp, "%ld", (long)n2);
break;
default:
d = (F64) n2;

View File

@ -23,7 +23,6 @@
#define HARD_MAX_ROWS_95 0x3FFF /*!< Used in add_wb_array to prevent OOM */
#define HARD_MAX_COLS 256 /*!< Used in add_wb_array to prevent OOM */
static U16 HARD_MAX_ROWS = HARD_MAX_ROWS_97;
/**********************************
*
* Don't change anything below here...

View File

@ -86,10 +86,10 @@ void OutputTableXML(void)
printf("\t\t\t<pagetitle>(Unknown Page)</pagetitle>\n");
}
printf( "\t\t\t<firstrow>%ld</firstrow>\n", ws_array[i]->first_row );
printf( "\t\t\t<lastrow>%ld</lastrow>\n", ws_array[i]->biggest_row );
printf( "\t\t\t<firstcol>%d</firstcol>\n", ws_array[i]->first_col );
printf( "\t\t\t<lastcol>%d</lastcol>\n", ws_array[i]->biggest_col );
printf( "\t\t\t<firstrow>%ld</firstrow>\n", (unsigned long)ws_array[i]->first_row );
printf( "\t\t\t<lastrow>%ld</lastrow>\n", (int) ws_array[i]->biggest_row );
printf( "\t\t\t<firstcol>%d</firstcol>\n", (long) ws_array[i]->first_col );
printf( "\t\t\t<lastcol>%d</lastcol>\n", (int)ws_array[i]->biggest_col );
printf( "\t\t\t<rows>\n" );
for (j=ws_array[i]->first_row; j<=ws_array[i]->biggest_row; j++)