<URL: http://bugs.freeciv.org/Ticket/Display.html?id=39906 >
On IRC a number of errors were reported in compiling gui-sdl on beos with gcc 2.95. This patch should fix the problems in the gui-sdl code. Most errors are simply caused by declaring variables mid-function. This is supported in C99 but still not a freeciv standard (no configure check for it). One other place in colors.h had a function header that didn't match the function declaration. This is simply fixed. Patch for 2.1; it doesn't quite commit cleanly to trunk. -jason
Index: client/gui-sdl/citydlg.c =================================================================== --- client/gui-sdl/citydlg.c (revision 14048) +++ client/gui-sdl/citydlg.c (working copy) @@ -1566,9 +1566,7 @@ (float)adj_size(249) / pBuf->w : (float)adj_size(159) / pBuf->h); - SDL_Surface *pRet = zoomSurface(pBuf, city_map_zoom, city_map_zoom, 1); - - return pRet; + return zoomSurface(pBuf, city_map_zoom, city_map_zoom, 1); } /************************************************************************** Index: client/gui-sdl/mapview.c =================================================================== --- client/gui-sdl/mapview.c (revision 14048) +++ client/gui-sdl/mapview.c (working copy) @@ -381,18 +381,22 @@ SDL_Surface *pTmp = NULL; char buffer[512]; +#ifdef SMALL_SCREEN + SDL_Rect area = {0, 0, 0, 0}; +#else + SDL_Rect area = {0, 3, 0, 0}; +#endif + SDL_String16 *pText; if (get_client_page() != PAGE_GAME) { return; } - #ifdef SMALL_SCREEN - SDL_Rect area = {0, 0, 0, 0}; - SDL_String16 *pText = create_string16(NULL, 0, 8); - #else - SDL_Rect area = {0, 3, 0, 0}; - SDL_String16 *pText = create_string16(NULL, 0, 10); - #endif +#ifdef SMALL_SCREEN + pText = create_string16(NULL, 0, 8); +#else + pText = create_string16(NULL, 0, 10); +#endif /* set text settings */ pText->style |= TTF_STYLE_BOLD; Index: client/gui-sdl/themespec.c =================================================================== --- client/gui-sdl/themespec.c (revision 14048) +++ client/gui-sdl/themespec.c (working copy) @@ -690,6 +690,7 @@ char *file_capstr; bool duplicates_ok; struct theme *t = theme_new(); + char *langname; fname = themespec_fullname(theme_name); if (!fname) { @@ -722,7 +723,7 @@ sz_strlcpy(t->name, theme_name); t->priority = secfile_lookup_int(file, "themespec.priority"); - char *langname = get_langname(); + langname = get_langname(); if (langname) { if (strstr(langname, "zh_CN") != NULL) { c = secfile_lookup_str(file, "themespec.font_file_zh_CN"); Index: client/gui-sdl/widget_button.c =================================================================== --- client/gui-sdl/widget_button.c (revision 14048) +++ client/gui-sdl/widget_button.c (working copy) @@ -229,6 +229,7 @@ { int iRet = 0; SDL_Surface *pIcon; + SDL_Surface *pCopy_Of_Icon_Theme; iRet = (*baseclass_redraw)(pTIButton); if (iRet != 0) { @@ -236,7 +237,7 @@ } pIcon = create_icon_from_theme(pTIButton->theme2, get_wstate(pTIButton)); - SDL_Surface *pCopy_Of_Icon_Theme = pTIButton->theme2; + pCopy_Of_Icon_Theme = pTIButton->theme2; pTIButton->theme2 = pIcon; Index: client/gui-sdl/dialogs.c =================================================================== --- client/gui-sdl/dialogs.c (revision 14048) +++ client/gui-sdl/dialogs.c (working copy) @@ -2667,7 +2667,8 @@ float zoom; struct NAT *pSetup; SDL_Rect area; - + int i; + #define TARGETS_ROW 5 #define TARGETS_COL 1 @@ -2836,7 +2837,7 @@ add_to_gui_list(ID_NATION_WIZARD_CHANGE_SEX_BUTTON, pWidget); /* ---------------------------------------------------------- */ - int i = 0; + i = 0; zoom = DEFAULT_ZOOM * 1.0; while (i < game.control.styles_count) { if (!city_style_has_requirements(&city_styles[i])) { Index: client/gui-sdl/graphics.c =================================================================== --- client/gui-sdl/graphics.c (revision 14048) +++ client/gui-sdl/graphics.c (working copy) @@ -3689,12 +3689,12 @@ Uint16 new_width, Uint16 new_height, int smooth, bool scale_up, bool absolute_dimensions) { + SDL_Surface *tmpSurface, *result; + if (pSrc == NULL) { return NULL; } - SDL_Surface *tmpSurface, *result; - if (!((scale_up == FALSE) && ((new_width >= pSrc->w) && (new_height >= pSrc->h)))) { if ((new_width - pSrc->w) <= (new_height - pSrc->h)) { /* horizontal limit */ @@ -3717,12 +3717,12 @@ } if (absolute_dimensions) { - result = create_surf_alpha(new_width, new_height, SDL_SWSURFACE); SDL_Rect area = { (new_width - tmpSurface->w) / 2, (new_height - tmpSurface->h) / 2, 0, 0 }; + result = create_surf_alpha(new_width, new_height, SDL_SWSURFACE); alphablit(tmpSurface, NULL, result, &area); FREESURFACE(tmpSurface); } else { Index: client/gui-sdl/inteldlg.c =================================================================== --- client/gui-sdl/inteldlg.c (revision 14048) +++ client/gui-sdl/inteldlg.c (working copy) @@ -203,6 +203,7 @@ int i, n = 0, count = 0, col; struct city *pCapital; SDL_Rect area; + struct player_research* research; if (pdialog) { @@ -276,7 +277,7 @@ /* ---------- */ pCapital = find_palace(p); - struct player_research* research = get_player_research(p); + research = get_player_research(p); change_ptsize16(pStr, adj_font(10)); pStr->style &= ~TTF_STYLE_BOLD; if (research->researching != A_UNKNOWN) { Index: client/gui-sdl/colors.h =================================================================== --- client/gui-sdl/colors.h (revision 14048) +++ client/gui-sdl/colors.h (working copy) @@ -31,6 +31,6 @@ }; struct color *color_alloc_rgba(int r, int g, int b, int a); -SDL_Color * get_game_colorRGB(Uint32 color_offset); +SDL_Color * get_game_colorRGB(enum color_std color_offset); #endif /* FC__COLORS_H */ Index: client/gui-sdl/chatline.c =================================================================== --- client/gui-sdl/chatline.c (revision 14048) +++ client/gui-sdl/chatline.c (working copy) @@ -712,6 +712,7 @@ SDL_String16 *pStr = NULL; int n; SDL_Rect area; + SDL_Surface *pSurf; if (pConnDlg || !aconnection.established) { return; @@ -732,7 +733,7 @@ widget_set_position(pWindow, 0, 0); /* create window background */ - SDL_Surface *pSurf = theme_get_background(theme, BACKGROUND_CONNLISTDLG); + pSurf = theme_get_background(theme, BACKGROUND_CONNLISTDLG); if (resize_window(pWindow, pSurf, NULL, Main.screen->w, Main.screen->h)) { FREESURFACE(pSurf); } Index: client/gui-sdl/wldlg.c =================================================================== --- client/gui-sdl/wldlg.c (revision 14048) +++ client/gui-sdl/wldlg.c (working copy) @@ -363,8 +363,9 @@ /* Get Help Info about target */ static void get_target_help_data(struct widget *pTarget) { + struct city_production prod; + assert(pTarget != NULL); - struct city_production prod; /* redraw Target Icon */ set_wstate(pTarget, FC_WS_SELLECTED); @@ -993,6 +994,7 @@ bool advanced_tech; bool can_build, can_eventually_build; SDL_Rect area; + struct worklist *worklist; if(pEditor) { return; @@ -1178,7 +1180,7 @@ count = 0; - struct worklist *worklist = pWorkList; + worklist = pWorkList; worklist_iterate(worklist, prod) { Index: client/gui-sdl/connectdlg.c =================================================================== --- client/gui-sdl/connectdlg.c (revision 14048) +++ client/gui-sdl/connectdlg.c (working copy) @@ -188,6 +188,7 @@ static struct server_list *sdl_create_server_list(bool lan) { struct server_list *server_list = NULL; + int i; if (lan) { pServer_scan = server_scan_begin(SERVER_SCAN_LOCAL, server_scan_error); @@ -201,7 +202,6 @@ SDL_Delay(5000); - int i; for (i = 0; i < 100; i++) { server_list = server_scan_get_servers(pServer_scan); if (server_list) { Index: client/gui-sdl/widget_scrollbar.c =================================================================== --- client/gui-sdl/widget_scrollbar.c (revision 14048) +++ client/gui-sdl/widget_scrollbar.c (working copy) @@ -138,15 +138,16 @@ { int ret; SDL_Rect dest = pVert->size; + SDL_Surface *pVert_Surf; ret = (*baseclass_redraw)(pVert); if (ret != 0) { return ret; } - SDL_Surface *pVert_Surf = create_vertical_surface(pVert->theme, - get_wstate(pVert), - pVert->size.h); + pVert_Surf = create_vertical_surface(pVert->theme, + get_wstate(pVert), + pVert->size.h); ret = blit_entire_src(pVert_Surf, pVert->dst->surface, dest.x, dest.y); @@ -278,15 +279,16 @@ { int ret; SDL_Rect dest = pHoriz->size; + SDL_Surface *pHoriz_Surf; ret = (*baseclass_redraw)(pHoriz); if (ret != 0) { return ret; } - SDL_Surface *pHoriz_Surf = create_horizontal_surface(pHoriz->theme, - get_wstate(pHoriz), - pHoriz->size.w); + pHoriz_Surf = create_horizontal_surface(pHoriz->theme, + get_wstate(pHoriz), + pHoriz->size.w); ret = blit_entire_src(pHoriz_Surf, pHoriz->dst->surface, dest.x, dest.y); FREESURFACE(pHoriz_Surf); Index: client/gui-sdl/widget_checkbox.c =================================================================== --- client/gui-sdl/widget_checkbox.c (revision 14048) +++ client/gui-sdl/widget_checkbox.c (working copy) @@ -142,6 +142,7 @@ struct widget *pCBox; struct CHECKBOX *pTmp; SDL_Surface *pSurf, *pIcon; + struct widget *pTmpWidget; if (!pStr) { return create_checkbox(pDest, state, flags); @@ -169,7 +170,7 @@ pTmp->pFALSE_Theme = pTheme->CBOX_Unsell_Icon; pCBox->private_data.cbox = pTmp; - struct widget *pTmpWidget = widget_new(); + pTmpWidget = widget_new(); /* we can't use pCBox->redraw here, because it is of type iconlabel */ textcheckbox_baseclass_redraw = pTmpWidget->redraw; FREEWIDGET(pTmpWidget);
_______________________________________________ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev