Swapped to using std::string from unsigned char* for ConstantUtf8Info.bytes
This commit is contained in:
parent
ddba2b6d66
commit
47df116083
@ -4,7 +4,7 @@
|
|||||||
#include <SpecTypes.h>
|
#include <SpecTypes.h>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
struct JavaClassFormat;
|
struct JavaClassFormat;
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ struct ConstantUtf8Info : ConstantPoolInfo
|
|||||||
{
|
{
|
||||||
ConstantPoolTags::Tags tag;
|
ConstantPoolTags::Tags tag;
|
||||||
u2 length;
|
u2 length;
|
||||||
unsigned char *bytes;
|
std::string bytes;
|
||||||
// std::vector<unsigned char> bytes;
|
// std::vector<unsigned char> bytes;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -163,7 +163,8 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
if (x == TYPE(ConstantPoolTags::ConstantUtf8Info))
|
if (x == TYPE(ConstantPoolTags::ConstantUtf8Info))
|
||||||
{
|
{
|
||||||
std::cout << "utf8:\t" << std::any_cast<ConstantPoolTags::ConstantUtf8Info>(jc.constant_pool[i]).bytes << std::endl;
|
ConstantPoolTags::ConstantUtf8Info ref = std::any_cast<ConstantPoolTags::ConstantUtf8Info>(jc.constant_pool[i]);
|
||||||
|
std::cout << "utf8:\t" << "(length): " << ref.length.ToHostFormat() << ",\t(str): " << ref.bytes << std::endl;
|
||||||
}
|
}
|
||||||
else if (x == TYPE(ConstantPoolTags::ConstantClassInfo))
|
else if (x == TYPE(ConstantPoolTags::ConstantClassInfo))
|
||||||
{
|
{
|
||||||
|
@ -32,7 +32,7 @@ void Methods::MethodParser(method_info &p, JavaClassFormat &jc)
|
|||||||
ASSERT(VEC_ELEM_TYPE(v) == TYPE(ConstantPoolTags::ConstantUtf8Info));
|
ASSERT(VEC_ELEM_TYPE(v) == TYPE(ConstantPoolTags::ConstantUtf8Info));
|
||||||
ConstantPoolTags::ConstantUtf8Info str = std::any_cast<ConstantPoolTags::ConstantUtf8Info>(v);
|
ConstantPoolTags::ConstantUtf8Info str = std::any_cast<ConstantPoolTags::ConstantUtf8Info>(v);
|
||||||
|
|
||||||
ASSERT(strcmp(reinterpret_cast<const char *>(str.bytes), "Code") == 0);
|
ASSERT(strcmp(str.bytes.c_str(), "Code") == 0);
|
||||||
|
|
||||||
u4 attribute_length = Utils::ReadFromStartIntoVal<uint32_t>(Globals::buffer());
|
u4 attribute_length = Utils::ReadFromStartIntoVal<uint32_t>(Globals::buffer());
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user