public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/ddnet] exclude-empty-files: Fix serverinfo json parser to work with system libjsonparser
@ 2026-09-03  0:10 ElXreno
  0 siblings, 0 replies; only message in thread
From: ElXreno @ 2026-09-03  0:10 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/ddnet
            Branch : exclude-empty-files
            Commit : 3dad07e6638473321afcd0f482560cec3cf4d660
            Author : ElXreno <elxreno@gmail.com>
            Date   : 2021-11-19T10:39:54+00:00
            Stats  : +64/-1 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/ddnet/c/3dad07e6638473321afcd0f482560cec3cf4d660?branch=exclude-empty-files

            Log:
            Fix serverinfo json parser to work with system libjsonparser

See [1] and [2].
[1]: https://github.com/ddnet/ddnet/issues/4202
[2]: https://github.com/ddnet/ddnet/pull/4357

Change-Id: I30fbe0b845d6cd9b1f540dadb3ce6e4aa67ca24d

---
diff --git a/4357.patch b/4357.patch
new file mode 100644
index 0000000..3a48e5f
--- /dev/null
+++ b/4357.patch
@@ -0,0 +1,56 @@
+From e9ffcc3c50a247c48f1ad7fafc5582779b124c62 Mon Sep 17 00:00:00 2001
+From: def <dennis@felsin9.de>
+Date: Wed, 17 Nov 2021 18:22:29 +0100
+Subject: [PATCH] Fix serverinfo json parser to work with system libjsonparser
+ (fixes #4202)
+
+Debian, Ubuntu, Fedora are using libjsonparser without our own changes,
+thus we were doing garbage.
+---
+ src/engine/external/json-parser/json.h | 6 ------
+ src/engine/shared/serverinfo.cpp       | 8 ++++----
+ 2 files changed, 4 insertions(+), 10 deletions(-)
+
+diff --git a/src/engine/external/json-parser/json.h b/src/engine/external/json-parser/json.h
+index b8a0acce444..610d072b6ad 100644
+--- a/src/engine/external/json-parser/json.h
++++ b/src/engine/external/json-parser/json.h
+@@ -226,12 +226,6 @@ typedef struct _json_value
+             };
+          }
+ 
+-         /* DDNet additions */
+-         inline operator int () const
+-         {
+-            return (json_int_t) *this;
+-         }
+-
+          inline operator bool () const
+          {  
+             if (type != json_boolean)
+diff --git a/src/engine/shared/serverinfo.cpp b/src/engine/shared/serverinfo.cpp
+index 7197f150540..8c83d50e5b2 100644
+--- a/src/engine/shared/serverinfo.cpp
++++ b/src/engine/shared/serverinfo.cpp
+@@ -80,8 +80,8 @@ bool CServerInfo2::FromJsonRaw(CServerInfo2 *pOut, const json_value *pJson)
+ 	{
+ 		return true;
+ 	}
+-	pOut->m_MaxClients = MaxClients;
+-	pOut->m_MaxPlayers = MaxPlayers;
++	pOut->m_MaxClients = json_int_get(&MaxClients);
++	pOut->m_MaxPlayers = json_int_get(&MaxPlayers);
+ 	pOut->m_Passworded = Passworded;
+ 	str_copy(pOut->m_aGameType, GameType, sizeof(pOut->m_aGameType));
+ 	str_copy(pOut->m_aName, Name, sizeof(pOut->m_aName));
+@@ -113,8 +113,8 @@ bool CServerInfo2::FromJsonRaw(CServerInfo2 *pOut, const json_value *pJson)
+ 			CClient *pClient = &pOut->m_aClients[i];
+ 			str_copy(pClient->m_aName, Name, sizeof(pClient->m_aName));
+ 			str_copy(pClient->m_aClan, Clan, sizeof(pClient->m_aClan));
+-			pClient->m_Country = Country;
+-			pClient->m_Score = Score;
++			pClient->m_Country = json_int_get(&Country);
++			pClient->m_Score = json_int_get(&Score);
+ 			pClient->m_IsPlayer = IsPlayer;
+ 		}
+ 

diff --git a/ddnet.spec b/ddnet.spec
index 04be77e..de6003b 100644
--- a/ddnet.spec
+++ b/ddnet.spec
@@ -3,7 +3,7 @@
 
 Name:           ddnet
 Version:        15.6.2
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        DDraceNetwork, a cooperative racing mod of Teeworlds
 
 # Disabled while can't fix build
@@ -43,6 +43,9 @@ Patch2:         0002-Unbundle-md5.patch
 # Unbundle json-parser
 Patch3:         0003-Unbundle-json-parser.patch
 
+# Fix serverinfo json parser to work with system libjsonparser
+Patch4:         https://github.com/ddnet/ddnet/pull/4357.patch
+
 BuildRequires:  desktop-file-utils
 BuildRequires:  libappstream-glib
 
@@ -163,6 +166,10 @@ appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/*.appdata.xml
 
 
 %changelog
+* Fri Nov 19 2021 Sérgio Basto <sergio@serjux.com> - 15.6.2-2
+- Fix serverinfo json parser to work with system libjsonparser
+  merge of https://src.fedoraproject.org/rpms/ddnet/pull-request/1
+
 * Sat Nov 13 2021 Sérgio Basto <sergio@serjux.com> - 15.6.2-1
 - Update ddnet to 15.6.2 (#2020793)
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-03  0:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-03  0:10 [rpms/ddnet] exclude-empty-files: Fix serverinfo json parser to work with system libjsonparser ElXreno

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox