1

More cleanup

This commit is contained in:
Alex Yatskov 2021-01-09 15:36:33 -08:00
parent 13de8b5081
commit 41f2d1a280
12 changed files with 12 additions and 135 deletions

View File

@ -41,7 +41,6 @@ static unsigned long png_crc(const char *buf, size_t len);
static int png_compress(const char *src, int width, int height, char *dest, static int png_compress(const char *src, int width, int height, char *dest,
size_t *dest_len); size_t *dest_len);
/* /*
* Return required buffer size for a narrow font character converted * Return required buffer size for a narrow font character converted
* to XBM image format. * to XBM image format.
@ -1285,78 +1284,3 @@ eb_bitmap_to_png(const char *bitmap, int width, int height, char *png,
#undef INT2CHARS #undef INT2CHARS
#undef RGB2CHARS #undef RGB2CHARS
#ifdef TEST
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#define test_width 32
#define test_height 16
static unsigned char test_bitmap[] = {
0xff, 0xff, 0xff, 0xff, 0x80, 0x81, 0x83, 0x01, 0x80, 0x81, 0x01, 0x01,
0x80, 0x81, 0x01, 0x01, 0xe3, 0x8f, 0x11, 0xc7, 0xe3, 0x8f, 0x0f, 0xc7,
0xe3, 0x81, 0x87, 0xc7, 0xe3, 0x81, 0xc3, 0xc7, 0xe3, 0x81, 0xe1, 0xc7,
0xe3, 0x8f, 0x11, 0xc7, 0xe3, 0x8f, 0x11, 0xc7, 0xe3, 0x81, 0x01, 0xc7,
0xe3, 0x81, 0x01, 0xc7, 0xe3, 0x81, 0x83, 0xc7, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff
};
int
main(int argc, char *argv[])
{
char image[EB_SIZE_FONT_IMAGE];
size_t image_size;
int file;
eb_bitmap_to_xbm(test_bitmap, test_width, test_height, image, &image_size);
file = creat("test.xbm", 0644);
if (file < 0)
exit(1);
if (write(file, image, image_size) != image_size) {
close(file);
exit(1);
}
eb_bitmap_to_xpm(test_bitmap, test_width, test_height, image, &image_size);
file = creat("test.xpm", 0644);
if (file < 0)
exit(1);
if (write(file, image, image_size) != image_size) {
close(file);
exit(1);
}
eb_bitmap_to_gif(test_bitmap, test_width, test_height, image, &image_size);
file = creat("test.gif", 0644);
if (file < 0)
exit(1);
if (write(file, image, image_size) != image_size) {
close(file);
exit(1);
}
eb_bitmap_to_bmp(test_bitmap, test_width, test_height, image, &image_size);
file = creat("test.bmp", 0644);
if (file < 0)
exit(1);
if (write(file, image, image_size) != image_size) {
close(file);
exit(1);
}
eb_bitmap_to_png(test_bitmap, test_width, test_height, image, &image_size);
file = creat("test.png", 0644);
if (file < 0)
exit(1);
if (write(file, image, image_size) != image_size) {
close(file);
exit(1);
}
return 0;
}
#endif /* TEST */

2
book.c
View File

@ -49,7 +49,6 @@ static EB_Error_Code eb_load_catalog_epwing(EB_Book *book,
static Zio_Code eb_get_hint_zio_code(int catalog_hint_value); static Zio_Code eb_get_hint_zio_code(int catalog_hint_value);
static void eb_load_language(EB_Book *book); static void eb_load_language(EB_Book *book);
/* /*
* Initialize `book'. * Initialize `book'.
*/ */
@ -73,7 +72,6 @@ eb_initialize_book(EB_Book *book)
LOG(("out: eb_initialize_book()")); LOG(("out: eb_initialize_book()"));
} }
/* /*
* Bind `book' to `path'. * Bind `book' to `path'.
*/ */

View File

@ -42,16 +42,6 @@
#include <fcntl.h> #include <fcntl.h>
#include <sys/time.h> #include <sys/time.h>
/*
* stat() macros.
*/
#ifndef S_ISREG
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#endif
#ifndef S_ISDIR
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#endif
/* /*
* Flags for open(). * Flags for open().
*/ */
@ -80,12 +70,4 @@
#define _(string) (string) #define _(string) (string)
#define N_(string) (string) #define N_(string) (string)
/*
* Fake missing function names.
*/
#ifndef HAVE_STRCASECMP
#define strcasecmp eb_strcasecmp
#define strncasecmp eb_strncasecmp
#endif
#endif /* EB_BUILD_PRE_H */ #endif /* EB_BUILD_PRE_H */

View File

@ -269,9 +269,5 @@ eb_error_message(EB_Error_Code error_code)
else else
message = N_("unknown error"); message = N_("unknown error");
#ifdef ENABLE_NLS
message = dgettext(EB_TEXT_DOMAIN_NAME, message);
#endif /* ENABLE_NLS */
return message; return message;
} }

View File

@ -113,7 +113,6 @@
#define EB_ERR_UNBOUND_BOOKLIST 67 #define EB_ERR_UNBOUND_BOOKLIST 67
#define EB_ERR_NO_SUCH_BOOK 68 #define EB_ERR_NO_SUCH_BOOK 68
/* /*
* The number of error codes. * The number of error codes.
*/ */

2
log.c
View File

@ -130,7 +130,7 @@ eb_log_stderr(const char *message, va_list ap)
} }
#define MAX_QUOTED_STREAM_LENGTH 100 #define MAX_QUOTED_STREAM_LENGTH 100
/* /*
* Return Quoted printable string of `stream'. * Return Quoted printable string of `stream'.

View File

@ -43,7 +43,7 @@ static EB_Error_Code eb_narrow_character_text_latin(EB_Appendix *appendix,
/* /*
* Hash macro for cache data. * Hash macro for cache data.
*/ */
#define EB_HASH_ALT_CACHE(c) ((c) & 0x0f) #define EB_HASH_ALT_CACHE(c) ((c) & 0x0f)
/* /*

View File

@ -40,7 +40,6 @@ static EB_Error_Code eb_narrow_character_bitmap_jis(EB_Book *book,
static EB_Error_Code eb_narrow_character_bitmap_latin(EB_Book *book, static EB_Error_Code eb_narrow_character_bitmap_latin(EB_Book *book,
int character_number, char *bitmap); int character_number, char *bitmap);
/* /*
* Open a font file. * Open a font file.
*/ */

View File

@ -35,17 +35,17 @@
/* /*
* The maximum number of arguments for an escape sequence. * The maximum number of arguments for an escape sequence.
*/ */
#define EB_MAX_ARGV 7 #define EB_MAX_ARGV 7
/* /*
* Read next when the length of cached data is shorter than this value. * Read next when the length of cached data is shorter than this value.
*/ */
#define SIZE_FEW_REST 48 #define SIZE_FEW_REST 48
/* /*
* Special skip-code that represents `no skip-code is set'. * Special skip-code that represents `no skip-code is set'.
*/ */
#define SKIP_CODE_NONE -1 #define SKIP_CODE_NONE -1
/* /*
* Cache data buffer. * Cache data buffer.
@ -2094,5 +2094,3 @@ eb_backward_text(EB_Book *book, EB_Appendix *appendix)
LOG(("out: eb_backward_text() = %s", eb_error_string(error_code))); LOG(("out: eb_backward_text() = %s", eb_error_string(error_code)));
return error_code; return error_code;
} }

View File

@ -35,16 +35,16 @@
/* /*
* Page-ID macros. * Page-ID macros.
*/ */
#define PAGE_ID_IS_LEAF_LAYER(page_id) (((page_id) & 0x80) == 0x80) #define PAGE_ID_IS_LEAF_LAYER(page_id) (((page_id) & 0x80) == 0x80)
#define PAGE_ID_IS_LAYER_START(page_id) (((page_id) & 0x40) == 0x40) #define PAGE_ID_IS_LAYER_START(page_id) (((page_id) & 0x40) == 0x40)
#define PAGE_ID_IS_LAYER_END(page_id) (((page_id) & 0x20) == 0x20) #define PAGE_ID_IS_LAYER_END(page_id) (((page_id) & 0x20) == 0x20)
#define PAGE_ID_HAVE_GROUP_ENTRY(page_id) (((page_id) & 0x10) == 0x10) #define PAGE_ID_HAVE_GROUP_ENTRY(page_id) (((page_id) & 0x10) == 0x10)
/* /*
* The maximum number of hit entries for tomporary hit lists. * The maximum number of hit entries for tomporary hit lists.
* This is used in eb_hit_list(). * This is used in eb_hit_list().
*/ */
#define EB_TMP_MAX_HITS 64 #define EB_TMP_MAX_HITS 64
/* /*
* Book-code of the book in which you want to search a word. * Book-code of the book in which you want to search a word.

2
text.c
View File

@ -111,5 +111,3 @@ eb_text(EB_Book *book, EB_Position *position)
LOG(("out: eb_text() = %s", eb_error_string(error_code))); LOG(("out: eb_text() = %s", eb_error_string(error_code)));
return error_code; return error_code;
} }

21
zio.c
View File

@ -45,23 +45,6 @@
#define O_BINARY 0 #define O_BINARY 0
#endif #endif
/*
* The maximum length of path name.
*/
#ifndef PATH_MAX
#ifdef MAXPATHLEN
#define PATH_MAX MAXPATHLEN
#else /* not MAXPATHLEN */
#define PATH_MAX 1024
#endif /* not MAXPATHLEN */
#endif /* not PATH_MAX */
/*
* Mutual exclusion lock of Pthreads.
*/
#ifndef ENABLE_PTHREAD
#endif
/* /*
* Debug message handler. * Debug message handler.
*/ */
@ -95,7 +78,7 @@ extern void eb_log(const char *, ...);
/* /*
* Size of a page (The term `page' means `block' in JIS X 4081). * Size of a page (The term `page' means `block' in JIS X 4081).
*/ */
#define ZIO_SIZE_PAGE 2048 #define ZIO_SIZE_PAGE 2048
/* /*
* Size of a cache buffer. * Size of a cache buffer.
@ -109,7 +92,7 @@ extern void eb_log(const char *, ...);
/* /*
* NULL Zio ID. * NULL Zio ID.
*/ */
#define ZIO_ID_NONE -1 #define ZIO_ID_NONE -1
/* /*
* Buffer for caching uncompressed data. * Buffer for caching uncompressed data.