本文整理汇总了C++中line::reserve方法的典型用法代码示例。如果您正苦于以下问题:C++ line::reserve方法的具体用法?C++ line::reserve怎么用?C++ line::reserve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类line
的用法示例。
在下文中一共展示了line::reserve方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Thd_Match
DWORD WINAPI Thd_Match(PVOID lParam)
{
UNREFERENCED_PARAMETER(lParam);
XLIB_TRY
{
const DWORD start_time = GetTickCount();
mlog << "\r\n\r\n------------------------匹配工作开始------------------------\r\n";
if(g_file_sig)
{
ifstream file(g_filename.c_str(), ios::in | ios::binary);
if(!file)
{
file.close();
mlog << "无法打开或读取指定的特征码文件:" << g_filename;
return 0;
}
file.seekg(0, ios::end);
const unsigned int filelen = file.tellg();
if(filelen == 0)
{
file.close();
mlog << "指定的特征码文件:" << g_filename << "内容为空";
return 0;
}
file.seekg(0, ios::beg);
g_signature.clear();
g_signature.reserve(filelen);
file.read((char*)g_signature.end()._Ptr, filelen);
g_signature.append(g_signature.end()._Ptr, filelen);
file.close();
if(g_create_atom)
{
const DWORD atom_start_time = GetTickCount();
line sig(g_signature);
const line atoms(signaturematcher::create_atom_by_script(sig));
if(!atoms.empty())
{
string atomname(g_filename);
const size_t pos = atomname.find_last_of('.');
if(pos != string::npos)
{
atomname.erase(pos);
}
atomname.append(".atom");
ofstream of(atomname.c_str(), ios::out | ios::binary);
of.write((const char*)atoms.c_str(), atoms.size());
of.close();
mlog << "成功解析并写入中间原子文件("
<< (int)(GetTickCount() - atom_start_time)
<< "ms):"<< atomname << "\r\n";
}
}
}
if(g_blk.start() == nullptr)
{
pe tmppe(GetModuleHandle(nullptr));
g_blk = tmppe.GetImage();
}
g_blks.clear();
g_blks.push_back(g_blk);
g_report.clear();
signaturematcher::analy_script(g_signature, match_routine, nullptr);
if(g_file_sig && !g_report.empty())
{
const DWORD h_start_time = GetTickCount();
xmsg s64, s32, s16, s8, sp;
const size_t max_name_len = 46;
for(auto rep : g_report)
{
signaturematcher::REPORT_VALUE& rv = rep.second.values;
xmsg* lpmsg = nullptr;
xmsg var;
switch(rv.t)
{
case 'q': lpmsg = &s64; var << rv.q; break;
case 'd': lpmsg = &s32; var << rv.d; break;
case 'w': lpmsg = &s16; var << rv.w; break;
case 'b': lpmsg = &s8; var << rv.b; break;
case 'p': lpmsg = &sp; var << rv.p; break;
default: lpmsg = &s64; var << rv.q; break;
}
if(!(*lpmsg).empty()) (*lpmsg) << "\r\n";
(*lpmsg) << " " << rep.first;
if(rep.first.size() < max_name_len)
{
(*lpmsg).append(max_name_len - rep.first.size(),' ');
}
(*lpmsg) << " = 0x" << var << ",";
if(!rep.second.note.empty()) (*lpmsg) << " //" << rep.second.note;
}
//.........这里部分代码省略.........