Cleanup of djvu.c

1. Use the proper <string.h> header.
2. Typo fixes and whitespace changes.
3. Comment out debug printf() about cache size.
4. Remove obsolete comment(s).

Conflicts:

	djvu.c
pull/2/merge
Tigran Aivazian 12 years ago committed by Qingping Hou
parent 50a76c09a0
commit cae259e0cb

@ -16,10 +16,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <math.h>
#include <string.h>
#include <libdjvu/miniexp.h>
#include <libdjvu/ddjvuapi.h>
#include "string.h"
#include "blitbuffer.h"
#include "drawcontext.h"
#include "djvu.h"
@ -27,7 +27,6 @@
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
typedef struct DjvuDocument {
ddjvu_context_t *context;
ddjvu_document_t *doc_ref;
@ -41,7 +40,6 @@ typedef struct DjvuPage {
DjvuDocument *doc;
} DjvuPage;
static int handle(lua_State *L, ddjvu_context_t *ctx, int wait)
{
const ddjvu_message_t *msg;
@ -83,7 +81,7 @@ static int openDocument(lua_State *L) {
return luaL_error(L, "cannot create context");
}
printf("## cache_size = %d\n", cache_size);
//printf("## cache_size = %d\n", cache_size);
ddjvu_cache_set_size(doc->context, (unsigned long)cache_size);
doc->doc_ref = ddjvu_document_create_by_filename_utf8(doc->context, filename, TRUE);
@ -108,7 +106,7 @@ static int openDocument(lua_State *L) {
static int closeDocument(lua_State *L) {
DjvuDocument *doc = (DjvuDocument*) luaL_checkudata(L, 1, "djvudocument");
// should be save if called twice
// should be safe if called twice
if (doc->doc_ref != NULL) {
ddjvu_document_release(doc->doc_ref);
doc->doc_ref = NULL;
@ -170,7 +168,6 @@ static int walkTableOfContent(lua_State *L, miniexp_t r, int *count, int depth)
return 0;
}
static int getTableOfContent(lua_State *L) {
DjvuDocument *doc = (DjvuDocument*) luaL_checkudata(L, 1, "djvudocument");
miniexp_t r;
@ -515,14 +512,14 @@ static int drawPage(lua_State *L) {
static int getCacheSize(lua_State *L) {
DjvuDocument *doc = (DjvuDocument*) luaL_checkudata(L, 1, "djvudocument");
unsigned long size = ddjvu_cache_get_size(doc->context);
printf("## ddjvu_cache_get_size = %d\n", size);
//printf("## ddjvu_cache_get_size = %d\n", (int)size);
lua_pushnumber(L, size);
return 1;
}
static int cleanCache(lua_State *L) {
DjvuDocument *doc = (DjvuDocument*) luaL_checkudata(L, 1, "djvudocument");
printf("## ddjvu_cache_clear\n");
//printf("## ddjvu_cache_clear\n");
ddjvu_cache_clear(doc->context);
return 0;
}

Loading…
Cancel
Save