[Expletive deleted] Windows is LLP64, not LP64


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3997 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/common/jpeg/jchuff.c b/common/jpeg/jchuff.c
index daf0736..e40cfe3 100644
--- a/common/jpeg/jchuff.c
+++ b/common/jpeg/jchuff.c
@@ -49,7 +49,7 @@
  */
 
 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 @@
 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 @@
   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/common/jpeg/jdhuff.h b/common/jpeg/jdhuff.h
index a7c8188..b192e48 100644
--- a/common/jpeg/jdhuff.h
+++ b/common/jpeg/jdhuff.h
@@ -75,7 +75,7 @@
 
 #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/common/jpeg/jmemmgr.c b/common/jpeg/jmemmgr.c
index 058a115..5458952 100644
--- a/common/jpeg/jmemmgr.c
+++ b/common/jpeg/jmemmgr.c
@@ -122,7 +122,7 @@
   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 @@
   /* 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 @@
 
   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 @@
   /* 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 @@
 /* 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/common/jpeg/jmemnobs.c b/common/jpeg/jmemnobs.c
index eb8c337..34b1895 100644
--- a/common/jpeg/jmemnobs.c
+++ b/common/jpeg/jmemnobs.c
@@ -69,9 +69,9 @@
  * 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/common/jpeg/jmemsys.h b/common/jpeg/jmemsys.h
index 6c3c6d3..b190945 100644
--- a/common/jpeg/jmemsys.h
+++ b/common/jpeg/jmemsys.h
@@ -100,10 +100,10 @@
  * 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/common/jpeg/jpegint.h b/common/jpeg/jpegint.h
index 95b00d4..7a31f51 100644
--- a/common/jpeg/jpegint.h
+++ b/common/jpeg/jpegint.h
@@ -369,7 +369,7 @@
 
 /* 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/common/jpeg/jutils.c b/common/jpeg/jutils.c
index d18a955..98b54f5 100644
--- a/common/jpeg/jutils.c
+++ b/common/jpeg/jutils.c
@@ -77,8 +77,8 @@
 }
 
 
-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/common/jpeg/rrutil.h b/common/jpeg/rrutil.h
index a7137de..4b61dbf 100644
--- a/common/jpeg/rrutil.h
+++ b/common/jpeg/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 @@
 	#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);
diff --git a/common/jpeg/simd/jsimd_x86_64.c b/common/jpeg/simd/jsimd_x86_64.c
index 0da564c..3437a9a 100644
--- a/common/jpeg/simd/jsimd_x86_64.c
+++ b/common/jpeg/simd/jsimd_x86_64.c
@@ -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 */
 
diff --git a/common/jpeg/turbojpegl.c b/common/jpeg/turbojpegl.c
index 82acf23..68dd35d 100644
--- a/common/jpeg/turbojpegl.c
+++ b/common/jpeg/turbojpegl.c
@@ -188,7 +188,8 @@
 			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;