Lehks / NostraUtils

A Utility Library for the Nostra Game Engine.
MIT License
6 stars 0 forks source link

String - INVALID_OBJECT Error / Performance issues #1

Closed Lehks closed 6 years ago

Lehks commented 6 years ago

File: dat_alg/String.hpp Line: 1463 Function: String::remove(...)

1) Translation from NULL_INDEX to String::size() is missing. remove() is supposed to use the size of the string as the end if NULL_INDEX is passed as end.

2) If the end is the size of the string, the underlying vector will trigger an INVALID_OBJECT error. This is not supposed to happen as the interval that should be removed is [start, end).

3) Using Vector::remove() is not perfect performance wise, this should be optimized.

4) As of now, the size is being set incorrectly. The size will always be decreased by one, even if the amount of removed characters is not one.

5) Error handling is missing.

NooCi commented 6 years ago

ad68d25d5281ba04ffbb447ad4d6ffc65784bc38

NooCi commented 6 years ago

Fixed