public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: ElXreno <elxreno@gmail.com>
To: git-commits@fedoraproject.org
Subject: [rpms/ddnet] exclude-empty-files: Fix serverinfo json parser to work with system libjsonparser
Date: Thu, 03 Sep 2026 00:10:07 GMT	[thread overview]
Message-ID: <178839420774.1.15264724845029101361.rpms-ddnet-3dad07e66384@fedoraproject.org> (raw)

            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)
 

                 reply	other threads:[~2026-09-03  0:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178839420774.1.15264724845029101361.rpms-ddnet-3dad07e66384@fedoraproject.org \
    --to=elxreno@gmail.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox