diff --git a/include/fc/datastream.hpp b/include/fc/datastream.hpp index 8f2f56d..c333935 100644 --- a/include/fc/datastream.hpp +++ b/include/fc/datastream.hpp @@ -40,7 +40,8 @@ struct datastream { m_pos += s; return true; } - FC_THROW_MSG( "Attempt to read %s bytes beyond end of buffer of size %s", -((m_end-m_pos) - s),(m_end-m_start) ); + FC_THROW_MSG( "Attempt to read %s bytes beyond end of buffer of size %s", + int64_t(-((m_end-m_pos) - s)), int64_t(m_end-m_start) ); return false; } @@ -50,7 +51,7 @@ struct datastream { m_pos += s; return true; } - FC_THROW_MSG( "Attempt to write %s bytes beyond end of buffer of size %s", -((m_end-m_pos) - s),(m_end-m_start) ); + FC_THROW_MSG( "Attempt to write %s bytes beyond end of buffer of size %s", int64_t(-((m_end-m_pos) - s)),int64_t(m_end-m_start) ); return false; } @@ -60,7 +61,7 @@ struct datastream { ++m_pos; return true; } - FC_THROW_MSG( "Attempt to write %s byte beyond end of buffer of size %s", -((m_end-m_pos) - 1), (m_end-m_start) ); + FC_THROW_MSG( "Attempt to write %s byte beyond end of buffer of size %s", int64_t(-((m_end-m_pos) - 1)), int64_t(m_end-m_start) ); return false; } @@ -71,7 +72,7 @@ struct datastream { ++m_pos; return true; } - FC_THROW_MSG( "Attempt to read %s byte beyond end of buffer of size %s", -((m_end-m_pos) - 1), (m_end-m_start) ); + FC_THROW_MSG( "Attempt to read %s byte beyond end of buffer of size %s", int64_t(-((m_end-m_pos) - 1)), int64_t(m_end-m_start) ); ++m_pos; return false; } diff --git a/include/fc/exception.hpp b/include/fc/exception.hpp index 602cb60..b7d9fd2 100644 --- a/include/fc/exception.hpp +++ b/include/fc/exception.hpp @@ -67,6 +67,8 @@ namespace fc { fc::string to_string( int64_t v ); fc::string to_string( double v ); fc::string to_string( float v ); + fc::string to_string( int8_t v ); + fc::string to_string( uint8_t v ); fc::string to_string( int32_t v ); fc::string to_string( uint32_t v ); fc::string to_string( int16_t v ); diff --git a/include/fc/filesystem.hpp b/include/fc/filesystem.hpp index 4045df1..67b9604 100644 --- a/include/fc/filesystem.hpp +++ b/include/fc/filesystem.hpp @@ -55,7 +55,7 @@ namespace fc { friend bool operator==( const directory_iterator&, const directory_iterator& ); friend bool operator!=( const directory_iterator&, const directory_iterator& ); private: - fwd _p; + fwd _p; }; bool exists( const path& p ); diff --git a/include/fc/fstream.hpp b/include/fc/fstream.hpp index 1704e1e..7dfd6b3 100644 --- a/include/fc/fstream.hpp +++ b/include/fc/fstream.hpp @@ -30,6 +30,7 @@ namespace fc { ~ifstream(); void open( const fc::path& file, int m ); + size_t readsome( char* buf, size_t len ); ifstream& read( char* buf, size_t len ); void close(); bool eof()const; diff --git a/include/fc/raw.hpp b/include/fc/raw.hpp index d61ac7b..0de79c6 100644 --- a/include/fc/raw.hpp +++ b/include/fc/raw.hpp @@ -55,7 +55,7 @@ namespace fc { uint8_t b = uint8_t(val) & 0x7f; val >>= 7; b |= ((val > 0) << 7); - s.put(b); + s.write((char*)&b,1);//.put(b); } while( val ); } @@ -65,7 +65,7 @@ namespace fc { uint8_t b = uint8_t(val) & 0x7f; val >>= 7; b |= ((val > 0) << 7); - s.put(b); + s.write((char*)&b,1);//.put(b); }while( val ); } @@ -198,11 +198,11 @@ namespace fc { struct if_reflected { template static inline void pack( Stream& s, const T& v ) { - fc::static_reflector::visit( pack_object_visitor( v, s ) ); + fc::reflector::visit( pack_object_visitor( v, s ) ); } template static inline void unpack( Stream& s, T& v ) { - fc::static_reflector::visit( unpack_object_visitor( v, s ) ); + fc::reflector::visit( unpack_object_visitor( v, s ) ); } }; @@ -234,11 +234,11 @@ namespace fc { template inline void pack( Stream& s, const T& v ) { - fc::raw::detail::if_reflected< typename fc::static_reflector::is_defined >::pack(s,v); + fc::raw::detail::if_reflected< typename fc::reflector::is_defined >::pack(s,v); } template inline void unpack( Stream& s, T& v ) { - fc::raw::detail::if_reflected< typename fc::static_reflector::is_defined >::unpack(s,v); + fc::raw::detail::if_reflected< typename fc::reflector::is_defined >::unpack(s,v); } diff --git a/src/filesystem.cpp b/src/filesystem.cpp index ce40900..c102785 100644 --- a/src/filesystem.cpp +++ b/src/filesystem.cpp @@ -69,6 +69,22 @@ namespace fc { return _p->parent_path(); } + directory_iterator::directory_iterator( const fc::path& p ) + :_p(p){} + + directory_iterator::directory_iterator(){} + directory_iterator::~directory_iterator(){} + + fc::path directory_iterator::operator*()const { return boost::filesystem::path(*(*_p)); } + directory_iterator& directory_iterator::operator++(int) { (*_p)++; return *this; } + directory_iterator& directory_iterator::operator++() { (*_p)++; return *this; } + + bool operator==( const directory_iterator& r, const directory_iterator& l) { + return *r._p == *l._p; + } + bool operator!=( const directory_iterator& r, const directory_iterator& l) { + return *r._p != *l._p; + } bool exists( const path& p ) { return boost::filesystem::exists(p); } void create_directories( const path& p ) { boost::filesystem::create_directories(p); } diff --git a/src/fstream.cpp b/src/fstream.cpp index 3295fdc..23929a7 100644 --- a/src/fstream.cpp +++ b/src/fstream.cpp @@ -48,6 +48,9 @@ namespace fc { void ifstream::open( const fc::path& file, int m ) { my->ifs.open( file.string().c_str(), std::ios::binary ); } + size_t ifstream::readsome( char* buf, size_t len ) { + return my->ifs.readsome( buf, len ); + } ifstream& ifstream::read( char* buf, size_t len ) { my->ifs.read(buf,len); return *this;