diff --git a/main.c b/main.c index 25ad8d6..b958f01 100644 --- a/main.c +++ b/main.c @@ -89,7 +89,7 @@ static void export_book(const char path[], Book* book) { do { EB_Error_Code error; if ((error = eb_initialize_library()) != EB_SUCCESS) { - strcpy(book->error, eb_error_message(error)); + fprintf(stderr, "Failed to initialize library: %s\n", eb_error_message(error)); break; } @@ -97,7 +97,7 @@ static void export_book(const char path[], Book* book) { eb_initialize_book(&eb_book); if ((error = eb_bind(&eb_book, path)) != EB_SUCCESS) { - strcpy(book->error, eb_error_message(error)); + fprintf(stderr, "Failed to bind book: %s\n", eb_error_message(error)); eb_finalize_book(&eb_book); eb_finalize_library(); break; @@ -146,13 +146,13 @@ static void export_book(const char path[], Book* book) { export_subbook(&eb_book, subbook); } else { - strcpy(subbook->error, eb_error_message(error)); + fprintf(stderr, "Failed to set subbook: %s\n", eb_error_message(error)); } } } } else { - strcpy(book->error, eb_error_message(error)); + fprintf(stderr, "Failed to get subbook list: %s\n", eb_error_message(error)); } eb_finalize_book(&eb_book); diff --git a/util.c b/util.c index a57c429..1014b2a 100644 --- a/util.c +++ b/util.c @@ -100,10 +100,6 @@ static void encode_subbook(Subbook* subbook, json_t* subbook_json) { json_object_set_new(subbook_json, "copyright", json_string(subbook->copyright)); } - if (strlen(subbook->error) > 0) { - json_object_set_new(subbook_json, "error", json_string(subbook->error)); - } - json_t* entry_json_array = json_array(); for (int i = 0; i < subbook->entry_count; ++i) { json_t* entry_json = json_object(); @@ -120,10 +116,6 @@ static void encode_book(Book* book, json_t* book_json) { json_object_set_new(book_json, "characterCode", json_string(book->character_code)); json_object_set_new(book_json, "discCode", json_string(book->disc_code)); - if (strlen(book->error) > 0) { - json_object_set_new(book_json, "error", json_string(book->error)); - } - json_t* subbook_json_array = json_array(); for (int i = 0; i < book->subbook_count; ++i) { json_t* subbook_json = json_object(); diff --git a/util.h b/util.h index 83f7f07..dc43ba9 100644 --- a/util.h +++ b/util.h @@ -48,8 +48,6 @@ typedef struct { Entry* entries; int entry_count; int entry_cap; - - char error[MAX_ERROR]; } Subbook; typedef struct { @@ -58,8 +56,6 @@ typedef struct { Subbook* subbooks; int subbook_count; - - char error[MAX_ERROR]; } Book; /*