Fix bugs
This commit is contained in:
parent
a6a7858eaf
commit
69776245a7
20 changed files with 59721 additions and 58907 deletions
|
|
@ -302,7 +302,7 @@ u_int adddic(SJ4_CONTEXT u_char* yomi, u_char* kanji, TypeGram hinsi) {
|
|||
|
||||
static int
|
||||
checksub(SJ4_CONTEXT u_char* kanji, TypeGram grm) {
|
||||
u_char* tagp;
|
||||
u_char* tagp = NULL;
|
||||
u_char* ptr;
|
||||
u_char* endp;
|
||||
int flg, nlen;
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ static CLREC *nextrecblk(SJ4_CONTEXT2), *prevrecblk(SJ4_CONTEXT2);
|
|||
|
||||
static void initkbuf(SJ4_CONTEXT u_char*);
|
||||
|
||||
int cl2knj(SJ4_CONTEXT u_char* yomi, int len, u_char* kouho) {
|
||||
int cl2knj(SJ4_CONTEXT u_char* yomi, int len, u_char* kouho, int klen) {
|
||||
u_char* ptr1;
|
||||
u_char* ptr2;
|
||||
int i;
|
||||
|
|
|
|||
|
|
@ -85,10 +85,26 @@ Sj4Context* alloccontext(const char* dic) {
|
|||
DictFile* dict;
|
||||
DICTL* node;
|
||||
|
||||
ctx->work = calloc(1, sizeof(*ctx->work));
|
||||
ctx->stdy = calloc(1, sizeof(*ctx->stdy));
|
||||
if((ctx->work = calloc(1, sizeof(*ctx->work))) == NULL) {
|
||||
free(ctx);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
if((ctx->stdy = calloc(1, sizeof(*ctx->stdy))) == NULL) {
|
||||
free(ctx->work);
|
||||
free(ctx);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if((node = calloc(1, sizeof(*node))) == NULL) {
|
||||
free(ctx->stdy);
|
||||
free(ctx->work);
|
||||
free(ctx);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
node = calloc(1, sizeof(*node));
|
||||
ctx->work->Jdictlist = node;
|
||||
|
||||
initwork(ctx);
|
||||
|
|
|
|||
|
|
@ -63,12 +63,12 @@ set2nd(SJ4_CONTEXT CLREC* clrec) {
|
|||
static int cost_penalty(CLREC* clrec) {
|
||||
int c = clrec->jnode->cost;
|
||||
|
||||
if(c < 0xfff / 5 * 1) return 8;
|
||||
if(c < 0xfff / 5 * 2) return 4;
|
||||
if(c < 0xfff / 5 * 1) return 0;
|
||||
if(c < 0xfff / 5 * 2) return 1;
|
||||
if(c < 0xfff / 5 * 3) return 2;
|
||||
if(c < 0xfff / 5 * 4) return 1;
|
||||
return 0;
|
||||
};
|
||||
if(c < 0xfff / 5 * 4) return 4;
|
||||
return 8;
|
||||
}
|
||||
|
||||
void mk2claus(SJ4_CONTEXT2) {
|
||||
u_char* keepptr;
|
||||
|
|
@ -127,7 +127,7 @@ void mk2claus(SJ4_CONTEXT2) {
|
|||
|
||||
if(selcl->cl2len > clrec->cl2len) continue;
|
||||
|
||||
prty = priority(SJ4_CONTEXT_PASS clrec) - prty2 + cost_penalty(clrec);
|
||||
prty = priority(SJ4_CONTEXT_PASS clrec) - prty2 - cost_penalty(clrec);
|
||||
|
||||
prty2++;
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@
|
|||
#define ftruncate chsize
|
||||
#endif
|
||||
|
||||
#ifdef SJ3_GLOBAL
|
||||
#ifdef SJ4_GLOBAL
|
||||
DictFile* dictlink = NULL;
|
||||
StdyFile* stdylink = NULL;
|
||||
#else
|
||||
|
|
@ -174,7 +174,6 @@ getidx(SJ4_CONTEXT DictFile* dp) {
|
|||
idxbuf = dp->buffer + dp->idxstrt;
|
||||
return 0;
|
||||
}
|
||||
/* XXX: not IFunc */
|
||||
static int
|
||||
getdic(SJ4_CONTEXT DictFile* dp, TypeDicSeg seg) {
|
||||
if(seg >= dp->dict.segunit) return -1;
|
||||
|
|
@ -182,10 +181,9 @@ getdic(SJ4_CONTEXT DictFile* dp, TypeDicSeg seg) {
|
|||
return 0;
|
||||
}
|
||||
static int
|
||||
putidx(SJ4_CONTEXT DictFile* dp) {
|
||||
putidx(SJ4_CONTEXT DictFile* dp, short dummy) {
|
||||
return putfile(dp->fd, dp->idxstrt, dp->dict.idxlen, idxbuf);
|
||||
}
|
||||
/* XXX: not IFunc */
|
||||
static int
|
||||
putdic(SJ4_CONTEXT DictFile* dp, TypeDicSeg seg) {
|
||||
u_char* p;
|
||||
|
|
@ -213,7 +211,6 @@ putdic(SJ4_CONTEXT DictFile* dp, TypeDicSeg seg) {
|
|||
|
||||
return putfile(dp->fd, i, dp->dict.seglen, p);
|
||||
}
|
||||
/* XXX: not IFunc */
|
||||
static int
|
||||
rszdic(SJ4_CONTEXT DictFile* dp, TypeDicSeg seg) {
|
||||
long i;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue