diff options
author | Robin Gareus <robin@gareus.org> | 2016-04-14 12:46:23 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2016-04-14 12:46:23 +0200 |
commit | 5af4ce47eb2f556ba403bc8896c7123dbc0d58a0 (patch) | |
tree | 085af1ee2dab196e4efa5fa7c456bda536b4c8ca /libs | |
parent | eda1508da1c7fadc7683fe1e6940d09237278d40 (diff) |
alternative approach for 48532baaa, C++98 compat that actually works, too
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ptformat/ptfformat.cc | 11 | ||||
-rw-r--r-- | libs/ptformat/ptfformat.h | 10 |
2 files changed, 10 insertions, 11 deletions
diff --git a/libs/ptformat/ptfformat.cc b/libs/ptformat/ptfformat.cc index 62fc0293c7..048c174918 100644 --- a/libs/ptformat/ptfformat.cc +++ b/libs/ptformat/ptfformat.cc @@ -637,11 +637,10 @@ PTFFormat::parserest5(void) { } void -PTFFormat::resort(std::vector<wav_t> *ws) { +PTFFormat::resort(std::vector<wav_t>& ws) { int j = 0; - std::sort((*ws).begin(), (*ws).end()); - for (std::vector<wav_t>::iterator i = (*ws).begin(); - i != (*ws).end(); ++i) { + std::sort(ws.begin(), ws.end()); + for (std::vector<wav_t>::iterator i = ws.begin(); i != ws.end(); ++i) { (*i).index = j; j++; } @@ -733,8 +732,8 @@ PTFFormat::parseaudio5(void) { numberofwavs--; i += 7; } - resort(&actualwavs); - resort(&audiofiles); + resort(actualwavs); + resort(audiofiles); } void diff --git a/libs/ptformat/ptfformat.h b/libs/ptformat/ptfformat.h index f2c51d9830..1ae362d672 100644 --- a/libs/ptformat/ptfformat.h +++ b/libs/ptformat/ptfformat.h @@ -32,24 +32,24 @@ public: */ int load(std::string path, int64_t targetsr); - typedef struct wav { + struct wav_t { std::string filename; uint16_t index; int64_t posabsolute; int64_t length; - bool operator <(const struct wav& other) { + bool operator <(const struct wav_t& other) const { return (strcasecmp(this->filename.c_str(), other.filename.c_str()) < 0); } - bool operator ==(const struct wav& other) { + bool operator ==(const struct wav_t& other) const { return (this->filename == other.filename || this->index == other.index); } - } wav_t; + }; typedef struct region { std::string name; @@ -130,7 +130,7 @@ private: void parserest10(void); void parseaudio5(void); void parseaudio(void); - void resort(std::vector<wav_t> *ws); + void resort(std::vector<wav_t>& ws); uint8_t mostfrequent(uint32_t start, uint32_t stop); std::vector<wav_t> actualwavs; float ratefactor; |