[Freeciv-Dev] (PR#2910) Warning and Errors for compiling SDL client on T
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
undisclosed-recipients:; |
Subject: |
[Freeciv-Dev] (PR#2910) Warning and Errors for compiling SDL client on Tru64 Unix |
From: |
"Davide Pagnin via RT" <rt@xxxxxxxxxxxxxx> |
Date: |
Sun, 26 Jan 2003 09:32:57 -0800 |
Reply-to: |
rt@xxxxxxxxxxxxxx |
Hi all!
I've just managed to compile sdl-client on an alpha processero with
Tru64 Unix 5.1A operating system.
Beside the problems to compile and install SDL.
I've faced some warnings or errors in the client/gui-sdl code.
There are 2 types of errors:
1. assert(p), with p pointer, class of errors, which I've addressed also
in another bug report.
2. &((SDL_Rect){ 0, x, y, 0}) parameter passed to a function
The first type, is only a warning, an is easily solved by changing the
code to:
assert(p!=NULL)
The second one, trigger a compilation error.
NOTE: Also on my RedHat 7.3, with gcc 2.96 compiler, the same error is
trigger, thus it is not a weird problem of the cc compiler of compaq.
To solve the problem, that is caused by the implicit assignment of a
value (that is dynamicly calculated) at the moment of declaration of an
array, we need to agree to not use such construct.
I attach a patch that will solve both the problems.
NOTE: There is another part of code, where a similar construct as #2 is
used, but in that case it is used &((SDL_Color) {0,0,0,0}) and then the
implicit assignment is static and triggers no errors.
Nevertheless I deprecate the use of such implicit declaration of
variables, and I think we should change also this one.
Let me know.
Ciao, Davide
diff -ur -Xfreeciv/diff_ignore freeciv/client/gui-sdl/chatline.c
freeciv-sdl/client/gui-sdl/chatline.c
--- freeciv/client/gui-sdl/chatline.c Fri Jan 24 14:50:18 2003
+++ freeciv-sdl/client/gui-sdl/chatline.c Sun Jan 26 16:26:31 2003
@@ -316,12 +316,11 @@
**************************************************************************/
static void scaling(Uint16 new_count)
{
- float fStep, fStep10;
+ float fStep;
struct GUI *pVert =
get_widget_pointer_form_main_list(ID_CHATLINE_VSCROLLBAR);
fStep = maxpix / (new_count - 1);
- fStep10 = maxpix / log10(new_count);
if (pVert->size.h > 10) {
if (tmp) {
tmp -= fStep * 0.5;
diff -ur -Xfreeciv/diff_ignore freeciv/client/gui-sdl/dialogs.c
freeciv-sdl/client/gui-sdl/dialogs.c
--- freeciv/client/gui-sdl/dialogs.c Fri Jan 24 14:50:18 2003
+++ freeciv-sdl/client/gui-sdl/dialogs.c Sun Jan 26 16:26:31 2003
@@ -1323,12 +1323,13 @@
if ( pBuf->ID == ID_SEPARATOR )
{
+ SDL_Rect rect = { 10, 0, 0, 2 };
FREESURFACE( pBuf->theme );
pBuf->size.h = h;
pBuf->theme = create_surf( w , h , SDL_SWSURFACE );
- SDL_FillRect( pBuf->theme ,
- &((SDL_Rect){ 10 , pBuf->size.h / 2 - 1 , pBuf->size.w - 20 , 2}),
- 0x64 );
+ rect.y = pBuf->size.h / 2 - 1;
+ rect.w = pBuf->size.w - 20;
+ SDL_FillRect( pBuf->theme , &rect, 0x64 );
SDL_SetColorKey( pBuf->theme , SDL_SRCCOLORKEY|SDL_RLEACCEL , 0x0 );
}
diff -ur -Xfreeciv/diff_ignore freeciv/client/gui-sdl/gui_tilespec.c
freeciv-sdl/client/gui-sdl/gui_tilespec.c
--- freeciv/client/gui-sdl/gui_tilespec.c Sun Jan 19 12:39:47 2003
+++ freeciv-sdl/client/gui-sdl/gui_tilespec.c Sun Jan 26 16:26:31 2003
@@ -159,7 +159,7 @@
my_snprintf(cBuf, sizeof(cBuf) ,"%s%s", pDataPath,
"theme/default/city_icons.png");
pBuf = load_surf(cBuf);
- assert( pBuf );
+ assert(pBuf != NULL);
crop_rect.x = 1;
crop_rect.y = 1;
@@ -266,7 +266,7 @@
my_snprintf(cBuf, sizeof(cBuf) ,"%s%s", pDataPath,
"theme/default/city_pollution.png");
pIcons->pPollution = load_surf(cBuf);
- assert( pIcons->pPollution );
+ assert(pIcons->pPollution != NULL);
SDL_SetColorKey(pIcons->pPollution, SDL_SRCCOLORKEY | SDL_RLEACCEL,
getpixel(pIcons->pPollution, 0, 0));
@@ -275,7 +275,7 @@
pIcons->pPolice = load_surf(cBuf);
- assert( pIcons->pPolice );
+ assert(pIcons->pPolice != NULL);
SDL_SetColorKey(pIcons->pPolice, SDL_SRCCOLORKEY | SDL_RLEACCEL,
getpixel(pIcons->pPolice, 1, 0));
@@ -626,7 +626,7 @@
my_snprintf(buf,sizeof(buf), "%s/theme/default/dither_mask.png", pDataPath
);
pDitherMask = load_surf(buf);
- assert(pDitherMask);
+ assert(pDitherMask != NULL);
return;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#2910) Warning and Errors for compiling SDL client on Tru64 Unix,
Davide Pagnin via RT <=
|
|