Created
June 19, 2021 22:19
-
-
Save lightspot21/9bc8f97c01b7fd417c77f4115cfc07f6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 87da5051028468cca48102a0a049be4d2c470255 Mon Sep 17 00:00:00 2001 | |
From: Grigoris Pavlakis <aur.archlinux.org/account/lightspot21> | |
Date: Sat, 19 Jun 2021 21:59:28 +0300 | |
Subject: [PATCH 1/4] Fix broken source link | |
--- | |
PKGBUILD | 8 ++++---- | |
1 file changed, 4 insertions(+), 4 deletions(-) | |
diff --git a/PKGBUILD b/PKGBUILD | |
index 4d1b95c..5338c8f 100644 | |
--- a/PKGBUILD | |
+++ b/PKGBUILD | |
@@ -12,18 +12,18 @@ url="http://www.happypenguin.org/show?Virus%20Killer" | |
license=('GPL') | |
depends=('gcc-libs' 'hicolor-icon-theme' 'sdl_image' 'sdl_mixer' 'sdl_net' 'sdl_ttf') | |
install="${pkgname}.install" | |
-source=("http://ftp.frugalware.org/pub/archive/frugalware-1.9/source/games-extra/viruskiller/viruskiller-1.03-1.tar.gz" | |
+source=("https://ftp.lysator.liu.se/pub/opensuse/source/tumbleweed/repo/oss/src/viruskiller-1.03-2.12.src.rpm" | |
"${pkgname}.patch") | |
-md5sums=('ac74f8a49d249a87e3e77cadd9aa6fa9' | |
+md5sums=('486f62776317fe94c22e5dc7a2bc1d3d' | |
'634374b2c8d57360126b22fc33dfe217') | |
build() { | |
- cd "${srcdir}/${pkgname}-${pkgver}" | |
+ cd "${srcdir}/${pkgname}-${pkgver}-1+dfsg1" | |
patch -Np1 -i "../${pkgname}.patch" | |
make | |
} | |
package() { | |
- cd "${srcdir}/${pkgname}-${pkgver}" | |
+ cd "${srcdir}/${pkgname}-${pkgver}-1+dfsg1" | |
make DESTDIR="${pkgdir}" install | |
} | |
-- | |
2.32.0 | |
From 17fa0724d5c4097637cfa5369f0bcb730d367245 Mon Sep 17 00:00:00 2001 | |
From: Grigoris Pavlakis <aur.archlinux.org/account/lightspot21> | |
Date: Sat, 19 Jun 2021 22:51:48 +0300 | |
Subject: [PATCH 2/4] Add source preparation | |
--- | |
PKGBUILD | 12 +++++++++--- | |
1 file changed, 9 insertions(+), 3 deletions(-) | |
diff --git a/PKGBUILD b/PKGBUILD | |
index 5338c8f..b123661 100644 | |
--- a/PKGBUILD | |
+++ b/PKGBUILD | |
@@ -14,16 +14,22 @@ depends=('gcc-libs' 'hicolor-icon-theme' 'sdl_image' 'sdl_mixer' 'sdl_net' 'sdl_ | |
install="${pkgname}.install" | |
source=("https://ftp.lysator.liu.se/pub/opensuse/source/tumbleweed/repo/oss/src/viruskiller-1.03-2.12.src.rpm" | |
"${pkgname}.patch") | |
-md5sums=('486f62776317fe94c22e5dc7a2bc1d3d' | |
+md5sums=('47c0cc26c5903d094ab756cbf155e865' | |
'634374b2c8d57360126b22fc33dfe217') | |
+prepare() { | |
+ bsdtar -xf "${pkgname}-${pkgver}-2.12.src.rpm" | |
+ bsdtar -xf "${pkgname}-${pkgver}.tar.gz" | |
+} | |
+ | |
+ | |
build() { | |
- cd "${srcdir}/${pkgname}-${pkgver}-1+dfsg1" | |
+ cd "${srcdir}/${pkgname}-${pkgver}" | |
patch -Np1 -i "../${pkgname}.patch" | |
make | |
} | |
package() { | |
- cd "${srcdir}/${pkgname}-${pkgver}-1+dfsg1" | |
+ cd "${srcdir}/${pkgname}-${pkgver}" | |
make DESTDIR="${pkgdir}" install | |
} | |
-- | |
2.32.0 | |
From 598fbae14f132a43f5125c7fb97acc7045d8c0dc Mon Sep 17 00:00:00 2001 | |
From: Grigoris Pavlakis <aur.archlinux.org/account/lightspot21> | |
Date: Sat, 19 Jun 2021 23:10:35 +0300 | |
Subject: [PATCH 3/4] Add sha256sums | |
--- | |
PKGBUILD | 4 ++-- | |
1 file changed, 2 insertions(+), 2 deletions(-) | |
diff --git a/PKGBUILD b/PKGBUILD | |
index b123661..577f28c 100644 | |
--- a/PKGBUILD | |
+++ b/PKGBUILD | |
@@ -14,8 +14,8 @@ depends=('gcc-libs' 'hicolor-icon-theme' 'sdl_image' 'sdl_mixer' 'sdl_net' 'sdl_ | |
install="${pkgname}.install" | |
source=("https://ftp.lysator.liu.se/pub/opensuse/source/tumbleweed/repo/oss/src/viruskiller-1.03-2.12.src.rpm" | |
"${pkgname}.patch") | |
-md5sums=('47c0cc26c5903d094ab756cbf155e865' | |
- '634374b2c8d57360126b22fc33dfe217') | |
+sha256sums=('456fa53eeed954a2528e7c2580970e1871aff8926be784ac0ad41a0477d00cb6' | |
+ '1aa8f806bf15737404e71f94d0b3d7b170d52484c1618c36374433963441e642') | |
prepare() { | |
bsdtar -xf "${pkgname}-${pkgver}-2.12.src.rpm" | |
-- | |
2.32.0 | |
From 1d447af366174bd65847b851d0b708708ba281b4 Mon Sep 17 00:00:00 2001 | |
From: Grigoris Pavlakis <aur.archlinux.org/account/lightspot21> | |
Date: Sun, 20 Jun 2021 00:12:01 +0300 | |
Subject: [PATCH 4/4] Add fixes for compiler warnings | |
--- | |
PKGBUILD | 10 +- | |
fix-warnings.patch | 225 +++++++++++++++++++++++++++++++++++++++++++++ | |
2 files changed, 232 insertions(+), 3 deletions(-) | |
create mode 100644 fix-warnings.patch | |
diff --git a/PKGBUILD b/PKGBUILD | |
index 577f28c..13d80c4 100644 | |
--- a/PKGBUILD | |
+++ b/PKGBUILD | |
@@ -1,4 +1,5 @@ | |
# Maintainer: Matteo Bonora <bonora.matteo@gmail.com> | |
+# Contributor: Grigoris Pavlakis (aur.archlinux.org/account/lightspot21) | |
# Contributor: Anton Bazhenov <anton.bazhenov at gmail> | |
# Contributor: Nick B <Shirakawasuna at gmail _dot_ com> | |
# Contributor: Dany Martineau <dany.luc.martineau at gmail.com> | |
@@ -12,10 +13,12 @@ url="http://www.happypenguin.org/show?Virus%20Killer" | |
license=('GPL') | |
depends=('gcc-libs' 'hicolor-icon-theme' 'sdl_image' 'sdl_mixer' 'sdl_net' 'sdl_ttf') | |
install="${pkgname}.install" | |
-source=("https://ftp.lysator.liu.se/pub/opensuse/source/tumbleweed/repo/oss/src/viruskiller-1.03-2.12.src.rpm" | |
- "${pkgname}.patch") | |
+source=("https://ftp.lysator.liu.se/pub/opensuse/source/tumbleweed/repo/oss/src/${pkgname}-${pkgver}-2.12.src.rpm" | |
+ "${pkgname}.patch" | |
+ "fix-warnings.patch") | |
sha256sums=('456fa53eeed954a2528e7c2580970e1871aff8926be784ac0ad41a0477d00cb6' | |
- '1aa8f806bf15737404e71f94d0b3d7b170d52484c1618c36374433963441e642') | |
+ '1aa8f806bf15737404e71f94d0b3d7b170d52484c1618c36374433963441e642' | |
+ 'e6d35b7c288e120055823f97df17e2c4f575bcf77899ff346e9ba1fdfde6cdbf') | |
prepare() { | |
bsdtar -xf "${pkgname}-${pkgver}-2.12.src.rpm" | |
@@ -26,6 +29,7 @@ prepare() { | |
build() { | |
cd "${srcdir}/${pkgname}-${pkgver}" | |
patch -Np1 -i "../${pkgname}.patch" | |
+ patch -Np1 -i "../fix-warnings.patch" | |
make | |
} | |
diff --git a/fix-warnings.patch b/fix-warnings.patch | |
new file mode 100644 | |
index 0000000..9c06d17 | |
--- /dev/null | |
+++ b/fix-warnings.patch | |
@@ -0,0 +1,225 @@ | |
+From b8c4e7986adb49742c382caad5bc8ce6f58e027f Mon Sep 17 00:00:00 2001 | |
+From: Grigoris Pavlakis <aur.archlinux.org/account/lightspot21> | |
+Date: Sat, 19 Jun 2021 23:26:58 +0300 | |
+Subject: [PATCH 1/5] Fix warnings | |
+ | |
+--- | |
+ src/CAudio.cpp | 2 +- | |
+ src/CEngine.cpp | 2 +- | |
+ src/CGraphics.cpp | 2 +- | |
+ 3 files changed, 3 insertions(+), 3 deletions(-) | |
+ | |
+diff --git a/src/CAudio.cpp b/src/CAudio.cpp | |
+index 04cbb74..df4551b 100644 | |
+--- a/src/CAudio.cpp | |
++++ b/src/CAudio.cpp | |
+@@ -89,7 +89,7 @@ bool Audio::loadSound(int i, const char *filename) | |
+ | |
+ bool Audio::loadMusic(const char *filename) | |
+ { | |
+- char tempPath[PATH_MAX]; | |
++ char tempPath[PATH_MAX + 9]; // to accommodate the filename | |
+ | |
+ sprintf(tempPath, "%smusic.mod", engine->userHomeDirectory); | |
+ | |
+diff --git a/src/CEngine.cpp b/src/CEngine.cpp | |
+index b02305a..186ae68 100644 | |
+--- a/src/CEngine.cpp | |
++++ b/src/CEngine.cpp | |
+@@ -304,7 +304,7 @@ bool Engine::unpack(const char *filename, int fileType) | |
+ | |
+ if ((fileType == PAK_MUSIC) || (fileType == PAK_FONT)) | |
+ { | |
+- char tempPath[PATH_MAX]; | |
++ char tempPath[PATH_MAX + 9]; // to accommodate the file name | |
+ | |
+ FILE *fp = NULL; | |
+ | |
+diff --git a/src/CGraphics.cpp b/src/CGraphics.cpp | |
+index 8bfde6c..a07569a 100644 | |
+--- a/src/CGraphics.cpp | |
++++ b/src/CGraphics.cpp | |
+@@ -427,7 +427,7 @@ void Graphics::loadFont(int i, const char *filename, int pixelSize) | |
+ TTF_CloseFont(font[i]); | |
+ } | |
+ | |
+- char tempPath[PATH_MAX]; | |
++ char tempPath[PATH_MAX + 8]; // accommodate filename | |
+ | |
+ sprintf(tempPath, "%sfont.ttf", engine->userHomeDirectory); | |
+ | |
+-- | |
+2.32.0 | |
+ | |
+ | |
+From cd547df641b59fdcf346d3fbe32b14ece13c1195 Mon Sep 17 00:00:00 2001 | |
+From: Grigoris Pavlakis <aur.archlinux.org/account/lightspot21> | |
+Date: Sat, 19 Jun 2021 23:34:05 +0300 | |
+Subject: [PATCH 2/5] Add virtual destructor to fix possible undefined behavior | |
+ warning | |
+ | |
+--- | |
+ src/CGameObject.h | 1 + | |
+ 1 file changed, 1 insertion(+) | |
+ | |
+diff --git a/src/CGameObject.h b/src/CGameObject.h | |
+index 80625af..c1d1b25 100644 | |
+--- a/src/CGameObject.h | |
++++ b/src/CGameObject.h | |
+@@ -25,6 +25,7 @@ class GameObject { | |
+ GameObject *next; | |
+ | |
+ GameObject(); | |
++ virtual ~GameObject() = default; | |
+ virtual void destroy(); | |
+ | |
+ }; | |
+-- | |
+2.32.0 | |
+ | |
+ | |
+From 5768c30acde83ca8562bbaf10e652110e3e9f6fd Mon Sep 17 00:00:00 2001 | |
+From: Grigoris Pavlakis <aur.archlinux.org/account/lightspot21> | |
+Date: Sat, 19 Jun 2021 23:36:06 +0300 | |
+Subject: [PATCH 3/5] Fix typo causing possible undefined behavior | |
+ | |
+--- | |
+ src/CParticle.cpp | 2 +- | |
+ 1 file changed, 1 insertion(+), 1 deletion(-) | |
+ | |
+diff --git a/src/CParticle.cpp b/src/CParticle.cpp | |
+index 9d34850..abffbdd 100644 | |
+--- a/src/CParticle.cpp | |
++++ b/src/CParticle.cpp | |
+@@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
+ Particle::Particle() | |
+ { | |
+ x = y = 0; | |
+- dy = dy = 0; | |
++ dx = dy = 0; | |
+ color = 0; | |
+ health = 0; | |
+ } | |
+-- | |
+2.32.0 | |
+ | |
+ | |
+From b886eed3dcaba994c88245b9f623d460b994eb89 Mon Sep 17 00:00:00 2001 | |
+From: Grigoris Pavlakis <aur.archlinux.org/account/lightspot21> | |
+Date: Sat, 19 Jun 2021 23:42:54 +0300 | |
+Subject: [PATCH 4/5] Fix warnings regarding too small buffer | |
+ | |
+--- | |
+ src/init.cpp | 10 +++++----- | |
+ 1 file changed, 5 insertions(+), 5 deletions(-) | |
+ | |
+diff --git a/src/init.cpp b/src/init.cpp | |
+index c8d2c50..c19e91f 100644 | |
+--- a/src/init.cpp | |
++++ b/src/init.cpp | |
+@@ -131,7 +131,7 @@ void initMedalService() | |
+ graphics.drawString(400, 520, true, graphics.screen, "Contacting Medal Server - %s:%d", MEDAL_SERVER_HOST, MEDAL_SERVER_PORT); | |
+ graphics.updateScreen(); | |
+ | |
+- char keyPath[PATH_MAX]; | |
++ char keyPath[PATH_MAX + 8]; // accommodate the "medalKey" filename | |
+ char privateKey[20]; | |
+ | |
+ sprintf(keyPath, "%smedalKey", engine.userHomeDirectory); | |
+@@ -160,7 +160,7 @@ void initMedalService() | |
+ | |
+ bool loadConfig() | |
+ { | |
+- char configPath[PATH_MAX]; | |
++ char configPath[PATH_MAX + 6]; // fit "config" filename | |
+ | |
+ sprintf(configPath, "%sconfig", engine.userHomeDirectory); | |
+ | |
+@@ -193,7 +193,7 @@ bool loadConfig() | |
+ | |
+ void saveConfig() | |
+ { | |
+- char configPath[PATH_MAX]; | |
++ char configPath[PATH_MAX + 6]; // fit "config" filename | |
+ | |
+ sprintf(configPath, "%sconfig", engine.userHomeDirectory); | |
+ | |
+@@ -282,7 +282,7 @@ void initSystem() | |
+ | |
+ #if USEPAK | |
+ | |
+- char tempPath[PATH_MAX]; | |
++ char tempPath[PATH_MAX + 8]; // fit "font.ttf" filename in buffer | |
+ sprintf(tempPath, "%sfont.ttf", engine.userHomeDirectory); | |
+ remove(tempPath); | |
+ | |
+@@ -337,7 +337,7 @@ atexit(); | |
+ */ | |
+ void cleanup() | |
+ { | |
+- char tempPath[PATH_MAX]; | |
++ char tempPath[PATH_MAX + 9]; // fit the biggest filename "music.mod" | |
+ | |
+ debug(("Cleaning Up...\n")); | |
+ | |
+-- | |
+2.32.0 | |
+ | |
+ | |
+From 383ddb0c5d9956e7076e0024e96f8b901535641f Mon Sep 17 00:00:00 2001 | |
+From: Grigoris Pavlakis <aur.archlinux.org/account/lightspot21> | |
+Date: Sun, 20 Jun 2021 00:08:35 +0300 | |
+Subject: [PATCH 5/5] Fix yet more warnings | |
+ | |
+--- | |
+ src/viruses.cpp | 3 --- | |
+ src/widgets.cpp | 5 +++-- | |
+ 2 files changed, 3 insertions(+), 5 deletions(-) | |
+ | |
+diff --git a/src/viruses.cpp b/src/viruses.cpp | |
+index 4457a05..2e27b64 100644 | |
+--- a/src/viruses.cpp | |
++++ b/src/viruses.cpp | |
+@@ -70,7 +70,6 @@ void addViruses(int amount) | |
+ | |
+ Virus *virus; | |
+ | |
+- int place; | |
+ int chompChance = 10 - (gameData.level); | |
+ int destroyChance = 20 - (gameData.level); | |
+ | |
+@@ -79,8 +78,6 @@ void addViruses(int amount) | |
+ | |
+ for (int i = 0 ; i < amount ; i++) | |
+ { | |
+- place = rand() % 4; | |
+- | |
+ virus = new Virus(); | |
+ | |
+ if (gameData.skill < 3) | |
+diff --git a/src/widgets.cpp b/src/widgets.cpp | |
+index cda06ee..aeb53f7 100644 | |
+--- a/src/widgets.cpp | |
++++ b/src/widgets.cpp | |
+@@ -28,7 +28,7 @@ void drawOptions(Widget *widget, int maxWidth) | |
+ | |
+ char *c = widget->options; | |
+ | |
+- char token[100]; | |
++ char token[100 + 2]; // fit c and null-termination | |
+ strcpy(token, ""); | |
+ | |
+ SDL_Surface *text; | |
+@@ -61,7 +61,8 @@ void drawOptions(Widget *widget, int maxWidth) | |
+ } | |
+ else | |
+ { | |
+- sprintf(token, "%s%c", token, *c); | |
++ strncat(token, c, 1); | |
++ //sprintf(token, "%s%c", token, *c); | |
+ } | |
+ | |
+ *c++; | |
+-- | |
+2.32.0 | |
+ | |
-- | |
2.32.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment