pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

zdbsp: Add patches for big endian machines



Module Name:	pkgsrc-wip
Committed By:	Michael Baeuerle <micha%NetBSD.org@localhost>
Pushed By:	micha
Date:		Mon May 4 12:22:46 2020 +0200
Changeset:	3025cfbb1d0c7262a3c535e17119c329d4e07f35

Modified Files:
	zdbsp/distinfo
Added Files:
	zdbsp/patches/patch-processor.cpp
	zdbsp/patches/patch-wad.cpp

Log Message:
zdbsp: Add patches for big endian machines

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=3025cfbb1d0c7262a3c535e17119c329d4e07f35

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 zdbsp/distinfo                    |  2 +
 zdbsp/patches/patch-processor.cpp | 96 +++++++++++++++++++++++++++++++++++++++
 zdbsp/patches/patch-wad.cpp       | 36 +++++++++++++++
 3 files changed, 134 insertions(+)

diffs:
diff --git a/zdbsp/distinfo b/zdbsp/distinfo
index 2615d74197..b08b5ea67a 100644
--- a/zdbsp/distinfo
+++ b/zdbsp/distinfo
@@ -4,3 +4,5 @@ SHA1 (zdbsp-1.19.tar.gz) = 96ad52ab3364c58f80024b285e328b1f88487d1f
 RMD160 (zdbsp-1.19.tar.gz) = a0d2e3559ed7ef7000a667af55e77143f9367897
 SHA512 (zdbsp-1.19.tar.gz) = bfd13e38ed5c8596f10c6ff79e2fb70a0a20921d98c2a49560ed20787fb52279a5f6e7c10b57f30a5afdde8ba37635871a27f13bbff071d3cf6bec775657ad93
 Size (zdbsp-1.19.tar.gz) = 208407 bytes
+SHA1 (patch-processor.cpp) = 79333e70b6fd7183037b5cb08cf36760d9840cd2
+SHA1 (patch-wad.cpp) = 28b17377fdacc4d135a9e52a0f9ec7c9fbd2508c
diff --git a/zdbsp/patches/patch-processor.cpp b/zdbsp/patches/patch-processor.cpp
new file mode 100644
index 0000000000..758e7f5ae0
--- /dev/null
+++ b/zdbsp/patches/patch-processor.cpp
@@ -0,0 +1,96 @@
+$NetBSD$
+
+On big endian machines the build fails like this without the patch:
+error: call of overloaded 'LittleShort()' is ambiguous
+
+--- processor.cpp.orig	2016-01-07 20:33:31.000000000 +0000
++++ processor.cpp
+@@ -944,8 +944,8 @@ void FProcessor::WriteVertices (FWadWrit
+ 
+ 	for (i = 0; i < count; ++i)
+ 	{
+-		verts[i*2] = LittleShort(vertdata[i].x >> FRACBITS);
+-		verts[i*2+1] = LittleShort(vertdata[i].y >> FRACBITS);
++		verts[i*2] = LittleShort((short)(vertdata[i].x >> FRACBITS));
++		verts[i*2+1] = LittleShort((short)(vertdata[i].y >> FRACBITS));
+ 	}
+ 	out.WriteLump ("VERTEXES", verts, sizeof(*verts)*count*2);
+ 	delete[] verts;
+@@ -1011,7 +1011,7 @@ void FProcessor::WriteSides (FWadWriter
+ 		memcpy(Sides[i].toptexture, Level.Sides[i].toptexture, 8);
+ 		memcpy(Sides[i].bottomtexture, Level.Sides[i].bottomtexture, 8);
+ 		memcpy(Sides[i].midtexture, Level.Sides[i].midtexture, 8);
+-		Sides[i].sector = LittleShort(Level.Sides[i].sector);
++		Sides[i].sector = LittleShort((unsigned short)(Level.Sides[i].sector));
+ 	}
+ 	out.WriteLump ("SIDEDEFS", Sides, Level.NumSides()*sizeof(*Sides));
+ 	delete[] Sides;
+@@ -1116,10 +1116,10 @@ void FProcessor::WriteNodes2 (FWadWriter
+ 
+ 	for (i = 0; i < count; ++i)
+ 	{
+-		nodes[0] = LittleShort(zaNodes[i].x >> 16);
+-		nodes[1] = LittleShort(zaNodes[i].y >> 16);
+-		nodes[2] = LittleShort(zaNodes[i].dx >> 16);
+-		nodes[3] = LittleShort(zaNodes[i].dy >> 16);
++		nodes[0] = LittleShort((short)(zaNodes[i].x >> 16));
++		nodes[1] = LittleShort((short)(zaNodes[i].y >> 16));
++		nodes[2] = LittleShort((short)(zaNodes[i].dx >> 16));
++		nodes[3] = LittleShort((short)(zaNodes[i].dy >> 16));
+ 		nodes += 4;
+ 		const short *inodes = (short *)&zaNodes[i].bbox[0][0];
+ 		for (j = 0; j < 2*4; ++j)
+@@ -1162,10 +1162,10 @@ void FProcessor::WriteNodes5 (FWadWriter
+ 		{
+ 			coord[j] = LittleShort(inodes[j]);
+ 		}
+-		nodes[i].x = LittleShort(zaNodes[i].x >> 16);
+-		nodes[i].y = LittleShort(zaNodes[i].y >> 16);
+-		nodes[i].dx = LittleShort(zaNodes[i].dx >> 16);
+-		nodes[i].dy = LittleShort(zaNodes[i].dy >> 16);
++		nodes[i].x = LittleShort((short)(zaNodes[i].x >> 16));
++		nodes[i].y = LittleShort((short)(zaNodes[i].y >> 16));
++		nodes[i].dx = LittleShort((short)(zaNodes[i].dx >> 16));
++		nodes[i].dy = LittleShort((short)(zaNodes[i].dy >> 16));
+ 		for (j = 0; j < 2; ++j)
+ 		{
+ 			nodes[i].children[j] = LittleLong(zaNodes[i].children[j]);
+@@ -1247,8 +1247,8 @@ void FProcessor::WriteGLVertices (FWadWr
+ 
+ 	for (i = 0; i < count; ++i)
+ 	{
+-		verts[i*2+1] = LittleShort(vertdata[i].x);
+-		verts[i*2+2] = LittleShort(vertdata[i].y);
++		verts[i*2+1] = LittleShort((short)(vertdata[i].x));
++		verts[i*2+2] = LittleShort((short)(vertdata[i].y));
+ 	}
+ 	out.WriteLump ("GL_VERT", verts, sizeof(*verts)*(count*2+1));
+ 	delete[] verts;
+@@ -1280,15 +1280,15 @@ void FProcessor::WriteGLSegs (FWadWriter
+ 		}
+ 		else
+ 		{
+-			segdata[i].v1 = LittleShort(0x8000 | (WORD)(Level.GLSegs[i].v1 - Level.NumOrgVerts));
++			segdata[i].v1 = LittleShort((WORD)(0x8000 | (WORD)(Level.GLSegs[i].v1 - Level.NumOrgVerts)));
+ 		}
+ 		if (Level.GLSegs[i].v2 < (DWORD)Level.NumOrgVerts)
+ 		{
+-			segdata[i].v2 = (WORD)LittleShort(Level.GLSegs[i].v2);
++			segdata[i].v2 = (WORD)LittleShort((WORD)Level.GLSegs[i].v2);
+ 		}
+ 		else
+ 		{
+-			segdata[i].v2 = LittleShort(0x8000 | (WORD)(Level.GLSegs[i].v2 - Level.NumOrgVerts));
++			segdata[i].v2 = LittleShort((WORD)(0x8000 | (WORD)(Level.GLSegs[i].v2 - Level.NumOrgVerts)));
+ 		}
+ 		segdata[i].linedef = LittleShort((WORD)Level.GLSegs[i].linedef);
+ 		segdata[i].side = LittleShort(Level.GLSegs[i].side);
+@@ -1333,7 +1333,7 @@ void FProcessor::WriteGLSegs5 (FWadWrite
+ 		{
+ 			segdata[i].v2 = LittleLong(0x80000000u | ((int)Level.GLSegs[i].v2 - Level.NumOrgVerts));
+ 		}
+-		segdata[i].linedef = LittleShort(Level.GLSegs[i].linedef);
++		segdata[i].linedef = LittleLong(Level.GLSegs[i].linedef);
+ 		segdata[i].side = LittleShort(Level.GLSegs[i].side);
+ 		segdata[i].partner = LittleLong(Level.GLSegs[i].partner);
+ 	}
diff --git a/zdbsp/patches/patch-wad.cpp b/zdbsp/patches/patch-wad.cpp
new file mode 100644
index 0000000000..4029b8bb61
--- /dev/null
+++ b/zdbsp/patches/patch-wad.cpp
@@ -0,0 +1,36 @@
+$NetBSD$
+
+On big endian machines the build fails like this without the patch:
+error: call of overloaded 'LittleLong()' is ambiguous
+
+--- wad.cpp.orig	2016-01-07 20:33:31.000000000 +0000
++++ wad.cpp
+@@ -380,8 +380,8 @@ void FWadWriter::Close ()
+ 	{
+ 		int32_t head[2];
+ 
+-		head[0] = LittleLong(Lumps.Size());
+-		head[1] = LittleLong(ftell (File));
++		head[0] = LittleLong((int)Lumps.Size());
++		head[1] = LittleLong((int)ftell (File));
+ 
+ 		SafeWrite (&Lumps[0], sizeof(WadLump)*Lumps.Size());
+ 		fseek (File, 4, SEEK_SET);
+@@ -396,7 +396,7 @@ void FWadWriter::CreateLabel (const char
+ 	WadLump lump;
+ 
+ 	strncpy (lump.Name, name, 8);
+-	lump.FilePos = LittleLong(ftell (File));
++	lump.FilePos = LittleLong((int)ftell (File));
+ 	lump.Size = 0;
+ 	Lumps.Push (lump);
+ }
+@@ -406,7 +406,7 @@ void FWadWriter::WriteLump (const char *
+ 	WadLump lump;
+ 
+ 	strncpy (lump.Name, name, 8);
+-	lump.FilePos = LittleLong(ftell (File));
++	lump.FilePos = LittleLong((int)ftell (File));
+ 	lump.Size = LittleLong(len);
+ 	Lumps.Push (lump);
+ 


Home | Main Index | Thread Index | Old Index