r4246 - in packages/trunk/hex-a-hop/debian: . patches
Jens Seidel
jseidel-guest at alioth.debian.org
Wed Sep 19 20:43:02 UTC 2007
Author: jseidel-guest
Date: 2007-09-19 20:43:02 +0000 (Wed, 19 Sep 2007)
New Revision: 4246
Modified:
packages/trunk/hex-a-hop/debian/changelog
packages/trunk/hex-a-hop/debian/patches/endianess.patch
packages/trunk/hex-a-hop/debian/patches/misc_errors.patch
Log:
Fixed a build error on m68k because of a wrong alignment test.
Closes: #442854
Modified: packages/trunk/hex-a-hop/debian/changelog
===================================================================
--- packages/trunk/hex-a-hop/debian/changelog 2007-09-19 15:38:08 UTC (rev 4245)
+++ packages/trunk/hex-a-hop/debian/changelog 2007-09-19 20:43:02 UTC (rev 4246)
@@ -10,8 +10,10 @@
* Fix compilation error on the Hurd where PATH_MAX is not defined.
* A string was not translateable. Thanks to Piotr Engelking
<inkerman42 at gmail.com> for the patch. Closes: 443193
+ * Fixed a build error on m68k because of a wrong alignment test.
+ Closes: #442854
- -- Jens Seidel <jensseidel at users.sf.net> Wed, 19 Sep 2007 17:30:00 +0200
+ -- Jens Seidel <jensseidel at users.sf.net> Wed, 19 Sep 2007 22:30:00 +0200
hex-a-hop (0.0.20070315-5) unstable; urgency=low
Modified: packages/trunk/hex-a-hop/debian/patches/endianess.patch
===================================================================
--- packages/trunk/hex-a-hop/debian/patches/endianess.patch 2007-09-19 15:38:08 UTC (rev 4245)
+++ packages/trunk/hex-a-hop/debian/patches/endianess.patch 2007-09-19 20:43:02 UTC (rev 4246)
@@ -6,7 +6,7 @@
===================================================================
--- hex-a-hop.svn.orig/packfile.h 2007-09-09 18:28:14.000000000 +0200
+++ hex-a-hop.svn/packfile.h 2007-09-09 19:16:58.000000000 +0200
-@@ -16,11 +16,23 @@
+@@ -16,11 +16,21 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
@@ -23,23 +23,13 @@
struct PackFile1
{
-+ /* CHECKME: Is it save to interpret a byte stream as list of Entries?
-+ * Does the alignment could increase the Entry size on 64 bit systems? */
class Entry {
- int len;
+ int32_t len;
public:
char name[1];
-@@ -42,6 +54,7 @@
- return len - strlen(name) - 1;
- }
- };
-+ int static_assert1[sizeof(Entry)==8 ? 0 : -1];
-
- int numfiles;
- Entry** e;
-@@ -73,10 +86,11 @@
+@@ -73,10 +83,11 @@
if (numfiles || e || data)
FATAL("Calling Packfile1::Read when already initialised.");
@@ -52,7 +42,7 @@
fseek(f, end_offset - size, SEEK_SET);
data = malloc(size);
-@@ -88,10 +102,12 @@
+@@ -88,10 +99,12 @@
while ((void*)i < data_end)
{
numfiles++;
@@ -145,7 +135,7 @@
diff = 0;
#ifdef USE_LEVEL_PACKFILE
-@@ -1902,13 +1914,18 @@ struct HexPuzzle : public State
+@@ -1902,13 +1910,18 @@ struct HexPuzzle : public State
return false;
}
@@ -165,7 +155,7 @@
if (save)
fprintf(f, "%d\n", version);
else
-@@ -1935,13 +1952,26 @@
+@@ -1935,13 +1948,26 @@
if (version==1)
{
for (int i=0; i<MAP_SIZE; i++)
@@ -193,7 +183,7 @@
}
else if (version>=2 && version<=4)
{
-@@ -1966,18 +1996,28 @@
+@@ -1966,18 +1992,28 @@
memset(map_item, 0, sizeof(map_item));
}
@@ -224,7 +214,7 @@
int offsetx=0, offsety=0;
-@@ -2016,24 +2056,27 @@
+@@ -2016,24 +2052,27 @@
for (int j=bounds[2]; j<=bounds[3]; j++)
if (special[i][j])
{
@@ -254,7 +244,7 @@
if (len<0) break;
char* tmp = new char[len+1];
tmp[len] = 0;
-@@ -2398,10 +2441,12 @@
+@@ -2398,10 +2437,12 @@
FILE* f = file_open(bmp, "rb");
if (!f) FATAL("Unable to open file", bmp);
@@ -269,7 +259,7 @@
tmp = new uint32[(int)w*h];
-@@ -2414,9 +2459,12 @@
+@@ -2414,9 +2455,12 @@
else
{
fread(&c, sizeof(c), 1, f);
Modified: packages/trunk/hex-a-hop/debian/patches/misc_errors.patch
===================================================================
--- packages/trunk/hex-a-hop/debian/patches/misc_errors.patch 2007-09-19 15:38:08 UTC (rev 4245)
+++ packages/trunk/hex-a-hop/debian/patches/misc_errors.patch 2007-09-19 20:43:02 UTC (rev 4246)
@@ -2,7 +2,7 @@
===================================================================
--- hex-a-hop.svn.orig/hex_puzzzle.cpp 2007-09-10 00:24:40.000000000 +0200
+++ hex-a-hop.svn/hex_puzzzle.cpp 2007-09-10 00:24:43.000000000 +0200
-@@ -610,8 +610,8 @@
+@@ -614,8 +614,8 @@
{
if (currentStage > 0 && numStages > 0)
{
@@ -33,3 +33,45 @@
currentLevelInfo = GetLevelInfo(currentFile);
loadPtr = (char*)e->Data();
+Index: hex-a-hop/packfile.h
+===================================================================
+--- hex-a-hop.orig/packfile.h
++++ hex-a-hop/packfile.h
+@@ -29,9 +29,22 @@
+
+ struct PackFile1
+ {
++ /* Is it *NOT* save to interpret a byte stream as list of Entries!
++ * The alignment could increase the Entry size on some systems without attribute.
++ *
++ * It works on: i386, amd64, mips o32 ABI, powerPC
++ * Maybe it's also compiler dependent ...
++ *
++ * See also http://c-faq.com/struct/padding.html,
++ * http://c-faq.com/strangeprob/ptralign.html and Debian bug #442854
++ * (Need to refer to a C FAQ in a (so called) C++ program, argh ...)
++ * */
+ class Entry {
+ int32_t len;
+ public:
++ // an array of size 1 (no char* pointer!) is saved after len,
++ // accessing name[0] should (but doesn't always) fit the first byte after len
++ // See e.g. http://c-faq.com/aryptr/index.html
+ char name[1];
+
+ Entry* GetNext()
+@@ -51,7 +64,13 @@ struct PackFile1
+ {
+ return len - strlen(name) - 1;
+ }
+- };
++ }
++#ifdef __GNUC__
++ __attribute__ ((__packed__));
++ int static_assert1[sizeof(Entry)==5 ? 0 : -1];
++#else
++ int static_assert1[sizeof(Entry)<=8 ? 0 : -1];
++#endif
+
+ int numfiles;
+ Entry** e;
More information about the Pkg-games-commits
mailing list