Changeset 440 for trunk/src/lua/lua_path.cc
- Timestamp:
- 07/23/15 21:16:01 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lua/lua_path.cc
r435 r440 74 74 } 75 75 76 st d::stringnv::lua::path::to_string() const76 string128 nv::lua::path::to_string() const 77 77 { 78 char buffer[64]; 79 char* start = buffer; 80 char* current = buffer; 78 string128 buffer; 81 79 bool dot = false; 82 bool oos = false;83 80 for ( const element& e : m_elements ) 84 81 { 85 if ( current - start > 48 ) { oos = true; break; } 86 if ( dot ) *current++ = '.'; 82 if ( dot ) buffer.append( "." ); 87 83 if ( e.length == 0 ) 88 84 { 89 *current++ = '['; 90 current += uint32_to_buffer( array_ref< char >( current, current - start ), e.value ); 91 *current++ = ']'; 85 buffer.append( "["_ls + e.value + "]"_ls ); 92 86 dot = false; 93 87 } 94 88 else 95 89 { 96 if ( size_t(current - start) + e.length > 60 ) { oos = true; break; } 97 nvmemcpy( current, e.str, e.length ); 98 current += e.length; 90 buffer.append( e.str, e.length ); 99 91 dot = true; 100 92 } 101 93 } 102 if (oos) 103 { 104 *current++ = '.'; 105 *current++ = '.'; 106 *current++ = '.'; 107 } 108 *current++ = '\0'; 109 return std::string( buffer, size_t(current - start - 1) ); 94 return buffer; 110 95 }
Note: See TracChangeset
for help on using the changeset viewer.