return NXT_ERROR;
}
- patch->address = (u_char *) &equal->offset;
+ patch->address = &equal->offset;
*last = patch;
last = &patch->next;
node = branch;
} else {
- *patch->address += parser->code_end - patch->address;
+ *patch->address += parser->code_end - (u_char *) patch->address;
next = patch->next;
nxt_mem_cache_free(vm->mem_cache_pool, patch);
block = parser->block;
for (patch = block->continuation; patch != NULL; patch = next) {
- *patch->address += parser->code_end - patch->address;
+ *patch->address += parser->code_end - (u_char *) patch->address;
next = patch->next;
nxt_mem_cache_free(vm->mem_cache_pool, patch);
parser->block = block->next;
for (patch = block->exit; patch != NULL; patch = next) {
- *patch->address += parser->code_end - patch->address;
+ *patch->address += parser->code_end - (u_char *) patch->address;
next = patch->next;
nxt_mem_cache_free(vm->mem_cache_pool, patch);
jump->code.retval = NJS_VMCODE_NO_RETVAL;
jump->offset = offsetof(njs_vmcode_jump_t, offset);
- patch->address = (u_char *) &jump->offset;
+ patch->address = &jump->offset;
}
return NXT_OK;
jump->code.retval = NJS_VMCODE_NO_RETVAL;
jump->offset = offsetof(njs_vmcode_jump_t, offset);
- patch->address = (u_char *) &jump->offset;
+ patch->address = &jump->offset;
}
return NXT_OK;
typedef struct njs_parser_patch_s njs_parser_patch_t;
struct njs_parser_patch_s {
- u_char *address;
+ /*
+ * The address field points to jump offset field which contains a small
+ * adjustment and the adjustment should be added as (njs_ret_t *) because
+ * pointer to u_char accesses only one byte so this does not work on big
+ * endian platforms.
+ */
+ njs_ret_t *address;
njs_parser_patch_t *next;
};