Re: clang6 fix games/einstein
Hi, The previous diff overwrote existing patches, here's revised diff. timo Index: patches/patch-font_cpp === RCS file: patches/patch-font_cpp diff -N patches/patch-font_cpp --- /dev/null 1 Jan 1970 00:00:00 - +++ patches/patch-font_cpp 11 Apr 2018 05:03:23 - @@ -0,0 +1,26 @@ +$OpenBSD$ + +Index: font.cpp +--- font.cpp.orig font.cpp +@@ -67,15 +67,15 @@ void Font::draw(SDL_Surface *s, int x, int y, int r, i + if (shadow) { + SDL_Color color = { 1, 1, 1, 1 }; + SDL_Surface *surface = TTF_RenderUNICODE_Blended(font, str, color); +-SDL_Rect src = { 0, 0, surface->w, surface->h }; +-SDL_Rect dst = { x+1, y+1, surface->w, surface->h }; ++SDL_Rect src = { 0, 0, static_cast(surface->w), static_cast(surface->h) }; ++SDL_Rect dst = { static_cast(x+1), static_cast(y+1), static_cast(surface->w), static_cast(surface->h) }; + SDL_BlitSurface(surface, , s, ); + SDL_FreeSurface(surface); + } +-SDL_Color color = { r, g, b, 0 }; ++SDL_Color color = { static_cast(r), static_cast(g), static_cast(b), 0 }; + SDL_Surface *surface = TTF_RenderUNICODE_Blended(font, str, color); +-SDL_Rect src = { 0, 0, surface->w, surface->h }; +-SDL_Rect dst = { x, y, surface->w, surface->h }; ++SDL_Rect src = { 0, 0, static_cast(surface->w), static_cast(surface->h) }; ++SDL_Rect dst = { static_cast(x), static_cast(y), static_cast(surface->w), static_cast(surface->h) }; + SDL_BlitSurface(surface, , s, ); + SDL_FreeSurface(surface); + } Index: patches/patch-game_cpp === RCS file: patches/patch-game_cpp diff -N patches/patch-game_cpp --- /dev/null 1 Jan 1970 00:00:00 - +++ patches/patch-game_cpp 11 Apr 2018 05:03:23 - @@ -0,0 +1,19 @@ +$OpenBSD$ + +Index: game.cpp +--- game.cpp.orig game.cpp +@@ -139,7 +139,12 @@ void Watch::draw() + int y = 24; + int w, h; + font->getSize(s, w, h); +-SDL_Rect rect = { x-2, y-2, w+4, h+4 }; ++SDL_Rect rect = { ++static_cast(x-2), ++static_cast(y-2), ++static_cast(w+4), ++static_cast(h+4) ++}; + SDL_FillRect(screen.getSurface(), , + SDL_MapRGB(screen.getSurface()->format, 0, 0, 255)); + font->draw(x, y, 255,255,255, true, s); Index: patches/patch-topscores_cpp === RCS file: patches/patch-topscores_cpp diff -N patches/patch-topscores_cpp --- /dev/null 1 Jan 1970 00:00:00 - +++ patches/patch-topscores_cpp 11 Apr 2018 05:03:23 - @@ -0,0 +1,14 @@ +$OpenBSD$ + +Index: topscores.cpp +--- topscores.cpp.orig topscores.cpp +@@ -122,7 +122,7 @@ ScoresWindow::ScoresWindow(int x, int y, TopScores *sc + int w = entryFont.getWidth(s); + int c = ((no - 1) == highlight) ? 0 : 255; + entryFont.draw(background, 30 - w, pos, 255,255,c, true, s); +-SDL_Rect rect = { 40, pos-20, 180, 40 }; ++SDL_Rect rect = { 40, static_cast(pos-20), 180, 40 }; + SDL_SetClipRect(background, ); + entryFont.draw(background, 40, pos, 255,255,c, true, e.name); + SDL_SetClipRect(background, NULL); Index: patches/patch-utils_cpp === RCS file: /cvs/ports/games/einstein/patches/patch-utils_cpp,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 patch-utils_cpp --- patches/patch-utils_cpp 3 Apr 2009 17:56:41 - 1.1.1.1 +++ patches/patch-utils_cpp 11 Apr 2018 05:03:23 - @@ -1,6 +1,18 @@ $OpenBSD: patch-utils_cpp,v 1.1.1.1 2009/04/03 17:56:41 landry Exp $ utils.cpp.orig Thu Apr 2 09:00:22 2009 -+++ utils.cpp Thu Apr 2 09:14:42 2009 +Index: utils.cpp +--- utils.cpp.orig utils.cpp +@@ -101,8 +101,8 @@ int gettimeofday(struct timeval* tp) + void drawWallpaper(const std::wstring ) + { + SDL_Surface *tile = loadImage(name); +-SDL_Rect src = { 0, 0, tile->w, tile->h }; +-SDL_Rect dst = { 0, 0, tile->w, tile->h }; ++SDL_Rect src = { 0, 0, static_cast(tile->w), static_cast(tile->h) }; ++SDL_Rect dst = { 0, 0, static_cast(tile->w), static_cast(tile->h) }; + for (int y = 0; y < screen.getHeight(); y += tile->h) + for (int x = 0; x < screen.getWidth(); x += tile->w) { + dst.x = x; @@ -275,7 +275,16 @@ std::wstring secToStr(int time) #ifdef WIN32 swprintf(buf, L"%02i:%02i:%02i", hours, minutes, seconds); Index: patches/patch-widgets_cpp === RCS file: patches/patch-widgets_cpp diff -N patches/patch-widgets_cpp --- /dev/null 1 Jan 1970 00:00:00 - +++ patches/patch-widgets_cpp 11 Apr 2018 05:03:23 - @@ -0,0 +1,80 @@ +$OpenBSD$ + +Index: widgets.cpp +--- widgets.cpp.orig widgets.cpp +@@ -38,8 +38,8 @@ Button::Button(int x, int y, int w, int h, Font
clang6 fix games/einstein
Hi, Here's few casts to fix einstein compilation. Running the game seems to work as well. timo Index: patches/patch-font_cpp === RCS file: patches/patch-font_cpp diff -N patches/patch-font_cpp --- /dev/null 1 Jan 1970 00:00:00 - +++ patches/patch-font_cpp 10 Apr 2018 16:09:56 - @@ -0,0 +1,26 @@ +$OpenBSD$ + +Index: font.cpp +--- font.cpp.orig font.cpp +@@ -67,15 +67,15 @@ void Font::draw(SDL_Surface *s, int x, int y, int r, i + if (shadow) { + SDL_Color color = { 1, 1, 1, 1 }; + SDL_Surface *surface = TTF_RenderUNICODE_Blended(font, str, color); +-SDL_Rect src = { 0, 0, surface->w, surface->h }; +-SDL_Rect dst = { x+1, y+1, surface->w, surface->h }; ++SDL_Rect src = { 0, 0, static_cast(surface->w), static_cast(surface->h) }; ++SDL_Rect dst = { static_cast(x+1), static_cast(y+1), static_cast(surface->w), static_cast(surface->h) }; + SDL_BlitSurface(surface, , s, ); + SDL_FreeSurface(surface); + } +-SDL_Color color = { r, g, b, 0 }; ++SDL_Color color = { static_cast(r), static_cast(g), static_cast(b), 0 }; + SDL_Surface *surface = TTF_RenderUNICODE_Blended(font, str, color); +-SDL_Rect src = { 0, 0, surface->w, surface->h }; +-SDL_Rect dst = { x, y, surface->w, surface->h }; ++SDL_Rect src = { 0, 0, static_cast(surface->w), static_cast(surface->h) }; ++SDL_Rect dst = { static_cast(x), static_cast(y), static_cast(surface->w), static_cast(surface->h) }; + SDL_BlitSurface(surface, , s, ); + SDL_FreeSurface(surface); + } Index: patches/patch-game_cpp === RCS file: patches/patch-game_cpp diff -N patches/patch-game_cpp --- /dev/null 1 Jan 1970 00:00:00 - +++ patches/patch-game_cpp 10 Apr 2018 16:09:56 - @@ -0,0 +1,19 @@ +$OpenBSD$ + +Index: game.cpp +--- game.cpp.orig game.cpp +@@ -139,7 +139,12 @@ void Watch::draw() + int y = 24; + int w, h; + font->getSize(s, w, h); +-SDL_Rect rect = { x-2, y-2, w+4, h+4 }; ++SDL_Rect rect = { ++static_cast(x-2), ++static_cast(y-2), ++static_cast(w+4), ++static_cast(h+4) ++}; + SDL_FillRect(screen.getSurface(), , + SDL_MapRGB(screen.getSurface()->format, 0, 0, 255)); + font->draw(x, y, 255,255,255, true, s); Index: patches/patch-screen_cpp === RCS file: patches/patch-screen_cpp diff -N patches/patch-screen_cpp --- /dev/null 1 Jan 1970 00:00:00 - +++ patches/patch-screen_cpp10 Apr 2018 16:09:56 - @@ -0,0 +1,78 @@ +$OpenBSD$ + +Index: screen.cpp +--- screen.cpp.orig screen.cpp +@@ -116,8 +116,13 @@ void Screen::hideMouse() + } + + if (mouseSave) { +-SDL_Rect src = { 0, 0, mouseSave->w, mouseSave->h }; +-SDL_Rect dst = { saveX, saveY, mouseSave->w, mouseSave->h }; ++SDL_Rect src = { 0, 0, static_cast(mouseSave->w), static_cast(mouseSave->h) }; ++SDL_Rect dst = { ++static_cast(saveX), ++ static_cast(saveY), ++ static_cast(mouseSave->w), ++ static_cast(mouseSave->h) ++}; + if (src.w > 0) { + SDL_BlitSurface(mouseSave, , screen, ); + addRegionToUpdate(dst.x, dst.y, dst.w, dst.h); +@@ -141,8 +146,13 @@ void Screen::showMouse() + SDL_GetMouseState(, ); + saveX = x; + saveY = y; +-SDL_Rect src = { 0, 0, mouseSave->w, mouseSave->h }; +-SDL_Rect dst = { x, y, mouseImage->w, mouseImage->h }; ++SDL_Rect src = { 0, 0, static_cast(mouseSave->w), static_cast(mouseSave->h) }; ++SDL_Rect dst = { ++static_cast(x), ++ static_cast(y), ++ static_cast(mouseImage->w), ++ static_cast(mouseImage->h) ++}; + if (src.w > 0) { + SDL_BlitSurface(screen, , mouseSave, ); + SDL_BlitSurface(mouseImage, , screen, ); +@@ -211,7 +221,7 @@ void Screen::addRegionToUpdate(int x, int y, int w, in + h = h + y; + y = 0; + } +-SDL_Rect r = { x, y, w, h }; ++SDL_Rect r = { static_cast(x), static_cast(y), static_cast(w), static_cast(h) }; + regions.push_back(r); + } + +@@ -255,8 +265,13 @@ void Screen::setPixel(int x, int y, int r, int g, int + + void Screen::draw(int x, int y, SDL_Surface *tile) + { +-SDL_Rect src = { 0, 0, tile->w, tile->h }; +-SDL_Rect dst = { x, y, tile->w, tile->h }; ++SDL_Rect src = { 0, 0, static_cast(tile->w), static_cast(tile->h) }; ++SDL_Rect dst = { ++static_cast(x), ++static_cast(y), ++static_cast(tile->w), ++static_cast(tile->h) ++}; + SDL_BlitSurface(tile, , screen, ); + } + +@@ -301,8 +316,13 @@ SDL_Surface* Screen::createSubimage(int x, int y, int + screen->format->Bmask, screen->format->Amask); +