s/openned/opened. Deprecate incorrectly spelled errors.

This commit is contained in:
Vreixo Formoso 2008-03-01 17:12:44 +01:00
parent 31a92bd8bd
commit 061dce1ec2
8 changed files with 39 additions and 33 deletions

View File

@ -57,7 +57,7 @@ int ds_open(IsoDataSource *src)
data = (struct file_data_src*) src->data; data = (struct file_data_src*) src->data;
if (data->fd != -1) { if (data->fd != -1) {
return ISO_FILE_ALREADY_OPENNED; return ISO_FILE_ALREADY_OPENED;
} }
fd = open(data->path, O_RDONLY); fd = open(data->path, O_RDONLY);
@ -81,7 +81,7 @@ int ds_close(IsoDataSource *src)
data = (struct file_data_src*) src->data; data = (struct file_data_src*) src->data;
if (data->fd == -1) { if (data->fd == -1) {
return ISO_FILE_NOT_OPENNED; return ISO_FILE_NOT_OPENED;
} }
/* close can fail if fd is not valid, but that should never happen */ /* close can fail if fd is not valid, but that should never happen */
@ -102,7 +102,7 @@ static int ds_read_block(IsoDataSource *src, uint32_t lba, uint8_t *buffer)
data = (struct file_data_src*) src->data; data = (struct file_data_src*) src->data;
if (data->fd == -1) { if (data->fd == -1) {
return ISO_FILE_NOT_OPENNED; return ISO_FILE_NOT_OPENED;
} }
/* goes to requested block */ /* goes to requested block */

View File

@ -538,7 +538,7 @@ int catalog_open(IsoStream *stream)
data = stream->data; data = stream->data;
if (data->offset != -1) { if (data->offset != -1) {
return ISO_FILE_ALREADY_OPENNED; return ISO_FILE_ALREADY_OPENED;
} }
memset(data->buffer, 0, BLOCK_SIZE); memset(data->buffer, 0, BLOCK_SIZE);
@ -563,7 +563,7 @@ int catalog_close(IsoStream *stream)
data = stream->data; data = stream->data;
if (data->offset == -1) { if (data->offset == -1) {
return ISO_FILE_NOT_OPENNED; return ISO_FILE_NOT_OPENED;
} }
data->offset = -1; data->offset = -1;
return ISO_SUCCESS; return ISO_SUCCESS;
@ -589,7 +589,7 @@ int catalog_read(IsoStream *stream, void *buf, size_t count)
data = stream->data; data = stream->data;
if (data->offset == -1) { if (data->offset == -1) {
return ISO_FILE_NOT_OPENNED; return ISO_FILE_NOT_OPENED;
} }
len = MIN(count, BLOCK_SIZE - data->offset); len = MIN(count, BLOCK_SIZE - data->offset);

View File

@ -474,7 +474,7 @@ int ifs_open(IsoFileSource *src)
data = (ImageFileSourceData*)src->data; data = (ImageFileSourceData*)src->data;
if (data->opened) { if (data->opened) {
return ISO_FILE_ALREADY_OPENNED; return ISO_FILE_ALREADY_OPENED;
} }
if (S_ISDIR(data->info.st_mode)) { if (S_ISDIR(data->info.st_mode)) {
@ -530,7 +530,7 @@ int ifs_close(IsoFileSource *src)
data = (ImageFileSourceData*)src->data; data = (ImageFileSourceData*)src->data;
if (!data->opened) { if (!data->opened) {
return ISO_FILE_NOT_OPENNED; return ISO_FILE_NOT_OPENED;
} }
if (data->opened == 2) { if (data->opened == 2) {
@ -569,7 +569,7 @@ int ifs_close(IsoFileSource *src)
* Error codes: * Error codes:
* ISO_FILE_ERROR * ISO_FILE_ERROR
* ISO_NULL_POINTER * ISO_NULL_POINTER
* ISO_FILE_NOT_OPENNED * ISO_FILE_NOT_OPENED
* ISO_FILE_IS_DIR * ISO_FILE_IS_DIR
* ISO_OUT_OF_MEM * ISO_OUT_OF_MEM
* ISO_INTERRUPTED * ISO_INTERRUPTED
@ -590,7 +590,7 @@ int ifs_read(IsoFileSource *src, void *buf, size_t count)
data = (ImageFileSourceData*)src->data; data = (ImageFileSourceData*)src->data;
if (!data->opened) { if (!data->opened) {
return ISO_FILE_NOT_OPENNED; return ISO_FILE_NOT_OPENED;
} else if (data->opened != 1) { } else if (data->opened != 1) {
return ISO_FILE_IS_DIR; return ISO_FILE_IS_DIR;
} }
@ -644,7 +644,7 @@ int ifs_readdir(IsoFileSource *src, IsoFileSource **child)
data = (ImageFileSourceData*)src->data; data = (ImageFileSourceData*)src->data;
if (!data->opened) { if (!data->opened) {
return ISO_FILE_NOT_OPENNED; return ISO_FILE_NOT_OPENED;
} else if (data->opened != 2) { } else if (data->opened != 2) {
return ISO_FILE_IS_NOT_DIR; return ISO_FILE_IS_NOT_DIR;
} }

View File

@ -190,7 +190,7 @@ int lfs_open(IsoFileSource *src)
data = src->data; data = src->data;
if (data->openned) { if (data->openned) {
return ISO_FILE_ALREADY_OPENNED; return ISO_FILE_ALREADY_OPENED;
} }
/* is a file or a dir ? */ /* is a file or a dir ? */
@ -251,7 +251,7 @@ int lfs_close(IsoFileSource *src)
ret = closedir(data->info.dir) == 0 ? ISO_SUCCESS : ISO_FILE_ERROR; ret = closedir(data->info.dir) == 0 ? ISO_SUCCESS : ISO_FILE_ERROR;
break; break;
default: default:
ret = ISO_FILE_NOT_OPENNED; ret = ISO_FILE_NOT_OPENED;
break; break;
} }
if (ret == ISO_SUCCESS) { if (ret == ISO_SUCCESS) {
@ -300,7 +300,7 @@ int lfs_read(IsoFileSource *src, void *buf, size_t count)
case 2: /* directory */ case 2: /* directory */
return ISO_FILE_IS_DIR; return ISO_FILE_IS_DIR;
default: default:
return ISO_FILE_NOT_OPENNED; return ISO_FILE_NOT_OPENED;
} }
} }
@ -341,7 +341,7 @@ int lfs_readdir(IsoFileSource *src, IsoFileSource **child)
return ret; return ret;
} }
default: default:
return ISO_FILE_NOT_OPENNED; return ISO_FILE_NOT_OPENED;
} }
} }

View File

@ -519,7 +519,7 @@ struct IsoFileSource_Iface
* Opens the source. * Opens the source.
* @return 1 on success, < 0 on error * @return 1 on success, < 0 on error
* Error codes: * Error codes:
* ISO_FILE_ALREADY_OPENNED * ISO_FILE_ALREADY_OPENED
* ISO_FILE_ACCESS_DENIED * ISO_FILE_ACCESS_DENIED
* ISO_FILE_BAD_PATH * ISO_FILE_BAD_PATH
* ISO_FILE_DOESNT_EXIST * ISO_FILE_DOESNT_EXIST
@ -535,7 +535,7 @@ struct IsoFileSource_Iface
* Error codes: * Error codes:
* ISO_FILE_ERROR * ISO_FILE_ERROR
* ISO_NULL_POINTER * ISO_NULL_POINTER
* ISO_FILE_NOT_OPENNED * ISO_FILE_NOT_OPENED
*/ */
int (*close)(IsoFileSource *src); int (*close)(IsoFileSource *src);
@ -552,7 +552,7 @@ struct IsoFileSource_Iface
* Error codes: * Error codes:
* ISO_FILE_ERROR * ISO_FILE_ERROR
* ISO_NULL_POINTER * ISO_NULL_POINTER
* ISO_FILE_NOT_OPENNED * ISO_FILE_NOT_OPENED
* ISO_WRONG_ARG_VALUE -> if count == 0 * ISO_WRONG_ARG_VALUE -> if count == 0
* ISO_FILE_IS_DIR * ISO_FILE_IS_DIR
* ISO_OUT_OF_MEM * ISO_OUT_OF_MEM
@ -578,7 +578,7 @@ struct IsoFileSource_Iface
* Error codes: * Error codes:
* ISO_FILE_ERROR * ISO_FILE_ERROR
* ISO_NULL_POINTER * ISO_NULL_POINTER
* ISO_FILE_NOT_OPENNED * ISO_FILE_NOT_OPENED
* ISO_FILE_IS_NOT_DIR * ISO_FILE_IS_NOT_DIR
* ISO_OUT_OF_MEM * ISO_OUT_OF_MEM
*/ */
@ -2893,7 +2893,7 @@ int iso_file_source_stat(IsoFileSource *src, struct stat *info);
* Opens the source. * Opens the source.
* @return 1 on success, < 0 on error * @return 1 on success, < 0 on error
* Error codes: * Error codes:
* ISO_FILE_ALREADY_OPENNED * ISO_FILE_ALREADY_OPENED
* ISO_FILE_ACCESS_DENIED * ISO_FILE_ACCESS_DENIED
* ISO_FILE_BAD_PATH * ISO_FILE_BAD_PATH
* ISO_FILE_DOESNT_EXIST * ISO_FILE_DOESNT_EXIST
@ -2911,7 +2911,7 @@ int iso_file_source_open(IsoFileSource *src);
* Error codes: * Error codes:
* ISO_FILE_ERROR * ISO_FILE_ERROR
* ISO_NULL_POINTER * ISO_NULL_POINTER
* ISO_FILE_NOT_OPENNED * ISO_FILE_NOT_OPENED
* *
* @since 0.6.2 * @since 0.6.2
*/ */
@ -2937,7 +2937,7 @@ int iso_file_source_close(IsoFileSource *src);
* Error codes: * Error codes:
* ISO_FILE_ERROR * ISO_FILE_ERROR
* ISO_NULL_POINTER * ISO_NULL_POINTER
* ISO_FILE_NOT_OPENNED * ISO_FILE_NOT_OPENED
* ISO_WRONG_ARG_VALUE -> if count == 0 * ISO_WRONG_ARG_VALUE -> if count == 0
* ISO_FILE_IS_DIR * ISO_FILE_IS_DIR
* ISO_OUT_OF_MEM * ISO_OUT_OF_MEM
@ -2965,7 +2965,7 @@ int iso_file_source_read(IsoFileSource *src, void *buf, size_t count);
* Error codes: * Error codes:
* ISO_FILE_ERROR * ISO_FILE_ERROR
* ISO_NULL_POINTER * ISO_NULL_POINTER
* ISO_FILE_NOT_OPENNED * ISO_FILE_NOT_OPENED
* ISO_FILE_IS_NOT_DIR * ISO_FILE_IS_NOT_DIR
* ISO_OUT_OF_MEM * ISO_OUT_OF_MEM
* *
@ -3280,6 +3280,9 @@ void iso_stream_get_id(IsoStream *stream, unsigned int *fs_id, dev_t *dev_id,
#define ISO_FILE_ERROR 0xE830FF80 #define ISO_FILE_ERROR 0xE830FF80
/** Trying to open an already openned file (FAILURE,HIGH, -129) */ /** Trying to open an already openned file (FAILURE,HIGH, -129) */
#define ISO_FILE_ALREADY_OPENED 0xE830FF7F
/* @deprecated use ISO_FILE_ALREADY_OPENED instead */
#define ISO_FILE_ALREADY_OPENNED 0xE830FF7F #define ISO_FILE_ALREADY_OPENNED 0xE830FF7F
/** Access to file is not allowed (FAILURE,HIGH, -130) */ /** Access to file is not allowed (FAILURE,HIGH, -130) */
@ -3292,7 +3295,10 @@ void iso_stream_get_id(IsoStream *stream, unsigned int *fs_id, dev_t *dev_id,
#define ISO_FILE_DOESNT_EXIST 0xE830FF7C #define ISO_FILE_DOESNT_EXIST 0xE830FF7C
/** Trying to read or close a file not openned (FAILURE,HIGH, -133) */ /** Trying to read or close a file not openned (FAILURE,HIGH, -133) */
#define ISO_FILE_NOT_OPENNED 0xE830FF7B #define ISO_FILE_NOT_OPENED 0xE830FF7B
/* @deprecated use ISO_FILE_NOT_OPENED instead */
#define ISO_FILE_NOT_OPENNED ISO_FILE_NOT_OPENED
/** Directory used where no dir is expected (FAILURE,HIGH, -134) */ /** Directory used where no dir is expected (FAILURE,HIGH, -134) */
#define ISO_FILE_IS_DIR 0xE830FF7A #define ISO_FILE_IS_DIR 0xE830FF7A

View File

@ -136,16 +136,16 @@ const char *iso_error_to_msg(int errcode)
return "Trying to use an invalid file as boot image"; return "Trying to use an invalid file as boot image";
case ISO_FILE_ERROR: case ISO_FILE_ERROR:
return "Error on file operation"; return "Error on file operation";
case ISO_FILE_ALREADY_OPENNED: case ISO_FILE_ALREADY_OPENED:
return "Trying to open an already openned file"; return "Trying to open an already opened file";
case ISO_FILE_ACCESS_DENIED: case ISO_FILE_ACCESS_DENIED:
return "Access to file is not allowed"; return "Access to file is not allowed";
case ISO_FILE_BAD_PATH: case ISO_FILE_BAD_PATH:
return "Incorrect path to file"; return "Incorrect path to file";
case ISO_FILE_DOESNT_EXIST: case ISO_FILE_DOESNT_EXIST:
return "The file does not exist in the filesystem"; return "The file does not exist in the filesystem";
case ISO_FILE_NOT_OPENNED: case ISO_FILE_NOT_OPENED:
return "Trying to read or close a file not openned"; return "Trying to read or close a file not opened";
case ISO_FILE_IS_DIR: case ISO_FILE_IS_DIR:
return "Directory used where no dir is expected"; return "Directory used where no dir is expected";
case ISO_FILE_READ_ERROR: case ISO_FILE_READ_ERROR:

View File

@ -231,7 +231,7 @@ int mem_open(IsoStream *stream)
} }
data = (MemStreamData*)stream->data; data = (MemStreamData*)stream->data;
if (data->offset != -1) { if (data->offset != -1) {
return ISO_FILE_ALREADY_OPENNED; return ISO_FILE_ALREADY_OPENED;
} }
data->offset = 0; data->offset = 0;
return ISO_SUCCESS; return ISO_SUCCESS;
@ -246,7 +246,7 @@ int mem_close(IsoStream *stream)
} }
data = (MemStreamData*)stream->data; data = (MemStreamData*)stream->data;
if (data->offset == -1) { if (data->offset == -1) {
return ISO_FILE_NOT_OPENNED; return ISO_FILE_NOT_OPENED;
} }
data->offset = -1; data->offset = -1;
return ISO_SUCCESS; return ISO_SUCCESS;
@ -275,7 +275,7 @@ int mem_read(IsoStream *stream, void *buf, size_t count)
data = stream->data; data = stream->data;
if (data->offset == -1) { if (data->offset == -1) {
return ISO_FILE_NOT_OPENNED; return ISO_FILE_NOT_OPENED;
} }
if (data->offset >= data->size) { if (data->offset >= data->size) {

View File

@ -43,13 +43,13 @@ void test_mem_open()
/* try to open an already opened stream */ /* try to open an already opened stream */
ret = iso_stream_open(stream); ret = iso_stream_open(stream);
CU_ASSERT_EQUAL(ret, ISO_FILE_ALREADY_OPENNED); CU_ASSERT_EQUAL(ret, ISO_FILE_ALREADY_OPENED);
ret = iso_stream_close(stream); ret = iso_stream_close(stream);
CU_ASSERT_EQUAL(ret, 1); CU_ASSERT_EQUAL(ret, 1);
ret = iso_stream_close(stream); ret = iso_stream_close(stream);
CU_ASSERT_EQUAL(ret, ISO_FILE_NOT_OPENNED); CU_ASSERT_EQUAL(ret, ISO_FILE_NOT_OPENED);
iso_stream_unref(stream); iso_stream_unref(stream);
} }