Skip to content

Commit

Permalink
Move some NanaZip.Codecs definitions to related header file.
Browse files Browse the repository at this point in the history
  • Loading branch information
MouriNaruto committed May 6, 2024
1 parent 3ee377d commit af1e067
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
17 changes: 3 additions & 14 deletions NanaZip.Codecs/NanaZip.Codecs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,6 @@

namespace
{
// Definition of NanaZip interface constants
// I had mentioned one of the reasons that I call this project NanaZip
// because Nana is the romaji of なな which means seven in Japanese. But
// I had not mentioned the way I confirm that: I had recalled one of the
// Japanese VTubers called Kagura Nana when I waiting my elder sister for
// dinner at Taiyanggong subway station, Beijing.
// For playing more puns, NanaZip uses the K7 prefix in some definitions.
// (K -> Kagura, 7 -> Nana)

// 0x4823374B is big-endian representation of K7#H (H -> Hash)
const UINT64 NanaZipHasherIdBase = 0x4823374B00000000;

std::vector<std::pair<std::string, IHasher*>> g_Hashers =
{
{ "BLAKE3", NanaZip::Codecs::Hash::CreateBlake3() },
Expand Down Expand Up @@ -69,7 +57,8 @@ struct HasherFactory : public winrt::implements<
{
case SevenZipHasherId:
{
Value->uhVal.QuadPart = NanaZipHasherIdBase | Index;
Value->uhVal.QuadPart =
NanaZip::Codecs::HashProviderIdBase | Index;
Value->vt = VT_UI8;
break;
}
Expand All @@ -90,7 +79,7 @@ struct HasherFactory : public winrt::implements<
EncoderGuid.Data2 = SevenZipGuidData2;
EncoderGuid.Data3 = SevenZipGuidData3Hasher;
*reinterpret_cast<PUINT64>(EncoderGuid.Data4) =
NanaZipHasherIdBase | Index;
NanaZip::Codecs::HashProviderIdBase | Index;
Value->bstrVal = ::SysAllocStringByteLen(
reinterpret_cast<LPCSTR>(&EncoderGuid),
sizeof(EncoderGuid));
Expand Down
20 changes: 20 additions & 0 deletions NanaZip.Codecs/NanaZip.Codecs.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,26 @@

#include <NanaZip.Specification.SevenZip.h>

/**
* Definition of NanaZip interface constants
*
* I had mentioned one of the reasons that I call this project NanaZip because
* Nana is the romaji of なな which means seven in Japanese. But I had not
* mentioned the way I confirm that: I had recalled one of the Japanese VTubers
* called Kagura Nana when I waiting my elder sister for dinner at Taiyanggong
* subway station, Beijing. For playing more puns, NanaZip uses the K7 prefix in
* some definitions. (K -> Kagura, 7 -> Nana)
*/

namespace NanaZip::Codecs
{
/**
* @brief The ID base value of NanaZip Hash Provider.
* @remark 0x4823374B is big-endian representation of K7#H (H -> Hash)
*/
const UINT64 HashProviderIdBase = 0x4823374B00000000;
}

namespace NanaZip::Codecs::Hash
{
IHasher* CreateBlake3();
Expand Down

0 comments on commit af1e067

Please sign in to comment.