SHA256
1
0
forked from pool/fmt

Accepting request 793884 from home:frispete:Tumbleweed

- Apply 7d01859ef16e6b65bc023ad8bebfedecb088bf81.patch
  to fix kodi compilation and probably others:
  https://github.com/fmtlib/fmt/issues/1620

OBS-URL: https://build.opensuse.org/request/show/793884
OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/fmt?expand=0&rev=19
This commit is contained in:
Luigi Baldoni 2020-04-14 17:10:31 +00:00 committed by Git OBS Bridge
parent 9cb81df54e
commit 67ccf09004
3 changed files with 55 additions and 0 deletions

View File

@ -0,0 +1,46 @@
From 7d01859ef16e6b65bc023ad8bebfedecb088bf81 Mon Sep 17 00:00:00 2001
From: Victor Zverovich <viz@fb.com>
Date: Wed, 8 Apr 2020 12:32:34 -0700
Subject: [PATCH] Fix handling of unsigned char strings in printf
---
include/fmt/core.h | 8 ++++++++
test/printf-test.cc | 6 ++++++
2 files changed, 14 insertions(+)
diff --git a/include/fmt/core.h b/include/fmt/core.h
index 6df2875ac..dc10722bf 100644
--- a/include/fmt/core.h
+++ b/include/fmt/core.h
@@ -972,6 +972,14 @@ template <typename Context> struct arg_mapper {
static_assert(std::is_same<char_type, char>::value, "invalid string type");
return reinterpret_cast<const char*>(val);
}
+ FMT_CONSTEXPR const char* map(signed char* val) {
+ const auto* const_val = val;
+ return map(const_val);
+ }
+ FMT_CONSTEXPR const char* map(unsigned char* val) {
+ const auto* const_val = val;
+ return map(const_val);
+ }
FMT_CONSTEXPR const void* map(void* val) { return val; }
FMT_CONSTEXPR const void* map(const void* val) { return val; }
diff --git a/test/printf-test.cc b/test/printf-test.cc
index 5aaa27b13..545e02aab 100644
--- a/test/printf-test.cc
+++ b/test/printf-test.cc
@@ -447,6 +447,12 @@ TEST(PrintfTest, String) {
EXPECT_PRINTF(L" (null)", L"%10s", null_wstr);
}
+TEST(PrintfTest, UCharString) {
+ unsigned char str[] = "test";
+ unsigned char* pstr = str;
+ EXPECT_EQ("test", fmt::sprintf("%s", pstr));
+}
+
TEST(PrintfTest, Pointer) {
int n;
void* p = &n;

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Tue Apr 14 13:04:56 UTC 2020 - Hans-Peter Jansen <hpj@urpla.net>
- Apply 7d01859ef16e6b65bc023ad8bebfedecb088bf81.patch
to fix kodi compilation and probably others:
https://github.com/fmtlib/fmt/issues/1620
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Apr 6 14:21:08 UTC 2020 - Luigi Baldoni <aloisio@gmx.com> Mon Apr 6 14:21:08 UTC 2020 - Luigi Baldoni <aloisio@gmx.com>

View File

@ -22,9 +22,11 @@ Version: 6.2.0
Release: 0 Release: 0
Summary: A formatting library for C++ Summary: A formatting library for C++
License: MIT License: MIT
Group: System/Libraries
URL: http://fmtlib.net/ URL: http://fmtlib.net/
Source0: https://github.com/fmtlib/fmt/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz Source0: https://github.com/fmtlib/fmt/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: baselibs.conf Source1: baselibs.conf
Patch0: 7d01859ef16e6b65bc023ad8bebfedecb088bf81.patch
BuildRequires: cmake BuildRequires: cmake
BuildRequires: gcc-c++ BuildRequires: gcc-c++
BuildRequires: pkgconfig BuildRequires: pkgconfig