From 048990944fccc2602c892dabace774f40271a61e Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 26 Feb 2010 23:01:19 +0000 Subject: [PATCH] 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 --- jchuff.c | 10 +++++----- jdhuff.h | 2 +- jmemmgr.c | 16 ++++++++-------- jmemnobs.c | 6 +++--- jmemsys.h | 8 ++++---- jpegint.h | 2 +- jutils.c | 4 ++-- rrutil.h | 3 ++- simd/jsimd_x86_64.c | 2 +- turbojpegl.c | 3 ++- 10 files changed, 29 insertions(+), 27 deletions(-) diff --git a/jchuff.c b/jchuff.c index daf0736..e40cfe3 100644 --- a/jchuff.c +++ b/jchuff.c @@ -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; diff --git a/jdhuff.h b/jdhuff.h index a7c8188..b192e48 100644 --- a/jdhuff.h +++ b/jdhuff.h @@ -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 diff --git a/jmemmgr.c b/jmemmgr.c index 058a115..5458952 100644 --- a/jmemmgr.c +++ b/jmemmgr.c @@ -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; diff --git a/jmemnobs.c b/jmemnobs.c index eb8c337..34b1895 100644 --- a/jmemnobs.c +++ b/jmemnobs.c @@ -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; } diff --git a/jmemsys.h b/jmemsys.h index 6c3c6d3..b190945 100644 --- a/jmemsys.h +++ b/jmemsys.h @@ -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)); /* diff --git a/jpegint.h b/jpegint.h index 95b00d4..7a31f51 100644 --- a/jpegint.h +++ b/jpegint.h @@ -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)); diff --git a/jutils.c b/jutils.c index d18a955..98b54f5 100644 --- a/jutils.c +++ b/jutils.c @@ -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 */ { diff --git a/rrutil.h b/rrutil.h index a7137de..4b61dbf 100644 --- a/rrutil.h +++ b/rrutil.h @@ -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; icinfo.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; -- 2.40.0