Skip to content

Commit

Permalink
use existing functions - std::replace and MDAL::split instead of cust…
Browse files Browse the repository at this point in the history
…om function

Co-authored-by: Stefanos Natsis <[email protected]>
  • Loading branch information
JanCaha and uclaros authored Feb 20, 2025
1 parent 501ba6a commit 005cbe5
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions mdal/frmts/mdal_mike21.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@

#define DRIVER_NAME "Mike21"

void replaceTabsWithSpaces(std::string& str) {
for (size_t i = 0; i < str.length(); ++i) {
if (str[i] == '\t') {
str[i] = ' ';
}
}
}

static bool parse_vertex_id_gaps( std::map<size_t, size_t> &vertexIDtoIndex, size_t vertexIndex, size_t vertexID )
Expand Down Expand Up @@ -246,8 +240,8 @@ std::unique_ptr<MDAL::Mesh> MDAL::DriverMike21::load( const std::string &meshFil
{
if ( 0 < lineNumber && lineNumber < mVertexCount + 1 )
{
replaceTabsWithSpaces(line);
chunks = MDAL::split( MDAL::trim( line ),' ');
std::replace( line.begin(), line.end(), '\t', ' ' );
chunks = MDAL::split( MDAL::trim( line ), ' ' );
if ( chunks.size() != 5 )
{
MDAL::Log::error( MDAL_Status::Err_InvalidData, name(), "vertex line in invalid format." );
Expand Down Expand Up @@ -284,8 +278,8 @@ std::unique_ptr<MDAL::Mesh> MDAL::DriverMike21::load( const std::string &meshFil

if ( mVertexCount + 1 < lineNumber )
{
replaceTabsWithSpaces(line);
chunks = MDAL::split( MDAL::trim( line ),' ');
std::replace( line.begin(), line.end(), '\t', ' ' );
chunks = MDAL::split( MDAL::trim( line ), ' ' );
assert( faceIndex < faceCount );

size_t faceVertexCount = chunks.size() - 1;
Expand Down

0 comments on commit 005cbe5

Please sign in to comment.