Bug#371845: diff for 1.3.8-1.1 NMU
Steinar H. Gunderson
sesse at debian.org
Wed Jun 7 20:48:00 UTC 2006
Package: holotz-castle
Version: 1.3.8-1
Severity: normal
Tags: patch
Hi,
Attached is the diff for my holotz-castle 1.3.8-1.1 NMU.
-------------- next part --------------
diff -Nru /tmp/AgRYRmMDQ2/holotz-castle-1.3.8/debian/changelog /tmp/8F9fFLIO0J/holotz-castle-1.3.8/debian/changelog
--- /tmp/AgRYRmMDQ2/holotz-castle-1.3.8/debian/changelog 2006-06-07 22:47:40.000000000 +0200
+++ /tmp/8F9fFLIO0J/holotz-castle-1.3.8/debian/changelog 2006-06-07 22:47:41.000000000 +0200
@@ -1,3 +1,12 @@
+holotz-castle (1.3.8-1.1) unstable; urgency=low
+
+ * Non-maintainer upload.
+ * Fix warnings (treated as errors because of -Werror) about questionable
+ casts; fixes FTBFS with g++ 4.1, patch from Ben Hutchings.
+ (Closes: #357897)
+
+ -- Steinar H. Gunderson <sesse at debian.org> Wed, 7 Jun 2006 21:18:09 +0200
+
holotz-castle (1.3.8-1) unstable; urgency=low
* New Upstream Version.
diff -Nru /tmp/AgRYRmMDQ2/holotz-castle-1.3.8/JLib/JLib/Util/JFS.cpp /tmp/8F9fFLIO0J/holotz-castle-1.3.8/JLib/JLib/Util/JFS.cpp
--- /tmp/AgRYRmMDQ2/holotz-castle-1.3.8/JLib/JLib/Util/JFS.cpp 2006-01-20 13:59:37.000000000 +0100
+++ /tmp/8F9fFLIO0J/holotz-castle-1.3.8/JLib/JLib/Util/JFS.cpp 2006-06-07 22:47:41.000000000 +0200
@@ -1112,7 +1112,7 @@
// Lee los datos desde el formato adecuado
if (JFS_COMPRESSED(index[id]->res))
{
- if (0 == (size = resFile.ZRead((void **)&buff)))
+ if (0 == (size = resFile.ZRead(&buff)))
{
fprintf(stderr, "JFS::Export - Error reading compressed resource\n");
delete[] buff;
diff -Nru /tmp/AgRYRmMDQ2/holotz-castle-1.3.8/JLib/JLib/Util/JRW.cpp /tmp/8F9fFLIO0J/holotz-castle-1.3.8/JLib/JLib/Util/JRW.cpp
--- /tmp/AgRYRmMDQ2/holotz-castle-1.3.8/JLib/JLib/Util/JRW.cpp 2006-01-20 13:59:37.000000000 +0100
+++ /tmp/8F9fFLIO0J/holotz-castle-1.3.8/JLib/JLib/Util/JRW.cpp 2006-06-07 22:47:41.000000000 +0200
@@ -7,7 +7,7 @@
#include <JLib/Util/JRW.h>
-u32 JRW::ZRead(void **buff)
+u32 JRW::ZRead(u8 **buff)
{
u32 len, lenUncomp;
@@ -112,12 +112,9 @@
return 0;
}
- // For compatibility with zlib
- unsigned long sizeCompUL, sizeUL;
- sizeCompUL = sizeComp;
- sizeUL = size;
+ unsigned long sizeCompUL = sizeComp;
- if (Z_OK != compress2((Bytef*)buffComp, (uLongf*)&sizeComp, (Bytef*)buff, size, level))
+ if (Z_OK != compress2(buffComp, &sizeCompUL, static_cast<const Byte *>(buff), size, level))
{
delete[] buffComp;
return 0;
diff -Nru /tmp/AgRYRmMDQ2/holotz-castle-1.3.8/JLib/JLib/Util/JRW.h /tmp/8F9fFLIO0J/holotz-castle-1.3.8/JLib/JLib/Util/JRW.h
--- /tmp/AgRYRmMDQ2/holotz-castle-1.3.8/JLib/JLib/Util/JRW.h 2006-01-20 13:59:37.000000000 +0100
+++ /tmp/8F9fFLIO0J/holotz-castle-1.3.8/JLib/JLib/Util/JRW.h 2006-06-07 22:47:41.000000000 +0200
@@ -30,6 +30,8 @@
#ifndef _JRW_INCLUDED
#define _JRW_INCLUDED
+#include <string.h>
+
#include <JLib/Util/JTypes.h>
#include <JLib/Util/JObject.h>
#include <zlib.h>
@@ -139,7 +141,7 @@
* @param buff Buffer to fill with the read data uncompressed.
* @return Uncompressed size of the data.
*/
- u32 ZRead(void **buff);
+ u32 ZRead(u8 **buff);
/** Reads a bool data. The bool is stored as a single byte.
* @param buff Variable with the result.
@@ -195,6 +197,22 @@
*/
u32 ReadLE32(s32 *buff) {if (0 < SDL_RWread(rwops, buff, 4, 1)) {*buff = SDL_SwapLE32(*buff); return 4;} return 0;}
+ /** Reads 32-bit IEEE-754 float data in little- endian format.
+ * @param buff Variable with the result in the machine weight.
+ * @return Number of bytes read or 0 (zero) if an error occured.
+ */
+ u32 ReadLE32(float *fbuff)
+ {
+ typedef char static_assert[sizeof(u32) == sizeof(float) ? 1 : -1 ];
+ u32 ibuff;
+ if (ReadLE32(&ibuff) == 4)
+ {
+ memcpy(fbuff, &ibuff, sizeof(float));
+ return 4;
+ }
+ return 0;
+ }
+
/** Reads a 32-bit unsigned data in big-endian format.
* @param buff Variable with the result in the machine weight.
* @return Number of bytes read or 0 (zero) if an error occured.
@@ -284,6 +302,18 @@
*/
u32 WriteLE32(s32 *buff) {s32 v = SDL_SwapLE32(*buff); return SDL_RWwrite(rwops, &v, 4, 1);}
+ /** Writes a 32-bit IEEE-754 float data in little-endian format.
+ * @param buff Variable with the data in the machine weight.
+ * @return Number of bytes written or 0 (zero) if an error occured.
+ */
+ u32 WriteLE32(const float *fbuff)
+ {
+ typedef char static_assert[sizeof(u32) == sizeof(float) ? 1 : -1 ];
+ u32 ibuff;
+ memcpy(&ibuff, fbuff, sizeof(u32));
+ return WriteLE32(&ibuff);
+ }
+
/** Writes a 32-bit unsigned data in big-endian format.
* @param buff Variable with the data in the machine weight.
* @return Number of bytes written or 0 (zero) if an error occured.
diff -Nru /tmp/AgRYRmMDQ2/holotz-castle-1.3.8/JLib/JLib/Util/JTypes.h /tmp/8F9fFLIO0J/holotz-castle-1.3.8/JLib/JLib/Util/JTypes.h
--- /tmp/AgRYRmMDQ2/holotz-castle-1.3.8/JLib/JLib/Util/JTypes.h 2006-01-20 13:59:37.000000000 +0100
+++ /tmp/8F9fFLIO0J/holotz-castle-1.3.8/JLib/JLib/Util/JTypes.h 2006-06-07 22:47:41.000000000 +0200
@@ -85,10 +85,10 @@
// use the 8bit and 16bit macros listed here, and using any of the 32-bit macros in this case could
// translate in a segmentation fault during execution. Notice that he 'double' and 'long' types are normally
// twice the size of the architecture
-#define JCAST_8_TO_VOIDPTR(val) ((void *)size_t(*((u8 *)&(val))))
-#define JCAST_16_TO_VOIDPTR(val) ((void *)size_t(*((u16 *)&(val))))
-#define JCAST_32_TO_VOIDPTR(val) ((void *)size_t(*((u32 *)&(val))))
-#define JCAST_64_TO_VOIDPTR(val) ((void *)size_t(*((u64 *)&(val))))
+#define JCAST_8_TO_VOIDPTR(val) ((void *)(size_t)(val))
+#define JCAST_16_TO_VOIDPTR(val) ((void *)(size_t)(val))
+#define JCAST_32_TO_VOIDPTR(val) ((void *)(size_t)(val))
+#define JCAST_64_TO_VOIDPTR(val) ((void *)(size_t)(val))
#define JCAST_S8_TO_VOIDPTR(val) JCAST_8_TO_VOIDPTR((val))
#define JCAST_U8_TO_VOIDPTR(val) JCAST_8_TO_VOIDPTR((val))
@@ -101,7 +101,7 @@
#define JCAST_U64_TO_VOIDPTR(val) JCAST_64_TO_VOIDPTR((val))
#define JCAST_DOUBLE_TO_VOIDPTR(val) JCAST_64_TO_VOIDPTR((val))
-#define JCAST_VOIDPTR_TO_TYPE(p, type) (*((type *)&(p)))
+#define JCAST_VOIDPTR_TO_TYPE(p, type) ((type)(size_t)(p))
#define JCAST_VOIDPTR_TO_S8(p) JCAST_VOIDPTR_TO_TYPE(p, s8)
#define JCAST_VOIDPTR_TO_U8(p) JCAST_VOIDPTR_TO_TYPE(p, u8)
#define JCAST_VOIDPTR_TO_S16(p) JCAST_VOIDPTR_TO_TYPE(p, s16)
diff -Nru /tmp/AgRYRmMDQ2/holotz-castle-1.3.8/JLib/JLib/Util/JUtil.cpp /tmp/8F9fFLIO0J/holotz-castle-1.3.8/JLib/JLib/Util/JUtil.cpp
--- /tmp/AgRYRmMDQ2/holotz-castle-1.3.8/JLib/JLib/Util/JUtil.cpp 2006-01-20 13:59:37.000000000 +0100
+++ /tmp/8F9fFLIO0J/holotz-castle-1.3.8/JLib/JLib/Util/JUtil.cpp 2006-06-07 22:47:41.000000000 +0200
@@ -209,7 +209,6 @@
s->w, s->h, fmt->BitsPerPixel, fmt->colorkey, fmt->alpha,
s->flags & SDL_SRCALPHA ? "yes" : "no",
s->flags & SDL_SRCCOLORKEY ? "yes" : "no",
- s->flags & SDL_RLEACCEL ? "yes" : "no",
s->flags & SDL_RLEACCEL ? "yes" : "no");
fprintf(stderr,
"RGBAmask: R: 0x%08x G: 0x%08x B: 0x%08x A: 0x%08x\n",
diff -Nru /tmp/AgRYRmMDQ2/holotz-castle-1.3.8/src/HCCharacter.cpp /tmp/8F9fFLIO0J/holotz-castle-1.3.8/src/HCCharacter.cpp
--- /tmp/AgRYRmMDQ2/holotz-castle-1.3.8/src/HCCharacter.cpp 2006-01-20 13:59:38.000000000 +0100
+++ /tmp/8F9fFLIO0J/holotz-castle-1.3.8/src/HCCharacter.cpp 2006-06-07 22:47:41.000000000 +0200
@@ -873,10 +873,10 @@
u32 HCCharacter::Load(JRW &file)
{
if (0 == file.ReadLE32(&subtype) ||
- 0 == file.ReadLE32((u32 *)&pos.x) ||
- 0 == file.ReadLE32((u32 *)&pos.y) ||
- 0 == file.ReadLE32((u32 *)&vMax.x) ||
- 0 == file.ReadLE32((u32 *)&vMax.y) ||
+ 0 == file.ReadLE32(&pos.x) ||
+ 0 == file.ReadLE32(&pos.y) ||
+ 0 == file.ReadLE32(&vMax.x) ||
+ 0 == file.ReadLE32(&vMax.y) ||
0 == file.ReadLE32(&maxJumpRows))
{
fprintf(stderr, "Error reading character's common parameters.\n");
@@ -891,10 +891,10 @@
u32 HCCharacter::Save(JRW &file)
{
if (0 == file.WriteLE32(&subtype) ||
- 0 == file.WriteLE32((u32 *)&pos.x) ||
- 0 == file.WriteLE32((u32 *)&pos.y) ||
- 0 == file.WriteLE32((u32 *)&vMax.x) ||
- 0 == file.WriteLE32((u32 *)&vMax.y) ||
+ 0 == file.WriteLE32(&pos.x) ||
+ 0 == file.WriteLE32(&pos.y) ||
+ 0 == file.WriteLE32(&vMax.x) ||
+ 0 == file.WriteLE32(&vMax.y) ||
0 == file.WriteLE32(&maxJumpRows))
{
fprintf(stderr, "Error writing character's common parameters.\n");
diff -Nru /tmp/AgRYRmMDQ2/holotz-castle-1.3.8/src/HCEnemy.cpp /tmp/8F9fFLIO0J/holotz-castle-1.3.8/src/HCEnemy.cpp
--- /tmp/AgRYRmMDQ2/holotz-castle-1.3.8/src/HCEnemy.cpp 2006-01-20 13:59:38.000000000 +0100
+++ /tmp/8F9fFLIO0J/holotz-castle-1.3.8/src/HCEnemy.cpp 2006-06-07 22:47:41.000000000 +0200
@@ -130,7 +130,9 @@
u32 HCEnemy::Load(JRW &file, HCTheme &theme, HCMap *_map)
{
- if (0 == file.ReadLE32((s32 *)&type) ||
+ u32 typeNum;
+
+ if (0 == file.ReadLE32(&typeNum) ||
0 == file.ReadLE32(¶m1) ||
0 == file.ReadLE32(¶m2) ||
0 != HCCharacter::Load(file))
@@ -141,7 +143,7 @@
bool ret = false;
- switch (type)
+ switch (typeNum)
{
default:
case HCENEMYTYPE_BALL:
@@ -170,6 +172,8 @@
return 2;
}
+ type = HCEnemyType(typeNum);
+
// Adjusts the sprite's framerate according to 1st param
for (s32 i = 0; i < HCCS_COUNT; ++i)
{
@@ -181,7 +185,9 @@
u32 HCEnemy::Save(JRW &file)
{
- if (0 == file.WriteLE32((s32 *)&type) ||
+ u32 typeNum = type;
+
+ if (0 == file.WriteLE32(&typeNum) ||
0 == file.WriteLE32(¶m1) ||
0 == file.WriteLE32(¶m2) ||
0 != HCCharacter::Save(file))
diff -Nru /tmp/AgRYRmMDQ2/holotz-castle-1.3.8/src/HCLevel.cpp /tmp/8F9fFLIO0J/holotz-castle-1.3.8/src/HCLevel.cpp
--- /tmp/AgRYRmMDQ2/holotz-castle-1.3.8/src/HCLevel.cpp 2006-01-20 13:59:38.000000000 +0100
+++ /tmp/8F9fFLIO0J/holotz-castle-1.3.8/src/HCLevel.cpp 2006-06-07 22:47:41.000000000 +0200
@@ -406,7 +406,7 @@
for (s32 i = 0; i < numEnemies; ++i)
{
- if (0 != file.ReadLE32((s32 *)&enemyType))
+ if (0 != file.ReadLE32(&enemyType))
{
// Lets the file at ist original position
file.Seek(-4, SEEK_CUR);
diff -Nru /tmp/AgRYRmMDQ2/holotz-castle-1.3.8/src/HCMap.cpp /tmp/8F9fFLIO0J/holotz-castle-1.3.8/src/HCMap.cpp
--- /tmp/AgRYRmMDQ2/holotz-castle-1.3.8/src/HCMap.cpp 2006-01-20 13:59:38.000000000 +0100
+++ /tmp/8F9fFLIO0J/holotz-castle-1.3.8/src/HCMap.cpp 2006-06-07 22:47:41.000000000 +0200
@@ -387,7 +387,7 @@
Destroy();
// Loads the number of rows and cols, etc.
- if (0 == f.ReadLE32((u32 *)&gravity) ||
+ if (0 == f.ReadLE32(&gravity) ||
0 == f.ReadLE32(&rows) ||
0 == f.ReadLE32(&cols) ||
0 == f.ReadLE32(&exitRow) ||
@@ -472,7 +472,7 @@
u32 HCMap::Save(JRW &f)
{
// Saves the number of rows and cols, etc.
- if (0 == f.WriteLE32((u32 *)&gravity) ||
+ if (0 == f.WriteLE32(&gravity) ||
0 == f.WriteLE32(&rows) ||
0 == f.WriteLE32(&cols) ||
0 == f.WriteLE32(&exitRow) ||
diff -Nru /tmp/AgRYRmMDQ2/holotz-castle-1.3.8/src/HCObject.cpp /tmp/8F9fFLIO0J/holotz-castle-1.3.8/src/HCObject.cpp
--- /tmp/AgRYRmMDQ2/holotz-castle-1.3.8/src/HCObject.cpp 2006-01-20 13:59:38.000000000 +0100
+++ /tmp/8F9fFLIO0J/holotz-castle-1.3.8/src/HCObject.cpp 2006-06-07 22:47:41.000000000 +0200
@@ -82,8 +82,8 @@
u32 HCObject::Load(JRW &file)
{
if (0 == file.ReadLE32(&subtype) ||
- 0 == file.ReadLE32((u32 *)&pos.x) ||
- 0 == file.ReadLE32((u32 *)&pos.y))
+ 0 == file.ReadLE32(&pos.x) ||
+ 0 == file.ReadLE32(&pos.y))
{
fprintf(stderr, "Error loading the object.\n");
@@ -98,8 +98,8 @@
u32 HCObject::Save(JRW &file)
{
if (0 == file.WriteLE32(&subtype) ||
- 0 == file.WriteLE32((u32 *)&pos.x) ||
- 0 == file.WriteLE32((u32 *)&pos.y))
+ 0 == file.WriteLE32(&pos.x) ||
+ 0 == file.WriteLE32(&pos.y))
{
fprintf(stderr, "Error saving the object.\n");
diff -Nru /tmp/AgRYRmMDQ2/holotz-castle-1.3.8/src/HCRope.cpp /tmp/8F9fFLIO0J/holotz-castle-1.3.8/src/HCRope.cpp
--- /tmp/AgRYRmMDQ2/holotz-castle-1.3.8/src/HCRope.cpp 2006-01-20 13:59:38.000000000 +0100
+++ /tmp/8F9fFLIO0J/holotz-castle-1.3.8/src/HCRope.cpp 2006-06-07 22:47:41.000000000 +0200
@@ -127,12 +127,12 @@
u32 HCRope::Load(JRW &file)
{
- if (0 == file.ReadLE32((u32 *)&period) ||
+ if (0 == file.ReadLE32(&period) ||
0 == file.ReadLE32(&litude) ||
0 == file.ReadLE32(&length) ||
0 == file.ReadLE32(&subtype) ||
- 0 == file.ReadLE32((u32 *)&pos.x) ||
- 0 == file.ReadLE32((u32 *)&pos.y))
+ 0 == file.ReadLE32(&pos.x) ||
+ 0 == file.ReadLE32(&pos.y))
{
fprintf(stderr, "Error reading rope parameters.\n");
@@ -161,12 +161,12 @@
u32 HCRope::Save(JRW &file)
{
- if (0 == file.WriteLE32((u32 *)&period) ||
+ if (0 == file.WriteLE32(&period) ||
0 == file.WriteLE32(&litude) ||
0 == file.WriteLE32(&length) ||
0 == file.WriteLE32(&subtype) ||
- 0 == file.WriteLE32((u32 *)&pos.x) ||
- 0 == file.WriteLE32((u32 *)&pos.y))
+ 0 == file.WriteLE32(&pos.x) ||
+ 0 == file.WriteLE32(&pos.y))
{
fprintf(stderr, "Error writing rope parameters.\n");
More information about the Pkg-games-devel
mailing list