Merge pull request #27 from um-lsr/main
fix: ncm 3.x version compatibility issues
This commit is contained in:
commit
2e5fc75fee
|
@ -391,23 +391,24 @@ NeteaseCrypt::NeteaseCrypt(std::string const &path)
|
||||||
mMetaData = new NeteaseMusicMetadata(cJSON_Parse(modifyDecryptData.c_str()));
|
mMetaData = new NeteaseMusicMetadata(cJSON_Parse(modifyDecryptData.c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// skip crc32 & unuse charset
|
// skip crc32 & image version
|
||||||
if (!mFile.seekg(9, mFile.cur))
|
if (!mFile.seekg(5, mFile.cur))
|
||||||
{
|
{
|
||||||
throw std::invalid_argument("can't seek file");
|
throw std::invalid_argument("can't seek file");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t cover_frame_len{0};
|
||||||
|
read(reinterpret_cast<char *>(&cover_frame_len), 4);
|
||||||
read(reinterpret_cast<char *>(&n), sizeof(n));
|
read(reinterpret_cast<char *>(&n), sizeof(n));
|
||||||
|
|
||||||
if (n > 0)
|
if (n > 0)
|
||||||
{
|
{
|
||||||
char *imageData = (char *)malloc(n);
|
mImageData = std::string(n, '\0');
|
||||||
read(imageData, n);
|
read(&mImageData[0], n);
|
||||||
|
|
||||||
mImageData = std::string(imageData, n);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout << "[Warn] " << path << " missing album can't fix album image!" << std::endl;
|
std::cout << "[Warn] " << path << " missing album can't fix album image!" << std::endl;
|
||||||
}
|
}
|
||||||
|
mFile.seekg(cover_frame_len - n, mFile.cur);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue