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;
}
char *q;
char path_buf[PATH_BUF_SIZE];
char dir_sep[2]={DIR_SEP,0};
+ char **ptr;
#ifdef __MSDOS__
struct ffblk ffblock;
int res,col;
#else
glob_t glob_buf;
int count,glob_flags=GLOB_ERR;
+
+ memset(&glob_buf,0,sizeof(glob_t));
#endif
- char **ptr;
for (p=charset_path;p;p=(q?(q+1):NULL)) {
q=strchr(p,LIST_SEP);
if (q) {
}
if (col>=rowptr[row].end) {
newcol=(col/16+1)*16;
- rowptr[row].cells=realloc(rowptr[row].cells,newcol*sizeof(char *));
+ rowptr[row].cells=
+ (unsigned char**)realloc(rowptr[row].cells,
+ newcol*sizeof(unsigned char *));
if (rowptr[row].cells == NULL) {
perror("allocating row");
exit(1);
if (reclen==8 || reclen==16) {
if (biff_version == 0x0809 ) {
itemsread=catdoc_read(rec,4,1,input);
+ if (itemsread == 0)
+ break;
build_year=getshort(rec+2,0);
build_rel=getshort(rec,0);
(void) build_rel;
if(build_year > 5 ) {
- itemsread=catdoc_read(rec,8,1,input);
+ catdoc_read(rec,8,1,input);
biff_version=8;
offset=12;
}
}
while(itemsread){
unsigned char buffer[2];
- rectype = 0;
+
itemsread = catdoc_read(buffer, 2, 1, input);
if (catdoc_eof(input)) {
process_item(MSEOF,0,NULL);
return;
}
- rectype=getshort(buffer,0);
if(itemsread == 0)
break;
- reclen=0;
+ rectype=getshort(buffer,0);
itemsread = catdoc_read(buffer, 2, 1, input);
+ if(itemsread == 0)
+ break;
reclen=getshort(buffer,0);
if (reclen && reclen <MAX_MS_RECSIZE &&reclen >0){
itemsread = catdoc_read(rec, 1, reclen, input);
count=**src;
flags = *(*src+offset);
offset --;
- flags = *(*src+1+offset);
if (! ( flags == 0 || flags == 1 || flags == 8 || flags == 9 ||
flags == 4 || flags == 5 || flags == 0x0c || flags == 0x0d ) ) {
/* fprintf(stderr,"Strange flags = %d, returning NULL\n", flags); */
}
d=dest+l;
strcpy((char *)d,(char *)c);
- d+=dl;
l+=dl;
}
}
unsigned char **parsedString;/*pointer into parsed array*/
sstsize = getlong(sstbuf+4,0);
- sst=malloc(sstsize*sizeof(char *));
+ sst=(unsigned char **)malloc(sstsize*sizeof(unsigned char *));
if (sst == NULL) {
perror("SST allocation error");