1
This commit is contained in:
Alex Yatskov 2016-11-01 22:11:29 -07:00
parent 61ccf7d091
commit 621681b738
2 changed files with 10 additions and 11 deletions

7
main.c
View File

@ -141,7 +141,6 @@ static void export_book(const char path[], Book* book_data) {
EB_Book book; EB_Book book;
eb_initialize_book(&book); eb_initialize_book(&book);
if ((error = eb_bind(&book, path)) != EB_SUCCESS) { if ((error = eb_bind(&book, path)) != EB_SUCCESS) {
strcpy(book_data->error, eb_error_message(error)); strcpy(book_data->error, eb_error_message(error));
eb_finalize_book(&book); eb_finalize_book(&book);
@ -161,9 +160,6 @@ static void export_book(const char path[], Book* book_data) {
case EB_CHARCODE_JISX0208_GB2312: case EB_CHARCODE_JISX0208_GB2312:
strcpy(book_data->character_code, "jisx0208/gb2312"); strcpy(book_data->character_code, "jisx0208/gb2312");
break; break;
default:
strcpy(book_data->character_code, "invalid");
break;
} }
} }
@ -176,9 +172,6 @@ static void export_book(const char path[], Book* book_data) {
case EB_DISC_EPWING: case EB_DISC_EPWING:
strcpy(book_data->disc_code, "epwing"); strcpy(book_data->disc_code, "epwing");
break; break;
default:
strcpy(book_data->disc_code, "invalid");
break;
} }
} }

14
util.h
View File

@ -20,6 +20,7 @@
#define UTIL_H #define UTIL_H
#include <stdlib.h> #include <stdlib.h>
#include "eb/eb/eb.h"
/* /*
Dictionary structures Dictionary structures
@ -32,8 +33,12 @@ typedef struct {
typedef struct { typedef struct {
char* heading; char* heading;
int heading_page;
int heading_offset;
char* text; char* text;
char* error; int text_page;
int text_offset;
int page; int page;
int offset; int offset;
@ -42,15 +47,16 @@ typedef struct {
typedef struct { typedef struct {
char* title; char* title;
char* copyright; char* copyright;
char* error;
Entry* entries; Entry* entries;
int entry_count; int entry_count;
char error[256];
} Subbook; } Subbook;
typedef struct { typedef struct {
char character_code[256]; char character_code[256];
char disc_code[256]; char disc_code[256];
Subbook* subbooks; Subbook* subbooks;
int subbook_count; int subbook_count;