Updated to using std::string from unsigned char*

This commit is contained in:
calcium 2024-08-24 23:42:43 -04:00
parent 47df116083
commit 76bf452547

View File

@ -1,4 +1,4 @@
#include "ConstantPoolTags/Tags.h"
#include <ConstantPoolTags/Tags.h>
#include <Globals.h>
#include <Utils/Utils.h>
#include <Attributes.h>
@ -8,6 +8,7 @@
#include <cassert>
#include <string>
#include <Utils/CRC32_CompileTime.hpp>
#include <algorithm>
attribute_info Attributes::AttributesParser(JavaClassFormat& jc)
{
@ -28,7 +29,7 @@ attribute_info Attributes::AttributesParser(JavaClassFormat& jc)
int idx = ret.info.data()->ToHostFormat();
ASSERT(VEC_ELEM_TYPE(jc.constant_pool[ret.attribute_name_index.ToHostFormat() - 1]) == TYPE(ConstantPoolTags::ConstantUtf8Info));
std::string str = reinterpret_cast<const char*>(std::any_cast<ConstantPoolTags::ConstantUtf8Info>(jc.constant_pool[ret.attribute_name_index.ToHostFormat() - 1]).bytes);
std::string str = std::any_cast<ConstantPoolTags::ConstantUtf8Info>(jc.constant_pool[ret.attribute_name_index.ToHostFormat() - 1]).bytes;
switch ((ClassAttributes)crc32_rec(CRC32, str.c_str()))
{
@ -39,6 +40,7 @@ attribute_info Attributes::AttributesParser(JavaClassFormat& jc)
<< std::any_cast<ConstantPoolTags::ConstantUtf8Info>(jc.constant_pool[idx - 1]).bytes
<< std::endl;
SOURCE_FILE_Attribute attr;
attr.sourcefile_index = idx;
// attr.
break;
}