File xjdic-Kstrcmp.patch of Package xjdic
Index: xjdic-2.4/xjdsa.c
===================================================================
--- xjdic-2.4.orig/xjdsa.c
+++ xjdic-2.4/xjdsa.c
@@ -31,17 +31,17 @@
#include <stdint.h>
#include "xjdic.h"
-unsigned char Dnamet[10][100],XJDXnamet[10][100];
-unsigned char CBname[100];
-unsigned char *dicbufft[10];
-uint32_t diclent[10], indlent[10],indptrt[10];
-int NoDics,CurrDic;
+extern unsigned char Dnamet[10][100],XJDXnamet[10][100];
+extern unsigned char CBname[100];
+extern unsigned char *dicbufft[10];
+extern uint32_t diclent[10], indlent[10],indptrt[10];
+extern int NoDics,CurrDic;
int iterlimit;
/* extern int TRIGGER; */
/*====== prototypes=================================================*/
-int Kstrcmp(uint32_t lhs, uint32_t rhs);
+int Kstrcmp1(int klen, unsigned char *str1);
uint32_t jindex(uint32_t xit);
unsigned char dbchar(uint32_t xit);
@@ -87,7 +87,7 @@ void xjdserver (int type, int dic_no, in
if (!iterlimit--) break;
it = (lo+hi)/2;
/* if (TRIGGER) printf("Calling KSTRCMP - 1\n"); */
- res = Kstrcmp(sch_str_len,sch_str);
+ res = Kstrcmp1(sch_str_len,sch_str);
if (res == 0)
{
itok = it;
@@ -98,7 +98,7 @@ void xjdserver (int type, int dic_no, in
if(lo2+1 >= hi2) break;
it = (lo2+hi2)/2;
/* if (TRIGGER) printf("Calling KSTRCMP - 1.5\n"); */
- res = Kstrcmp(sch_str_len,sch_str);
+ res = Kstrcmp1(sch_str_len,sch_str);
if (res == 0)
{
hi2 = it;
@@ -134,7 +134,7 @@ void xjdserver (int type, int dic_no, in
while (TRUE)
{
/* if (TRIGGER) printf("Calling KSTRCMP - 2\n"); */
- if(Kstrcmp(sch_str_len,sch_str) == 0)
+ if(Kstrcmp1(sch_str_len,sch_str) == 0)
{
it--;
if (it == 0)
@@ -164,7 +164,7 @@ void xjdserver (int type, int dic_no, in
}
it = index_posn;
/* if (TRIGGER) printf("Calling KSTRCMP - 3\n"); */
- res = Kstrcmp(sch_str_len,sch_str);
+ res = Kstrcmp1(sch_str_len,sch_str);
if (res != 0)
{
*sch_resp = XJ_NBG;
Index: xjdic-2.4/xjdservcomm.c
===================================================================
--- xjdic-2.4.orig/xjdservcomm.c
+++ xjdic-2.4/xjdservcomm.c
@@ -50,7 +50,7 @@ uint32_t indhits[10],indmiss[10];
uint32_t vbkills=0;
uint32_t diclent[10], indlent[10],indptrt[10];
int i,NoDics,CurrDic;
-int xfilelen;
+extern int xfilelen;
/*====== Prototypes========================================================*/
FILE *xfopen (char *name, char *mode, int *xfilelen);
@@ -58,7 +58,7 @@ int xopen (char *name, int *xfilelen);
uint32_t jindex(uint32_t xit);
unsigned char dbchar(uint32_t xit);
void DicSet ();
-int Kstrcmp(int klen,unsigned char *str1);
+int Kstrcmp1(int klen,unsigned char *str1);
void DicLoad(int dn);
unsigned char *DicName(int dn);
void DicTest(int dn);
@@ -419,7 +419,7 @@ uint32_t jindex(uint32_t xit)
/*=========string comparison function used in binary search ==========*/
/* This one is used by the main dictionary search */
-int Kstrcmp(int klen,unsigned char *str1)
+int Kstrcmp1(int klen,unsigned char *str1)
{
unsigned c1,c2;
int i,rc1,rc2;
Index: xjdic-2.4/xjdserver.c
===================================================================
--- xjdic-2.4.orig/xjdserver.c
+++ xjdic-2.4/xjdserver.c
@@ -352,7 +352,7 @@ unsigned char **argv;
{
if (!iterlimit--) break;
it = (lo+hi)/2;
- res = Kstrcmp(pdu_in.xjdreq_schlen,pdu_in.xjdreq_schstr);
+ res = Kstrcmp1(pdu_in.xjdreq_schlen,pdu_in.xjdreq_schstr);
if (res == 0)
{
itok = it;
@@ -362,7 +362,7 @@ unsigned char **argv;
{
if(lo2+1 >= hi2) break;
it = (lo2+hi2)/2;
- res = Kstrcmp(pdu_in.xjdreq_schlen,pdu_in.xjdreq_schstr);
+ res = Kstrcmp1(pdu_in.xjdreq_schlen,pdu_in.xjdreq_schstr);
if (res == 0)
{
hi2 = it;
@@ -398,7 +398,7 @@ unsigned char **argv;
first */
while (TRUE)
{
- if(Kstrcmp(pdu_in.xjdreq_schlen,pdu_in.xjdreq_schstr) == 0)
+ if(Kstrcmp1(pdu_in.xjdreq_schlen,pdu_in.xjdreq_schstr) == 0)
{
it--;
if (it == 0)
@@ -428,7 +428,7 @@ unsigned char **argv;
continue;
}
it = pdu_in.xjdreq_indexpos;
- res = Kstrcmp(pdu_in.xjdreq_schlen,pdu_in.xjdreq_schstr);
+ res = Kstrcmp1(pdu_in.xjdreq_schlen,pdu_in.xjdreq_schstr);
if (res != 0)
{
pdu_out.xjdrsp_type = htons(XJ_NBG);