From 271781f78c544d66706c49060118d4a520cd49d1 Mon Sep 17 00:00:00 2001 From: Nicolas Wack Date: Sun, 19 Jan 2014 19:30:42 +0100 Subject: [PATCH 1/4] Fix compilation with clang/libc++ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The issue was that redeclaring the hash template in the code somehow seems to shadow the declaration that is done in and and afterwards the template specialization of the hash function seems to use our redefined template instead of libc++’s one (most likely due to the fact that libc++ uses an inline namespace inside std) --- include/fc/array.hpp | 2 -- include/fc/crypto/ripemd160.hpp | 2 -- include/fc/crypto/sha1.hpp | 2 -- include/fc/crypto/sha224.hpp | 2 -- include/fc/network/ip.hpp | 2 -- include/fc/uint128.hpp | 2 -- 6 files changed, 12 deletions(-) diff --git a/include/fc/array.hpp b/include/fc/array.hpp index cae423f..b465b59 100644 --- a/include/fc/array.hpp +++ b/include/fc/array.hpp @@ -117,8 +117,6 @@ namespace fc { #include namespace std { - template struct hash; - template struct hash > { diff --git a/include/fc/crypto/ripemd160.hpp b/include/fc/crypto/ripemd160.hpp index 9816fe4..5cf404d 100644 --- a/include/fc/crypto/ripemd160.hpp +++ b/include/fc/crypto/ripemd160.hpp @@ -79,8 +79,6 @@ class ripemd160 namespace std { - template struct hash; - template<> struct hash { diff --git a/include/fc/crypto/sha1.hpp b/include/fc/crypto/sha1.hpp index 991ae57..62d077c 100644 --- a/include/fc/crypto/sha1.hpp +++ b/include/fc/crypto/sha1.hpp @@ -72,8 +72,6 @@ class sha1 namespace std { - template struct hash; - template<> struct hash { diff --git a/include/fc/crypto/sha224.hpp b/include/fc/crypto/sha224.hpp index 26fd51b..a7ed1ae 100644 --- a/include/fc/crypto/sha224.hpp +++ b/include/fc/crypto/sha224.hpp @@ -73,8 +73,6 @@ class sha224 } // fc namespace std { - template struct hash; - template<> struct hash { diff --git a/include/fc/network/ip.hpp b/include/fc/network/ip.hpp index 900c89a..60b95d7 100644 --- a/include/fc/network/ip.hpp +++ b/include/fc/network/ip.hpp @@ -112,8 +112,6 @@ namespace fc { } namespace std { - template struct hash; - template<> struct hash { diff --git a/include/fc/uint128.hpp b/include/fc/uint128.hpp index 2d84c4f..d41b388 100644 --- a/include/fc/uint128.hpp +++ b/include/fc/uint128.hpp @@ -99,8 +99,6 @@ namespace fc namespace std { - template struct hash; - template<> struct hash { From 36de4226d9e63e47b8eb811e412dac15afba6002 Mon Sep 17 00:00:00 2001 From: Nicolas Wack Date: Sun, 19 Jan 2014 19:58:58 +0100 Subject: [PATCH 2/4] Removed unused duplicate file. This functionality is now found in network/ip.hpp --- include/fc/network/endpoint.hpp | 37 --------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 include/fc/network/endpoint.hpp diff --git a/include/fc/network/endpoint.hpp b/include/fc/network/endpoint.hpp deleted file mode 100644 index f1805f3..0000000 --- a/include/fc/network/endpoint.hpp +++ /dev/null @@ -1,37 +0,0 @@ -#pragma once -#include - -namespace fc { - - namespace ip { - class address { - public: - address( uint32_t _ip = 0 ); - address( const fc::string& s ); - - - address& operator=( const fc::string& s ); - operator fc::string()const; - - uint32_t ip()const { return _ip; } - - - private: - uint32_t _ip; - }; - - class endpoint { - public: - endpoint(); - endpoint( const fc::string& i, uint16_t p ); - endpoint( const address& i, uint16_t p ); - - uint16_t port()const { return _port; } - fc::ip::address get_address()const { return _ip; } - - private: - uint16_t _port; - address _ip; - }; - } -} From 21558dbd70f31706050639422ec80fb027c8ab98 Mon Sep 17 00:00:00 2001 From: vogel76 Date: Fri, 31 Jan 2014 14:06:57 +0100 Subject: [PATCH 3/4] [BW]: [Ign] Fixed compile errors on MSVC. --- include/fc/io/enum_type.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/fc/io/enum_type.hpp b/include/fc/io/enum_type.hpp index c4bb024..2127ac2 100644 --- a/include/fc/io/enum_type.hpp +++ b/include/fc/io/enum_type.hpp @@ -23,8 +23,8 @@ namespace fc enum_type& operator=( IntType i ) { value = (EnumType)i; return *this;} enum_type& operator=( EnumType i ) { value = i; return *this;} - bool operator<( EnumType i ) { return value < i; } - bool operator>( EnumType i ) { return value < i; } + bool operator<( EnumType i ) const { return value < i; } + bool operator>( EnumType i ) const { return value < i; } bool operator<(const enum_type& e) const { return value < e.value;} bool operator>(const enum_type& e) const { return value > e.value;} From af77f4dc4b583413b8334a95f55eb4311d4c72b0 Mon Sep 17 00:00:00 2001 From: vogel76 Date: Sat, 1 Feb 2014 14:41:02 +0100 Subject: [PATCH 4/4] [BW]: [Fix] Fixed gcc compile errors --- include/fc/time.hpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/include/fc/time.hpp b/include/fc/time.hpp index c5ae58a..adde1c0 100644 --- a/include/fc/time.hpp +++ b/include/fc/time.hpp @@ -36,7 +36,7 @@ namespace fc { explicit time_point( microseconds e = microseconds() ) :elapsed(e){} static time_point now(); static time_point maximum() { return time_point( microseconds::maximum() ); } - static time_point (min)() { return time_point(); } + static time_point min() { return time_point(); } operator fc::string()const; static time_point from_iso_string( const fc::string& s ); @@ -48,10 +48,10 @@ namespace fc { bool operator <=( const time_point& t )const { return elapsed._count <=t.elapsed._count; } bool operator ==( const time_point& t )const { return elapsed._count ==t.elapsed._count; } bool operator !=( const time_point& t )const { return elapsed._count !=t.elapsed._count; } - time_point& operator += ( const microseconds& m ) { elapsed+=m; return *this; } - friend time_point operator + ( const time_point& t, const microseconds& m ) { return time_point(t.elapsed+m); } - friend time_point operator - ( const time_point& t, const microseconds& m ) { return time_point(t.elapsed-m); } - friend microseconds operator - ( const time_point& t, const time_point& m ) { return microseconds(t.elapsed.count() - m.elapsed.count()); } + time_point& operator += ( const microseconds& m) { elapsed+=m; return *this; } + time_point operator + (const microseconds& m) const { return time_point(elapsed+m); } + time_point operator - (const microseconds& m) const { return time_point(elapsed-m); } + microseconds operator - (const time_point& m) const { return microseconds(elapsed.count() - m.elapsed.count()); } private: microseconds elapsed; }; @@ -86,6 +86,8 @@ namespace fc { friend bool operator == ( const time_point_sec& a, const time_point_sec& b ) { return a.utc_seconds == b.utc_seconds; } time_point_sec& operator += ( uint32_t m ) { utc_seconds+=m; return *this; } + microseconds operator - (const time_point_sec& rhs) const { return microseconds(utc_seconds - rhs.utc_seconds);} + private: uint32_t utc_seconds; };