1
This commit is contained in:
Alex Yatskov 2016-11-20 17:49:50 -08:00
parent f6a10aecc2
commit 3aeee4b0ee
5 changed files with 12 additions and 12 deletions

View File

@ -105,7 +105,7 @@ static void encode_sequence(char output[], int size, const char utf8[]) {
* Exported functions
*/
const Gaiji_Context* gaiji_select_context(const char name[]) {
const Gaiji_Context* gaiji_context_select(const char name[]) {
for (unsigned i = 0; i < ARRSIZE(gaiji_contexts); ++i) {
const Gaiji_Context* context = gaiji_contexts + i;
if (strcmp(context->name, name) == 0) {
@ -116,7 +116,7 @@ const Gaiji_Context* gaiji_select_context(const char name[]) {
return NULL;
}
void gaiji_build_stub(char output[], int size, int code, const Gaiji_Context* context, Gaiji_Width width) {
void gaiji_stub_encode(char output[], int size, int code, const Gaiji_Context* context, Gaiji_Width width) {
do {
if (context == NULL) {
break;
@ -153,7 +153,7 @@ void gaiji_build_stub(char output[], int size, int code, const Gaiji_Context* co
output[size - 1] = 0;
}
void gaiji_fixup_stub(char output[], int size, const char input[]) {
void gaiji_stub_decode(char output[], int size, const char input[]) {
const char* ptr_in = input;
char* ptr_out = output;
bool decode = false;

View File

@ -53,8 +53,8 @@ typedef enum {
* Functions
*/
const Gaiji_Context* gaiji_select_context(const char name[]);
void gaiji_build_stub(char output[], int size, int code, const Gaiji_Context* context, Gaiji_Width width);
void gaiji_fixup_stub(char output[], int size, const char input[]);
const Gaiji_Context* gaiji_context_select(const char name[]);
void gaiji_stub_encode(char output[], int size, int code, const Gaiji_Context* context, Gaiji_Width width);
void gaiji_stub_decode(char output[], int size, const char input[]);
#endif /* GAIJI_H */

View File

@ -107,7 +107,7 @@ static EB_Error_Code hook_narrow_font( /* EB_HOOK_NARROW_FONT */
assert(argc > 0);
char stub[MAX_STUB_BYTES];
gaiji_build_stub(stub, ARRSIZE(stub), argv[0], container, GAIJI_WIDTH_NARROW);
gaiji_stub_encode(stub, ARRSIZE(stub), argv[0], container, GAIJI_WIDTH_NARROW);
eb_write_text_string(book, stub);
return 0;
@ -126,7 +126,7 @@ static EB_Error_Code hook_wide_font( /* EB_HOOK_WIDE_FONT */
assert(argc > 0);
char stub[MAX_STUB_BYTES];
gaiji_build_stub(stub, ARRSIZE(stub), argv[0], container, GAIJI_WIDTH_WIDE);
gaiji_stub_encode(stub, ARRSIZE(stub), argv[0], container, GAIJI_WIDTH_WIDE);
eb_write_text_string(book, stub);
return 0;

2
main.c
View File

@ -79,7 +79,7 @@ static void export_subbook(Subbook* subbook, EB_Book* eb_book, EB_Hookset* eb_ho
char title[EB_MAX_TITLE_LENGTH + 1];
if (eb_subbook_title(eb_book, title) == EB_SUCCESS) {
subbook->title = eucjp_to_utf8(title);
context = *gaiji_select_context(subbook->title);
context = *gaiji_context_select(subbook->title);
}
if (eb_have_copyright(eb_book)) {

2
util.c
View File

@ -124,7 +124,7 @@ char* read_book_data(EB_Book* book, EB_Hookset* hookset, Gaiji_Context* context,
return NULL;
}
gaiji_fixup_stub(result, strlen(result) + 1, result);
gaiji_stub_decode(result, strlen(result) + 1, result);
return result;
}