1
0
Fork 0
mirror of https://git.openwrt.org/openwrt/openwrt.git synced 2024-04-27 20:35:14 +02:00
openwrt/package/libs/uclibc++/patches/005-istream_helpers-Fix-ssc...
Rosen Penev 6ab386c9bc uClibc++: Fix three bugs
The first allows usage of several functions in the std namespace, which
broke compilation of gddrescue specifically with uClibc-ng and uClibc++.

The second allows usage of long long with normal C++11, which is part of
the standard. Before, std=gnu++11 needed to be passsed to work around it.

As a result of the second patch, the pedantic patch can safely be removed.

Both patches are upstream backports.

Added -std=c++11 to CFLAGS to guarentee proper inclusion of long long.

Added another patch that fixes a typo with the long long support. Sent to
upstream.

Fixed up license information according to SPDX.

Small cleanups for consistency.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-10-12 23:43:08 +02:00

38 lines
1.3 KiB
Diff

From 7f6dd860818512c0eb313320308b22ba7e2c7205 Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
Date: Fri, 4 Oct 2019 20:06:53 -0700
Subject: [PATCH] istream_helpers: Fix sscanf typo
This caused readin not to work properly with long long types.
Found accidentally through a glibc warning
(declared with warn_unused_result).
Tested with gptfdisk on OpenWrt.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
include/istream_helpers | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/include/istream_helpers
+++ b/include/istream_helpers
@@ -317,7 +317,7 @@ namespace std{
sscanf(temp.c_str(), "%llo", (unsigned long long *)&var );
}else if(stream.flags() & ios_base::hex){
if(stream.flags() & ios_base::uppercase){
- scanf(temp.c_str(), "%llX", (unsigned long long *)&var );
+ sscanf(temp.c_str(), "%llX", (unsigned long long *)&var );
}else{
sscanf(temp.c_str(), "%llx", (unsigned long long *)&var);
}
@@ -344,7 +344,7 @@ namespace std{
sscanf(temp.c_str(), "%llo", &var );
}else if(stream.flags() & ios_base::hex){
if(stream.flags() & ios_base::uppercase){
- scanf(temp.c_str(), "%llX", &var );
+ sscanf(temp.c_str(), "%llX", &var );
}else{
sscanf(temp.c_str(), "%llx", &var);
}