本文整理汇总了C++中DataReader::HasOverflow方法的典型用法代码示例。如果您正苦于以下问题:C++ DataReader::HasOverflow方法的具体用法?C++ DataReader::HasOverflow怎么用?C++ DataReader::HasOverflow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataReader
的用法示例。
在下文中一共展示了DataReader::HasOverflow方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: new
status_t
AbbreviationTable::_ParseAbbreviationEntry(DataReader& abbrevReader,
bool& _nullEntry)
{
uint32 code = abbrevReader.ReadUnsignedLEB128(0);
if (code == 0) {
if (abbrevReader.HasOverflow()) {
fprintf(stderr, "Invalid abbreviation table 1!\n");
return B_BAD_DATA;
}
_nullEntry = true;
return B_OK;
}
off_t remaining = abbrevReader.BytesRemaining();
/* uint32 tag =*/ abbrevReader.ReadUnsignedLEB128(0);
/* uint8 hasChildren =*/ abbrevReader.Read<uint8>(DW_CHILDREN_no);
// printf("entry: %lu, tag: %lu, children: %d\n", code, tag,
// hasChildren);
// parse attribute specifications
while (true) {
uint32 attributeName = abbrevReader.ReadUnsignedLEB128(0);
uint32 attributeForm = abbrevReader.ReadUnsignedLEB128(0);
if (abbrevReader.HasOverflow()) {
fprintf(stderr, "Invalid abbreviation table 2!\n");
return B_BAD_DATA;
}
if (attributeName == 0 && attributeForm == 0)
break;
// printf(" attr: name: %lu, form: %lu\n", attributeName,
// attributeForm);
}
// create the entry
if (fEntryTable.Lookup(code) == NULL) {
AbbreviationTableEntry* entry = new(std::nothrow)
AbbreviationTableEntry(code, fSize - remaining,
remaining - abbrevReader.BytesRemaining());
if (entry == NULL)
return B_NO_MEMORY;
fEntryTable.Insert(entry);
} else
fprintf(stderr, "Duplicate abbreviation table entry %lu!\n", code);
_nullEntry = false;
return B_OK;
}