Commit 125d69cd authored by Teodor Sigaev's avatar Teodor Sigaev

Fix signed char in comparison and check memory allocation

parent ad8c09c2
...@@ -49,7 +49,7 @@ strnduplicate(char *s, int len) { ...@@ -49,7 +49,7 @@ strnduplicate(char *s, int len) {
} }
/* backward string compaire for suffix tree operations */ /* backward string compaire for suffix tree operations */
static int static int
strbcmp(const char *s1, const char *s2) strbcmp(const unsigned char *s1, const unsigned char *s2)
{ {
int l1 = strlen(s1) - 1, int l1 = strlen(s1) - 1,
l2 = strlen(s2) - 1; l2 = strlen(s2) - 1;
...@@ -71,7 +71,7 @@ strbcmp(const char *s1, const char *s2) ...@@ -71,7 +71,7 @@ strbcmp(const char *s1, const char *s2)
return 0; return 0;
} }
static int static int
strbncmp(const char *s1, const char *s2, size_t count) strbncmp(const unsigned char *s1, const unsigned char *s2, size_t count)
{ {
int l1 = strlen(s1) - 1, int l1 = strlen(s1) - 1,
l2 = strlen(s2) - 1, l2 = strlen(s2) - 1,
...@@ -536,9 +536,10 @@ mkANode(IspellDict *Conf, int low, int high, int level, int type) { ...@@ -536,9 +536,10 @@ mkANode(IspellDict *Conf, int low, int high, int level, int type) {
} }
data->val=GETCHAR( Conf->Affix + i, level, type ); data->val=GETCHAR( Conf->Affix + i, level, type );
if ( Conf->Affix[i].replen == level+1 ) { /* affix stopped */ if ( Conf->Affix[i].replen == level+1 ) { /* affix stopped */
if ( !data->naff ) if ( !data->naff ) {
data->aff=(AFFIX**)malloc(sizeof(AFFIX*)*(high-i+1)); data->aff=(AFFIX**)malloc(sizeof(AFFIX*)*(high-i+1));
MEMOUT(data); MEMOUT(data->aff);
}
data->aff[ data->naff ] = Conf->Affix + i; data->aff[ data->naff ] = Conf->Affix + i;
data->naff++; data->naff++;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment