Skip to content

Commit

Permalink
closes #5: fix invalid statement in TArray::move.
Browse files Browse the repository at this point in the history
  • Loading branch information
kimkulling committed Jan 18, 2020
1 parent 0adc8d9 commit a4b3117
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions build/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ if( WIN32 AND NOT CYGWIN )
endif()
elseif( CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX )
# Update if necessary
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -pedantic -std=c++0x")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -g -pedantic -std=c++0x")
elseif ( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -pedantic -std=c++11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -g -pedantic -std=c++11")
endif()

IF (ASSIMP_ASAN)
Expand Down
5 changes: 3 additions & 2 deletions include/cppcore/Container/TArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ void TArray<T>::move( size_t fromIdx, size_t toIdx ) {

size_t numElements = m_Size - fromIdx;
size_t newSize = toIdx + numElements;
printf("newSize = %d\n", newSize);
while ( m_Capacity < newSize ) {
resize( m_Capacity + getGrowing( newSize - m_Capacity ) );
}
Expand All @@ -348,8 +349,8 @@ void TArray<T>::move( size_t fromIdx, size_t toIdx ) {
destroy( index );
}
} else {
for ( size_t i=numElements-1; i>=0; --i ) {
m_pData[ toIdx + i ] = m_pData[ fromIdx + i ];
for ( size_t i=numElements-1; i!=0; --i ) {
m_pData[ toIdx + i ] = m_pData[ fromIdx + i ];
}

for( size_t i = 0; i<numElements; i++ ) {
Expand Down

0 comments on commit a4b3117

Please sign in to comment.