Bleepin' Windows uses LLP64, not LP64

git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@158 632fc199-4ca6-4c93-a231-07263d6284db
This commit is contained in:
DRC
2010-02-26 23:01:19 +00:00
parent d3c7eff53d
commit 048990944f
10 changed files with 29 additions and 27 deletions

View File

@@ -49,7 +49,7 @@ int jpeg_first_bit_table_init=0;
*/
typedef struct {
long put_buffer; /* current bit-accumulation buffer */
size_t put_buffer; /* current bit-accumulation buffer */
int put_bits; /* # of bits now in it */
int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */
} savable_state;
@@ -489,8 +489,8 @@ LOCAL(boolean)
flush_bits (working_state * state)
{
unsigned char _buffer[BUFSIZE], *buffer;
long put_buffer; int put_bits;
int bytes, bytestocopy, localbuf = 0;
size_t put_buffer; int put_bits;
size_t bytes, bytestocopy; int localbuf = 0;
put_buffer = state->cur.put_buffer;
put_bits = state->cur.put_bits;
@@ -515,9 +515,9 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val,
int nbits;
int r, sflag, size, code;
unsigned char _buffer[BUFSIZE], *buffer;
long put_buffer; int put_bits;
size_t put_buffer; int put_bits;
int code_0xf0 = actbl->ehufco[0xf0], size_0xf0 = actbl->ehufsi[0xf0];
int bytes, bytestocopy, localbuf = 0;
size_t bytes, bytestocopy; int localbuf = 0;
put_buffer = state->cur.put_buffer;
put_bits = state->cur.put_bits;

View File

@@ -75,7 +75,7 @@ EXTERN(void) jpeg_make_d_derived_tbl
#if __WORDSIZE == 64
typedef long bit_buf_type; /* type of bit-extraction buffer */
typedef size_t bit_buf_type; /* type of bit-extraction buffer */
#define BIT_BUF_SIZE 64 /* size of buffer in bits */
#else

View File

@@ -122,7 +122,7 @@ typedef struct {
jvirt_barray_ptr virt_barray_list;
/* This counts total space obtained from jpeg_get_small/large */
long total_space_allocated;
size_t total_space_allocated;
/* alloc_sarray and alloc_barray set this value for use by virtual
* array routines.
@@ -317,8 +317,8 @@ alloc_small (j_common_ptr cinfo, int pool_id, size_t sizeofobject)
/* OK, allocate the object from the current pool */
data_ptr = (char *) hdr_ptr; /* point to first data byte in pool... */
data_ptr += SIZEOF(small_pool_hdr); /* ...by skipping the header... */
if ((unsigned long)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
data_ptr += ALIGN_SIZE - (unsigned long)data_ptr % ALIGN_SIZE;
if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
data_ptr += hdr_ptr->bytes_used; /* point to place for object */
hdr_ptr->bytes_used += sizeofobject;
hdr_ptr->bytes_left -= sizeofobject;
@@ -382,8 +382,8 @@ alloc_large (j_common_ptr cinfo, int pool_id, size_t sizeofobject)
data_ptr = (char *) hdr_ptr; /* point to first data byte in pool... */
data_ptr += SIZEOF(small_pool_hdr); /* ...by skipping the header... */
if ((unsigned long)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
data_ptr += ALIGN_SIZE - (unsigned long)data_ptr % ALIGN_SIZE;
if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
return (void FAR *) data_ptr;
}
@@ -420,7 +420,7 @@ alloc_sarray (j_common_ptr cinfo, int pool_id,
/* Make sure each row is properly aligned */
if ((ALIGN_SIZE % SIZEOF(JSAMPLE)) != 0)
out_of_memory(cinfo, 5); /* safety check */
samplesperrow = jround_up(samplesperrow, (2 * ALIGN_SIZE) / SIZEOF(JSAMPLE));
samplesperrow = (JDIMENSION)jround_up(samplesperrow, (2 * ALIGN_SIZE) / SIZEOF(JSAMPLE));
/* Calculate max # of rows allowed in one allocation chunk */
ltemp = (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)) /
@@ -608,8 +608,8 @@ realize_virt_arrays (j_common_ptr cinfo)
/* Allocate the in-memory buffers for any unrealized virtual arrays */
{
my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
long space_per_minheight, maximum_space, avail_mem;
long minheights, max_minheights;
size_t space_per_minheight, maximum_space, avail_mem;
size_t minheights, max_minheights;
jvirt_sarray_ptr sptr;
jvirt_barray_ptr bptr;

View File

@@ -69,9 +69,9 @@ jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject)
* Here we always say, "we got all you want bud!"
*/
GLOBAL(long)
jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed,
long max_bytes_needed, long already_allocated)
GLOBAL(size_t)
jpeg_mem_available (j_common_ptr cinfo, size_t min_bytes_needed,
size_t max_bytes_needed, size_t already_allocated)
{
return max_bytes_needed;
}

View File

@@ -100,10 +100,10 @@ EXTERN(void) jpeg_free_large JPP((j_common_ptr cinfo, void FAR * object,
* Conversely, zero may be returned to always use the minimum amount of memory.
*/
EXTERN(long) jpeg_mem_available JPP((j_common_ptr cinfo,
long min_bytes_needed,
long max_bytes_needed,
long already_allocated));
EXTERN(size_t) jpeg_mem_available JPP((j_common_ptr cinfo,
size_t min_bytes_needed,
size_t max_bytes_needed,
size_t already_allocated));
/*

View File

@@ -369,7 +369,7 @@ EXTERN(void) jinit_memory_mgr JPP((j_common_ptr cinfo));
/* Utility routines in jutils.c */
EXTERN(long) jdiv_round_up JPP((long a, long b));
EXTERN(long) jround_up JPP((long a, long b));
EXTERN(size_t) jround_up JPP((size_t a, size_t b));
EXTERN(void) jcopy_sample_rows JPP((JSAMPARRAY input_array, int source_row,
JSAMPARRAY output_array, int dest_row,
int num_rows, JDIMENSION num_cols));

View File

@@ -77,8 +77,8 @@ jdiv_round_up (long a, long b)
}
GLOBAL(long)
jround_up (long a, long b)
GLOBAL(size_t)
jround_up (size_t a, size_t b)
/* Compute a rounded up to next multiple of b, ie, ceil(a/b)*b */
/* Assumes a >= 0, b > 0 */
{

View File

@@ -1,5 +1,6 @@
/* Copyright (C)2004 Landmark Graphics Corporation
* Copyright (C)2005 Sun Microsystems, Inc.
* Copyright (C)2010 D. R. Commander
*
* This library is free software and may be redistributed and/or modified under
* the terms of the wxWindows Library License, Version 3.1 or (at your option)
@@ -49,7 +50,7 @@ static __inline int numprocs(void)
#ifdef _WIN32
DWORD_PTR ProcAff, SysAff, i; int count=0;
if(!GetProcessAffinityMask(GetCurrentProcess(), &ProcAff, &SysAff)) return(1);
for(i=0; i<sizeof(long)*8; i++) if(ProcAff&(1<<i)) count++;
for(i=0; i<sizeof(long*)*8; i++) if(ProcAff&(1LL<<i)) count++;
return(count);
#elif defined (__APPLE__)
return(1);

View File

@@ -24,7 +24,7 @@
* In the PIC cases, we have no guarantee that constants will keep
* their alignment. This macro allows us to verify it at runtime.
*/
#define IS_ALIGNED(ptr, order) (((unsigned long)ptr & ((1 << order) - 1)) == 0)
#define IS_ALIGNED(ptr, order) (((size_t)ptr & ((1 << order) - 1)) == 0)
#define IS_ALIGNED_SSE(ptr) (IS_ALIGNED(ptr, 4)) /* 16 byte alignment */

View File

@@ -192,7 +192,8 @@ DLLEXPORT int DLLCALL tjCompress(tjhandle h,
j->cinfo.image_height-j->cinfo.next_scanline);
}
jpeg_finish_compress(&j->cinfo);
*size=TJBUFSIZE(j->cinfo.image_width, j->cinfo.image_height)-(j->jdms.free_in_buffer);
*size=TJBUFSIZE(j->cinfo.image_width, j->cinfo.image_height)
-(unsigned long)(j->jdms.free_in_buffer);
if(row_pointer) free(row_pointer);
return 0;