diff --git a/src/include/ncmcrypt.h b/src/include/ncmcrypt.h index 7cbebd6..367cdc2 100644 --- a/src/include/ncmcrypt.h +++ b/src/include/ncmcrypt.h @@ -47,7 +47,7 @@ private: NcmFormat mFormat; std::string mImageData; std::ifstream mFile; - unsigned char mKeyBox[256]; + unsigned char mKeyBox[256]{}; NeteaseMusicMetadata* mMetaData; private: diff --git a/src/ncmcrypt.cpp b/src/ncmcrypt.cpp index ce07f12..c41ac1a 100644 --- a/src/ncmcrypt.cpp +++ b/src/ncmcrypt.cpp @@ -224,7 +224,7 @@ void NeteaseCrypt::FixMetadata() audioFile = new TagLib::MPEG::File(mDumpFilepath.c_str()); tag = dynamic_cast(audioFile)->ID3v2Tag(true); - if (mImageData.length() > 0) + if (!mImageData.empty()) { TagLib::ID3v2::AttachedPictureFrame *frame = new TagLib::ID3v2::AttachedPictureFrame; @@ -239,7 +239,7 @@ void NeteaseCrypt::FixMetadata() audioFile = new TagLib::FLAC::File(mDumpFilepath.c_str()); tag = audioFile->tag(); - if (mImageData.length() > 0) + if (!mImageData.empty()) { TagLib::FLAC::Picture *cover = new TagLib::FLAC::Picture; cover->setMimeType(mimeType(mImageData)); @@ -301,7 +301,7 @@ void NeteaseCrypt::Dump(std::string const &outputDir = "") mFormat = NeteaseCrypt::FLAC; } - output.open(mDumpFilepath, output.out | output.binary); + output.open(mDumpFilepath, std::ofstream::out | std::ofstream::binary); } output.write((char *)buffer.data(), n);