mirror of
https://github.com/clangen/musikcube.git
synced 2024-11-19 20:13:36 +00:00
Fixed a couple really old LibraryTrack bugs caused by code that was
never exercised.
This commit is contained in:
parent
b51dee258f
commit
c63892bcdc
@ -69,8 +69,11 @@ LibraryTrack::~LibraryTrack() {
|
||||
std::string LibraryTrack::GetString(const char* metakey) {
|
||||
std::unique_lock<std::mutex> lock(this->mutex);
|
||||
MetadataMap::iterator metavalue = this->metadata.find(metakey);
|
||||
if (metavalue != this->metadata.end()) {
|
||||
return metavalue->second;
|
||||
while (metavalue != this->metadata.end()) {
|
||||
if (metavalue->second.size() > 0) {
|
||||
return metavalue->second;
|
||||
}
|
||||
++metavalue;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
@ -112,8 +115,14 @@ double LibraryTrack::GetDouble(const char* key, double defaultValue) {
|
||||
}
|
||||
|
||||
void LibraryTrack::SetValue(const char* metakey, const char* value) {
|
||||
std::unique_lock<std::mutex> lock(this->mutex);
|
||||
this->metadata.insert(std::pair<std::string, std::string>(metakey,value));
|
||||
if (value) {
|
||||
std::string strValue(value);
|
||||
if (strValue.size()) {
|
||||
std::unique_lock<std::mutex> lock(this->mutex);
|
||||
this->metadata.insert(std::pair<std::string, std::string>(metakey, strValue));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void LibraryTrack::ClearValue(const char* metakey) {
|
||||
|
@ -66,6 +66,10 @@ class SdkWrapper : public Track {
|
||||
}
|
||||
}
|
||||
|
||||
virtual int64_t GetId() {
|
||||
return track->GetId();
|
||||
}
|
||||
|
||||
virtual int GetString(const char* key, char* dst, int size) override {
|
||||
return track->GetString(key, dst, size);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user