Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
xnp2-0.86-minmax.diff
diff -ur xnp2-0.86.orig/accessories/lzxpack.c xnp2-0.86/accessories/lzxpack.c
--- xnp2-0.86.orig/accessories/lzxpack.c 2016-03-09 02:25:48.000000000 +0900
+++ xnp2-0.86/accessories/lzxpack.c 2019-08-03 16:01:28.488689336 +0900
@@ -49,8 +49,8 @@
ctrl = ptr;
*ptr++ = 0x00;
}
- back = min(pos, maxhis);
- rem = min(datasize - pos, maxlen);
+ back = mymin(pos, maxhis);
+ rem = mymin(datasize - pos, maxlen);
minback = back;
minr = rem;
while(back) {
diff -ur xnp2-0.86.orig/android-project/jni/src/compiler.h xnp2-0.86/android-project/jni/src/compiler.h
--- xnp2-0.86.orig/android-project/jni/src/compiler.h 2016-03-09 02:25:49.000000000 +0900
+++ xnp2-0.86/android-project/jni/src/compiler.h 2019-08-03 16:10:04.251280374 +0900
@@ -53,11 +53,11 @@
#define MAX_PATH 256
#endif
-#ifndef max
-#define max(a,b) (((a) > (b)) ? (a) : (b))
+#ifndef mymax
+#define mymax(a,b) (((a) > (b)) ? (a) : (b))
#endif
-#ifndef min
-#define min(a,b) (((a) < (b)) ? (a) : (b))
+#ifndef mymin
+#define mymin(a,b) (((a) < (b)) ? (a) : (b))
#endif
#ifndef ZeroMemory
diff -ur xnp2-0.86.orig/bios/bios.c xnp2-0.86/bios/bios.c
--- xnp2-0.86.orig/bios/bios.c 2016-03-09 02:25:48.000000000 +0900
+++ xnp2-0.86/bios/bios.c 2019-08-03 15:55:06.367708959 +0900
@@ -139,7 +139,7 @@
}
mem[MEMB_BIOS_FLAG1] = biosflag;
extmem = pccore.extmem;
- extmem = min(extmem, 14);
+ extmem = mymin(extmem, 14);
mem[MEMB_EXPMMSZ] = (UINT8)(extmem << 3);
if (pccore.extmem >= 15) {
mem[0x0594] = pccore.extmem - 15;
diff -ur xnp2-0.86.orig/bios/bios1f.c xnp2-0.86/bios/bios1f.c
--- xnp2-0.86.orig/bios/bios1f.c 2016-03-09 02:25:48.000000000 +0900
+++ xnp2-0.86/bios/bios1f.c 2019-08-03 15:56:27.046221296 +0900
@@ -36,9 +36,9 @@
leng = LOW16(CPU_CX - 1) + 1;
// TRACEOUT(("move %.8x %.8x %.4x", srcbase + srcaddr, dstbase + dstaddr, leng));
do {
- l = min(leng, sizeof(work));
- l = min(l, srclimit - srcaddr);
- l = min(l, dstlimit - dstaddr);
+ l = mymin(leng, sizeof(work));
+ l = mymin(l, srclimit - srcaddr);
+ l = mymin(l, dstlimit - dstaddr);
if (!l) {
CPU_A20EN(FALSE);
goto p90_err2;
diff -ur xnp2-0.86.orig/bios/sxsibios.c xnp2-0.86/bios/sxsibios.c
--- xnp2-0.86.orig/bios/sxsibios.c 2016-03-09 02:25:48.000000000 +0900
+++ xnp2-0.86/bios/sxsibios.c 2019-08-03 15:57:03.133557006 +0900
@@ -65,7 +65,7 @@
if (!ret) {
addr = (CPU_ES << 4) + CPU_BP;
while(size) {
- r = min(size, sxsi->size);
+ r = mymin(size, sxsi->size);
MEML_READS(addr, work, r);
ret = sxsi_write(CPU_AL, pos, work, r);
if (ret >= 0x20) {
@@ -96,7 +96,7 @@
if (!ret) {
addr = (CPU_ES << 4) + CPU_BP;
while(size) {
- r = min(size, sxsi->size);
+ r = mymin(size, sxsi->size);
ret = sxsi_read(CPU_AL, pos, work, r);
if (ret >= 0x20) {
break;
diff -ur xnp2-0.86.orig/cbus/atapicmd.c xnp2-0.86/cbus/atapicmd.c
--- xnp2-0.86.orig/cbus/atapicmd.c 2016-03-09 02:25:49.000000000 +0900
+++ xnp2-0.86/cbus/atapicmd.c 2019-08-03 16:02:18.915766989 +0900
@@ -50,7 +50,7 @@
static void senddata(IDEDRV drv, UINT size, UINT limit) {
- size = min(size, limit);
+ size = mymin(size, limit);
drv->sc = IDEINTR_IO;
drv->cy = size;
drv->status &= ~(IDESTAT_BSY|IDESTAT_DMRD|IDESTAT_SERV|IDESTAT_CHK);
@@ -432,7 +432,7 @@
else {
ptr = defval_pagecode_01;
}
- CopyMemory(drv->buf + cnt, ptr, min((leng - cnt), PC_01_SIZE));
+ CopyMemory(drv->buf + cnt, ptr, mymin((leng - cnt), PC_01_SIZE));
cnt += PC_01_SIZE;
if (cnt > leng) {
goto length_exceeded;
@@ -449,7 +449,7 @@
else {
ptr = defval_pagecode_0d;
}
- CopyMemory(drv->buf + cnt, ptr, min((leng - cnt), PC_0D_SIZE));
+ CopyMemory(drv->buf + cnt, ptr, mymin((leng - cnt), PC_0D_SIZE));
cnt += PC_0D_SIZE;
if (cnt > leng) {
goto length_exceeded;
@@ -466,7 +466,7 @@
else {
ptr = defval_pagecode_0e;
}
- CopyMemory(drv->buf + cnt, ptr, min((leng - cnt), PC_0E_SIZE));
+ CopyMemory(drv->buf + cnt, ptr, mymin((leng - cnt), PC_0E_SIZE));
cnt += PC_0E_SIZE;
if (cnt > leng) {
goto length_exceeded;
@@ -483,7 +483,7 @@
else {
ptr = defval_pagecode_2a;
}
- CopyMemory(drv->buf + cnt, ptr, min((leng - cnt), PC_2A_SIZE));
+ CopyMemory(drv->buf + cnt, ptr, mymin((leng - cnt), PC_2A_SIZE));
cnt += PC_2A_SIZE;
if (cnt > leng) {
goto length_exceeded;
diff -ur xnp2-0.86.orig/cbus/ideio.c xnp2-0.86/cbus/ideio.c
--- xnp2-0.86.orig/cbus/ideio.c 2016-03-09 02:25:49.000000000 +0900
+++ xnp2-0.86/cbus/ideio.c 2019-08-03 16:02:37.003436319 +0900
@@ -936,7 +936,7 @@
return(FAILURE);
}
while(count) {
- r = min(count, drv->dabufrem);
+ r = mymin(count, drv->dabufrem);
if (r) {
count -= r;
ptr = drv->dabuf + 2352 - (drv->dabufrem * 4);
diff -ur xnp2-0.86.orig/cbus/scsicmd.c xnp2-0.86/cbus/scsicmd.c
--- xnp2-0.86.orig/cbus/scsicmd.c 2016-03-09 02:25:49.000000000 +0900
+++ xnp2-0.86/cbus/scsicmd.c 2019-08-03 16:02:46.187268457 +0900
@@ -40,7 +40,7 @@
// Page code = cdb[2];
length = cdb[4];
if (length) {
- CopyMemory(scsiio.data, hdd_inquiry, min(length, 0x20));
+ CopyMemory(scsiio.data, hdd_inquiry, mymin(length, 0x20));
}
break;
diff -ur xnp2-0.86.orig/common/arcunzip.c xnp2-0.86/common/arcunzip.c
--- xnp2-0.86.orig/common/arcunzip.c 2016-03-09 02:25:49.000000000 +0900
+++ xnp2-0.86/common/arcunzip.c 2019-08-03 16:03:10.250828722 +0900
@@ -114,7 +114,7 @@
}
size = size - 1;
fnamesize = LOADINTELWORD(cat->filenamesize);
- size = min(size, fnamesize);
+ size = mymin(size, fnamesize);
if (size) {
CopyMemory(filename, cat + 1, size);
}
@@ -157,7 +157,7 @@
m0 = (METHOD0 *)arcfh;
rsize = m0->size - m0->pos;
- rsize = min(rsize, size);
+ rsize = mymin(rsize, size);
if (rsize == 0) {
return(0);
}
@@ -271,11 +271,11 @@
long fpos;
r = m8->dstsize - m8->dstpos;
- size = min(size, r);
+ size = mymin(size, r);
ptr = (UINT8 *)buffer;
while(size) {
dstrem = NELEMENTS(m8->dst) - m8->stream.avail_out - m8->pos;
- r = min(dstrem, size);
+ r = mymin(dstrem, size);
if (r) {
if (buffer != NULL) {
CopyMemory(ptr, m8->dst + m8->pos, r);
@@ -295,7 +295,7 @@
// TRACEOUT(("try decompress"));
if (m8->stream.avail_in == 0) {
r = m8->srcsize - m8->srcpos;
- r = min(r, NELEMENTS(m8->src));
+ r = mymin(r, NELEMENTS(m8->src));
if (r == 0) {
break;
}
@@ -575,7 +575,7 @@
bufrem = 0;
while(fpos > 0) {
rsize = NELEMENTS(buf) - bufrem;
- rsize = (UINT)(min(fpos, (long)rsize));
+ rsize = (UINT)(mymin(fpos, (long)rsize));
fpos -= rsize;
r = bufrem;
while(r) {
diff -ur xnp2-0.86.orig/common/bmpdata.c xnp2-0.86/common/bmpdata.c
--- xnp2-0.86.orig/common/bmpdata.c 2016-03-09 02:25:49.000000000 +0900
+++ xnp2-0.86/common/bmpdata.c 2019-08-03 15:54:50.008011089 +0900
@@ -40,7 +40,7 @@
bit = LOADINTELWORD(bi->biBitCount);
if (bit < 8) {
pal = LOADINTELDWORD(bi->biClrUsed);
- pal = min(pal, (UINT)(1 << bit));
+ pal = mymin(pal, (UINT)(1 << bit));
ret += pal * 4;
}
if (bf) {
@@ -156,7 +156,7 @@
tmp |= *dat++;
pos = -1 - (tmp >> level);
leng = (tmp & mask) + 1;
- leng = min(leng, dstsize);
+ leng = mymin(leng, dstsize);
dstsize -= leng;
while(leng--) {
*ptr = *(ptr + pos);
diff -ur xnp2-0.86.orig/common/profile.c xnp2-0.86/common/profile.c
--- xnp2-0.86.orig/common/profile.c 2016-03-09 02:25:49.000000000 +0900
+++ xnp2-0.86/common/profile.c 2019-08-03 15:55:25.707352007 +0900
@@ -521,7 +521,7 @@
#if defined(OSLANG_UTF8)
lpHeader = str_utf8;
cbHeader = sizeof(str_utf8);
-#elif defined(OSLANG_UCS2)
+#elif defined(OSLANG_UCS2)
lpHeader = (UINT8 *)str_ucs2;
cbHeader = sizeof(str_ucs2);
#else
@@ -755,7 +755,7 @@
}
else
{
- nSize = min(nSize, pfp.cchString + 1);
+ nSize = mymin(nSize, pfp.cchString + 1);
milstr_ncpy(lpReturnedString, pfp.lpString, nSize);
return SUCCESS;
}
@@ -781,7 +781,7 @@
}
else
{
- nSize = min(NELEMENTS(szBuffer), pfp.cchString + 1);
+ nSize = mymin(NELEMENTS(szBuffer), pfp.cchString + 1);
milstr_ncpy(szBuffer, pfp.lpString, nSize);
return (int)milstr_solveINT(szBuffer);
}
diff -ur xnp2-0.86.orig/common/rect.c xnp2-0.86/common/rect.c
--- xnp2-0.86.orig/common/rect.c 2016-03-09 02:25:49.000000000 +0900
+++ xnp2-0.86/common/rect.c 2019-08-03 15:55:44.215010618 +0900
@@ -45,7 +45,7 @@
if ((tag != NULL) && (base != NULL) && (outcb != NULL)) {
// base.top -> tag.top
rect.top = base->top;
- rect.bottom = min(tag->top, base->bottom);
+ rect.bottom = mymin(tag->top, base->bottom);
if (rect.top < rect.bottom) {
rect.left = base->left;
rect.right = base->right;
@@ -54,14 +54,14 @@
}
// -> tag.bottom
- rect.bottom = min(tag->bottom, base->bottom);
+ rect.bottom = mymin(tag->bottom, base->bottom);
if (rect.top < rect.bottom) {
rect.left = base->left;
- rect.right = min(tag->left, base->right);
+ rect.right = mymin(tag->left, base->right);
if (rect.left < rect.right) {
outcb(arg, &rect);
}
- rect.left = max(tag->right, base->left);
+ rect.left = mymax(tag->right, base->left);
rect.right = base->right;
if (rect.left < rect.right) {
outcb(arg, &rect);
diff -ur xnp2-0.86.orig/common/textfile.c xnp2-0.86/common/textfile.c
--- xnp2-0.86.orig/common/textfile.c 2016-03-09 02:25:49.000000000 +0900
+++ xnp2-0.86/common/textfile.c 2019-08-03 15:54:08.948770127 +0900
@@ -283,7 +283,7 @@
ret = SUCCESS;
p = (UINT8 *)buffer;
while(size) {
- wsize = min(size, tf->bufrem);
+ wsize = mymin(size, tf->bufrem);
if (wsize) {
CopyMemory(tf->buf + tf->bufpos, p, wsize);
p += wsize;
@@ -310,7 +310,7 @@
ret = SUCCESS;
p = (UINT8 *)buffer;
while(size) {
- wsize = min(size, tf->bufrem);
+ wsize = mymin(size, tf->bufrem);
if (wsize) {
q = tf->buf + (tf->bufpos * sizeof(UINT16));
CopyMemory(q, p, wsize * sizeof(UINT16));
@@ -504,7 +504,7 @@
#if defined(OSLANG_UTF8)
hdr = str_utf8;
hdrsize = sizeof(str_utf8);
-#elif defined(OSLANG_UCS2)
+#elif defined(OSLANG_UCS2)
hdr = (UINT8 *)str_ucs2;
hdrsize = sizeof(str_ucs2);
#else
diff -ur xnp2-0.86.orig/common/wavefile.c xnp2-0.86/common/wavefile.c
--- xnp2-0.86.orig/common/wavefile.c 2016-03-09 02:25:49.000000000 +0900
+++ xnp2-0.86/common/wavefile.c 2019-08-03 15:56:16.306419123 +0900
@@ -225,7 +225,7 @@
}
while (cbBuffer)
{
- UINT nSize = min(hWave->nRemain, cbBuffer);
+ UINT nSize = mymin(hWave->nRemain, cbBuffer);
memcpy(hWave->lpCurrent, lpBuffer, nSize);
lpBuffer = ((UINT8 *)lpBuffer) + nSize;
cbBuffer -= nSize;
diff -ur xnp2-0.86.orig/debugsub.c xnp2-0.86/debugsub.c
--- xnp2-0.86.orig/debugsub.c 2016-03-09 02:25:49.000000000 +0900
+++ xnp2-0.86/debugsub.c 2019-08-03 15:47:07.268653137 +0900
@@ -122,10 +122,10 @@
if (fh == FILEH_INVALID) {
return;
}
- limit = min(limit, 0xffff);
+ limit = mymin(limit, 0xffff);
limit++;
while(limit) {
- size = min(limit, sizeof(buf));
+ size = mymin(limit, sizeof(buf));
MEML_READS(addr, buf, size);
file_write(fh, buf, size);
addr += size;
diff -ur xnp2-0.86.orig/debugsub386.c xnp2-0.86/debugsub386.c
--- xnp2-0.86.orig/debugsub386.c 2016-03-09 02:25:49.000000000 +0900
+++ xnp2-0.86/debugsub386.c 2019-08-03 16:03:31.646437856 +0900
@@ -128,14 +128,14 @@
if (limit <= addr) {
return;
}
- size = min(limit - addr, size - 1) + 1;
+ size = mymin(limit - addr, size - 1) + 1;
fh = file_create_c(fname);
if (fh == FILEH_INVALID) {
return;
}
addr += sd->u.seg.segbase;
while(size) {
- limit = min(size, sizeof(buf));
+ limit = mymin(size, sizeof(buf));
MEML_READS(addr, buf, limit);
file_write(fh, buf, limit);
addr += limit;
diff -ur xnp2-0.86.orig/embed/menubase/menusys.c xnp2-0.86/embed/menubase/menusys.c
--- xnp2-0.86.orig/embed/menubase/menusys.c 2016-03-09 02:25:50.000000000 +0900
+++ xnp2-0.86/embed/menubase/menusys.c 2019-08-03 16:03:50.830087489 +0900
@@ -586,8 +586,8 @@
parent.top = parent.bottom - height;
}
}
- wnd->vram->posx = min(parent.left, menubase.width - width);
- wnd->vram->posy = min(parent.top, menubase.height - height);
+ wnd->vram->posx = mymin(parent.left, menubase.width - width);
+ wnd->vram->posy = mymin(parent.top, menubase.height - height);
wnd->items = items;
wnd->focus = -1;
sys->depth++;
diff -ur xnp2-0.86.orig/embed/menubase/menuvram.c xnp2-0.86/embed/menubase/menuvram.c
--- xnp2-0.86.orig/embed/menubase/menuvram.c 2016-03-09 02:25:50.000000000 +0900
+++ xnp2-0.86/embed/menubase/menuvram.c 2019-08-03 16:13:43.963283091 +0900
@@ -160,7 +160,7 @@
}
}
}
- c = min(cnt, width);
+ c = mymin(cnt, width);
cnt -= c;
width -= c;
if (pix) {
@@ -225,7 +225,7 @@
}
cnt += c;
}
- c = min(cnt, width);
+ c = mymin(cnt, width);
cnt -= c;
width -= c;
if (!pix) {
@@ -378,7 +378,7 @@
}
}
}
- c = min(cnt, width);
+ c = mymin(cnt, width);
cnt -= c;
width -= c;
if (pix) {
@@ -444,7 +444,7 @@
}
cnt += c;
}
- c = min(cnt, width);
+ c = mymin(cnt, width);
cnt -= c;
width -= c;
if (!pix) {
@@ -585,7 +585,7 @@
tmp |= *dat++;
pos = -1 - (tmp >> level);
leng = (tmp & mask) + 1;
- leng = min(leng, size);
+ leng = mymin(leng, size);
size -= leng;
while(leng--) {
*ptr = *(ptr + pos);
diff -ur xnp2-0.86.orig/embed/vramhdl.c xnp2-0.86/embed/vramhdl.c
--- xnp2-0.86.orig/embed/vramhdl.c 2016-03-09 02:25:50.000000000 +0900
+++ xnp2-0.86/embed/vramhdl.c 2019-08-03 16:08:58.628475172 +0900
@@ -99,12 +99,12 @@
}
}
else {
- pos = max(rect->left, 0);
+ pos = mymax(rect->left, 0);
ptr = pos;
- width = min(rect->right, hdl->width) - pos;
- pos = max(rect->top, 0);
+ width = mymin(rect->right, hdl->width) - pos;
+ pos = mymax(rect->top, 0);
ptr += pos * hdl->width;
- height = min(rect->bottom, hdl->height) - pos;
+ height = mymin(rect->bottom, hdl->height) - pos;
if ((width > 0) && (height > 0)) {
p = hdl->ptr;
p += ptr * hdl->xalign;
@@ -185,12 +185,12 @@
}
}
else {
- pos = max(rect->left, 0);
+ pos = mymax(rect->left, 0);
ptr = pos;
- width = min(rect->right, hdl->width) - pos;
- pos = max(rect->top, 0);
+ width = mymin(rect->right, hdl->width) - pos;
+ pos = mymax(rect->top, 0);
ptr += pos * hdl->width;
- height = min(rect->bottom, hdl->height) - pos;
+ height = mymin(rect->bottom, hdl->height) - pos;
if ((width > 0) && (height > 0)) {
p = hdl->ptr;
p += ptr * hdl->xalign;
@@ -308,12 +308,12 @@
}
}
else {
- pos = max(rect->left, 0);
+ pos = mymax(rect->left, 0);
ptr = pos;
- width = min(rect->right, hdl->width) - pos;
- pos = max(rect->top, 0);
+ width = mymin(rect->right, hdl->width) - pos;
+ pos = mymax(rect->top, 0);
ptr += pos * hdl->width;
- height = min(rect->bottom, hdl->height) - pos;
+ height = mymin(rect->bottom, hdl->height) - pos;
if ((width > 0) && (height > 0)) {
p = hdl->ptr;
p += ptr * hdl->xalign;
@@ -386,12 +386,12 @@
FillMemory(hdl->alpha, hdl->scrnsize, alpha);
}
else {
- pos = max(rect->left, 0);
+ pos = mymax(rect->left, 0);
ptr = pos;
- width = min(rect->right, hdl->width) - pos;
- pos = max(rect->top, 0);
+ width = mymin(rect->right, hdl->width) - pos;
+ pos = mymax(rect->top, 0);
ptr += pos * hdl->width;
- height = min(rect->bottom, hdl->height) - pos;
+ height = mymin(rect->bottom, hdl->height) - pos;
if ((width > 0) && (height > 0)) {
p = hdl->alpha + ptr;
remain = height;
@@ -463,12 +463,12 @@
}
}
else {
- pos = max(rect->left, 0);
+ pos = mymax(rect->left, 0);
ptr = pos;
- width = min(rect->right, hdl->width) - pos;
- pos = max(rect->top, 0);
+ width = mymin(rect->right, hdl->width) - pos;
+ pos = mymax(rect->top, 0);
ptr += pos * hdl->width;
- height = min(rect->bottom, hdl->height) - pos;
+ height = mymin(rect->bottom, hdl->height) - pos;
if ((width > 0) && (height > 0)) {
p = hdl->ptr;
p += ptr * hdl->xalign;
@@ -618,10 +618,10 @@
(rct->left >= vram->width) || (rct->top >= vram->height)) {
return(FAILURE);
}
- clip->left = max(rct->left, 0);
- clip->top = max(rct->top, 0);
- clip->right = min(rct->right, vram->width);
- clip->bottom = min(rct->bottom, vram->height);
+ clip->left = mymax(rct->left, 0);
+ clip->top = mymax(rct->top, 0);
+ clip->right = mymin(rct->right, vram->width);
+ clip->bottom = mymin(rct->bottom, vram->height);
if ((clip->top >= clip->bottom) || (clip->left >= clip->right)) {
return(FAILURE);
}
@@ -637,10 +637,10 @@
if (rct == NULL) {
return(SUCCESS);
}
- clip->left = max(clip->left, rct->left);
- clip->top = max(clip->top, rct->top);
- clip->right = min(clip->right, rct->right);
- clip->bottom = min(clip->bottom, rct->bottom);
+ clip->left = mymax(clip->left, rct->left);
+ clip->top = mymax(clip->top, rct->top);
+ clip->right = mymin(clip->right, rct->right);
+ clip->bottom = mymin(clip->bottom, rct->bottom);
if ((clip->left >= clip->right) || (clip->top >= clip->bottom)) {
return(FAILURE);
}
diff -ur xnp2-0.86.orig/embed/vrammix.c xnp2-0.86/embed/vrammix.c
--- xnp2-0.86.orig/embed/vrammix.c 2016-03-09 02:25:50.000000000 +0900
+++ xnp2-0.86/embed/vrammix.c 2019-08-03 16:14:52.830030941 +0900
@@ -10,7 +10,7 @@
};
-static BRESULT cpyrect(MIX_RECT *r, const VRAMHDL dst, const POINT_T *pt,
+static BRESULT cpyrect(MIX_RECT *r, const VRAMHDL dst, const POINT_T *pt,
const VRAMHDL src, const RECT_T *rct) {
POINT_T p;
@@ -29,7 +29,7 @@
}
r->srcpos = 0;
if (rct) {
- width = min(rct->right, src->width);
+ width = mymin(rct->right, src->width);
if (rct->left >= 0) {
r->srcpos += rct->left;
width -= rct->left;
@@ -37,7 +37,7 @@
else {
p.x -= rct->left;
}
- height = min(rct->bottom, src->height);
+ height = mymin(rct->bottom, src->height);
if (rct->top >= 0) {
r->srcpos += rct->top * src->width;
height -= rct->top;
@@ -52,10 +52,10 @@
}
r->dstpos = 0;
- r->width = min(width + p.x, dst->width);
+ r->width = mymin(width + p.x, dst->width);
if (p.x > 0) {
r->dstpos += p.x;
- r->width = min(r->width, dst->width) - p.x;
+ r->width = mymin(r->width, dst->width) - p.x;
}
else {
r->srcpos -= p.x;
@@ -64,10 +64,10 @@
return(FAILURE);
}
- r->height = min(height + p.y, dst->height);
+ r->height = mymin(height + p.y, dst->height);
if (p.y > 0) {
r->dstpos += p.y * dst->width;
- r->height = min(r->height, dst->height) - p.y;
+ r->height = mymin(r->height, dst->height) - p.y;
}
else {
r->srcpos -= p.y * src->width;
@@ -100,10 +100,10 @@
(rct->left >= dst->width) || (rct->top >= dst->height)) {
return(FAILURE);
}
- s.left = max(rct->left, 0);
- s.top = max(rct->top, 0);
- s.right = min(rct->right, dst->width);
- s.bottom = min(rct->bottom, dst->height);
+ s.left = mymax(rct->left, 0);
+ s.top = mymax(rct->top, 0);
+ s.right = mymin(rct->right, dst->width);
+ s.bottom = mymin(rct->bottom, dst->height);
if ((s.top >= s.bottom) || (s.left >= s.right)) {
return(FAILURE);
}
@@ -117,11 +117,11 @@
}
if (pos < 0) {
r->srcpos -= pos * src->width;
- r->height = min(src->height + pos, s.bottom - s.top);
+ r->height = mymin(src->height + pos, s.bottom - s.top);
}
else {
r->dstpos += pos * dst->width;
- r->height = min(s.bottom - s.top - pos, src->height);
+ r->height = mymin(s.bottom - s.top - pos, src->height);
}
if (r->height <= 0) {
return(FAILURE);
@@ -133,11 +133,11 @@
}
if (pos < 0) {
r->srcpos -= pos;
- r->width = min(src->width + pos, s.right - s.left);
+ r->width = mymin(src->width + pos, s.right - s.left);
}
else {
r->dstpos += pos;
- r->width = min(s.right - s.left - pos, src->width);
+ r->width = mymin(s.right - s.left - pos, src->width);
}
if (r->width <= 0) {
return(FAILURE);
@@ -179,7 +179,7 @@
r->srcpos = 0;
if (rct) {
- width = min(rct->right, src->width);
+ width = mymin(rct->right, src->width);
if (rct->left >= 0) {
r->srcpos += rct->left;
width -= rct->left;
@@ -187,7 +187,7 @@
else {
p.x -= rct->left;
}
- height = min(rct->bottom, src->height);
+ height = mymin(rct->bottom, src->height);
if (rct->top >= 0) {
r->srcpos += rct->top * src->width;
height -= rct->top;
@@ -203,12 +203,12 @@
r->orgpos = 0;
r->dstpos = 0;
- dstwidth = min(dst->width, org->width);
- r->width = min(width + p.x, dstwidth);
+ dstwidth = mymin(dst->width, org->width);
+ r->width = mymin(width + p.x, dstwidth);
if (p.x > 0) {
r->orgpos += p.x;
r->dstpos += p.x;
- r->width = min(r->width, dstwidth) - p.x;
+ r->width = mymin(r->width, dstwidth) - p.x;
}
else {
r->srcpos -= p.x;
@@ -217,12 +217,12 @@
return(FAILURE);
}
- dstheight = min(dst->height, org->height);
- r->height = min(height + p.y, dstheight);
+ dstheight = mymin(dst->height, org->height);
+ r->height = mymin(height + p.y, dstheight);
if (p.y > 0) {
r->orgpos += p.y * org->width;
r->dstpos += p.y * dst->width;
- r->height = min(r->height, dstheight) - p.y;
+ r->height = mymin(r->height, dstheight) - p.y;
}
else {
r->srcpos -= p.y * src->width;
@@ -245,8 +245,8 @@
(dst->bpp != org->bpp) || (dst->bpp != src->bpp)) {
return(FAILURE);
}
- dstwidth = min(dst->width, org->width);
- dstheight = min(dst->height, org->height);
+ dstwidth = mymin(dst->width, org->width);
+ dstheight = mymin(dst->height, org->height);
r->srcpos = 0;
if (rct == NULL) {
s.left = 0;
@@ -261,10 +261,10 @@
(rct->left >= dstwidth) || (rct->top >= dstheight)) {
return(FAILURE);
}
- s.left = max(rct->left, 0);
- s.top = max(rct->top, 0);
- s.right = min(rct->right, dstwidth);
- s.bottom = min(rct->bottom, dstheight);
+ s.left = mymax(rct->left, 0);
+ s.top = mymax(rct->top, 0);
+ s.right = mymin(rct->right, dstwidth);
+ s.bottom = mymin(rct->bottom, dstheight);
if ((s.top >= s.bottom) || (s.left >= s.right)) {
return(FAILURE);
}
@@ -280,12 +280,12 @@
}
if (pos < 0) {
r->srcpos -= pos * src->width;
- r->height = min(src->height + pos, s.bottom - s.top);
+ r->height = mymin(src->height + pos, s.bottom - s.top);
}
else {
r->orgpos += pos * org->width;
r->dstpos += pos * dst->width;
- r->height = min(s.bottom - s.top - pos, src->height);
+ r->height = mymin(s.bottom - s.top - pos, src->height);
}
if (r->height <= 0) {
return(FAILURE);
@@ -297,12 +297,12 @@
}
if (pos < 0) {
r->srcpos -= pos;
- r->width = min(src->width + pos, s.right - s.left);
+ r->width = mymin(src->width + pos, s.right - s.left);
}
else {
r->orgpos += pos;
r->dstpos += pos;
- r->width = min(s.right - s.left - pos, src->width);
+ r->width = mymin(s.right - s.left - pos, src->width);
}
if (r->width <= 0) {
return(FAILURE);
@@ -983,10 +983,10 @@
do {
p = pbase;
- ystep = min(mr->height, dot);
+ ystep = mymin(mr->height, dot);
x = mr->width;
do {
- xstep = min(x, dot);
+ xstep = mymin(x, dot);
xstep2 = xstep * 2;
q = qbase;
yy = ystep;
@@ -1032,10 +1032,10 @@
dstep = (dst->yalign * dot) - (mr->width * 2);
do {
- ystep = min(mr->height, dot);
+ ystep = mymin(mr->height, dot);
x = mr->width;
do {
- xstep = min(x, dot);
+ xstep = mymin(x, dot);
xstep2 = xstep * 2;
r = q;
yy = ystep;
@@ -1647,10 +1647,10 @@
do {
p = pbase;
- ystep = min(mr->height, dot);
+ ystep = mymin(mr->height, dot);
x = mr->width;
do {
- xstep = min(x, dot);
+ xstep = mymin(x, dot);
xstep3 = xstep * 3;
q = qbase;
yy = ystep;
@@ -1696,10 +1696,10 @@
dstep = (dst->yalign * dot) - (mr->width * 3);
do {
- ystep = min(mr->height, dot);
+ ystep = mymin(mr->height, dot);
x = mr->width;
do {
- xstep = min(x, dot);
+ xstep = mymin(x, dot);
xstep3 = xstep * 3;
r = q;
yy = ystep;
@@ -1975,7 +1975,7 @@
#endif
}
-void vramcpy_mosaic(VRAMHDL dst, const POINT_T *pt,
+void vramcpy_mosaic(VRAMHDL dst, const POINT_T *pt,
const VRAMHDL src, const RECT_T *rct,
int dot) {
@@ -2453,10 +2453,10 @@
pos = pt->y - rct->top;
if (pos < 0) {
r->srcpos -= pos * fnt->width;
- r->height = min(fnt->height + pos, rct->bottom - rct->top);
+ r->height = mymin(fnt->height + pos, rct->bottom - rct->top);
}
else {
- r->height = min(rct->bottom - rct->top - pos, fnt->height);
+ r->height = mymin(rct->bottom - rct->top - pos, fnt->height);
}
if (r->height <= 0) {
return(FAILURE);
@@ -2465,10 +2465,10 @@
pos = pt->x - rct->left;
if (pos < 0) {
r->srcpos -= pos;
- r->width = min(fnt->width + pos, rct->right - rct->left);
+ r->width = mymin(fnt->width + pos, rct->right - rct->left);
}
else {
- r->width = min(rct->right - rct->left - pos, fnt->width);
+ r->width = mymin(rct->right - rct->left - pos, fnt->width);
}
if (r->width <= 0) {
return(FAILURE);
diff -ur xnp2-0.86.orig/fdd/newdisk.c xnp2-0.86/fdd/newdisk.c
--- xnp2-0.86.orig/fdd/newdisk.c 2016-03-09 02:25:49.000000000 +0900
+++ xnp2-0.86/fdd/newdisk.c 2019-08-03 15:57:15.933321544 +0900
@@ -42,7 +42,7 @@
ZeroMemory(work, sizeof(work));
while(size) {
- wsize = min(size, sizeof(work));
+ wsize = mymin(size, sizeof(work));
if (file_write(fh, work, wsize) != wsize) {
return(FAILURE);
}
@@ -69,7 +69,7 @@
tsize -= sizeof(work);
ZeroMemory(work, sizeof(work));
while(tsize) {
- size = min(tsize, sizeof(work));
+ size = mymin(tsize, sizeof(work));
tsize -= size;
if (file_write(fh, work, size) != size) {
return(FAILURE);
diff -ur xnp2-0.86.orig/fdd/sxsicd.c xnp2-0.86/fdd/sxsicd.c
--- xnp2-0.86.orig/fdd/sxsicd.c 2016-03-09 02:25:49.000000000 +0900
+++ xnp2-0.86/fdd/sxsicd.c 2019-08-03 15:57:42.736828725 +0900
@@ -69,7 +69,7 @@
return(0xd0);
}
while(size) {
- rsize = min(size, 2048);
+ rsize = mymin(size, 2048);
CPU_REMCLOCK -= rsize;
if (file_read(fh, buf, rsize) != rsize) {
return(0xd0);
@@ -132,7 +132,7 @@
if (file_seek(fh, fpos, FSEEK_SET) != fpos) {
return(0xd0);
}
- rsize = min(size, 2048);
+ rsize = mymin(size, 2048);
CPU_REMCLOCK -= rsize;
if (file_read(fh, buf, rsize) != rsize) {
return(0xd0);
@@ -218,7 +218,7 @@
cdinfo->fh = fh;
cdinfo->type = type;
if ((trk != NULL) && (trks != 0)) {
- trks = min(trks, NELEMENTS(cdinfo->trk) - 1);
+ trks = mymin(trks, NELEMENTS(cdinfo->trk) - 1);
CopyMemory(cdinfo->trk, trk, trks * sizeof(_CDTRK));
}
else {
diff -ur xnp2-0.86.orig/fdd/sxsihdd.c xnp2-0.86/fdd/sxsihdd.c
--- xnp2-0.86.orig/fdd/sxsihdd.c 2016-03-09 02:25:49.000000000 +0900
+++ xnp2-0.86/fdd/sxsihdd.c 2019-08-03 15:57:59.564519491 +0900
@@ -54,7 +54,7 @@
return(0xd0);
}
while(size) {
- rsize = min(size, sxsi->size);
+ rsize = mymin(size, sxsi->size);
CPU_REMCLOCK -= rsize;
if (file_read(fh, buf, rsize) != rsize) {
return(0xd0);
@@ -84,7 +84,7 @@
return(0xd0);
}
while(size) {
- wsize = min(size, sxsi->size);
+ wsize = mymin(size, sxsi->size);
CPU_REMCLOCK -= wsize;
if (file_write(fh, buf, wsize) != wsize) {
return(0x70);
@@ -120,7 +120,7 @@
for (i=0; i<sxsi->sectors; i++) {
size = sxsi->size;
while(size) {
- wsize = min(size, sizeof(work));
+ wsize = mymin(size, sizeof(work));
size -= wsize;
CPU_REMCLOCK -= wsize;
if (file_write(fh, work, wsize) != wsize) {
diff -ur xnp2-0.86.orig/font/fontmake.c xnp2-0.86/font/fontmake.c
--- xnp2-0.86.orig/font/fontmake.c 2016-03-09 02:25:50.000000000 +0900
+++ xnp2-0.86/font/fontmake.c 2019-08-03 15:58:16.836202226 +0900
@@ -156,8 +156,8 @@
dat = fontmng_get(fnt, work);
#endif
if (dat) {
- width = min(dat->width, 8);
- height = min(dat->height, 16);
+ width = mymin(dat->width, 8);
+ height = mymin(dat->height, 16);
p = (UINT8 *)(dat + 1);
q = ptr;
while(height > 0) {
@@ -231,8 +231,8 @@
dat = fontmng_get(fnt, work);
#endif
if (dat) {
- width = min(dat->width, 16);
- height = min(dat->height, 16);
+ width = mymin(dat->width, 16);
+ height = mymin(dat->height, 16);
p = (UINT8 *)(dat + 1);
q = ptr;
while(height > 0) {
diff -ur xnp2-0.86.orig/generic/cmndraw.c xnp2-0.86/generic/cmndraw.c
--- xnp2-0.86.orig/generic/cmndraw.c 2016-03-09 02:25:50.000000000 +0900
+++ xnp2-0.86/generic/cmndraw.c 2019-08-03 15:58:30.371953676 +0900
@@ -340,7 +340,7 @@
(bmpdata_getinfo(bi, &inf) != SUCCESS) || (inf.bpp != 4)) {
return(FAILURE);
}
- pals = min(LOADINTELDWORD(bi->biClrUsed), 16);
+ pals = mymin(LOADINTELDWORD(bi->biClrUsed), 16);
src = (UINT8 *)bf + (LOADINTELDWORD(bf->bfOffBits));
bmpalign = bmpdata_getalign(bi);
diff -ur xnp2-0.86.orig/generic/hostdrv.c xnp2-0.86/generic/hostdrv.c
--- xnp2-0.86.orig/generic/hostdrv.c 2016-03-09 02:25:50.000000000 +0900
+++ xnp2-0.86/generic/hostdrv.c 2019-08-03 15:59:13.531161658 +0900
@@ -355,7 +355,7 @@
return(FAILURE);
}
while(size) {
- r = min(size, sizeof(work));
+ r = mymin(size, sizeof(work));
if (file_read(fh, work, r) != r) {
return(FAILURE);
}
@@ -386,7 +386,7 @@
}
else {
do {
- r = min(size, sizeof(work));
+ r = mymin(size, sizeof(work));
MEMR_READS(seg, off, work, r);
if (file_write(fh, work, r) != r) {
return(FAILURE);
diff -ur xnp2-0.86.orig/generic/keydisp.c xnp2-0.86/generic/keydisp.c
--- xnp2-0.86.orig/generic/keydisp.c 2016-03-09 02:25:50.000000000 +0900
+++ xnp2-0.86/generic/keydisp.c 2019-08-03 15:58:52.043555887 +0900
@@ -371,7 +371,7 @@
}
nKey += nOct * 12;
- return (int)(min(nKey, 127));
+ return (int)(mymin(nKey, 127));
}
static void opnakeyoff(KEYDISP *keydisp, OPNACTL *k, UINT nChannel)
@@ -540,7 +540,7 @@
{
}
nKey += nOct * 12;
- return (int)(min(nKey, 127));
+ return (int)(mymin(nKey, 127));
}
static void psgmix(KEYDISP *keydisp, PSGCTL *k)
@@ -704,7 +704,7 @@
}
nKey += nOct * 12;
- return (int)(min(nKey, 127));
+ return (int)(mymin(nKey, 127));
}
static void opl3keyoff(KEYDISP *keydisp, OPL3CTL *k, UINT nChannel)
@@ -865,7 +865,7 @@
{
k = &s_keydisp.psgctl[s_keydisp.psgmax];
k->cChannelNum = s_keydisp.keymax;
- k->pcRegister = pcRegister;
+ k->pcRegister = pcRegister;
for (i = 0; i < NELEMENTS(k->wTone); i++)
{
k->wTone[i] = (UINT16)((double)nBaseClock / 32.0 / (440.0 * pow(2.0, ((double)i - 9.5) / 12.0)));
@@ -969,7 +969,7 @@
keys = 0;
break;
}
- return min(keys, KEYDISP_CHMAX);
+ return mymin(keys, KEYDISP_CHMAX);
}
static void clearrect(CMNVRAM *vram, int x, int y, int cx, int cy)
@@ -1295,7 +1295,7 @@
}
vram->ptr += vram->xalign + vram->yalign;
keys = (vram->height - 1) / KEYDISP_KEYCY;
- keys = min(keys, getdispkeys(&s_keydisp));
+ keys = mymin(keys, getdispkeys(&s_keydisp));
for (i = 0, p = s_keydisp.ch; i < keys; i++, p++)
{
draw |= draw1ch(vram, s_keydisp.framepast, p);
diff -ur xnp2-0.86.orig/generic/np2info.c xnp2-0.86/generic/np2info.c
--- xnp2-0.86.orig/generic/np2info.c 2016-03-09 02:25:50.000000000 +0900
+++ xnp2-0.86/generic/np2info.c 2019-08-03 16:09:50.755526052 +0900
@@ -49,7 +49,7 @@
UINT family;
#if defined(CPU_FAMILY)
- family = min(CPU_FAMILY, 6);
+ family = mymin(CPU_FAMILY, 6);
#else
family = (CPU_TYPE & CPUTYPE_V30)?1:2;
#endif
diff -ur xnp2-0.86.orig/i286c/i286c.c xnp2-0.86/i286c/i286c.c
--- xnp2-0.86.orig/i286c/i286c.c 2016-03-09 02:25:49.000000000 +0900
+++ xnp2-0.86/i286c/i286c.c 2019-08-03 15:48:00.703642728 +0900
@@ -196,7 +196,7 @@
CPU_EXTMEM = extmem;
CPU_EXTMEMSIZE = size;
CPU_EXTMEMBASE = CPU_EXTMEM - 0x100000;
- CPU_EXTLIMIT16 = min(size + 0x100000, 0xf00000);
+ CPU_EXTLIMIT16 = mymin(size + 0x100000, 0xf00000);
#if defined(CPU_EXTLIMIT)
CPU_EXTLIMIT = size + 0x100000;
#endif
diff -ur xnp2-0.86.orig/i286c/v30patch.c xnp2-0.86/i286c/v30patch.c
--- xnp2-0.86.orig/i286c/v30patch.c 2016-03-09 02:25:49.000000000 +0900
+++ xnp2-0.86/i286c/v30patch.c 2019-08-03 15:47:44.363951250 +0900
@@ -253,7 +253,7 @@
}
}
else {
- cl = max(cl, 9);
+ cl = mymax(cl, 9);
}
sft_e8cl_table[(op >> 3) & 7](madr, cl);
return;
@@ -271,7 +271,7 @@
}
}
else {
- cl = max(cl, 9);
+ cl = mymax(cl, 9);
}
sft_r8cl_table[(op >> 3) & 7](out, cl);
}
@@ -303,7 +303,7 @@
}
}
else { // shift
- cl = max(cl, 17);
+ cl = mymax(cl, 17);
}
sft_e16cl_table[(op >> 3) & 7](madr, cl);
return;
@@ -321,7 +321,7 @@
}
}
else { // shift
- cl = max(cl, 17);
+ cl = mymax(cl, 17);
}
sft_r16cl_table[(op >> 3) & 7](out, cl);
}
@@ -353,7 +353,7 @@
}
}
else {
- cl = max(cl, 9);
+ cl = mymax(cl, 9);
}
sft_e8cl_table[(op >> 3) & 7](madr, cl);
return;
@@ -371,7 +371,7 @@
}
}
else {
- cl = max(cl, 9);
+ cl = mymax(cl, 9);
}
sft_r8cl_table[(op >> 3) & 7](out, cl);
}
@@ -403,7 +403,7 @@
}
}
else { // shift
- cl = max(cl, 17);
+ cl = mymax(cl, 17);
}
sft_e16cl_table[(op >> 3) & 7](madr, cl);
return;
@@ -421,7 +421,7 @@
}
}
else { // shift
- cl = max(cl, 17);
+ cl = mymax(cl, 17);
}
sft_r16cl_table[(op >> 3) & 7](out, cl);
}
@@ -532,7 +532,7 @@
INT_NUM(0, I286_IP); // V30
}
-I286FN v30_ope0xf6(void) { // F6:
+I286FN v30_ope0xf6(void) { // F6:
UINT op;
@@ -589,7 +589,7 @@
INT_NUM(0, I286_IP); // V30
}
-I286FN v30_ope0xf7(void) { // F7:
+I286FN v30_ope0xf7(void) { // F7:
UINT op;
diff -ur xnp2-0.86.orig/i386c/cpumem.c xnp2-0.86/i386c/cpumem.c
--- xnp2-0.86.orig/i386c/cpumem.c 2016-03-09 02:25:48.000000000 +0900
+++ xnp2-0.86/i386c/cpumem.c 2019-08-03 16:09:36.407787263 +0900
@@ -625,7 +625,7 @@
else {
while(leng) {
size = 0x1000 - (address & 0xfff);
- size = min(size, leng);
+ size = mymin(size, leng);
memp_reads(physicaladdr(address, FALSE), dat, size);
address += size;
dat = ((UINT8 *)dat) + size;
@@ -644,7 +644,7 @@
else {
while(leng) {
size = 0x1000 - (address & 0xfff);
- size = min(size, leng);
+ size = mymin(size, leng);
memp_writes(physicaladdr(address, TRUE), dat, size);
address += size;
dat = ((UINT8 *)dat) + size;
@@ -717,10 +717,10 @@
off = LOW16(off);
addr = (seg << 4) + off;
rem = 0x10000 - off;
- size = min(leng, rem);
+ size = mymin(leng, rem);
if (CPU_STAT_PAGING) {
rem = 0x1000 - (addr & 0xfff);
- size = min(size, rem);
+ size = mymin(size, rem);
addr = physicaladdr(addr, FALSE);
}
memp_reads(addr, dat, size);
@@ -740,10 +740,10 @@
off = LOW16(off);
addr = (seg << 4) + off;
rem = 0x10000 - off;
- size = min(leng, rem);
+ size = mymin(leng, rem);
if (CPU_STAT_PAGING) {
rem = 0x1000 - (addr & 0xfff);
- size = min(size, rem);
+ size = mymin(size, rem);
addr = physicaladdr(addr, TRUE);
}
memp_writes(addr, dat, size);
diff -ur xnp2-0.86.orig/i386c/ia32/ia32.c xnp2-0.86/i386c/ia32/ia32.c
--- xnp2-0.86.orig/i386c/ia32/ia32.c 2016-03-09 02:25:48.000000000 +0900
+++ xnp2-0.86/i386c/ia32/ia32.c 2019-08-03 16:09:20.340079814 +0900
@@ -93,7 +93,7 @@
CPU_EXTMEM = extmem;
CPU_EXTMEMSIZE = size;
CPU_EXTMEMBASE = CPU_EXTMEM - 0x100000;
- CPU_EXTLIMIT16 = min(size + 0x100000, 0xf00000);
+ CPU_EXTLIMIT16 = mymin(size + 0x100000, 0xf00000);
CPU_EXTLIMIT = size + 0x100000;
}
else {
@@ -143,7 +143,7 @@
}
CPU_INST_OP32 = CPU_INST_AS32 =
- CPU_STATSAVE.cpu_inst_default.op_32 =
+ CPU_STATSAVE.cpu_inst_default.op_32 =
CPU_STATSAVE.cpu_inst_default.as_32 = 0;
CPU_STAT_SS32 = 0;
set_cpl(0);
diff -ur xnp2-0.86.orig/io/dmac.c xnp2-0.86/io/dmac.c
--- xnp2-0.86.orig/io/dmac.c 2016-03-09 02:25:50.000000000 +0900
+++ xnp2-0.86/io/dmac.c 2019-08-03 15:59:29.974860087 +0900
@@ -90,7 +90,7 @@
UINT32 addr;
UINT i;
- leng = min(dmach->leng.w, size);
+ leng = mymin(dmach->leng.w, size);
if (leng) {
addr = dmach->adrs.d; // + mask
if (!(dmach->mode & 0x20)) { // dir +
diff -ur xnp2-0.86.orig/keystat.c xnp2-0.86/keystat.c
--- xnp2-0.86.orig/keystat.c 2016-03-09 02:25:49.000000000 +0900
+++ xnp2-0.86/keystat.c 2019-08-03 15:56:04.166642812 +0900
@@ -61,11 +61,11 @@
if ((ref >= NKEY_USER) && (ref < (NKEY_USER + NKEY_USERKEYS))) {
nkey = (NKEYM *)(nkeytbl.user + (ref - NKEY_USER));
- cnt = min(cnt, 15);
+ cnt = mymin(cnt, 15);
}
else if (ref < NKEY_SYSTEM) {
nkey = (NKEYM *)(nkeytbl.key + ref);
- cnt = min(cnt, 3);
+ cnt = mymin(cnt, 3);
}
else {
return;
diff -ur xnp2-0.86.orig/lio/gline.c xnp2-0.86/lio/gline.c
--- xnp2-0.86.orig/lio/gline.c 2016-03-09 02:25:49.000000000 +0900
+++ xnp2-0.86/lio/gline.c 2019-08-03 15:56:42.593935015 +0900
@@ -126,7 +126,7 @@
if (d2 < 0) {
d2 = 0 - d2;
}
- d1 = max(d1, d2) & 15;
+ d1 = mymax(d1, d2) & 15;
pat = (UINT16)((pat >> d1) | (pat << (16 - d1)));
csrw = (y1 * 40) + (x1 >> 4) + ((x1 & 0xf) << 20);
@@ -213,10 +213,10 @@
(y1 > lio->draw.y2) || (y2 < lio->draw.y1)) {
return;
}
- x1 = max(x1, lio->draw.x1);
- y1 = max(y1, lio->draw.y1);
- x2 = min(x2, lio->draw.x2);
- y2 = min(y2, lio->draw.y2);
+ x1 = mymax(x1, lio->draw.x1);
+ y1 = mymax(y1, lio->draw.y1);
+ x2 = mymin(x2, lio->draw.x2);
+ y2 = mymin(y2, lio->draw.y2);
csrw = 0;
if (lio->draw.flag & LIODRAW_UPPER) {
diff -ur xnp2-0.86.orig/lio/lio.c xnp2-0.86/lio/lio.c
--- xnp2-0.86.orig/lio/lio.c 2016-03-09 02:25:49.000000000 +0900
+++ xnp2-0.86/lio/lio.c 2019-08-03 15:53:13.073804932 +0900
@@ -148,13 +148,13 @@
lio->draw.palmax = 1 << colorbit;
tmp = (SINT16)LOADINTELWORD(lio->work.viewx1);
- lio->draw.x1 = max(tmp, 0);
+ lio->draw.x1 = mymax(tmp, 0);
tmp = (SINT16)LOADINTELWORD(lio->work.viewy1);
- lio->draw.y1 = max(tmp, 0);
+ lio->draw.y1 = mymax(tmp, 0);
tmp = (SINT16)LOADINTELWORD(lio->work.viewx2);
- lio->draw.x2 = min(tmp, 639);
+ lio->draw.x2 = mymin(tmp, 639);
tmp = (SINT16)LOADINTELWORD(lio->work.viewy2);
- lio->draw.y2 = min(tmp, maxline);
+ lio->draw.y2 = mymin(tmp, maxline);
if (!gdcs.access) {
lio->draw.base = 0;
lio->draw.bank = 0;
diff -ur xnp2-0.86.orig/pccore.c xnp2-0.86/pccore.c
--- xnp2-0.86.orig/pccore.c 2016-03-09 02:25:49.000000000 +0900
+++ xnp2-0.86/pccore.c 2019-08-03 15:53:42.953251283 +0900
@@ -171,9 +171,9 @@
{
extsize = np2cfg.EXTMEM;
#if defined(CPUCORE_IA32)
- extsize = min(extsize, 63);
+ extsize = mymin(extsize, 63);
#else
- extsize = min(extsize, 13);
+ extsize = mymin(extsize, 13);
#endif
}
pccore.extmem = extsize;
diff -ur xnp2-0.86.orig/sdl2/MacOSX/np2sdl2/compiler.h xnp2-0.86/sdl2/MacOSX/np2sdl2/compiler.h
--- xnp2-0.86.orig/sdl2/MacOSX/np2sdl2/compiler.h 2016-03-09 02:25:49.000000000 +0900
+++ xnp2-0.86/sdl2/MacOSX/np2sdl2/compiler.h 2019-08-03 16:11:09.542092075 +0900
@@ -58,11 +58,11 @@
#endif
#ifndef __cplusplus
-#ifndef max
+#ifndef mymax
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
-#ifndef min
-#define min(a,b) (((a) < (b)) ? (a) : (b))
+#ifndef mymin
+#define mymin(a,b) (((a) < (b)) ? (a) : (b))
#endif
#endif /* __cplusplus */
diff -ur xnp2-0.86.orig/sdl2/fontmng.c xnp2-0.86/sdl2/fontmng.c
--- xnp2-0.86.orig/sdl2/fontmng.c 2016-03-09 02:25:49.000000000 +0900
+++ xnp2-0.86/sdl2/fontmng.c 2019-08-03 16:10:57.666308183 +0900
@@ -366,8 +366,8 @@
if (s)
{
- width = min(s->w, _this->ptsize);
- height = min(s->h, _this->ptsize);
+ width = mymin(s->w, _this->ptsize);
+ height = mymin(s->h, _this->ptsize);
}
else
{
diff -ur xnp2-0.86.orig/sdl2/iOS/compiler.h xnp2-0.86/sdl2/iOS/compiler.h
--- xnp2-0.86.orig/sdl2/iOS/compiler.h 2016-03-09 02:25:49.000000000 +0900
+++ xnp2-0.86/sdl2/iOS/compiler.h 2019-08-03 16:10:48.222480047 +0900
@@ -57,11 +57,11 @@
#define MAX_PATH 256
#endif
-#ifndef max
-#define max(a,b) (((a) > (b)) ? (a) : (b))
+#ifndef mymax
+#define mymax(a,b) (((a) > (b)) ? (a) : (b))
#endif
-#ifndef min
-#define min(a,b) (((a) < (b)) ? (a) : (b))
+#ifndef mymin
+#define mymin(a,b) (((a) < (b)) ? (a) : (b))
#endif
#ifndef ZeroMemory
diff -ur xnp2-0.86.orig/sdl2/scrnmng.c xnp2-0.86/sdl2/scrnmng.c
--- xnp2-0.86.orig/sdl2/scrnmng.c 2016-03-09 02:25:49.000000000 +0900
+++ xnp2-0.86/sdl2/scrnmng.c 2019-08-03 16:10:35.482711906 +0900
@@ -50,18 +50,18 @@
dr->yalign = surface->pitch;
dr->srcpos = 0;
dr->dstpos = 0;
- dr->width = min(scrnmng.width, s->width);
- dr->height = min(scrnmng.height, s->height);
+ dr->width = mymin(scrnmng.width, s->width);
+ dr->height = mymin(scrnmng.height, s->height);
if (rt) {
- pos = max(rt->left, 0);
+ pos = mymax(rt->left, 0);
dr->srcpos += pos;
dr->dstpos += pos * dr->xalign;
- dr->width = min(rt->right, dr->width) - pos;
+ dr->width = mymin(rt->right, dr->width) - pos;
- pos = max(rt->top, 0);
+ pos = mymax(rt->top, 0);
dr->srcpos += pos * s->width;
dr->dstpos += pos * dr->yalign;
- dr->height = min(rt->bottom, dr->height) - pos;
+ dr->height = mymin(rt->bottom, dr->height) - pos;
}
if ((dr->width <= 0) || (dr->height <= 0)) {
return(FAILURE);
@@ -185,8 +185,8 @@
scrnsurf.yalign = scrnmng.vram->yalign;
scrnsurf.bpp = scrnmng.vram->bpp;
}
- scrnsurf.width = min(scrnstat.width, 640);
- scrnsurf.height = min(scrnstat.height, 400);
+ scrnsurf.width = mymin(scrnstat.width, 640);
+ scrnsurf.height = mymin(scrnstat.height, 400);
scrnsurf.extend = 0;
return(&scrnsurf);
}
@@ -205,8 +205,8 @@
rt.left = 0;
rt.top = 0;
- rt.right = min(scrnstat.width, 640);
- rt.bottom = min(scrnstat.height, 400);
+ rt.right = mymin(scrnstat.width, 640);
+ rt.bottom = mymin(scrnstat.height, 400);
#if defined(SIZE_QVGA)
rt.right >>= 1;
rt.bottom >>= 1;
diff -ur xnp2-0.86.orig/sound/adpcmg.c xnp2-0.86/sound/adpcmg.c
--- xnp2-0.86.orig/sound/adpcmg.c 2016-03-09 02:25:48.000000000 +0900
+++ xnp2-0.86/sound/adpcmg.c 2019-08-03 15:50:39.484662574 +0900
@@ -265,7 +265,7 @@
if (ad->play == 0) {
goto adpcmstop;
}
- samp += ad->out0 * min(remain, ad->pertim);
+ samp += ad->out0 * mymin(remain, ad->pertim);
remain -= ad->pertim;
} while(remain > 0);
}
diff -ur xnp2-0.86.orig/sound/beepg.c xnp2-0.86/sound/beepg.c
--- xnp2-0.86.orig/sound/beepg.c 2016-03-09 02:25:48.000000000 +0900
+++ xnp2-0.86/sound/beepg.c 2019-08-03 15:51:36.783593996 +0900
@@ -84,7 +84,7 @@
do {
if (clk >= (1 << 16)) {
r = clk >> 16;
- r = min(r, count);
+ r = mymin(r, count);
clk -= r << 16;
count -= r;
if (bp->lastenable) {
diff -ur xnp2-0.86.orig/sound/cs4231c.c xnp2-0.86/sound/cs4231c.c
--- xnp2-0.86.orig/sound/cs4231c.c 2016-03-09 02:25:48.000000000 +0900
+++ xnp2-0.86/sound/cs4231c.c 2019-08-03 15:50:53.152407388 +0900
@@ -86,7 +86,7 @@
if (cs4231.bufsize > cs4231.bufdatas) {
rem = cs4231.bufsize - cs4231.bufdatas;
pos = (cs4231.bufpos + cs4231.bufdatas) & CS4231_BUFMASK;
- size = min(rem, CS4231_BUFFERS - pos);
+ size = mymin(rem, CS4231_BUFFERS - pos);
r = dmac_getdatas(dmach, cs4231.buffer + pos, size);
rem -= r;
cs4231.bufdatas += r;
@@ -167,7 +167,7 @@
step = (0 - cs4231.bufpos) & 3;
if (step) {
cs4231.bufpos += step;
- cs4231.bufdatas -= min(step, cs4231.bufdatas);
+ cs4231.bufdatas -= mymin(step, cs4231.bufdatas);
}
cs4231.bufdatas &= ~3;
}
diff -ur xnp2-0.86.orig/sound/cs4231g.c xnp2-0.86/sound/cs4231g.c
--- xnp2-0.86.orig/sound/cs4231g.c 2016-03-09 02:25:48.000000000 +0900
+++ xnp2-0.86/sound/cs4231g.c 2019-08-03 15:51:23.159847780 +0900
@@ -43,7 +43,7 @@
pos12 += cs->step12;
} while(--count);
- leng = min(leng, (pos12 >> 12));
+ leng = mymin(leng, (pos12 >> 12));
cs->bufdatas -= (leng << 0);
cs->bufpos += (leng << 0);
cs->pos12 = pos12 & ((1 << 12) - 1);
@@ -87,7 +87,7 @@
pos12 += cs->step12;
} while(--count);
- leng = min(leng, (pos12 >> 12));
+ leng = mymin(leng, (pos12 >> 12));
cs->bufdatas -= (leng << 1);
cs->bufpos += (leng << 1);
cs->pos12 = pos12 & ((1 << 12) - 1);
@@ -128,7 +128,7 @@
pos12 += cs->step12;
} while(--count);
- leng = min(leng, (pos12 >> 12));
+ leng = mymin(leng, (pos12 >> 12));
cs->bufdatas -= (leng << 1);
cs->bufpos += (leng << 1);
cs->pos12 = pos12 & ((1 << 12) - 1);
@@ -172,7 +172,7 @@
pos12 += cs->step12;
} while(--count);
- leng = min(leng, (pos12 >> 12));
+ leng = mymin(leng, (pos12 >> 12));
cs->bufdatas -= (leng << 2);
cs->bufpos += (leng << 2);
cs->pos12 = pos12 & ((1 << 12) - 1);
diff -ur xnp2-0.86.orig/sound/getsnd/getsndmn.mcr xnp2-0.86/sound/getsnd/getsndmn.mcr
--- xnp2-0.86.orig/sound/getsnd/getsndmn.mcr 2016-03-09 02:25:48.000000000 +0900
+++ xnp2-0.86/sound/getsnd/getsndmn.mcr 2019-08-03 16:04:55.400908754 +0900
@@ -34,7 +34,7 @@
_SMP_IN *samp;
UINT size;
- size = min(trk->remain, (UINT)(pcmterm - pcm));
+ size = mymin(trk->remain, (UINT)(pcmterm - pcm));
trk->remain -= size;
samp = (_SMP_IN *)trk->buf;
do {
diff -ur xnp2-0.86.orig/sound/getsnd/getsndst.mcr xnp2-0.86/sound/getsnd/getsndst.mcr
--- xnp2-0.86.orig/sound/getsnd/getsndst.mcr 2016-03-09 02:25:48.000000000 +0900
+++ xnp2-0.86/sound/getsnd/getsndst.mcr 2019-08-03 15:52:05.451060531 +0900
@@ -34,7 +34,7 @@
_SMP_IN *samp;
UINT size;
- size = min(trk->remain, (UINT)((pcmterm - pcm) / 2));
+ size = mymin(trk->remain, (UINT)((pcmterm - pcm) / 2));
trk->remain -= size;
samp = (_SMP_IN *)trk->buf;
do {
diff -ur xnp2-0.86.orig/sound/getsnd/getwave.c xnp2-0.86/sound/getsnd/getwave.c
--- xnp2-0.86.orig/sound/getsnd/getwave.c 2016-03-09 02:25:48.000000000 +0900
+++ xnp2-0.86/sound/getsnd/getwave.c 2019-08-03 16:07:36.977962521 +0900
@@ -75,7 +75,7 @@
UINT size;
- size = min(snd->blocksize, snd->datsize);
+ size = mymin(snd->blocksize, snd->datsize);
if (size) {
CopyMemory(dst, snd->datptr, size);
snd->datptr += size;
@@ -91,7 +91,7 @@
UINT cnt;
UINT8 *src;
- size = min(snd->blocksize, snd->datsize);
+ size = mymin(snd->blocksize, snd->datsize);
if (size) {
if (snd->bit == 16) {
cnt = size >> 1;
@@ -148,7 +148,7 @@
static const int MSADPCMTable[16] = {
230, 230, 230, 230, 307, 409, 512, 614,
- 768, 614, 512, 409, 307, 230, 230, 230
+ 768, 614, 512, 409, 307, 230, 230, 230
};
static UINT msa_dec(GETSND snd, SINT16 *dst) {
@@ -164,7 +164,7 @@
SINT32 outdata;
buf = snd->datptr; // ワーク使ってません。
- size = min(snd->datsize, snd->blocksize);
+ size = mymin(snd->datsize, snd->blocksize);
snd->datptr += size;
snd->datsize -= size;
@@ -531,7 +531,7 @@
ptr += pos;
size -= pos;
datasize = LOADINTELDWORD(head->size);
- size = min(size, datasize);
+ size = mymin(size, datasize);
switch(format) {
case 0x01: // PCM
diff -ur xnp2-0.86.orig/sound/pcmmix.c xnp2-0.86/sound/pcmmix.c
--- xnp2-0.86.orig/sound/pcmmix.c 2016-03-09 02:25:48.000000000 +0900
+++ xnp2-0.86/sound/pcmmix.c 2019-08-03 15:52:18.246822652 +0900
@@ -118,7 +118,7 @@
flag = t->flag;
vol = t->volume;
do {
- r = min(srem, drem);
+ r = mymin(srem, drem);
switch(flag & (PMIXFLAG_L | PMIXFLAG_R)) {
case PMIXFLAG_L:
for (j=0; j<r; j++) {
diff -ur xnp2-0.86.orig/sound/psggeng.c xnp2-0.86/sound/psggeng.c
--- xnp2-0.86.orig/sound/psggeng.c 2016-03-09 02:25:48.000000000 +0900
+++ xnp2-0.86/sound/psggeng.c 2019-08-03 15:52:48.066268831 +0900
@@ -23,7 +23,7 @@
UINT noise;
if ((psg->mixer & 0x3f) == 0) {
- count = min(count, psg->puchicount);
+ count = mymin(count, psg->puchicount);
psg->puchicount -= count;
}
if (count == 0) {
diff -ur xnp2-0.86.orig/sound/sound.c xnp2-0.86/sound/sound.c
--- xnp2-0.86.orig/sound/sound.c 2016-03-09 02:25:48.000000000 +0900
+++ xnp2-0.86/sound/sound.c 2019-08-03 16:06:52.262777444 +0900
@@ -55,7 +55,7 @@
CBTBL *cb;
UINT count;
- count = min(sndstream.remain, samples);
+ count = mymin(sndstream.remain, samples);
if (count) {
ZeroMemory(sndstream.ptr, count * 2 * sizeof(SINT32));
cb = sndstream.cb;
@@ -133,7 +133,7 @@
while (nSamples)
{
- nCount = min(nSamples, 512);
+ nCount = mymin(nSamples, 512);
memset(buf32, 0, nCount * 2 * sizeof(buf32[0]));
cb = sndstream.cb;
while (cb < sndstream.cbreg)
@@ -141,7 +141,7 @@
cb->cbfn(cb->hdl, buf32, nCount);
cb++;
}
- r = min(sndstream.remain, nCount);
+ r = mymin(sndstream.remain, nCount);
if (r)
{
memcpy(sndstream.ptr, buf32, r * 2 * sizeof(buf32[0]));
@@ -179,7 +179,7 @@
SINT32 nSampleL;
SINT32 nSampleR;
- nCount = min(sndstream.remain, nCount);
+ nCount = mymin(sndstream.remain, nCount);
if (nCount)
{
ptr = sndstream.ptr;
@@ -243,7 +243,7 @@
#else
reserve = 0;
#endif
- sndstream.buffer = (SINT32 *)_MALLOC((samples + reserve) * 2
+ sndstream.buffer = (SINT32 *)_MALLOC((samples + reserve) * 2
* sizeof(SINT32), "stream");
if (sndstream.buffer == NULL) {
goto scre_err2;
diff -ur xnp2-0.86.orig/sound/vermouth/midinst.c xnp2-0.86/sound/vermouth/midinst.c
--- xnp2-0.86.orig/sound/vermouth/midinst.c 2016-03-09 02:25:48.000000000 +0900
+++ xnp2-0.86/sound/vermouth/midinst.c 2019-08-03 15:49:24.070074235 +0900
@@ -398,7 +398,7 @@
if (sampdat < 0) {
sampdat *= -1;
}
- sampmax = max(sampmax, sampdat);
+ sampmax = mymax(sampmax, sampdat);
} while(--cnt);
layer->volume = 32768 * 128 / sampmax;
}
diff -ur xnp2-0.86.orig/sound/vermouth/midiout.c xnp2-0.86/sound/vermouth/midiout.c
--- xnp2-0.86.orig/sound/vermouth/midiout.c 2016-03-09 02:25:48.000000000 +0900
+++ xnp2-0.86/sound/vermouth/midiout.c 2019-08-03 16:07:18.658296357 +0900
@@ -320,7 +320,7 @@
if (!(v2->phase & (VOICE_ON | VOICE_REL))) {
vol = v2->envleft;
if ((v2->flag & VOICE_MIXMASK) == VOICE_MIXNORMAL) {
- vol = max(vol, v2->envright);
+ vol = mymax(vol, v2->envright);
}
if (volmin > vol) {
volmin = vol;
@@ -716,7 +716,7 @@
VEXTERN UINT VEXPORT midiout_getver(char *string, UINT leng) {
- leng = min(leng, sizeof(vermouthver));
+ leng = mymin(leng, sizeof(vermouthver));
CopyMemory(string, vermouthver, leng);
return((MIDIOUT_VERSION << 8) | 0x00);
}
@@ -729,8 +729,8 @@
if (mod == NULL) {
return(NULL);
}
- worksize = min(worksize, 512U);
- worksize = max(worksize, 16384U);
+ worksize = mymin(worksize, 512U);
+ worksize = mymax(worksize, 16384U);
size = sizeof(_MIDIHDL);
size += sizeof(SINT32) * 2 * worksize;
size += sizeof(_SAMPLE) * worksize;
@@ -1079,7 +1079,7 @@
UINT rem;
ret = 0;
- size = min(size, hdl->worksize);
+ size = mymin(size, hdl->worksize);
buf = hdl->sampbuf;
ZeroMemory(buf, size * 2 * sizeof(SINT32));
v = VOICEHDLPTR(hdl);
diff -ur xnp2-0.86.orig/vram/dispsync.c xnp2-0.86/vram/dispsync.c
--- xnp2-0.86.orig/vram/dispsync.c 2016-03-09 02:25:49.000000000 +0900
+++ xnp2-0.86/vram/dispsync.c 2019-08-03 15:49:04.054450005 +0900
@@ -59,7 +59,7 @@
}
scrnxmax = cr + 2;
if ((scrnxpos + scrnxmax) > 80) {
- scrnxmax = min(scrnxmax, 80);
+ scrnxmax = mymin(scrnxmax, 80);
scrnxpos = 80 - scrnxmax;
}
scrnxpos <<= 3;
@@ -123,7 +123,7 @@
dsync.textymax = textymax;
dsync.grphymax = grphymax;
- scrnymax = max(grphymax, textymax);
+ scrnymax = mymax(grphymax, textymax);
scrnymax = (scrnymax + 7) & (~7);
if (dsync.scrnymax != scrnymax) {
dsync.scrnymax = scrnymax;
diff -ur xnp2-0.86.orig/vram/maketgrp.c xnp2-0.86/vram/maketgrp.c
--- xnp2-0.86.orig/vram/maketgrp.c 2016-03-09 02:25:49.000000000 +0900
+++ xnp2-0.86/vram/maketgrp.c 2019-08-03 15:48:51.114693199 +0900
@@ -136,7 +136,7 @@
ppage = (plane)?VRAM_STEP:0;
gbit = 0x01010101 << plane;
- ymax = min(dsync.textymax, dsync.grphymax);
+ ymax = mymin(dsync.textymax, dsync.grphymax);
q = np2_vram[plane] + dsync.textvad;
wait1 = 0;
TEXT_LRcnt = 0;
@@ -394,7 +394,7 @@
ppage = (plane)?VRAM_STEP:0;
gbit = 0x01010101 << plane;
- ymax = min(dsync.textymax, dsync.grphymax);
+ ymax = mymin(dsync.textymax, dsync.grphymax);
q = np2_vram[plane] + dsync.textvad;
wait1 = 0;
TEXT_LRcnt = 0;
diff -ur xnp2-0.86.orig/vram/scrnsave.c xnp2-0.86/vram/scrnsave.c
--- xnp2-0.86.orig/vram/scrnsave.c 2016-03-09 02:25:49.000000000 +0900
+++ xnp2-0.86/vram/scrnsave.c 2019-08-03 15:48:29.807094128 +0900
@@ -555,7 +555,7 @@
STOREINTELWORD(bitbuf + 7, sd->height); // cy
bitbuf[9] = 0; // noninterlace
- bpp = max(bpp, 2);
+ bpp = mymax(bpp, 2);
bitbuf[10] = (UINT8)bpp;
if (file_write(fh, bitbuf, 11) != 11) {
goto sswg_err4;
diff -ur xnp2-0.86.orig/win9x/commng/cmmidioutvst.cpp xnp2-0.86/win9x/commng/cmmidioutvst.cpp
--- xnp2-0.86.orig/win9x/commng/cmmidioutvst.cpp 2016-03-09 02:25:50.000000000 +0900
+++ xnp2-0.86/win9x/commng/cmmidioutvst.cpp 2019-08-03 16:11:51.593326951 +0900
@@ -165,7 +165,7 @@
}
UINT nSize = m_nBlockSize - m_nIndex;
- nSize = min(nSize, nBufferCount);
+ nSize = mymin(nSize, nBufferCount);
nBufferCount -= nSize;
float** output = m_output.GetBuffer();
do
diff -ur xnp2-0.86.orig/win9x/debuguty/viewasm.cpp xnp2-0.86/win9x/debuguty/viewasm.cpp
--- xnp2-0.86.orig/win9x/debuguty/viewasm.cpp 2016-03-09 02:25:50.000000000 +0900
+++ xnp2-0.86/win9x/debuguty/viewasm.cpp 2019-08-03 16:13:01.200060784 +0900
@@ -163,7 +163,7 @@
{
while (cbBuffer)
{
- const UINT nLimit = min(nOffset + cbBuffer, 0x10000);
+ const UINT nLimit = mymin(nOffset + cbBuffer, 0x10000);
const UINT nSize = nLimit - nOffset;
if (!m_buffer.empty())
diff -ur xnp2-0.86.orig/win9x/dialog/d_config.cpp xnp2-0.86/win9x/dialog/d_config.cpp
--- xnp2-0.86.orig/win9x/dialog/d_config.cpp 2016-03-09 02:25:51.000000000 +0900
+++ xnp2-0.86/win9x/dialog/d_config.cpp 2019-08-03 16:13:14.995809880 +0900
@@ -258,8 +258,8 @@
}
UINT nMultiple = GetDlgItemInt(IDC_MULTIPLE, NULL, FALSE);
- nMultiple = max(nMultiple, 1);
- nMultiple = min(nMultiple, 32);
+ nMultiple = mymax(nMultiple, 1);
+ nMultiple = mymin(nMultiple, 32);
if (np2cfg.multiple != nMultiple)
{
np2cfg.multiple = nMultiple;
@@ -309,8 +309,8 @@
}
UINT nBuffer = GetDlgItemInt(IDC_SOUND_BUFFER, NULL, FALSE);
- nBuffer = max(nBuffer, 40);
- nBuffer = min(nBuffer, 1000);
+ nBuffer = mymax(nBuffer, 40);
+ nBuffer = mymin(nBuffer, 1000);
if (np2cfg.delayms != static_cast<UINT16>(nBuffer))
{
np2cfg.delayms = static_cast<UINT16>(nBuffer);
@@ -404,8 +404,8 @@
{
nMultiple = GetDlgItemInt(IDC_MULTIPLE, NULL, FALSE);
}
- nMultiple = max(nMultiple, 1);
- nMultiple = min(nMultiple, 32);
+ nMultiple = mymax(nMultiple, 1);
+ nMultiple = mymin(nMultiple, 32);
const UINT nClock = (nBaseClock / 100) * nMultiple;
diff -ur xnp2-0.86.orig/win9x/dialog/d_disk.cpp xnp2-0.86/win9x/dialog/d_disk.cpp
--- xnp2-0.86.orig/win9x/dialog/d_disk.cpp 2016-03-09 02:25:51.000000000 +0900
+++ xnp2-0.86/win9x/dialog/d_disk.cpp 2019-08-03 16:13:23.835649116 +0900
@@ -139,7 +139,7 @@
static const UINT32 s_hddsizetbl[5] = {20, 41, 65, 80, 128};
/** SASI HDD */
-static const UINT16 s_sasires[6] =
+static const UINT16 s_sasires[6] =
{
IDC_NEWSASI5MB, IDC_NEWSASI10MB,
IDC_NEWSASI15MB, IDC_NEWSASI20MB,
@@ -207,8 +207,8 @@
virtual void OnOK()
{
UINT nSize = GetDlgItemInt(IDC_HDDSIZE, NULL, FALSE);
- nSize = max(nSize, m_nHddMinSize);
- nSize = min(nSize, m_nHddMaxSize);
+ nSize = mymax(nSize, m_nHddMinSize);
+ nSize = mymin(nSize, m_nHddMaxSize);
m_nHddSize = nSize;
CDlgProc::OnOK();
}
diff -ur xnp2-0.86.orig/win9x/ext/mt32snd.cpp xnp2-0.86/win9x/ext/mt32snd.cpp
--- xnp2-0.86.orig/win9x/ext/mt32snd.cpp 2016-03-09 02:25:50.000000000 +0900
+++ xnp2-0.86/win9x/ext/mt32snd.cpp 2019-08-03 16:13:31.171515708 +0900
@@ -193,7 +193,7 @@
while (cchBuffer)
{
SINT16 sSamples[512 * 2];
- const UINT nLength = min(cchBuffer, 512);
+ const UINT nLength = mymin(cchBuffer, 512);
(*m_fnMix)(sSamples, nLength);
for (UINT i = 0; i < nLength; i++)
{
diff -ur xnp2-0.86.orig/win9x/fontmng.cpp xnp2-0.86/win9x/fontmng.cpp
--- xnp2-0.86.orig/win9x/fontmng.cpp 2016-03-09 02:25:50.000000000 +0900
+++ xnp2-0.86/win9x/fontmng.cpp 2019-08-03 16:12:41.140425635 +0900
@@ -151,7 +151,7 @@
SIZE fntsize;
if (GetTextExtentPoint32(fhdl->hdcimage, string, length, &fntsize)) {
- fntsize.cx = min(fntsize.cx, fhdl->bmpwidth);
+ fntsize.cx = mymin(fntsize.cx, fhdl->bmpwidth);
fdat->width = fntsize.cx;
fdat->pitch = fntsize.cx;
}
diff -ur xnp2-0.86.orig/win9x/misc/extrom.cpp xnp2-0.86/win9x/misc/extrom.cpp
--- xnp2-0.86.orig/win9x/misc/extrom.cpp 2016-03-09 02:25:51.000000000 +0900
+++ xnp2-0.86/win9x/misc/extrom.cpp 2019-08-03 16:12:55.264168744 +0900
@@ -78,7 +78,7 @@
UINT CExtRom::Read(LPVOID lpBuffer, UINT cbBuffer)
{
UINT nLength = m_nSize - m_nPointer;
- nLength = min(nLength, cbBuffer);
+ nLength = mymin(nLength, cbBuffer);
if (nLength)
{
if (lpBuffer)
diff -ur xnp2-0.86.orig/win9x/misc/tstring.cpp xnp2-0.86/win9x/misc/tstring.cpp
--- xnp2-0.86.orig/win9x/misc/tstring.cpp 2016-03-09 02:25:51.000000000 +0900
+++ xnp2-0.86/win9x/misc/tstring.cpp 2019-08-03 16:12:48.172297733 +0900
@@ -46,7 +46,7 @@
}
UINT nLength = pRes[dwPos++];
- nLength = min(nLength, (dwResSize - dwPos));
+ nLength = mymin(nLength, (dwResSize - dwPos));
#if defined(_UNICODE)
diff -ur xnp2-0.86.orig/win9x/recvideo.cpp xnp2-0.86/win9x/recvideo.cpp
--- xnp2-0.86.orig/win9x/recvideo.cpp 2016-03-09 02:25:50.000000000 +0900
+++ xnp2-0.86/win9x/recvideo.cpp 2019-08-03 16:12:34.568545173 +0900
@@ -366,8 +366,8 @@
}
(*fnMix)(m_pWork8, p, q);
- const int nWidth = min(dsync.scrnxmax, VIDEO_WIDTH);
- const int nHeight = min(dsync.scrnymax, VIDEO_HEIGHT);
+ const int nWidth = mymin(dsync.scrnxmax, VIDEO_WIDTH);
+ const int nHeight = mymin(dsync.scrnymax, VIDEO_HEIGHT);
p = m_pWork8;
q = m_pWork24 + (VIDEO_WIDTH * nHeight * 3);
for (int y = 0; y < nHeight; y++)
diff -ur xnp2-0.86.orig/win9x/scrnmng.cpp xnp2-0.86/win9x/scrnmng.cpp
--- xnp2-0.86.orig/win9x/scrnmng.cpp 2016-03-09 02:25:50.000000000 +0900
+++ xnp2-0.86/win9x/scrnmng.cpp 2019-08-03 16:11:37.957575036 +0900
@@ -150,8 +150,8 @@
int tmpcy;
WINLOCEX wlex;
- width = min(scrnstat.width, ddraw.width);
- height = min(scrnstat.height, ddraw.height);
+ width = mymin(scrnstat.width, ddraw.width);
+ height = mymin(scrnstat.height, ddraw.height);
extend = 0;
// 描画範囲~
@@ -169,7 +169,7 @@
case FSCRNMOD_ASPECTFIX8:
scrnwidth = (ddraw.width << 3) / width;
scrnheight = (ddraw.height << 3) / height;
- multiple = min(scrnwidth, scrnheight);
+ multiple = mymin(scrnwidth, scrnheight);
scrnwidth = (width * multiple) >> 3;
scrnheight = (height * multiple) >> 3;
break;
@@ -203,7 +203,7 @@
switch(fscrnmod) {
default:
case FSCRNMOD_NORESIZE:
- tmpcy = min(tmpcy, height);
+ tmpcy = mymin(tmpcy, height);
ddraw.rectclip.bottom = tmpcy;
break;
@@ -223,7 +223,7 @@
multiple = scrnstat.multiple;
if (!(ddraw.scrnmode & SCRNMODE_ROTATE)) {
if ((np2oscfg.paddingx) && (multiple == 8)) {
- extend = min(scrnstat.extend, ddraw.extend);
+ extend = mymin(scrnstat.extend, ddraw.extend);
}
scrnwidth = (width * multiple) >> 3;
scrnheight = (height * multiple) >> 3;
@@ -234,7 +234,7 @@
}
else {
if ((np2oscfg.paddingy) && (multiple == 8)) {
- extend = min(scrnstat.extend, ddraw.extend);
+ extend = mymin(scrnstat.extend, ddraw.extend);
}
scrnwidth = (height * multiple) >> 3;
scrnheight = (width * multiple) >> 3;
@@ -287,8 +287,8 @@
primsurf->Blt(&rect, NULL, NULL, DDBLT_COLORFILL, &ddbf);
}
- rect.top = max(base->top, target->top);
- rect.bottom = min(base->bottom, target->bottom);
+ rect.top = mymax(base->top, target->top);
+ rect.bottom = mymin(base->bottom, target->bottom);
if (rect.top < rect.bottom) {
rect.left = base->left;
rect.right = target->left;
@@ -977,9 +977,9 @@
scrnsizing.by = (np2oscfg.paddingy * 2) +
(rectwindow.bottom - rectwindow.top) -
(rectclient.bottom - rectclient.top);
- cx = min(scrnstat.width, ddraw.width);
+ cx = mymin(scrnstat.width, ddraw.width);
cx = (cx + 7) >> 3;
- cy = min(scrnstat.height, ddraw.height);
+ cy = mymin(scrnstat.height, ddraw.height);
cy = (cy + 7) >> 3;
if (!(ddraw.scrnmode & SCRNMODE_ROTATE)) {
scrnsizing.cx = cx;
@@ -1012,7 +1012,7 @@
else {
height = 16;
}
- mul = min(width, height);
+ mul = mymin(width, height);
if (mul <= 0) {
mul = 1;
}
diff -ur xnp2-0.86.orig/win9x/subwnd/kdispwnd.cpp xnp2-0.86/win9x/subwnd/kdispwnd.cpp
--- xnp2-0.86.orig/win9x/subwnd/kdispwnd.cpp 2016-03-09 02:25:51.000000000 +0900
+++ xnp2-0.86/win9x/subwnd/kdispwnd.cpp 2019-08-03 16:12:12.112953652 +0900
@@ -340,8 +340,8 @@
RECT draw;
draw.left = 0;
draw.top = 0;
- draw.right = min(KEYDISP_WIDTH, rect.right - rect.left);
- draw.bottom = min(KEYDISP_HEIGHT, rect.bottom - rect.top);
+ draw.right = mymin(KEYDISP_WIDTH, rect.right - rect.left);
+ draw.bottom = mymin(KEYDISP_HEIGHT, rect.bottom - rect.top);
if ((draw.right <= 0) || (draw.bottom <= 0))
{
return;
diff -ur xnp2-0.86.orig/win9x/subwnd/mdbgwnd.cpp xnp2-0.86/win9x/subwnd/mdbgwnd.cpp
--- xnp2-0.86.orig/win9x/subwnd/mdbgwnd.cpp 2016-03-09 02:25:51.000000000 +0900
+++ xnp2-0.86/win9x/subwnd/mdbgwnd.cpp 2019-08-03 16:12:02.713124652 +0900
@@ -199,8 +199,8 @@
RECT draw;
draw.left = 0;
draw.top = 0;
- draw.right = min(m_nWidth, rect.right - rect.left);
- draw.bottom = min(m_nHeight, rect.bottom - rect.top);
+ draw.right = mymin(m_nWidth, rect.right - rect.left);
+ draw.bottom = mymin(m_nHeight, rect.bottom - rect.top);
CMNVRAM* vram = m_dd2.Lock();
if (vram)
{
diff -ur xnp2-0.86.orig/win9x/subwnd/skbdwnd.cpp xnp2-0.86/win9x/subwnd/skbdwnd.cpp
--- xnp2-0.86.orig/win9x/subwnd/skbdwnd.cpp 2016-03-09 02:25:51.000000000 +0900
+++ xnp2-0.86/win9x/subwnd/skbdwnd.cpp 2019-08-03 16:12:26.080699567 +0900
@@ -211,8 +211,8 @@
RECT draw;
draw.left = 0;
draw.top = 0;
- draw.right = min(m_nWidth, rect.right - rect.left);
- draw.bottom = min(m_nHeight, rect.bottom - rect.top);
+ draw.right = mymin(m_nWidth, rect.right - rect.left);
+ draw.bottom = mymin(m_nHeight, rect.bottom - rect.top);
CMNVRAM* vram = m_dd2.Lock();
if (vram)
{
diff -ur xnp2-0.86.orig/x11/compiler.h xnp2-0.86/x11/compiler.h
--- xnp2-0.86.orig/x11/compiler.h 2016-03-09 02:25:50.000000000 +0900
+++ xnp2-0.86/x11/compiler.h 2019-08-03 15:45:30.906486894 +0900
@@ -117,11 +117,11 @@
#define MAX_PATH MAXPATHLEN
#endif
-#ifndef max
-#define max(a,b) (((a) > (b)) ? (a) : (b))
+#ifndef mymax
+#define mymax(a,b) (((a) > (b)) ? (a) : (b))
#endif
-#ifndef min
-#define min(a,b) (((a) < (b)) ? (a) : (b))
+#ifndef mymin
+#define mymin(a,b) (((a) < (b)) ? (a) : (b))
#endif
#ifndef ZeroMemory
diff -ur xnp2-0.86.orig/x11/gtk2/gtk_font.c xnp2-0.86/x11/gtk2/gtk_font.c
--- xnp2-0.86.orig/x11/gtk2/gtk_font.c 2016-03-09 02:25:50.000000000 +0900
+++ xnp2-0.86/x11/gtk2/gtk_font.c 2019-08-03 16:16:44.052055510 +0900
@@ -264,7 +264,7 @@
memcpy(buf, str, len * sizeof(char));
buf[len] = '\0';
getlength1(fhdl, &fdat, buf, len);
- width = posx + max(fdat.width, fdat.pitch);
+ width = posx + mymax(fdat.width, fdat.pitch);
posx += fdat.pitch;
}
}
diff -ur xnp2-0.86.orig/x11/gtk2/gtk_screen.c xnp2-0.86/x11/gtk2/gtk_screen.c
--- xnp2-0.86.orig/x11/gtk2/gtk_screen.c 2016-03-09 02:25:50.000000000 +0900
+++ xnp2-0.86/x11/gtk2/gtk_screen.c 2019-08-03 15:46:14.077663372 +0900
@@ -128,8 +128,8 @@
int scrnheight;
int multiple;
- width = min(scrnstat.width, drawmng.width);
- height = min(scrnstat.height, drawmng.height);
+ width = mymin(scrnstat.width, drawmng.width);
+ height = mymin(scrnstat.height, drawmng.height);
extend = 0;
if (drawmng.scrnmode & SCRNMODE_FULLSCREEN) {
@@ -155,7 +155,7 @@
multiple = scrnstat.multiple;
if (!(drawmng.scrnmode & SCRNMODE_ROTATE)) {
if ((np2oscfg.paddingx > 0) && (multiple == SCREEN_DEFMUL)) {
- extend = min(scrnstat.extend, drawmng.extend);
+ extend = mymin(scrnstat.extend, drawmng.extend);
}
scrnwidth = (width * multiple) / SCREEN_DEFMUL;
scrnheight = (height * multiple) / SCREEN_DEFMUL;
@@ -170,7 +170,7 @@
drawmng.scrn.top = np2oscfg.paddingy;
} else {
if ((np2oscfg.paddingy > 0) && (multiple == SCREEN_DEFMUL)) {
- extend = min(scrnstat.extend, drawmng.extend);
+ extend = mymin(scrnstat.extend, drawmng.extend);
}
scrnwidth = (height * multiple) / SCREEN_DEFMUL;
scrnheight = (width * multiple) / SCREEN_DEFMUL;
@@ -217,8 +217,8 @@
rect.left, rect.top, rect.right, rect.bottom);
}
- rect.top = max(base->top, target->top);
- rect.bottom = min(base->bottom, target->bottom);
+ rect.top = mymax(base->top, target->top);
+ rect.bottom = mymin(base->bottom, target->bottom);
if (rect.top < rect.bottom) {
rect.left = base->left;
rect.right = target->left;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment