archivebase.cpp

来自「这是整套横扫千军3D版游戏的源码」· C++ 代码 · 共 25 行

CPP
25
字号
#include "ArchiveBase.h"

extern "C" {
#include "lib/7zip/7zCrc.h"
};

unsigned int CArchiveBase::GetCrc32 (const string& fileName)
{
	UInt32 crc;
	unsigned char buffer [65536];
	int handle;

	CrcInit(&crc);
	handle = this->OpenFile(fileName);
	if (handle == 0) return CrcGetDigest(&crc);

	while (!this->Eof(handle)) {
		int maxRead = this->ReadFile(handle, &buffer, sizeof(buffer));
		CrcUpdate (&crc, buffer, maxRead);
	}

	this->CloseFile(handle);
	return CrcGetDigest(&crc);
};

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?