int i,j,k,l;
short int *p;
if (! charset) {
+ free(newmap);
return NULL;
}
for (i=0;i<256;i++) {
k= charset[i];
j= (unsigned)k>>8;
if (!newmap[j]) {
- newmap[j] = malloc(sizeof(short int *)*256);
+ newmap[j] = (short int *)malloc(sizeof(short int)*256);
if (!newmap[j]) {
fprintf(stderr,"Insufficient memory for charset\n");
exit(1);
short int * read_charset(const char *filename) {
char *path;
FILE *f;
- short int *new=calloc(sizeof(short int),256);
+ short int *new;
int c;
long int uc;
path= find_file(stradd(filename,CHARSET_EXT),charset_path);
if (input_buffer)
setvbuf(f,input_buffer,_IOFBF,FILE_BUFFER);
/* defaults */
+ new = calloc(sizeof(short int),256);
for (c=0;c<32;c++) {
new[c]=c;
}
int get_utf8 (FILE *f,long *offset,long fileend) {
unsigned char buf[3];
- int d,c;
+ int c;
int result;
result=catdoc_read(buf, 1, 1, f);
if (result<0) {
}
if (result==0) return EOF;
c=buf[0];
- d=0;
if (c<0x80)
return c;
if (c <0xC0)