textcat.c | textcat.c | |||
---|---|---|---|---|
skipping to change at line 174 | skipping to change at line 174 | |||
finger_print_file_name_size = prefix_size + 1; | finger_print_file_name_size = prefix_size + 1; | |||
finger_print_file_name = | finger_print_file_name = | |||
(char *)malloc(sizeof(char) * (finger_print_file_name_size + 1024)) ; | (char *)malloc(sizeof(char) * (finger_print_file_name_size + 1024)) ; | |||
finger_print_file_name[0] = '\0'; | finger_print_file_name[0] = '\0'; | |||
strcat(finger_print_file_name, prefix); | strcat(finger_print_file_name, prefix); | |||
while (wg_getline(line, 1024, fp)) | while (wg_getline(line, 1024, fp)) | |||
{ | { | |||
char *p; | char *p; | |||
char *segment[4]; | char *segment[4]; | |||
int res; | ||||
/*** Skip comments ***/ | /*** Skip comments ***/ | |||
if ((p = strchr(line, '#'))) | if ((p = strchr(line, '#'))) | |||
{ | { | |||
*p = '\0'; | *p = '\0'; | |||
} | } | |||
if ((res = wg_split(segment, line, line, 4)) < 2) | ||||
if (wg_split(segment, line, line, 4) < 2) | ||||
{ | { | |||
continue; | continue; | |||
} | } | |||
/*** Ensure enough space ***/ | /*** Ensure enough space ***/ | |||
if (h->size == h->maxsize) | if (h->size == h->maxsize) | |||
{ | { | |||
h->maxsize *= 2; | h->maxsize *= 2; | |||
h->fprint = | h->fprint = | |||
(void **)realloc(h->fprint, sizeof(void *) * h->maxsize); | (void **)realloc(h->fprint, sizeof(void *) * h->maxsize); | |||
skipping to change at line 212 | skipping to change at line 212 | |||
while (prefix_size + strlen(segment[0]) > finger_print_file_name_si ze) | while (prefix_size + strlen(segment[0]) > finger_print_file_name_si ze) | |||
{ | { | |||
char *tmp; | char *tmp; | |||
size_t tmp_size = finger_print_file_name_size * 2; | size_t tmp_size = finger_print_file_name_size * 2; | |||
tmp = | tmp = | |||
(char *)realloc(finger_print_file_name, | (char *)realloc(finger_print_file_name, | |||
sizeof(char) * (tmp_size + 1)); | sizeof(char) * (tmp_size + 1)); | |||
if (tmp == NULL) | if (tmp == NULL) | |||
{ | { | |||
free(finger_print_file_name); | ||||
finger_print_file_name_size = 0; | ||||
goto BAILOUT; | goto BAILOUT; | |||
} | } | |||
else | else | |||
{ | { | |||
finger_print_file_name = tmp; | finger_print_file_name = tmp; | |||
finger_print_file_name_size = tmp_size; | finger_print_file_name_size = tmp_size; | |||
} | } | |||
} | } | |||
finger_print_file_name[prefix_size] = '\0'; | finger_print_file_name[prefix_size] = '\0'; | |||
strcat(finger_print_file_name, segment[0]); | strcat(finger_print_file_name, segment[0]); | |||
if (fp_Read(h->fprint[h->size], finger_print_file_name, 400) == 0) | if (fp_Read(h->fprint[h->size], finger_print_file_name, 400) == 0) | |||
{ | ||||
textcat_Done(h); | ||||
goto BAILOUT; | goto BAILOUT; | |||
} | ||||
h->fprint_disable[h->size] = 0xF0; /* 0xF0 is the code for enabled | h->fprint_disable[h->size] = 0xF0; /* 0xF0 is the code for enabled | |||
languages, 0x0F is for disab led | languages, 0x0F is for disab led | |||
*/ | */ | |||
h->size++; | h->size++; | |||
} | } | |||
free(finger_print_file_name); | free(finger_print_file_name); | |||
fclose(fp); | fclose(fp); | |||
return h; | return h; | |||
BAILOUT: | BAILOUT: | |||
free(finger_print_file_name); | ||||
fclose(fp); | fclose(fp); | |||
textcat_Done(h); | ||||
return NULL; | return NULL; | |||
} | } | |||
extern candidate_t *textcat_GetClassifyFullOutput(void *handle) | extern candidate_t *textcat_GetClassifyFullOutput(void *handle) | |||
{ | { | |||
textcat_t *h = (textcat_t *) handle; | textcat_t *h = (textcat_t *) handle; | |||
return (candidate_t *) malloc(sizeof(candidate_t) * h->size); | return (candidate_t *) malloc(sizeof(candidate_t) * h->size); | |||
} | } | |||
extern void textcat_ReleaseClassifyFullOutput(void *handle, | extern void textcat_ReleaseClassifyFullOutput(void *handle, | |||
candidate_t * candidates) | candidate_t * candidates) | |||
End of changes. 8 change blocks. | ||||
8 lines changed or deleted | 4 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |