meta: replace bluelib with fx
This commit is contained in:
40
asm/reader.c
40
asm/reader.c
@@ -12,9 +12,9 @@
|
||||
static enum ivy_status decode_header(
|
||||
const struct ivy_bin_header *hdr, struct ivy_asm_object_info *out)
|
||||
{
|
||||
out->obj_magic = b_i32_btoh(hdr->h_magic);
|
||||
out->obj_nr_sections = b_i16_btoh(hdr->h_table_len);
|
||||
out->obj_table_offset = b_i64_btoh(hdr->h_table_offset);
|
||||
out->obj_magic = fx_i32_btoh(hdr->h_magic);
|
||||
out->obj_nr_sections = fx_i16_btoh(hdr->h_table_len);
|
||||
out->obj_table_offset = fx_i64_btoh(hdr->h_table_offset);
|
||||
|
||||
return IVY_OK;
|
||||
}
|
||||
@@ -22,9 +22,9 @@ static enum ivy_status decode_header(
|
||||
static enum ivy_status decode_table_entry(
|
||||
const struct ivy_bin_table_entry *entry, struct ivy_asm_section_info *out)
|
||||
{
|
||||
out->s_type = b_i32_btoh(entry->e_type);
|
||||
out->s_offset = b_i64_btoh(entry->e_offset);
|
||||
out->s_length = b_i32_btoh(entry->e_size);
|
||||
out->s_type = fx_i32_btoh(entry->e_type);
|
||||
out->s_offset = fx_i64_btoh(entry->e_offset);
|
||||
out->s_length = fx_i32_btoh(entry->e_size);
|
||||
|
||||
return IVY_OK;
|
||||
}
|
||||
@@ -258,7 +258,7 @@ static enum ivy_status read_string_xdata(
|
||||
return IVY_ERR_BAD_FORMAT;
|
||||
}
|
||||
|
||||
size_t str_len = b_i32_btoh(str.s_len);
|
||||
size_t str_len = fx_i32_btoh(str.s_len);
|
||||
if (str_len == 0) {
|
||||
*out = NULL;
|
||||
return IVY_OK;
|
||||
@@ -306,7 +306,7 @@ enum ivy_status ivy_asm_constpool_reader_read_value(
|
||||
return IVY_ERR_BAD_FORMAT;
|
||||
}
|
||||
|
||||
unsigned long type = b_i32_btoh(entry.e_type);
|
||||
unsigned long type = fx_i32_btoh(entry.e_type);
|
||||
|
||||
struct ivy_asm_constpool_value *value = malloc(sizeof *value);
|
||||
if (!value) {
|
||||
@@ -319,26 +319,26 @@ enum ivy_status ivy_asm_constpool_reader_read_value(
|
||||
switch (type) {
|
||||
case IVY_CONSTPOOL_TABLE_STRING: {
|
||||
value->v_type = IVY_ASM_CONSTPOOL_TYPE_STRING;
|
||||
handle = b_i32_btoh(entry.e_ex_handle);
|
||||
handle = fx_i32_btoh(entry.e_ex_handle);
|
||||
status = read_string_xdata(reader, handle, &value->v_str);
|
||||
break;
|
||||
}
|
||||
case IVY_CONSTPOOL_TABLE_INT:
|
||||
value->v_type = IVY_ASM_CONSTPOOL_TYPE_INT;
|
||||
value->v_int = b_i32_btoh(entry.e_int);
|
||||
value->v_int = fx_i32_btoh(entry.e_int);
|
||||
break;
|
||||
case IVY_CONSTPOOL_TABLE_UINT:
|
||||
value->v_type = IVY_ASM_CONSTPOOL_TYPE_UINT;
|
||||
value->v_uint = b_i32_btoh(entry.e_int);
|
||||
value->v_uint = fx_i32_btoh(entry.e_int);
|
||||
break;
|
||||
case IVY_CONSTPOOL_TABLE_ATOM:
|
||||
value->v_type = IVY_ASM_CONSTPOOL_TYPE_ATOM;
|
||||
handle = b_i32_btoh(entry.e_ex_handle);
|
||||
handle = fx_i32_btoh(entry.e_ex_handle);
|
||||
status = read_string_xdata(reader, handle, &value->v_str);
|
||||
break;
|
||||
case IVY_CONSTPOOL_TABLE_SELECTOR: {
|
||||
value->v_type = IVY_ASM_CONSTPOOL_TYPE_SELECTOR;
|
||||
handle = b_i32_btoh(entry.e_ex_handle);
|
||||
handle = fx_i32_btoh(entry.e_ex_handle);
|
||||
|
||||
struct ivy_bin_selector sel_entry;
|
||||
status = ivy_asm_section_reader_read(
|
||||
@@ -365,7 +365,7 @@ enum ivy_status ivy_asm_constpool_reader_read_value(
|
||||
ivy_selector_set_recipient(sel, IVY_SEL_CLASS);
|
||||
}
|
||||
|
||||
size_t name_key = b_i32_btoh(sel_entry.sel_name);
|
||||
size_t name_key = fx_i32_btoh(sel_entry.sel_name);
|
||||
status = read_string_xdata(reader, name_key, &sel->sel_name);
|
||||
if (status != IVY_OK) {
|
||||
ivy_selector_destroy(sel);
|
||||
@@ -375,7 +375,7 @@ enum ivy_status ivy_asm_constpool_reader_read_value(
|
||||
handle += sizeof sel_entry;
|
||||
size_t nr_args = sel_entry.sel_nr_args;
|
||||
for (size_t i = 0; i < nr_args; i++) {
|
||||
b_i32 arg;
|
||||
fx_i32 arg;
|
||||
status = ivy_asm_section_reader_read(
|
||||
reader->r_xdat, handle, sizeof arg, &arg, &r);
|
||||
|
||||
@@ -388,7 +388,7 @@ enum ivy_status ivy_asm_constpool_reader_read_value(
|
||||
break;
|
||||
}
|
||||
|
||||
size_t arg_key = b_i32_btoh(arg);
|
||||
size_t arg_key = fx_i32_btoh(arg);
|
||||
char *arg_name = NULL;
|
||||
status = read_string_xdata(reader, arg_key, &arg_name);
|
||||
if (status != IVY_OK) {
|
||||
@@ -411,7 +411,7 @@ enum ivy_status ivy_asm_constpool_reader_read_value(
|
||||
}
|
||||
case IVY_CONSTPOOL_TABLE_IDENT: {
|
||||
value->v_type = IVY_ASM_CONSTPOOL_TYPE_IDENT;
|
||||
handle = b_i32_btoh(entry.e_ex_handle);
|
||||
handle = fx_i32_btoh(entry.e_ex_handle);
|
||||
|
||||
struct ivy_bin_ident id_entry;
|
||||
status = ivy_asm_section_reader_read(
|
||||
@@ -436,7 +436,7 @@ enum ivy_status ivy_asm_constpool_reader_read_value(
|
||||
handle += sizeof id_entry;
|
||||
size_t nr_parts = id_entry.id_nr_parts;
|
||||
for (size_t i = 0; i < nr_parts; i++) {
|
||||
b_i32 part;
|
||||
fx_i32 part;
|
||||
status = ivy_asm_section_reader_read(
|
||||
reader->r_xdat, handle, sizeof part, &part, &r);
|
||||
|
||||
@@ -449,7 +449,7 @@ enum ivy_status ivy_asm_constpool_reader_read_value(
|
||||
break;
|
||||
}
|
||||
|
||||
size_t part_key = b_i32_btoh(part);
|
||||
size_t part_key = fx_i32_btoh(part);
|
||||
char *part_name = NULL;
|
||||
status = read_string_xdata(reader, part_key, &part_name);
|
||||
if (status != IVY_OK) {
|
||||
@@ -517,7 +517,7 @@ enum ivy_status ivy_asm_constpool_value_destroy(struct ivy_asm_constpool_value *
|
||||
|
||||
bool ivy_asm_section_type_to_string(uint32_t in, char out[5])
|
||||
{
|
||||
b_i32 v = b_i32_htob(in);
|
||||
fx_i32 v = fx_i32_htob(in);
|
||||
|
||||
for (size_t i = 0; i < sizeof in; i++) {
|
||||
char c = v.i_bytes[i];
|
||||
|
||||
Reference in New Issue
Block a user