diff options
Diffstat (limited to 'indexlib')
-rw-r--r-- | indexlib/bitio.h | 10 | ||||
-rw-r--r-- | indexlib/bitio.tcc | 6 | ||||
-rw-r--r-- | indexlib/leafdata.cpp | 6 | ||||
-rw-r--r-- | indexlib/leafdata.h | 2 | ||||
-rw-r--r-- | indexlib/mempool.tcc | 2 | ||||
-rw-r--r-- | indexlib/memvector.h | 14 | ||||
-rw-r--r-- | indexlib/memvector.tcc | 10 | ||||
-rw-r--r-- | indexlib/thing.h | 4 |
8 files changed, 27 insertions, 27 deletions
diff --git a/indexlib/bitio.h b/indexlib/bitio.h index 40f4ef7d7..913f44ea4 100644 --- a/indexlib/bitio.h +++ b/indexlib/bitio.h @@ -50,11 +50,11 @@ namespace byte_io { T read( const unsigned char* ); template<typename T> - struct byte_lenght_struct { }; + struct byte_length_struct { }; template<typename T> - struct byte_lenght_struct<const T> { - static const int value = byte_lenght_struct<T>::value; + struct byte_length_struct<const T> { + static const int value = byte_length_struct<T>::value; }; @@ -63,8 +63,8 @@ namespace byte_io { * for supported types. */ template<typename T> - unsigned byte_lenght() { - return byte_lenght_struct<T>::value; + unsigned byte_length() { + return byte_length_struct<T>::value; } } diff --git a/indexlib/bitio.tcc b/indexlib/bitio.tcc index 2779cfedb..f6dbdfc0b 100644 --- a/indexlib/bitio.tcc +++ b/indexlib/bitio.tcc @@ -39,7 +39,7 @@ namespace byte_io { } template<> - struct byte_lenght_struct<uint8_t> { + struct byte_length_struct<uint8_t> { static const int value = 1; }; @@ -60,7 +60,7 @@ namespace byte_io { } template<> - struct byte_lenght_struct<uint16_t> { + struct byte_length_struct<uint16_t> { static const int value = 2; }; @@ -84,7 +84,7 @@ namespace byte_io { return res; } template<> - struct byte_lenght_struct<uint32_t> { + struct byte_length_struct<uint32_t> { static const int value = 4; }; } diff --git a/indexlib/leafdata.cpp b/indexlib/leafdata.cpp index 70773330a..db61119af 100644 --- a/indexlib/leafdata.cpp +++ b/indexlib/leafdata.cpp @@ -50,7 +50,7 @@ uint32_t leaf_data::get_reference( unsigned idx ) const { } bool leaf_data::can_add( uint32_t ref ) const { - if ( ( capacity() - usedbytes() ) > ( 1 + byte_io::byte_lenght<uint32_t>() ) ) return true; + if ( ( capacity() - usedbytes() ) > ( 1 + byte_io::byte_length<uint32_t>() ) ) return true; if ( capacity() == usedbytes() ) return false; uint32_t last = 0; for ( iterator first = begin(), past = end(); first != past; ++first ) { @@ -97,7 +97,7 @@ void leaf_data::add_reference( uint32_t ref ) { } else { *target++ = 0; byte_io::write<uint32_t>( target, ref ); - set_usedbytes( usedbytes() + 1 + byte_io::byte_lenght<uint32_t>() ); + set_usedbytes( usedbytes() + 1 + byte_io::byte_length<uint32_t>() ); } assert( usedbytes() <= capacity() ); } @@ -123,7 +123,7 @@ void leaf_data::remove_reference( uint32_t ref ) { else { ++iter; byte_io::write<uint32_t>(iter,byte_io::read<uint32_t>(iter)-1); - iter += byte_io::byte_lenght<uint32_t>(); + iter += byte_io::byte_length<uint32_t>(); } } } diff --git a/indexlib/leafdata.h b/indexlib/leafdata.h index fa08645e7..4b54a4e8a 100644 --- a/indexlib/leafdata.h +++ b/indexlib/leafdata.h @@ -60,7 +60,7 @@ struct leafdata_iterator : public std::iterator<STD_NAMESPACE_PREFIX input_itera value_ += delta; } else { value_ = byte_io::read<uint32_t>( data_ ); - data_ += byte_io::byte_lenght<uint32_t>(); + data_ += byte_io::byte_length<uint32_t>(); } return value_ - 1; } diff --git a/indexlib/mempool.tcc b/indexlib/mempool.tcc index 19a5e6d44..a130bffee 100644 --- a/indexlib/mempool.tcc +++ b/indexlib/mempool.tcc @@ -135,7 +135,7 @@ void mempool<Traits>::print( std::ostream& out ) const { template <typename Traits> memory_reference<uint32_t> mempool<Traits>::free_list( unsigned order ) { assert( order ); - return memory_reference<uint32_t>( manager_->rw_base( order * byte_io::byte_lenght<uint32_t>() ) ); + return memory_reference<uint32_t>( manager_->rw_base( order * byte_io::byte_length<uint32_t>() ) ); } template <typename Traits> diff --git a/indexlib/memvector.h b/indexlib/memvector.h index d4cc446ef..446fddf92 100644 --- a/indexlib/memvector.h +++ b/indexlib/memvector.h @@ -72,23 +72,23 @@ struct memory_iterator : public std::iterator<STD_NAMESPACE_PREFIX random_access } memory_iterator& operator ++() { - data_ += byte_io::byte_lenght<T>(); + data_ += byte_io::byte_length<T>(); return *this; } memory_iterator& operator --() { - data_ -= byte_io::byte_lenght<T>(); + data_ -= byte_io::byte_length<T>(); return *this; } memory_iterator& operator += ( ptrdiff_t dif ) { - data_ += dif * byte_io::byte_lenght<T>(); + data_ += dif * byte_io::byte_length<T>(); return *this; } ptrdiff_t operator - ( const memory_iterator<T>& other ) const { - assert( !( ( raw() - other.raw() )%byte_io::byte_lenght<T>() ) ); - return ( raw() - other.raw() )/byte_io::byte_lenght<T>(); + assert( !( ( raw() - other.raw() )%byte_io::byte_length<T>() ) ); + return ( raw() - other.raw() )/byte_io::byte_length<T>(); } bool operator < ( const memory_iterator<T>& other ) const { @@ -211,8 +211,8 @@ struct memvector { boost::scoped_ptr<memory_manager> data_; unsigned char* address_of( unsigned i ) { return data_->rw_base( - byte_io::byte_lenght<unsigned>() + - i * byte_io::byte_lenght<T>() ); + byte_io::byte_length<unsigned>() + + i * byte_io::byte_length<T>() ); } const unsigned char* address_of( unsigned i ) const { return const_cast<memvector*>( this )->address_of( i ); diff --git a/indexlib/memvector.tcc b/indexlib/memvector.tcc index 792c389c3..0acfef58c 100644 --- a/indexlib/memvector.tcc +++ b/indexlib/memvector.tcc @@ -9,7 +9,7 @@ memvector<T>::memvector( std::string fname ): data_( new mmap_manager( fname ) ) { if ( !data_->size() ) { - data_->resize( byte_io::byte_lenght<unsigned>() ); + data_->resize( byte_io::byte_length<unsigned>() ); byte_io::write<unsigned>( data_->rw_base( 0 ), 0 ); } } @@ -31,7 +31,7 @@ void memvector<T>::resize( size_type n_s ) { if ( size() >= n_s ) return; using namespace byte_io; - data_->resize( n_s * byte_lenght<value_type>() + byte_lenght<unsigned>() ); + data_->resize( n_s * byte_length<value_type>() + byte_length<unsigned>() ); iterator p_end = end(); write<unsigned>( data_->rw_base( 0 ), n_s ); while ( p_end != end() ) { @@ -45,10 +45,10 @@ void memvector<T>::insert( const_iterator where, const value_type v ) { assert( !( where < begin() ) ); assert( where <= end() ); const unsigned to_idx = where.raw() - data_->ronly_base( 0 ); - data_->resize( ( size() + 1 ) * byte_io::byte_lenght<value_type>() + byte_io::byte_lenght<unsigned>() ); + data_->resize( ( size() + 1 ) * byte_io::byte_length<value_type>() + byte_io::byte_length<unsigned>() ); unsigned char* to = data_->rw_base( to_idx ); // make space: - std::memmove( to + byte_io::byte_lenght<value_type>(), to, end().raw() - to ); + std::memmove( to + byte_io::byte_length<value_type>(), to, end().raw() - to ); byte_io::write<value_type>( to, v ); byte_io::write<unsigned>( data_->rw_base( 0 ), size() + 1 ); } @@ -68,7 +68,7 @@ void memvector<T>::erase( iterator where ) { template <typename T> void memvector<T>::clear() { - data_->resize( byte_io::byte_lenght<uint32_t>() ); + data_->resize( byte_io::byte_length<uint32_t>() ); byte_io::write<uint32_t>( data_->rw_base( 0 ), 0 ); } diff --git a/indexlib/thing.h b/indexlib/thing.h index 923bad33c..0fc495f73 100644 --- a/indexlib/thing.h +++ b/indexlib/thing.h @@ -157,8 +157,8 @@ struct simple_accessor { write<uint32_t>( out, p.cast_to_uint32() ); \ } \ template<> \ - struct byte_lenght_struct< pointer <name> > { \ - static const unsigned value = byte_lenght_struct<uint32_t>::value; \ + struct byte_length_struct< pointer <name> > { \ + static const unsigned value = byte_length_struct<uint32_t>::value; \ }; \ } // namespace |