[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-gnubg] AMD64 fixes for 0.14.3
From: |
Russ Allbery |
Subject: |
[Bug-gnubg] AMD64 fixes for 0.14.3 |
Date: |
Mon, 20 Mar 2006 20:14:51 -0800 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) XEmacs/21.4.18 (linux) |
The following patch was required for a pure-64 AMD64 build to not segfault
shorly after startup. Fixes int vs. size_t mismatches, size of pointer
vs. size of float, and size of pointer vs. size of int mismatches.
Index: gnubg/board3d/misc3d.c
===================================================================
--- gnubg.orig/board3d/misc3d.c 2006-03-11 14:43:08.000000000 -0800
+++ gnubg/board3d/misc3d.c 2006-03-18 14:17:25.000000000 -0800
@@ -787,10 +787,10 @@ void initDT(diceTest* dt, int x, int y,
float ***Alloc3d(int x, int y, int z)
{ /* Allocate 3d array */
int i, j;
- float ***array = (float ***)malloc(sizeof(float) * x);
+ float ***array = (float ***)malloc(sizeof(float **) * x);
for (i = 0; i < x; i++)
{
- array[i] = (float **)malloc(sizeof(float) * y);
+ array[i] = (float **)malloc(sizeof(float *) * y);
for (j = 0; j < y; j++)
array[i][j] = (float *)malloc(sizeof(float) * z);
}
Index: gnubg/gnubg.c
===================================================================
--- gnubg.orig/gnubg.c 2006-03-11 14:43:08.000000000 -0800
+++ gnubg/gnubg.c 2006-03-18 14:17:25.000000000 -0800
@@ -8971,7 +8971,8 @@ Convert ( const char *sz,
#if HAVE_ICONV
iconv_t id;
- int lIn, lOut, l, rc, nUsed;
+ size_t lIn, lOut, l;
+ int rc, nUsed;
#if WIN32
const char *pchIn;
#else
Index: gnubg/renderprefs.c
===================================================================
--- gnubg.orig/renderprefs.c 2006-03-18 14:23:29.000000000 -0800
+++ gnubg/renderprefs.c 2006-03-18 14:23:55.000000000 -0800
@@ -158,7 +158,7 @@ static int SetColourF( float arColour[ 4
#endif /* USE_GTK */
#if USE_BOARD3D
-static int SetMaterialCommon(Material* pMat, char *sz)
+static int SetMaterialCommon(Material* pMat, char *sz, char **newsz)
{
float opac;
char* pch;
@@ -206,38 +206,45 @@ static int SetMaterialCommon(Material* p
{
sz += strlen(sz) + 1;
if (sz && *sz)
- return (int)sz;
+ {
+ *newsz = sz;
+ return 1;
+ }
}
return 0;
}
static int SetMaterial(Material* pMat, char *sz)
{
+ int status = (sz != NULL);
+
if (fX)
{
- sz = (char*)SetMaterialCommon(pMat, sz);
+ status = SetMaterialCommon(pMat, sz, &sz);
pMat->textureInfo = 0;
pMat->pTexture = 0;
- if (sz > 0)
+ if (status > 0)
{
FindTexture(&pMat->textureInfo, sz);
- sz = 0;
+ status = 0;
}
}
- return (int)sz;
+ return status;
}
static int SetMaterialDice(Material* pMat, char *sz, int* flag)
{
- sz = (char*)SetMaterialCommon(pMat, sz);
+ int status;
+
+ status = SetMaterialCommon(pMat, sz, &sz);
/* die colour same as chequer colour */
*flag = TRUE;
- if (sz > 0)
+ if (status > 0)
{
*flag = (toupper(*sz) == 'Y');
- sz = 0;
+ status = 0;
}
- return (int)sz;
+ return status;
}
#endif
--
Russ Allbery (address@hidden) <http://www.eyrie.org/~eagle/>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug-gnubg] AMD64 fixes for 0.14.3,
Russ Allbery <=