p = (char *)(((intptr_t)p+4) & ~3); // advance to next word boundary | p = (char *)(((intptr_t)p+4) & ~3); // advance to next word boundary | ||||
tr->langopts.replace_chars = (unsigned char *)p; | tr->langopts.replace_chars = (unsigned char *)p; | ||||
// Don't cast to (unsigned int), result may not be garanted depending on compiler | |||||
while ( !is_str_fully_empty(p, 4) ) { | |||||
while ( !is_str_totally_null(p, 4) ) { | |||||
p++; | p++; | ||||
} | } | ||||
return CLAUSE_NONE; | return CLAUSE_NONE; | ||||
} | } | ||||
int is_str_fully_empty(const char* str, int size) { | |||||
// Tests if all bytes of str are null uf to size | |||||
int is_str_totally_null(const char* str, int size) { | |||||
// Tests if all bytes of str are null up to size | |||||
// This should never be reimplemented with integers, because | // This should never be reimplemented with integers, because | ||||
// this function has to work with unaligned char* | // this function has to work with unaligned char* | ||||
// (casting to int when unaligned may result in ungaranteed behaviors) | // (casting to int when unaligned may result in ungaranteed behaviors) |
extern PARAM_STACK param_stack[]; | extern PARAM_STACK param_stack[]; | ||||
// Tests if all bytes of str up to size are null | // Tests if all bytes of str up to size are null | ||||
int is_str_fully_empty(const char* str, int size); | |||||
int is_str_totally_null(const char* str, int size); | |||||
int clause_type_from_codepoint(uint32_t c); | int clause_type_from_codepoint(uint32_t c); | ||||
int towlower2(unsigned int c, Translator *translator); // Supports Turkish I | int towlower2(unsigned int c, Translator *translator); // Supports Turkish I |
static const char *FindReplacementChars(Translator *tr, const char **pfrom, unsigned int c, const char *next, int *ignore_next_n) | static const char *FindReplacementChars(Translator *tr, const char **pfrom, unsigned int c, const char *next, int *ignore_next_n) | ||||
{ | { | ||||
const char *from = *pfrom; | const char *from = *pfrom; | ||||
while ( !is_str_fully_empty(from, 4) ) { | |||||
while ( !is_str_totally_null(from, 4) ) { | |||||
unsigned int fc = 0; // from character | unsigned int fc = 0; // from character | ||||
unsigned int nc = c; // next character | unsigned int nc = c; // next character | ||||
const char *match_next = next; | const char *match_next = next; |