📄 zle.cpp
字号:
/// @file zle.cpp
/// Zero length encoding
///
/// @remarks
/// Loco's first attempt to make a compressor for octane
///
/// @author loco
/// @date 2003.08.13
///
///
#include "zle.hpp"
#include <iomanip>
using namespace std;
zleCompressor GloballyInstantiated_zle(true);
zleCompressor::zleCompressor(bool registerme)
:OctaneCompressor(registerme)
{
if (registerme)CompressorManager_SingletonInsurer managerinsurance(this);
}
bool zleCompressor::DoProtectedCompress(bitreader &s, bitwriter &d)
{
while (!s.empty())
{
unsigned char b = s.get_byte();
unsigned char c;
d.put_byte(b);
if (!b)
{
for (c= 0; c < 255; c++)
{
if (s.empty()) break;
if (s.get_byte())
{
s.seek_byte(-1, ios::cur);
break;
}
}
d.put_byte(c);
}
}
return true;
}
bool zleCompressor::DoProtectedDecompress(bitreader &s, bitwriter &d)
{
while (!s.empty())
{
unsigned char b = s.get_byte();
d.put_byte(b);
if (!b)
{
for (unsigned char c = s.get_byte(); c; c--) d.put_byte(0);
}
}
return true;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -