Ubuntu 18.04 Upgrade #3

Merged
RoshanSyed merged 143 commits from github/fork/PBSA/master into master 2019-09-03 16:20:50 +00:00
3 changed files with 35 additions and 13 deletions
Showing only changes of commit 2bc237537c - Show all commits

View file

@ -8,6 +8,8 @@
namespace fc namespace fc
{ {
std::string prune_invalid_utf8( const std::string& str );
bool is_utf8( const std::string& str ); bool is_utf8( const std::string& str );
/** Decodes utf 8 std::string into unicode string. /** Decodes utf 8 std::string into unicode string.

View file

@ -3,16 +3,36 @@
#include "utf8/checked.h" #include "utf8/checked.h"
#include "utf8/core.h" #include "utf8/core.h"
#include "utf8/unchecked.h" #include "utf8/unchecked.h"
#include <websocketpp/utf8_validator.hpp>
#include <assert.h> #include <assert.h>
#include <fc/log/logger.hpp>
#include <iostream>
namespace fc { namespace fc {
bool is_utf8( const std::string& str ) bool is_utf8( const std::string& str )
{ {
auto itr = utf8::find_invalid(str.begin(), str.end());
return utf8::is_valid( str.begin(), str.end() ); return utf8::is_valid( str.begin(), str.end() );
} }
string prune_invalid_utf8( const string& str ) {
string result;
auto itr = utf8::find_invalid(str.begin(), str.end());
if( itr == str.end() ) return str;
result = string( str.begin(), itr );
while( itr != str.end() ) {
++itr;
auto start = itr;
itr = utf8::find_invalid( start, str.end());
result += string( start, itr );
}
return result;
}
void decodeUtf8(const std::string& input, std::wstring* storage) void decodeUtf8(const std::string& input, std::wstring* storage)
{ {
assert(storage != nullptr); assert(storage != nullptr);

2
vendor/websocketpp vendored

@ -1 +1 @@
Subproject commit c5510d6de04917812b910a8dd44735c1f17061d9 Subproject commit 378437aecdcb1dfe62096ffd5d944bf1f640ccc3