Removed clashing of sopen in Windows.

This commit is contained in:
Andrea Mazzoleni 2011-06-26 11:16:47 +02:00
parent b90e7fdacf
commit 4bf68b6204
4 changed files with 7 additions and 6 deletions

View file

@ -10,6 +10,7 @@ SnapRAID HISTORY
information for a potential GUI for SnapRAID. information for a potential GUI for SnapRAID.
* Added a new "diff" command to print the list of changes detected * Added a new "diff" command to print the list of changes detected
at file level. at file level.
* Faster loading of content file. Approx 3 times faster.
1.4 2011/6 1.4 2011/6
========== ==========

View file

@ -70,7 +70,7 @@ void state_config(struct snapraid_state* state, const char* path, int verbose, i
fflush(stderr); fflush(stderr);
} }
f = sopen(path); f = sopen_read(path);
if (!f) { if (!f) {
if (errno == ENOENT) { if (errno == ENOENT) {
fprintf(stderr, "No configuration file found at '%s'\n", path); fprintf(stderr, "No configuration file found at '%s'\n", path);
@ -305,7 +305,7 @@ void state_read(struct snapraid_state* state)
} }
printf("Loading state from %s...\n", path); printf("Loading state from %s...\n", path);
f = sopen(path); f = sopen_read(path);
if (f != 0) { if (f != 0) {
/* if openend stop the search */ /* if openend stop the search */
break; break;

2
util.c
View file

@ -86,7 +86,7 @@ char* strdechex(void* void_data, unsigned data_len, char* str)
/****************************************************************************/ /****************************************************************************/
/* stream */ /* stream */
STREAM* sopen(const char* file) STREAM* sopen_read(const char* file)
{ {
STREAM* s = malloc_nofail(sizeof(STREAM)); STREAM* s = malloc_nofail(sizeof(STREAM));

6
util.h
View file

@ -56,7 +56,7 @@ typedef struct stream STREAM;
/** /**
* Open a stream for reading. Like fopen(). * Open a stream for reading. Like fopen().
*/ */
STREAM* sopen(const char* file); STREAM* sopen_read(const char* file);
/** /**
* Close a stream. Like fclose(). * Close a stream. Like fclose().
@ -79,7 +79,7 @@ static inline int sptrlookup(STREAM* s, int size)
/** /**
* Gets the current stream ptr. * Gets the current stream ptr.
*/ */
unsigned char* sptrget(STREAM* s) static inline unsigned char* sptrget(STREAM* s)
{ {
return s->pos; return s->pos;
} }
@ -87,7 +87,7 @@ unsigned char* sptrget(STREAM* s)
/** /**
* Set the current stream ptr. * Set the current stream ptr.
*/ */
void sptrset(STREAM* s, unsigned char* ptr) static inline void sptrset(STREAM* s, unsigned char* ptr)
{ {
s->pos = ptr; s->pos = ptr;
} }