Skip to content

Commit

Permalink
Merge pull request #768 from cazfi/srvup
Browse files Browse the repository at this point in the history
  • Loading branch information
cazfi authored Oct 22, 2023
2 parents 39804d7 + eba66f6 commit 33e09ee
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 119 deletions.
16 changes: 12 additions & 4 deletions freeciv/apply_patches.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
# 0031-Lua-Always-pass-lua_Integer-to-API_TYPE_INT.patch
# Lua API fix
# osdn #48722
# 0042-Meson-Make-manual-generator-build-optional.patch
# Manual Generator build optional
# osdn #48650
# 0036-tile_move_cost_ptrs-Make-cardinal_move-signed.patch
# Unit movemenet handling fix
# osdn #48737
Expand Down Expand Up @@ -38,6 +35,15 @@
# 0025-Autoworkers-Use-ADV_WANTS_EQ-for-comparing-tile-valu.patch
# Autoworkers work value fix
# osdn #48842
# 0032-mapimg_help-Fix-format-overflow-warning.patch
# gcc-14 warning fix
# osdn #48850
# 0031-city_from_wonder-Fix-illegal-array-subscript-warning.patch
# gcc-14 warning fix
# osdn #48849
# 0029-Fix-dbv_copy.patch
# Memory handling fix
# osdn #48869

# Not in the upstream Freeciv server
# ----------------------------------
Expand All @@ -61,7 +67,6 @@ declare -a GIT_PATCHLIST=(

declare -a PATCHLIST=(
"backports/0031-Lua-Always-pass-lua_Integer-to-API_TYPE_INT"
"backports/0042-Meson-Make-manual-generator-build-optional"
"backports/0036-tile_move_cost_ptrs-Make-cardinal_move-signed"
"backports/0047-Meson-Turn-audio-option-to-a-combo"
"backports/0008-Add-new-bitvector-utility-functions"
Expand All @@ -71,6 +76,9 @@ declare -a PATCHLIST=(
"backports/0050-Cache-territory-claiming-base-types"
"backports/0050-Correct-filling-of-territory-claiming-extras-cache"
"backports/0025-Autoworkers-Use-ADV_WANTS_EQ-for-comparing-tile-valu"
"backports/0032-mapimg_help-Fix-format-overflow-warning"
"backports/0031-city_from_wonder-Fix-illegal-array-subscript-warning"
"backports/0029-Fix-dbv_copy"
"meson_webperimental"
"metachange"
"text_fixes"
Expand Down
30 changes: 30 additions & 0 deletions freeciv/patches/backports/0029-Fix-dbv_copy.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
From 638959581b0967db72823d936720c1b48a15149e Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <[email protected]>
Date: Wed, 18 Oct 2023 08:25:13 +0300
Subject: [PATCH 29/29] Fix dbv_copy()

It was overwriting the pointer, not pointed memory.

See osdn #48869

Signed-off-by: Marko Lindqvist <[email protected]>
---
utility/bitvector.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/utility/bitvector.c b/utility/bitvector.c
index 17a65411e6..d0895d5499 100644
--- a/utility/bitvector.c
+++ b/utility/bitvector.c
@@ -225,7 +225,7 @@ void dbv_copy(struct dbv *dest, const struct dbv *src)
dbv_resize(dest, src->bits);
}

- memcpy(&dest->vec, src->vec, _BV_BYTES(src->bits));
+ memcpy(dest->vec, src->vec, _BV_BYTES(src->bits));
}

/***********************************************************************//**
--
2.42.0

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
From 0caae00b77c7b02882521e2a1253c68413ee57f5 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <[email protected]>
Date: Sun, 15 Oct 2023 21:54:24 +0300
Subject: [PATCH 31/32] city_from_wonder(): Fix illegal array subscript warning

See osdn #48849

Signed-off-by: Marko Lindqvist <[email protected]>
---
common/improvement.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/common/improvement.c b/common/improvement.c
index a8e04e4ff5..39eda11b8e 100644
--- a/common/improvement.c
+++ b/common/improvement.c
@@ -890,7 +890,14 @@ bool wonder_is_built(const struct player *pplayer,
struct city *city_from_wonder(const struct player *pplayer,
const struct impr_type *pimprove)
{
- int city_id = pplayer->wonders[improvement_index(pimprove)];
+ int idx = improvement_index(pimprove);
+ int city_id;
+
+ if (idx < 0) {
+ return NULL;
+ }
+
+ city_id = pplayer->wonders[idx];

fc_assert_ret_val(NULL != pplayer, NULL);
fc_assert_ret_val(is_wonder(pimprove), NULL);
--
2.42.0

Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
From 6635a583cdffcc810d51462f75cd752e6ad81c20 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <[email protected]>
Date: Sun, 15 Oct 2023 22:02:59 +0300
Subject: [PATCH 32/32] mapimg_help(): Fix format-overflow warning

See osdn #48850

Signed-off-by: Marko Lindqvist <[email protected]>
---
common/mapimg.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/common/mapimg.c b/common/mapimg.c
index 13670f7af2..661b5e1311 100644
--- a/common/mapimg.c
+++ b/common/mapimg.c
@@ -620,6 +620,7 @@ char *mapimg_help(const char *cmdname)
tool = imagetool_next(tool)) {
enum imageformat format;
const struct toolkit *toolkit = img_toolkit_get(tool);
+ const char *separator = "";

if (!toolkit) {
continue;
@@ -627,12 +628,15 @@ char *mapimg_help(const char *cmdname)

astr_add(&str_format, " - '%s': ", imagetool_name(tool));

- const char *separator = "";
for (format = imageformat_begin(); format != imageformat_end();
format = imageformat_next(format)) {
if (toolkit->formats & format) {
- astr_add(&str_format, "%s'%s'", separator, imageformat_name(format));
- separator = ", ";
+ const char *name = imageformat_name(format);
+
+ if (name != NULL) {
+ astr_add(&str_format, "%s'%s'", separator, name);
+ separator = ", ";
+ }
}
}

--
2.42.0

This file was deleted.

2 changes: 1 addition & 1 deletion freeciv/version.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# The Git SHA hash for the commit to checkout from
# https://github.com/freeciv/freeciv

FCREV=2348fcd8d45fc589fc67c07373e1c4a8d0a4ae76
FCREV=22c3d069a39604a49324fdb2454198986b88ad12

ORIGCAPSTR="+Freeciv.Devel-\${MAIN_VERSION}-2023.Sep.23"

Expand Down

0 comments on commit 33e09ee

Please sign in to comment.