<commit_before>#include "pch.h"
#include "analyze_ISO_item_Box.h"

#include "analyze_ISO_util.h"

using namespace analyze_ISO;

uint64_t analyze_ISO::Box::getBoxSize(const agaliaContainer* image, uint64_t offset, uint64_t endpos)
{
	Box temp = {};
	auto hr = image->ReadData(&temp.size, offset + offsetof(Box, size), sizeof(Box::size));
	if (FAILED(hr)) return 0;

	if (temp.getSize() == 1)
	{
		uint64_t largesize = 0;
		hr = image->ReadData(&largesize, offset + sizeof(Box), sizeof(largesize));
		if (FAILED(hr)) return 0;

		return largesize;
	}
	else if (temp.getSize() == 0)
	{
		return endpos - offset;
	}
	return temp.getSize();
}

uint64_t analyze_ISO::Box::getDataOffset(const agaliaContainer* image, uint64_t offset)
{
	Box temp = {};
	auto hr = image->ReadData(&temp, offset, sizeof(temp));
	if (FAILED(hr)) return 0;

	uint64_t ret = sizeof(Box);

	if (temp.getSize() == 1)
	{
		ret += sizeof(uint64_t);
	}
<commit_msg>fix missing byteswap<commit_after>#include "pch.h"
#include "analyze_ISO_item_Box.h"

#include "analyze_ISO_util.h"

using namespace analyze_ISO;

uint64_t analyze_ISO::Box::getBoxSize(const agaliaContainer* image, uint64_t offset, uint64_t endpos)
{
	Box temp = {};
	auto hr = image->ReadData(&temp.size, offset + offsetof(Box, size), sizeof(Box::size));
	if (FAILED(hr)) return 0;

	if (temp.getSize() == 1)
	{
		uint64_t largesize = 0;
		hr = image->ReadData(&largesize, offset + sizeof(Box), sizeof(largesize));
		if (FAILED(hr)) return 0;

		return agalia_byteswap(largesize);
	}
	else if (temp.getSize() == 0)
	{
		return endpos - offset;
	}
	return temp.getSize();
}

uint64_t analyze_ISO::Box::getDataOffset(const agaliaContainer* image, uint64_t offset)
{
	Box temp = {};
	auto hr = image->ReadData(&temp, offset, sizeof(temp));
	if (FAILED(hr)) return 0;

	uint64_t ret = sizeof(Box);

	if (temp.getSize() == 1)
	{
		ret += sizeof(uint64_t);
	}

{'fraction_non_alphanumeric': 0.1569459172852598, 'fraction_numerical': 0.024390243902439025, 'mean_word_length': 5.0287539936102235, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5311265', 'n_tokens_mistral': 770, 'n_tokens_neox': 727, 'n_words': 164}