mirror of
https://github.com/badaix/snapcast.git
synced 2025-08-02 08:09:35 +02:00
c++11 string compat
This commit is contained in:
parent
c0ca0bef57
commit
6ea10c77dd
2 changed files with 6 additions and 16 deletions
|
@ -24,13 +24,13 @@ ifeq ($(TARGET), ANDROID)
|
|||
# make ANDROID=1
|
||||
CXX = $(NDK_DIR)/bin/arm-linux-androideabi-g++
|
||||
STRIP = $(NDK_DIR)/bin/arm-linux-androideabi-strip
|
||||
CXXFLAGS += -DANDROID -fPIC -DHAS_OPENSL -I/home/johannes/Develop/build/arm/include
|
||||
CXXFLAGS += -DANDROID -DNO_CPP11_STRING -fPIC -DHAS_OPENSL -I/home/johannes/Develop/build/arm/include
|
||||
LDFLAGS = -L/home/johannes/Develop/build/arm/lib -pie -lFLAC -lOpenSLES
|
||||
OBJ += player/openslPlayer.o
|
||||
|
||||
else ifeq ($(TARGET), OPENWRT)
|
||||
|
||||
CXXFLAGS += -DIS_BIG_ENDIAN -DNO_TO_STRING -DNO_STOUL -DNO_STOI -DHAS_OGG -DHAS_ALSA -DHAS_AVAHI -DHAS_DAEMON
|
||||
CXXFLAGS += -DIS_BIG_ENDIAN -DNO_CPP11_STRING -DHAS_OGG -DHAS_ALSA -DHAS_AVAHI -DHAS_DAEMON
|
||||
LDFLAGS = -lasound -logg -lvorbisidec -lFLAC -lavahi-client -lavahi-common -latomic
|
||||
OBJ += player/alsaPlayer.o decoder/oggDecoder.o browseAvahi.o
|
||||
|
||||
|
|
|
@ -1,20 +1,11 @@
|
|||
#ifndef COMPAT_H
|
||||
#define COMPAT_H
|
||||
|
||||
#ifdef ANDROID
|
||||
#define NO_TO_STRING
|
||||
#define NO_STOUL
|
||||
#define NO_STOUL
|
||||
#define NO_STOI
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
|
||||
#ifdef NO_TO_STRING
|
||||
#ifdef NO_CPP11_STRING
|
||||
#include <sstream>
|
||||
#endif
|
||||
|
||||
#if defined(NO_STOUL) || defined(NO_STOI)
|
||||
#include <cstdlib>
|
||||
#endif
|
||||
|
||||
|
@ -24,7 +15,7 @@ namespace cpt
|
|||
template<typename T>
|
||||
static std::string to_string(const T& t)
|
||||
{
|
||||
#ifdef NO_TO_STRING
|
||||
#ifdef NO_CPP11_STRING
|
||||
std::stringstream ss;
|
||||
ss << t;
|
||||
return ss.str();
|
||||
|
@ -35,17 +26,16 @@ namespace cpt
|
|||
|
||||
static long stoul(const std::string& s)
|
||||
{
|
||||
#ifdef NO_STOUL
|
||||
#ifdef NO_CPP11_STRING
|
||||
return atol(s.c_str());
|
||||
#else
|
||||
return std::stoul(s);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static int stoi(const std::string& str)
|
||||
{
|
||||
#ifdef NO_STOI
|
||||
#ifdef NO_CPP11_STRING
|
||||
return strtol(str.c_str(), 0, 10);
|
||||
#else
|
||||
return std::stoi(str);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue