Revision: 6806
Author: ek.kato
Date: Mon Nov 8 08:21:56 2010
Log: * uim/bsdlook.c
- (uim_look_finish) : Cast return value of mmap to uintptr_t.
- (uim_look_open_dict) : Set front0 and front zero upon
MAP_FAILED.
http://code.google.com/p/uim/source/detail?r=6806
Modified:
/trunk/uim/bsdlook.c
=======================================
--- /trunk/uim/bsdlook.c Sun Nov 7 21:30:06 2010
+++ /trunk/uim/bsdlook.c Mon Nov 8 08:21:56 2010
@@ -166,7 +166,7 @@
if (!ctx)
return;
- if ((intptr_t)ctx->front0 > 0 && munmap(ctx->front0, ctx->len) == -1)
+ if ((uintptr_t)ctx->front0 > 0 && munmap(ctx->front0, ctx->len) == -1)
perror("uim_look_finish");
if (ctx->fd > 0)
@@ -192,6 +192,7 @@
if ((ctx->front0 = ctx->front = mmap(NULL,
(size_t)sb.st_size, PROT_READ, MAP_PRIVATE, ctx->fd, (off_t)0)) ==
MAP_FAILED) {
perror("uim_look_open_dict");
+ ctx->front0 = ctx->front = 0;
}
ctx->len = (size_t)sb.st_size;
ctx->back0 = ctx->back = ctx->front + sb.st_size;