diff -ur ../eb-4.3.3.org/eb/appsub.c ./eb/appsub.c --- ../eb-4.3.3.org/eb/appsub.c 2007-12-12 16:54:52.000000000 +0900 +++ ./eb/appsub.c 2008-10-15 12:10:29.000000000 +0900 @@ -241,7 +241,7 @@ } stop_code_page = eb_uint4(buffer); if (0 < stop_code_page) { - if (zio_lseek(&subbook->zio, (stop_code_page - 1) * EB_SIZE_PAGE, + if (zio_lseek(&subbook->zio, (off_t) (stop_code_page - 1) * EB_SIZE_PAGE, SEEK_SET) < 0) { error_code = EB_ERR_FAIL_SEEK_APP; goto failed; diff -ur ../eb-4.3.3.org/eb/binary.c ./eb/binary.c --- ../eb-4.3.3.org/eb/binary.c 2007-12-12 16:54:52.000000000 +0900 +++ ./eb/binary.c 2008-10-15 12:23:02.000000000 +0900 @@ -197,7 +197,7 @@ char buffer[22]; if (zio_lseek(&book->subbook_current->text_zio, - (position->page - 1) * EB_SIZE_PAGE + position->offset, + (off_t) (position->page - 1) * EB_SIZE_PAGE + position->offset, SEEK_SET) < 0) { error_code = EB_ERR_FAIL_SEEK_BINARY; goto failed; @@ -450,7 +450,7 @@ char buffer[22]; if (zio_lseek(&book->subbook_current->text_zio, - (position->page - 1) * EB_SIZE_PAGE + position->offset, + (off_t) (position->page - 1) * EB_SIZE_PAGE + position->offset, SEEK_SET) < 0) { error_code = EB_ERR_FAIL_SEEK_BINARY; goto failed; @@ -677,7 +677,7 @@ context->size = 0; } else { if (zio_lseek(context->zio, - (book->subbook_current->sound.start_page - 1) * EB_SIZE_PAGE + 32, + (off_t) (book->subbook_current->sound.start_page - 1) * EB_SIZE_PAGE + 32, SEEK_SET) < 0) { error_code = EB_ERR_FAIL_SEEK_BINARY; goto failed; diff -ur ../eb-4.3.3.org/eb/multi.c ./eb/multi.c --- ../eb-4.3.3.org/eb/multi.c 2007-12-12 16:54:52.000000000 +0900 +++ ./eb/multi.c 2008-10-15 12:23:52.000000000 +0900 @@ -57,7 +57,7 @@ * Read the index table page of the multi search. */ if (zio_lseek(&subbook->text_zio, - (multi->search.start_page - 1) * EB_SIZE_PAGE, SEEK_SET) < 0) { + (off_t) (multi->search.start_page - 1) * EB_SIZE_PAGE, SEEK_SET) < 0) { error_code = EB_ERR_FAIL_SEEK_TEXT; goto failed; } @@ -212,7 +212,7 @@ * Read the page of the multi search. */ if (zio_lseek(&subbook->text_zio, - (subbook->search_title_page - 1) * EB_SIZE_PAGE, SEEK_SET) < 0) { + (off_t) (subbook->search_title_page - 1) * EB_SIZE_PAGE, SEEK_SET) < 0) { error_code = EB_ERR_FAIL_SEEK_TEXT; goto failed; } diff -ur ../eb-4.3.3.org/eb/narwfont.c ./eb/narwfont.c --- ../eb-4.3.3.org/eb/narwfont.c 2007-12-12 16:54:52.000000000 +0900 +++ ./eb/narwfont.c 2008-10-15 12:24:40.000000000 +0900 @@ -151,7 +151,7 @@ /* * Read information from the text file. */ - if (zio_lseek(zio, (narrow_font->page - 1) * EB_SIZE_PAGE, SEEK_SET) < 0) { + if (zio_lseek(zio, (off_t) (narrow_font->page - 1) * EB_SIZE_PAGE, SEEK_SET) < 0) { error_code = EB_ERR_FAIL_SEEK_FONT; goto failed; } @@ -276,7 +276,7 @@ /* * Read glyphs. */ - if (zio_lseek(zio, narrow_font->page * EB_SIZE_PAGE, SEEK_SET) < 0) { + if (zio_lseek(zio, (off_t) narrow_font->page * EB_SIZE_PAGE, SEEK_SET) < 0) { error_code = EB_ERR_FAIL_SEEK_FONT; goto failed; } @@ -761,7 +761,7 @@ if (narrow_current->glyphs == NULL) { zio = &narrow_current->zio; - if (zio_lseek(zio, narrow_current->page * EB_SIZE_PAGE + offset, + if (zio_lseek(zio, (off_t) narrow_current->page * EB_SIZE_PAGE + offset, SEEK_SET) < 0) { error_code = EB_ERR_FAIL_SEEK_FONT; goto failed; @@ -848,7 +848,7 @@ if (narrow_current->glyphs == NULL) { zio = &narrow_current->zio; - if (zio_lseek(zio, narrow_current->page * EB_SIZE_PAGE + offset, + if (zio_lseek(zio, (off_t) narrow_current->page * EB_SIZE_PAGE + offset, SEEK_SET) < 0) { error_code = EB_ERR_FAIL_SEEK_FONT; goto failed; diff -ur ../eb-4.3.3.org/eb/readtext.c ./eb/readtext.c --- ../eb-4.3.3.org/eb/readtext.c 2007-12-12 16:54:52.000000000 +0900 +++ ./eb/readtext.c 2008-10-15 15:01:51.000000000 +0900 @@ -99,7 +99,7 @@ LOG(("in: eb_initialize_text_context(book=%d)", (int)book->code)); book->text_context.code = EB_TEXT_INVALID; - book->text_context.location = -1; + book->text_context.location = (off_t) -1; book->text_context.out = NULL; book->text_context.out_rest_length = 0; book->text_context.unprocessed = NULL; @@ -213,7 +213,7 @@ */ eb_reset_text_context(book); book->text_context.code = EB_TEXT_SEEKED; - book->text_context.location = (position->page - 1) * EB_SIZE_PAGE + book->text_context.location = (off_t) (position->page - 1) * EB_SIZE_PAGE + position->offset; /* @@ -510,13 +510,13 @@ * Seek START file and read data. */ if (zio_lseek(&book->subbook_current->text_zio, - book->text_context.location, SEEK_SET) == -1) { + book->text_context.location, SEEK_SET) == (off_t) -1) { error_code = EB_ERR_FAIL_SEEK_TEXT; goto failed; } *text_length = zio_read(&book->subbook_current->text_zio, text, text_max_length); - book->text_context.location += *text_length; + book->text_context.location += (off_t) *text_length; if (*text_length < 0) { error_code = EB_ERR_FAIL_READ_TEXT; goto failed; @@ -610,7 +610,7 @@ */ if (book->code == cache_book_code && cache_location <= context->location - && context->location < cache_location + cache_length) { + && context->location < (off_t) cache_location + cache_length) { cache_p = cache_buffer + (context->location - cache_location); cache_rest_length = cache_length - (context->location - cache_location); @@ -637,7 +637,7 @@ if (0 < cache_rest_length) memmove(cache_buffer, cache_p, cache_rest_length); if (zio_lseek(&book->subbook_current->text_zio, - context->location + cache_rest_length, SEEK_SET) == -1) { + (off_t) context->location + cache_rest_length, SEEK_SET) == -1) { error_code = EB_ERR_FAIL_SEEK_TEXT; goto failed; } @@ -747,7 +747,7 @@ in_step = 2; if (context->code == EB_TEXT_HEADING) { context->text_status = EB_TEXT_STATUS_SOFT_STOP; - context->location += in_step; + context->location += (off_t) in_step; goto succeeded; } hook = hookset->hooks + EB_HOOK_NEWLINE; @@ -1414,7 +1414,7 @@ */ cache_p += in_step; cache_rest_length -= in_step; - context->location += in_step; + context->location += (off_t) in_step; in_step = 0; /* @@ -1877,7 +1877,7 @@ off_t current_location; off_t forward_location; off_t read_location; - off_t backward_location = -1; + off_t backward_location = (off_t) -1; char text_buffer[EB_SIZE_PAGE]; char *text_buffer_p; ssize_t read_result; @@ -1963,7 +1963,7 @@ */ current_location = book->text_context.location; - while (0 < book->text_context.location) { + while ((off_t) 0 < book->text_context.location) { size_t backward_distance; int i; @@ -1984,8 +1984,8 @@ if (book->text_context.location < EB_SIZE_PAGE + 3) read_location = 0; else - read_location = book->text_context.location - EB_SIZE_PAGE + 3; - backward_distance = book->text_context.location - read_location; + read_location = (off_t) book->text_context.location - EB_SIZE_PAGE + 3; + backward_distance = (off_t) book->text_context.location - read_location; if (zio_lseek(&book->subbook_current->text_zio, read_location, SEEK_SET) == -1) { @@ -2009,8 +2009,8 @@ while (0 <= i) { if (eb_uint2(text_buffer_p) == 0x1f02) { - book->text_context.location = read_location + i; - if (current_location <= book->text_context.location + 2) { + book->text_context.location = (off_t) read_location + i; + if (current_location <= (off_t) book->text_context.location + 2) { error_code = EB_ERR_END_OF_CONTENT; goto failed; } @@ -2026,32 +2026,32 @@ } eb_reset_text_context(book); - book->text_context.location = read_location + i; + book->text_context.location = (off_t) read_location + i; error_code = eb_read_text_internal(book, appendix, &eb_default_hookset, NULL, EB_SIZE_PAGE, NULL, NULL, 1); if (error_code != EB_SUCCESS && error_code != EB_ERR_END_OF_CONTENT) goto failed; - if (book->text_context.location >= current_location - 4 - && book->text_context.location <= current_location + 4 - && backward_location < 0) - forward_location = current_location; - if (book->text_context.location >= forward_location - 4 - && book->text_context.location <= forward_location + 4) - backward_location = read_location + i; - else if (book->text_context.location < forward_location) + if (book->text_context.location >= (off_t) current_location - 4 + && book->text_context.location <= (off_t) current_location + 4 + && backward_location < (off_t) 0) + forward_location = (off_t) current_location; + if (book->text_context.location >= (off_t) forward_location - 4 + && book->text_context.location <= (off_t) forward_location + 4) + backward_location = (off_t) read_location + i; + else if (book->text_context.location < (off_t) forward_location) goto loop_end; text_buffer_p--; i--; } - book->text_context.location = read_location - 1; + book->text_context.location = (off_t) read_location - 1; } loop_end: - if (backward_location < 0) { + if (backward_location < (off_t) 0) { error_code = EB_ERR_UNEXP_TEXT; goto failed; } diff -ur ../eb-4.3.3.org/eb/search.c ./eb/search.c --- ../eb-4.3.3.org/eb/search.c 2007-12-12 16:54:52.000000000 +0900 +++ ./eb/search.c 2008-10-15 12:27:13.000000000 +0900 @@ -299,7 +299,7 @@ * Seek and read a page. */ if (zio_lseek(&book->subbook_current->text_zio, - (context->page - 1) * EB_SIZE_PAGE, SEEK_SET) < 0) { + (off_t) (context->page - 1) * EB_SIZE_PAGE, SEEK_SET) < 0) { cache_book_code = EB_BOOK_NONE; error_code = EB_ERR_FAIL_SEEK_TEXT; goto failed; @@ -603,7 +603,7 @@ */ if (cache_book_code != book->code || cache_page != context->page) { if (zio_lseek(&book->subbook_current->text_zio, - (context->page - 1) * EB_SIZE_PAGE, SEEK_SET) < 0) { + (off_t) (context->page - 1) * EB_SIZE_PAGE, SEEK_SET) < 0) { error_code = EB_ERR_FAIL_SEEK_TEXT; goto failed; } @@ -929,7 +929,7 @@ */ if (cache_book_code != book->code || cache_page != context->page) { if (zio_lseek(&book->subbook_current->text_zio, - (context->page - 1) * EB_SIZE_PAGE, SEEK_SET) < 0) { + (off_t) (context->page - 1) * EB_SIZE_PAGE, SEEK_SET) < 0) { error_code = EB_ERR_FAIL_SEEK_TEXT; goto failed; } @@ -1261,7 +1261,7 @@ */ if (cache_book_code != book->code || cache_page != context->page) { if (zio_lseek(&book->subbook_current->text_zio, - (context->page - 1) * EB_SIZE_PAGE, SEEK_SET) < 0) { + (off_t) (context->page - 1) * EB_SIZE_PAGE, SEEK_SET) < 0) { error_code = EB_ERR_FAIL_SEEK_TEXT; goto failed; } diff -ur ../eb-4.3.3.org/eb/subbook.c ./eb/subbook.c --- ../eb-4.3.3.org/eb/subbook.c 2007-12-12 16:54:52.000000000 +0900 +++ ./eb/subbook.c 2008-10-15 12:27:47.000000000 +0900 @@ -190,7 +190,7 @@ * Rewind the file descriptor of the start file. */ if (zio_lseek(&subbook->text_zio, - (subbook->index_page - 1) * EB_SIZE_PAGE, SEEK_SET) < 0) { + (off_t) (subbook->index_page - 1) * EB_SIZE_PAGE, SEEK_SET) < 0) { error_code = EB_ERR_FAIL_SEEK_TEXT; goto failed; } @@ -288,7 +288,7 @@ /* * Read the index table in the subbook. */ - if (zio_lseek(&subbook->text_zio, (subbook->index_page - 1) * EB_SIZE_PAGE, + if (zio_lseek(&subbook->text_zio, (off_t) (subbook->index_page - 1) * EB_SIZE_PAGE, SEEK_SET) < 0) { error_code = EB_ERR_FAIL_SEEK_TEXT; goto failed; diff -ur ../eb-4.3.3.org/eb/widefont.c ./eb/widefont.c --- ../eb-4.3.3.org/eb/widefont.c 2008-01-14 22:53:58.000000000 +0900 +++ ./eb/widefont.c 2008-10-15 12:28:26.000000000 +0900 @@ -152,7 +152,7 @@ /* * Read information from the text file. */ - if (zio_lseek(zio, (wide_font->page - 1) * EB_SIZE_PAGE, SEEK_SET) < 0) { + if (zio_lseek(zio, (off_t) (wide_font->page - 1) * EB_SIZE_PAGE, SEEK_SET) < 0) { error_code = EB_ERR_FAIL_SEEK_FONT; goto failed; } @@ -277,7 +277,7 @@ /* * Read glyphs. */ - if (zio_lseek(zio, wide_font->page * EB_SIZE_PAGE, SEEK_SET) < 0) { + if (zio_lseek(zio, (off_t) wide_font->page * EB_SIZE_PAGE, SEEK_SET) < 0) { error_code = EB_ERR_FAIL_SEEK_FONT; goto failed; } @@ -762,7 +762,7 @@ if (wide_current->glyphs == NULL) { zio = &wide_current->zio; - if (zio_lseek(zio, wide_current->page * EB_SIZE_PAGE + offset, + if (zio_lseek(zio, (off_t) wide_current->page * EB_SIZE_PAGE + offset, SEEK_SET) < 0) { error_code = EB_ERR_FAIL_SEEK_FONT; goto failed; @@ -849,7 +849,7 @@ if (wide_current->glyphs == NULL) { zio = &wide_current->zio; - if (zio_lseek(zio, wide_current->page * EB_SIZE_PAGE + offset, + if (zio_lseek(zio, (off_t) wide_current->page * EB_SIZE_PAGE + offset, SEEK_SET) < 0) { error_code = EB_ERR_FAIL_SEEK_FONT; goto failed;