You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ap...@apache.org on 2006/12/05 14:54:29 UTC

svn commit: r482652 - in /harmony/enhanced/classlib/trunk/modules/awt/src/main/native: jpegdecoder/shared/JPEGDecoder.h jpegdecoder/shared/JpegDecoder.c lcmm/shared/cmmapi.h lcmm/shared/cmmio.c

Author: apetrenko
Date: Tue Dec  5 05:54:28 2006
New Revision: 482652

URL: http://svn.apache.org/viewvc?view=rev&rev=482652
Log:
Our own versions of MIN and MAX macros are changed to standard from stdlib.h

Modified:
    harmony/enhanced/classlib/trunk/modules/awt/src/main/native/jpegdecoder/shared/JPEGDecoder.h
    harmony/enhanced/classlib/trunk/modules/awt/src/main/native/jpegdecoder/shared/JpegDecoder.c
    harmony/enhanced/classlib/trunk/modules/awt/src/main/native/lcmm/shared/cmmapi.h
    harmony/enhanced/classlib/trunk/modules/awt/src/main/native/lcmm/shared/cmmio.c

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/jpegdecoder/shared/JPEGDecoder.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/jpegdecoder/shared/JPEGDecoder.h?view=diff&rev=482652&r1=482651&r2=482652
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/jpegdecoder/shared/JPEGDecoder.h (original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/jpegdecoder/shared/JPEGDecoder.h Tue Dec  5 05:54:28 2006
@@ -43,12 +43,4 @@
 jfieldID img_JPEG_currScanlineID;
 jfieldID img_JPEG_hNativeDecoderID;
 
-/* MIN(a, b) macro */
-#undef MIN
-#define MIN(a, b) ((a) < (b))?(a):(b)
-
-/* MAX(a, b) macro */
-#undef MAX
-#define MAX(a, b) ((a) > (b))?(a):(b)
-
 #endif

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/jpegdecoder/shared/JpegDecoder.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/jpegdecoder/shared/JpegDecoder.c?view=diff&rev=482652&r1=482651&r2=482652
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/jpegdecoder/shared/JpegDecoder.c (original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/jpegdecoder/shared/JpegDecoder.c Tue Dec  5 05:54:28 2006
@@ -20,6 +20,7 @@
  * 
  */
 
+#include <stdlib.h>
 #include "JPEGDecoder.h"
 
 typedef enum TAG_DECODER_STATE{
@@ -90,7 +91,7 @@
     srcmgr = (gl_jpeg_source_mgr*) cinfo->src;
     srcmgr->skip_input_bytes += num_bytes;
   
-    skipbytes = MIN(srcmgr->base.bytes_in_buffer, srcmgr->skip_input_bytes);
+    skipbytes = __min(srcmgr->base.bytes_in_buffer, srcmgr->skip_input_bytes);
 
     if(skipbytes < srcmgr->base.bytes_in_buffer) {
             memmove(srcmgr->jpeg_buffer,
@@ -354,7 +355,7 @@
     }
   }
 
-  consumed = MIN(bytesInBuffer, freeInJpegBuffer);
+  consumed = __min(bytesInBuffer, freeInJpegBuffer);
 
   // filling buffer with the new data  
   buffer = (*env)->GetPrimitiveArrayCritical(env, jbuffer, 0);
@@ -368,7 +369,7 @@
     glDecompress->srcMgr.valid_buffer_length += consumed;
 
     if(glDecompress->srcMgr.skip_input_bytes) {
-        int skipbytes = (int) MIN((size_t) glDecompress->srcMgr.valid_buffer_length, glDecompress->srcMgr.skip_input_bytes);
+        int skipbytes = (int) __min((size_t) glDecompress->srcMgr.valid_buffer_length, glDecompress->srcMgr.skip_input_bytes);
 
         if(skipbytes < glDecompress->srcMgr.valid_buffer_length) {
             memmove(glDecompress->srcMgr.jpeg_buffer,
@@ -449,7 +450,7 @@
         }
 
     // Calculate output buffer size and allocate memory for it
-    glDecompress->maxScanlines = MAX((int)(MAX_BUFFER / glDecompress->scanlineSize), 1);
+    glDecompress->maxScanlines = __max((int)(MAX_BUFFER / glDecompress->scanlineSize), 1);
     glDecompress->outBufferSize = glDecompress->maxScanlines; // * glDecompress->scanlineSize;    
 
     glDecompress->outBuffer = malloc(glDecompress->outBufferSize * sizeof(JSAMPROW));

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/lcmm/shared/cmmapi.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/lcmm/shared/cmmapi.h?view=diff&rev=482652&r1=482651&r2=482652
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/lcmm/shared/cmmapi.h (original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/lcmm/shared/cmmapi.h Tue Dec  5 05:54:28 2006
@@ -27,12 +27,6 @@
 #endif
 
 
-// Just a useful macro
-#undef MIN
-
-#define MIN(a,b)    ((a) < (b) ? (a) : (b))
-
-
 LPLCMSICCPROFILE cmmOpenProfile(LPBYTE dataPtr, DWORD dwSize);
 
 BOOL cmmCloseProfile(LPLCMSICCPROFILE hProfile);

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/lcmm/shared/cmmio.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/lcmm/shared/cmmio.c?view=diff&rev=482652&r1=482651&r2=482652
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/lcmm/shared/cmmio.c (original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/lcmm/shared/cmmio.c Tue Dec  5 05:54:28 2006
@@ -20,6 +20,7 @@
  * 
  */
 
+#include <stdlib.h>
 #include "cmmapi.h"
 
 
@@ -543,7 +544,7 @@
     return FALSE;    
   }
 
-  *dataSize = MIN(*dataSize, hProfile->TagSizes[idx]);
+  *dataSize = __min(*dataSize, hProfile->TagSizes[idx]);
 
 
 
@@ -587,7 +588,7 @@
 
 BOOL cmmGetProfileHeader(LPLCMSICCPROFILE hProfile, LPBYTE data, size_t size) {
 
-  size_t bytesToRead = MIN(size, sizeof(icHeader));
+  size_t bytesToRead = __min(size, sizeof(icHeader));
 
   hProfile->Seek(hProfile->stream, 0);