Ignore:
Timestamp:
05/29/15 17:28:16 (10 years ago)
Author:
epyon
Message:
  • oops, missed src : got rid of to_string and other std::string utilities (except slurp) string no longer in nv namespace
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lua/lua_path.cc

    r376 r380  
    3232}
    3333
    34 void lua::path::push( nv::size_t value )
     34void lua::path::push( nv::uint32 value )
    3535{
    3636        m_elements[ m_count ].value  = value;
     
    5050        if (m_count == 0) return false;
    5151        if (global) lua_pushglobaltable( L );
    52         for (int i = 0; i < m_count; ++i )
     52        for ( uint32 i = 0; i < m_count; ++i )
    5353        {
    5454                if ( lua_istable( L, -1 ) )
     
    7676std::string nv::lua::path::to_string() const
    7777{
    78         std::string result;
    79         result.reserve( 64 );
     78        char buffer[64];
     79        char* start   = buffer;
     80        char* current = buffer;
    8081        bool dot = false;
     82        bool oos = false;
    8183        for ( const element& e : m_elements )
    8284        {
    83                 if ( dot ) result.append(".");
     85                if ( current - start > 48 ) { oos = true; break; }
     86                if ( dot ) *current++ = '.';
    8487                if ( e.length == 0 )
    8588                {
    86                         result.append("[" + nv::to_string( e.value ) + "]" );
     89                        *current++ = '[';
     90                        current += uint32_to_buffer( e.value, current );
     91                        *current++ = ']';
    8792                        dot = false;
    8893                }
    8994                else
    9095                {
    91                         result.append( e.str, e.length );
     96                        if ( size_t(current - start) + e.length > 60 ) { oos = true; break; }
     97                        nvmemcpy( current, e.str, e.length );
     98                        current += e.length;
    9299                        dot = true;
    93100                }
    94101        }
    95         return result;
     102        if (oos)
     103        {
     104                *current++ = '.';
     105                *current++ = '.';
     106                *current++ = '.';
     107        }
     108        *current++ = '\0';
     109        return std::string( buffer, size_t(current - start - 1) );
    96110}
Note: See TracChangeset for help on using the changeset viewer.