diff options
author | Robin Gareus <robin@gareus.org> | 2016-02-13 23:15:47 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2016-02-13 23:15:47 +0100 |
commit | 48532baaa7eeda99e9b5ea880f52308570dc3181 (patch) | |
tree | 4a36a5d9cb34da7488a178dc258ee94a806d9d38 /libs | |
parent | d442190b8a01e0f941080a75fa31e02bf39a202e (diff) |
remove C++11'isms from libptformat. back to C++98 compat.
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ptformat/ptfformat.cc | 20 | ||||
-rw-r--r-- | libs/ptformat/ptfformat.h | 23 |
2 files changed, 26 insertions, 17 deletions
diff --git a/libs/ptformat/ptfformat.cc b/libs/ptformat/ptfformat.cc index 62fc0293c7..6d055d4a36 100644 --- a/libs/ptformat/ptfformat.cc +++ b/libs/ptformat/ptfformat.cc @@ -589,18 +589,13 @@ PTFFormat::parserest5(void) { vector<track_t>::iterator ti; vector<track_t>::iterator bt = tracks.begin(); vector<track_t>::iterator et = tracks.end(); - track_t tr = { name, 0, 0, r }; + track_t tr ( name, 0, 0, &r); if ((ti = std::find(bt, et, tr)) != et) { tracknumber = (*ti).index; } else { tracknumber = tracks.size() + 1; } - track_t t = { - name, - (uint16_t)tracknumber, - uint8_t(0), - r - }; + track_t t ( name, (uint16_t)tracknumber, uint8_t(0), &r); tracks.push_back(t); } else { region_t r = { @@ -615,18 +610,13 @@ PTFFormat::parserest5(void) { vector<track_t>::iterator ti; vector<track_t>::iterator bt = tracks.begin(); vector<track_t>::iterator et = tracks.end(); - track_t tr = { name, 0, 0, r }; + track_t tr ( name, 0, 0, &r ); if ((ti = std::find(bt, et, tr)) != et) { tracknumber = (*ti).index; } else { tracknumber = tracks.size() + 1; } - track_t t = { - name, - (uint16_t)tracknumber, - uint8_t(0), - r - }; + track_t t ( name, (uint16_t)tracknumber, uint8_t(0), &r); tracks.push_back(t); } rindex++; @@ -1307,7 +1297,7 @@ PTFFormat::parserest10(void) { vector<region_t>::iterator finish = regions.end(); vector<region_t>::iterator found; if ((found = std::find(begin, finish, tr.reg)) != finish) { - tr.reg = (*found); + tr.set_region (&(*found)); } i = l+16; offset = 0; diff --git a/libs/ptformat/ptfformat.h b/libs/ptformat/ptfformat.h index f2c51d9830..8b2f58de73 100644 --- a/libs/ptformat/ptfformat.h +++ b/libs/ptformat/ptfformat.h @@ -39,12 +39,12 @@ public: int64_t posabsolute; int64_t length; - bool operator <(const struct wav& other) { + bool operator <(const struct wav& other) const { return (strcasecmp(this->filename.c_str(), other.filename.c_str()) < 0); } - bool operator ==(const struct wav& other) { + bool operator ==(const struct wav& other) const { return (this->filename == other.filename || this->index == other.index); } @@ -65,6 +65,25 @@ public: } region_t; typedef struct track { + track () + : index (0) + , playlist (0) + { + memset ((void*)®, 0, sizeof(region_t)); + } + + track (std::string n, uint16_t i, uint8_t p, region_t *r) + : name (n) + , index (i) + , playlist (p) + { + set_region (r); + } + + void set_region (region_t *r) { + memcpy ((void*)®, (void*)r, sizeof(region_t)); + } + std::string name; uint16_t index; uint8_t playlist; |