Index: trunk/i386/libsaio/ext2fs.c =================================================================== --- trunk/i386/libsaio/ext2fs.c (revision 1052) +++ trunk/i386/libsaio/ext2fs.c (revision 1053) @@ -37,6 +37,6 @@ return; } str[strMaxLen]=0; - strncpy (str, buf+0x478, min (strMaxLen, 16)); + strncpy (str, buf+0x478, MIN(strMaxLen, 16)); free (buf); } Index: trunk/i386/libsaio/sys.c =================================================================== --- trunk/i386/libsaio/sys.c (revision 1052) +++ trunk/i386/libsaio/sys.c (revision 1053) @@ -451,7 +451,7 @@ if ((iob[i].i_flgs != F_ALLOC) || (i == fdesc)) { continue; } - io->i_buf = max(iob[i].i_filesize + iob[i].i_buf, io->i_buf); + io->i_buf = MAX(iob[i].i_filesize + iob[i].i_buf, io->i_buf); } // Load entire file into memory. Unnecessary open() calls must be avoided. Index: trunk/i386/libsaio/load.c =================================================================== --- trunk/i386/libsaio/load.c (revision 1052) +++ trunk/i386/libsaio/load.c (revision 1053) @@ -151,8 +151,8 @@ case LC_SEGMENT: ret = DecodeSegment(cmdBase, &load_addr, &load_size); if (ret == 0 && load_size != 0 && load_addr >= KERNEL_ADDR) { - vmaddr = min(vmaddr, load_addr); - vmend = max(vmend, load_addr + load_size); + vmaddr = MIN(vmaddr, load_addr); + vmend = MAX(vmend, load_addr + load_size); } break; Index: trunk/i386/libsaio/cpu.c =================================================================== --- trunk/i386/libsaio/cpu.c (revision 1052) +++ trunk/i386/libsaio/cpu.c (revision 1053) @@ -56,7 +56,7 @@ */ if((tscEnd - tscStart) <= CALIBRATE_TIME_MSEC) continue; - // tscDelta = min(tscDelta, (tscEnd - tscStart)) + // tscDelta = MIN(tscDelta, (tscEnd - tscStart)) if( (tscEnd - tscStart) < tscDelta ) tscDelta = tscEnd - tscStart; } @@ -170,7 +170,7 @@ strlcpy(p->CPU.BrandString, s, sizeof(p->CPU.BrandString)); - if (!strncmp(p->CPU.BrandString, CPU_STRING_UNKNOWN, min(sizeof(p->CPU.BrandString), strlen(CPU_STRING_UNKNOWN) + 1))) { + if (!strncmp(p->CPU.BrandString, CPU_STRING_UNKNOWN, MIN(sizeof(p->CPU.BrandString), strlen(CPU_STRING_UNKNOWN) + 1))) { /* * This string means we have a firmware-programmable brand string, * and the firmware couldn't figure out what sort of CPU we have. Index: trunk/i386/libsaio/disk.c =================================================================== --- trunk/i386/libsaio/disk.c (revision 1052) +++ trunk/i386/libsaio/disk.c (revision 1053) @@ -1766,7 +1766,7 @@ if ( matchVolumeToString(bvr, volStart, volLen) ) { - strncat(str, aliasStart, min(strMaxLen, aliasLen)); + strncat(str, aliasStart, MIN(strMaxLen, aliasLen)); free(aliasList); return true; Index: trunk/i386/libsaio/saio_types.h =================================================================== --- trunk/i386/libsaio/saio_types.h (revision 1052) +++ trunk/i386/libsaio/saio_types.h (revision 1053) @@ -233,18 +233,23 @@ DEV_EN = 3 }; -#ifndef max -#define max(a,b) ((a) > (b) ? (a) : (b)) +/* + * min/max Macros. + * + * Azi: defined on , i386/include/IOKit/IOLib.h (min/max, lower case), and others... + */ +#ifndef MIN +#define MIN(a,b) ( ((a) < (b)) ? (a) : (b) ) #endif - -#ifndef min -#define min(a,b) ((a) < (b) ? (a) : (b)) +#ifndef MAX +#define MAX(a,b) ( ((a) > (b)) ? (a) : (b) ) #endif +/*Azi: not used #define round2(x, m) (((x) + (m / 2)) & ~(m - 1)) #define roundup2(x, m) (((x) + m - 1) & ~(m - 1)) -#define MAKEKERNDEV(t, u, p) MAKEBOOTDEV(t, 0, 0, u, p) +#define MAKEKERNDEV(t, u, p) MAKEBOOTDEV(t, 0, 0, u, p)*/ enum { kNetworkDeviceType = kBIOSDevTypeNetwork, Index: trunk/i386/libsaio/msdos.c =================================================================== --- trunk/i386/libsaio/msdos.c (revision 1052) +++ trunk/i386/libsaio/msdos.c (revision 1053) @@ -45,10 +45,9 @@ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#define tolower(c) (((c)>='A' && c<='Z')?((c) | 0x20):(c)) + #include "libsaio.h" #include "sl.h" - #include "msdos_private.h" #include "msdos.h" @@ -60,6 +59,8 @@ #define CLUST_RSRVD16 0xfff8 /* reserved cluster range */ #define CLUST_RSRVD12 0xff8 /* reserved cluster range */ +#define tolower(c) (((c)>='A' && c<='Z')?((c) | 0x20):(c)) + static int msdosressector=0; static int msdosnfats = 0; static int msdosfatsecs = 0; @@ -767,10 +768,10 @@ if (length==0 || length>size-offset) toread=size-offset; wastoread=toread; - bcopy (buf+(offset%msdosclustersize),ptr,min(msdosclustersize-(offset%msdosclustersize), toread)); + bcopy (buf+(offset%msdosclustersize),ptr,MIN(msdosclustersize-(offset%msdosclustersize), toread)); ptr+=msdosclustersize-(offset%msdosclustersize); toread-=msdosclustersize-(offset%msdosclustersize); - while (toread>0 && msdosreadcluster (ih, (uint8_t *)ptr, min(msdosclustersize,toread), &cluster)) + while (toread>0 && msdosreadcluster (ih, (uint8_t *)ptr, MIN(msdosclustersize,toread), &cluster)) { ptr+=msdosclustersize; toread-=msdosclustersize; Index: trunk/i386/boot2/graphics.c =================================================================== --- trunk/i386/boot2/graphics.c (revision 1052) +++ trunk/i386/boot2/graphics.c (revision 1053) @@ -42,8 +42,6 @@ uint8_t *previewSaveunder = 0; #define VIDEO(x) (bootArgs->Video.v_ ## x) - -#define MIN(x, y) ((x) < (y) ? (x) : (y)) //========================================================================== // getVBEInfoString Index: trunk/i386/boot2/gui.c =================================================================== --- trunk/i386/boot2/gui.c (revision 1052) +++ trunk/i386/boot2/gui.c (revision 1053) @@ -22,9 +22,6 @@ #define LOADPNG(img, alt_img) if (loadThemeImage(#img, alt_img) != 0) { return 1; } -#define MIN(x, y) ((x) < (y) ? (x) : (y)) -#define MAX(x, y) ((x) > (y) ? (x) : (y)) - #define VIDEO(x) (bootArgs->Video.v_ ## x) #define vram VIDEO(baseAddr) Index: trunk/i386/boot2/options.c =================================================================== --- trunk/i386/boot2/options.c (revision 1052) +++ trunk/i386/boot2/options.c (revision 1053) @@ -322,11 +322,11 @@ gMenuHeight = height; gMenuItemCount = count; gMenuTop = 0; - gMenuBottom = min( count, height ) - 1; + gMenuBottom = MIN( count, height ) - 1; gMenuSelection = selection; gMenuStart = 0; - gMenuEnd = min( count, gui.maxdevices ) - 1; + gMenuEnd = MIN( count, gui.maxdevices ) - 1; // If the selected item is not visible, shift the list down. @@ -899,7 +899,7 @@ printf("Use \30\31 keys to select the startup volume."); } showMenu( menuItems, gDeviceCount, selectIndex, kMenuTopRow + 2, kMenuMaxItems ); - nextRow += min( gDeviceCount, kMenuMaxItems ) + 3; + nextRow += MIN( gDeviceCount, kMenuMaxItems ) + 3; } // Show the boot prompt. @@ -1024,7 +1024,7 @@ if (gDeviceCount) { printf("Use \30\31 keys to select the startup volume."); showMenu(menuItems, gDeviceCount, selectIndex, kMenuTopRow + 2, kMenuMaxItems); - nextRow += min(gDeviceCount, kMenuMaxItems) + 3; + nextRow += MIN(gDeviceCount, kMenuMaxItems) + 3; } showPrompt = (gDeviceCount == 0) || (menuBVR->flags & kBVFlagNativeBoot); Index: trunk/i386/libsa/qsort.c =================================================================== --- trunk/i386/libsa/qsort.c (revision 1052) +++ trunk/i386/libsa/qsort.c (revision 1053) @@ -57,12 +57,11 @@ #include #include +#include "saio_types.h" //Azi: MIN/MAX static inline char *med3 __P((char *, char *, char *, int (*)())); static inline void swapfunc __P((char *, char *, int, int)); -#define min(a, b) (a) < (b) ? a : b - /* * Qsort routine from Bentley & McIlroy's "Engineering a Sort Function". */ @@ -178,9 +177,9 @@ } pn = a + n * es; - r = min(pa - (char *)a, pb - pa); + r = MIN(pa - (char *)a, pb - pa); vecswap(a, pb - r, r); - r = min(pd - pc, (pn - pd) - (int)es); + r = MIN(pd - pc, (pn - pd) - (int)es); vecswap(pb, pn - r, r); if ((r = pb - pa) > (int)es) qsort(a, r / es, es, cmp); Index: trunk/i386/util/fdisk/cmd.c =================================================================== --- trunk/i386/util/fdisk/cmd.c (revision 1052) +++ trunk/i386/util/fdisk/cmd.c (revision 1053) @@ -65,6 +65,7 @@ #include "part.h" #include "cmd.h" #include "auto.h" + #define MAX(a, b) ((a) >= (b) ? (a) : (b)) int