forked from xyzz/openmw-android
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
buildscripts: restore boost format patch
removed by mistake
- Loading branch information
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
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
38 changes: 38 additions & 0 deletions
38
buildscripts/patches/openmw/0012-components-misc-stringops-use-boost-format-instead-o.patch
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Ilya Zhuravlev <[email protected]> | ||
Date: Tue, 23 Feb 2021 11:52:20 -0500 | ||
Subject: [PATCH] components/misc/stringops: use boost format instead of | ||
snprintf | ||
|
||
snprintf randomly returns -1 on android | ||
--- | ||
components/misc/stringops.hpp | 9 ++------- | ||
1 file changed, 2 insertions(+), 7 deletions(-) | ||
|
||
diff --git a/components/misc/stringops.hpp b/components/misc/stringops.hpp | ||
index 086352235..52d54acb8 100644 | ||
--- a/components/misc/stringops.hpp | ||
+++ b/components/misc/stringops.hpp | ||
@@ -6,6 +6,7 @@ | ||
#include <algorithm> | ||
#include <string_view> | ||
#include <iterator> | ||
+#include <boost/format.hpp> | ||
|
||
#include "utf8stream.hpp" | ||
|
||
@@ -250,13 +251,7 @@ public: | ||
template <typename ... Args> | ||
static std::string format(const char* fmt, Args const & ... args) | ||
{ | ||
- auto size = std::snprintf(nullptr, 0, fmt, argument(args) ...); | ||
- // Note: sprintf also writes a trailing null character. We should remove it. | ||
- std::string ret(size+1, '\0'); | ||
- std::sprintf(&ret[0], fmt, argument(args) ...); | ||
- ret.erase(size); | ||
- | ||
- return ret; | ||
+ return boost::str((boost::format(fmt) % ... % args)); | ||
} | ||
|
||
template <typename ... Args> |