Added patches that were uploaded to Chicago patch area.
This commit is contained in:
48
cole/cole.c
48
cole/cole.c
@@ -1,3 +1,5 @@
|
||||
|
||||
|
||||
/*
|
||||
cole - A free C OLE library.
|
||||
Copyright 1998, 1999 Roberto Arturo Tena Sanchez
|
||||
@@ -20,8 +22,12 @@
|
||||
Arturo Tena <arturo@directmail.org>
|
||||
*/
|
||||
|
||||
#if !(defined( __BORLANDC__ ) || defined( __WIN32__ ))
|
||||
#include "config.h"
|
||||
#include "cole.h"
|
||||
#else
|
||||
#include "cole.h.in"
|
||||
#endif
|
||||
|
||||
#include "internal.h"
|
||||
#include <stdlib.h>
|
||||
@@ -189,7 +195,7 @@ cole_umount (COLEFS *colefilesystem, COLERRNO *colerrno)
|
||||
if (colerrno != NULL) *colerrno = COLE_ECLOSEFILE;
|
||||
ret = 1;
|
||||
}
|
||||
#if defined(WIN32)
|
||||
#if defined(__WIN32__) || (__BORLANDC__)
|
||||
if (remove (colefilesystem->sbfilename) && !ret) {
|
||||
if (colerrno != NULL) *colerrno = COLE_EREMOVE;
|
||||
ret = 1;
|
||||
@@ -243,9 +249,6 @@ __cole_print_tree_indir(COLEDIR *cd, void *info, COLERRNO *colerrno)
|
||||
* Modify colerrno comment in the functions that call it,
|
||||
* ie. cole_print_tree().
|
||||
*/
|
||||
(void) cd; /*UNUSED*/
|
||||
(void) colerrno; /*UNUSED*/
|
||||
|
||||
(*((long*)info))++;
|
||||
return 0;
|
||||
}
|
||||
@@ -258,9 +261,6 @@ __cole_print_tree_outdir(COLEDIR *cd, void *info, COLERRNO *colerrno)
|
||||
* Modify colerrno comment in the functions that call it,
|
||||
* ie. cole_print_tree().
|
||||
*/
|
||||
(void) cd; /*UNUSED*/
|
||||
(void) colerrno; /*UNUSED*/
|
||||
|
||||
(*((long*)info))--;
|
||||
return 0;
|
||||
}
|
||||
@@ -275,9 +275,6 @@ __cole_print_tree_inroot(COLEDIR *cd, void *info, COLERRNO *colerrno)
|
||||
*/
|
||||
char *entry_name;
|
||||
|
||||
(void) info; /*UNUSED*/
|
||||
(void) colerrno; /*UNUSED*/
|
||||
|
||||
printf ("DIR ");
|
||||
printf (" %7zu", cole_dir_getsize (cd));
|
||||
printf (" %08lx-%08lx %08lx-%08lx",
|
||||
@@ -306,8 +303,6 @@ __cole_print_tree_indirentry(COLEDIRENT *cde, void *info, COLERRNO *colerrno)
|
||||
long level;
|
||||
long i;
|
||||
|
||||
(void) colerrno; /*UNUSED*/
|
||||
|
||||
level = *((long*)info);
|
||||
for (i = 0; i < level; i++) {
|
||||
if (i == level - 1)
|
||||
@@ -412,8 +407,6 @@ cole_opendir_direntry (COLEDIRENT *coledirentry, COLERRNO *colerrno)
|
||||
int
|
||||
cole_closedir (COLEDIR *coledir, COLERRNO *colerrno)
|
||||
{
|
||||
(void) colerrno; /*UNUSED*/
|
||||
|
||||
free (coledir);
|
||||
|
||||
return 0;
|
||||
@@ -601,7 +594,7 @@ cole_fopen (COLEFS *colefilesystem, char *filename, COLERRNO *colerrno)
|
||||
_cole_fopen_action, colerrno)) {
|
||||
/* couldn't locate the filename */
|
||||
/* colerrno is set */
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (info.succ)
|
||||
@@ -624,13 +617,15 @@ _cole_fopen_action (COLEDIRENT *cde, void *_info)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
info->file = cole_fopen_direntry (cde, &info->colerrno);
|
||||
|
||||
if (info->file == NULL) {
|
||||
/* colerrno is set */
|
||||
info->succ = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
info->succ = 1;
|
||||
}
|
||||
|
||||
@@ -838,39 +833,46 @@ cole_fseek (COLEFILE *colefile, size_t delta, COLE_SEEK_FLAG direction,
|
||||
case COLE_SEEK_SET:
|
||||
if (delta <= colefile->filesize) {
|
||||
colefile->pos = delta;
|
||||
return 0;
|
||||
|
||||
} else {
|
||||
if (colerrno != NULL) *colerrno = COLE_EFSEEKDELTA;
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case COLE_SEEK_END:
|
||||
if (delta <= colefile->filesize) {
|
||||
colefile->pos = colefile->filesize - delta;
|
||||
return 0;
|
||||
|
||||
} else {
|
||||
if (colerrno != NULL) *colerrno = COLE_EFSEEKDELTA;
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case COLE_SEEK_BACKWARD:
|
||||
if (delta <= colefile->pos) {
|
||||
colefile->pos = colefile->pos - delta;
|
||||
return 0;
|
||||
|
||||
} else {
|
||||
if (colerrno != NULL) *colerrno = COLE_EFSEEKDELTA;
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case COLE_SEEK_FORWARD:
|
||||
if (delta <= colefile->filesize - colefile->pos) {
|
||||
colefile->pos = colefile->pos + delta;
|
||||
return 0;
|
||||
|
||||
} else {
|
||||
if (colerrno != NULL) *colerrno = COLE_EFSEEKDELTA;
|
||||
return 1;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
if (colerrno != NULL) *colerrno = COLE_EFSEEKFLAG;
|
||||
return 1;
|
||||
}
|
||||
|
||||
fseek(colefile->file,colefile->pos,SEEK_SET);
|
||||
}
|
||||
|
||||
|
||||
@@ -1117,8 +1119,8 @@ cole_locate_filename (COLEFS *colefilesystem, char *filename,
|
||||
|
||||
/* FIXME allow no absolute paths */
|
||||
if (filename[0] != '/') {
|
||||
if (colerrno != NULL) *colerrno = COLE_EBROKENFILENAME;
|
||||
return 1;
|
||||
if (colerrno != NULL) *colerrno = COLE_EBROKENFILENAME;
|
||||
return 1;
|
||||
}
|
||||
|
||||
_info.action = action;
|
||||
@@ -1145,8 +1147,6 @@ cole_locate_filename (COLEFS *colefilesystem, char *filename,
|
||||
static int
|
||||
__cole_locate_filename_visitdir (COLEDIR *cd, void *info)
|
||||
{
|
||||
(void) cd; /*UNUSED*/
|
||||
|
||||
return ((struct __cole_locate_filenameinfo *)info)->visitdir;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user