Browse Source

check HAVE_BOOST_LOCALE and fix compilation when boost-locale is not available

miguelfreitas
Miguel Freitas 11 years ago
parent
commit
d4b1c9b569
  1. 8
      src/init.cpp
  2. 12
      src/twister.cpp

8
src/init.cpp

@ -22,8 +22,10 @@
#include <boost/filesystem/convenience.hpp> #include <boost/filesystem/convenience.hpp>
#include <boost/interprocess/sync/file_lock.hpp> #include <boost/interprocess/sync/file_lock.hpp>
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
#include <boost/locale.hpp> #ifdef HAVE_BOOST_LOCALE
#include <boost/locale/generator.hpp> #include <boost/locale.hpp>
#include <boost/locale/generator.hpp>
#endif
#include <openssl/crypto.h> #include <openssl/crypto.h>
#ifndef WIN32 #ifndef WIN32
@ -401,7 +403,9 @@ bool AppInit2(boost::thread_group& threadGroup)
#endif #endif
#endif #endif
#endif #endif
#ifdef HAVE_BOOST_LOCALE
std::locale::global(boost::locale::generator().generate("")); std::locale::global(boost::locale::generator().generate(""));
#endif
// ********************************************************* Step 2: parameter interactions // ********************************************************* Step 2: parameter interactions

12
src/twister.cpp

@ -13,7 +13,9 @@ using namespace json_spirit;
using namespace std; using namespace std;
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <boost/locale.hpp> #ifdef HAVE_BOOST_LOCALE
#include <boost/locale.hpp>
#endif
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
@ -1227,7 +1229,11 @@ void updateSeenHashtags(std::string &message, int64_t msgTime)
BOOST_FOREACH(string const& token, tokens) { BOOST_FOREACH(string const& token, tokens) {
if( token.length() >= 2 ) { if( token.length() >= 2 ) {
string word = token.substr(1); string word = token.substr(1);
#ifdef HAVE_BOOST_LOCALE
word = boost::locale::to_lower(word); word = boost::locale::to_lower(word);
#else
boost::algorithm::to_lower(word);
#endif
if( token.at(0) == '#') { if( token.at(0) == '#') {
hashtags.insert(word); hashtags.insert(word);
} }
@ -1490,7 +1496,11 @@ Value newpostmsg(const Array& params, bool fHelp)
BOOST_FOREACH(string const& token, tokens) { BOOST_FOREACH(string const& token, tokens) {
if( token.length() >= 2 ) { if( token.length() >= 2 ) {
string word = token.substr(1); string word = token.substr(1);
#ifdef HAVE_BOOST_LOCALE
word = boost::locale::to_lower(word); word = boost::locale::to_lower(word);
#else
boost::algorithm::to_lower(word);
#endif
if( token.at(0) == '#') { if( token.at(0) == '#') {
ses->dht_putData(word, "hashtag", true, ses->dht_putData(word, "hashtag", true,
v, strUsername, GetAdjustedTime(), 0); v, strUsername, GetAdjustedTime(), 0);

Loading…
Cancel
Save