s/openned/opened. Deprecate incorrectly spelled errors.
This commit is contained in:
parent
31a92bd8bd
commit
061dce1ec2
@ -57,7 +57,7 @@ int ds_open(IsoDataSource *src)
|
||||
|
||||
data = (struct file_data_src*) src->data;
|
||||
if (data->fd != -1) {
|
||||
return ISO_FILE_ALREADY_OPENNED;
|
||||
return ISO_FILE_ALREADY_OPENED;
|
||||
}
|
||||
|
||||
fd = open(data->path, O_RDONLY);
|
||||
@ -81,7 +81,7 @@ int ds_close(IsoDataSource *src)
|
||||
|
||||
data = (struct file_data_src*) src->data;
|
||||
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 */
|
||||
@ -102,7 +102,7 @@ static int ds_read_block(IsoDataSource *src, uint32_t lba, uint8_t *buffer)
|
||||
|
||||
data = (struct file_data_src*) src->data;
|
||||
if (data->fd == -1) {
|
||||
return ISO_FILE_NOT_OPENNED;
|
||||
return ISO_FILE_NOT_OPENED;
|
||||
}
|
||||
|
||||
/* goes to requested block */
|
||||
|
@ -538,7 +538,7 @@ int catalog_open(IsoStream *stream)
|
||||
data = stream->data;
|
||||
|
||||
if (data->offset != -1) {
|
||||
return ISO_FILE_ALREADY_OPENNED;
|
||||
return ISO_FILE_ALREADY_OPENED;
|
||||
}
|
||||
|
||||
memset(data->buffer, 0, BLOCK_SIZE);
|
||||
@ -563,7 +563,7 @@ int catalog_close(IsoStream *stream)
|
||||
data = stream->data;
|
||||
|
||||
if (data->offset == -1) {
|
||||
return ISO_FILE_NOT_OPENNED;
|
||||
return ISO_FILE_NOT_OPENED;
|
||||
}
|
||||
data->offset = -1;
|
||||
return ISO_SUCCESS;
|
||||
@ -589,7 +589,7 @@ int catalog_read(IsoStream *stream, void *buf, size_t count)
|
||||
data = stream->data;
|
||||
|
||||
if (data->offset == -1) {
|
||||
return ISO_FILE_NOT_OPENNED;
|
||||
return ISO_FILE_NOT_OPENED;
|
||||
}
|
||||
|
||||
len = MIN(count, BLOCK_SIZE - data->offset);
|
||||
|
@ -474,7 +474,7 @@ int ifs_open(IsoFileSource *src)
|
||||
data = (ImageFileSourceData*)src->data;
|
||||
|
||||
if (data->opened) {
|
||||
return ISO_FILE_ALREADY_OPENNED;
|
||||
return ISO_FILE_ALREADY_OPENED;
|
||||
}
|
||||
|
||||
if (S_ISDIR(data->info.st_mode)) {
|
||||
@ -530,7 +530,7 @@ int ifs_close(IsoFileSource *src)
|
||||
data = (ImageFileSourceData*)src->data;
|
||||
|
||||
if (!data->opened) {
|
||||
return ISO_FILE_NOT_OPENNED;
|
||||
return ISO_FILE_NOT_OPENED;
|
||||
}
|
||||
|
||||
if (data->opened == 2) {
|
||||
@ -569,7 +569,7 @@ int ifs_close(IsoFileSource *src)
|
||||
* Error codes:
|
||||
* ISO_FILE_ERROR
|
||||
* ISO_NULL_POINTER
|
||||
* ISO_FILE_NOT_OPENNED
|
||||
* ISO_FILE_NOT_OPENED
|
||||
* ISO_FILE_IS_DIR
|
||||
* ISO_OUT_OF_MEM
|
||||
* ISO_INTERRUPTED
|
||||
@ -590,7 +590,7 @@ int ifs_read(IsoFileSource *src, void *buf, size_t count)
|
||||
data = (ImageFileSourceData*)src->data;
|
||||
|
||||
if (!data->opened) {
|
||||
return ISO_FILE_NOT_OPENNED;
|
||||
return ISO_FILE_NOT_OPENED;
|
||||
} else if (data->opened != 1) {
|
||||
return ISO_FILE_IS_DIR;
|
||||
}
|
||||
@ -644,7 +644,7 @@ int ifs_readdir(IsoFileSource *src, IsoFileSource **child)
|
||||
data = (ImageFileSourceData*)src->data;
|
||||
|
||||
if (!data->opened) {
|
||||
return ISO_FILE_NOT_OPENNED;
|
||||
return ISO_FILE_NOT_OPENED;
|
||||
} else if (data->opened != 2) {
|
||||
return ISO_FILE_IS_NOT_DIR;
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ int lfs_open(IsoFileSource *src)
|
||||
|
||||
data = src->data;
|
||||
if (data->openned) {
|
||||
return ISO_FILE_ALREADY_OPENNED;
|
||||
return ISO_FILE_ALREADY_OPENED;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
break;
|
||||
default:
|
||||
ret = ISO_FILE_NOT_OPENNED;
|
||||
ret = ISO_FILE_NOT_OPENED;
|
||||
break;
|
||||
}
|
||||
if (ret == ISO_SUCCESS) {
|
||||
@ -300,7 +300,7 @@ int lfs_read(IsoFileSource *src, void *buf, size_t count)
|
||||
case 2: /* directory */
|
||||
return ISO_FILE_IS_DIR;
|
||||
default:
|
||||
return ISO_FILE_NOT_OPENNED;
|
||||
return ISO_FILE_NOT_OPENED;
|
||||
}
|
||||
}
|
||||
|
||||
@ -341,7 +341,7 @@ int lfs_readdir(IsoFileSource *src, IsoFileSource **child)
|
||||
return ret;
|
||||
}
|
||||
default:
|
||||
return ISO_FILE_NOT_OPENNED;
|
||||
return ISO_FILE_NOT_OPENED;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -519,7 +519,7 @@ struct IsoFileSource_Iface
|
||||
* Opens the source.
|
||||
* @return 1 on success, < 0 on error
|
||||
* Error codes:
|
||||
* ISO_FILE_ALREADY_OPENNED
|
||||
* ISO_FILE_ALREADY_OPENED
|
||||
* ISO_FILE_ACCESS_DENIED
|
||||
* ISO_FILE_BAD_PATH
|
||||
* ISO_FILE_DOESNT_EXIST
|
||||
@ -535,7 +535,7 @@ struct IsoFileSource_Iface
|
||||
* Error codes:
|
||||
* ISO_FILE_ERROR
|
||||
* ISO_NULL_POINTER
|
||||
* ISO_FILE_NOT_OPENNED
|
||||
* ISO_FILE_NOT_OPENED
|
||||
*/
|
||||
int (*close)(IsoFileSource *src);
|
||||
|
||||
@ -552,7 +552,7 @@ struct IsoFileSource_Iface
|
||||
* Error codes:
|
||||
* ISO_FILE_ERROR
|
||||
* ISO_NULL_POINTER
|
||||
* ISO_FILE_NOT_OPENNED
|
||||
* ISO_FILE_NOT_OPENED
|
||||
* ISO_WRONG_ARG_VALUE -> if count == 0
|
||||
* ISO_FILE_IS_DIR
|
||||
* ISO_OUT_OF_MEM
|
||||
@ -578,7 +578,7 @@ struct IsoFileSource_Iface
|
||||
* Error codes:
|
||||
* ISO_FILE_ERROR
|
||||
* ISO_NULL_POINTER
|
||||
* ISO_FILE_NOT_OPENNED
|
||||
* ISO_FILE_NOT_OPENED
|
||||
* ISO_FILE_IS_NOT_DIR
|
||||
* ISO_OUT_OF_MEM
|
||||
*/
|
||||
@ -2893,7 +2893,7 @@ int iso_file_source_stat(IsoFileSource *src, struct stat *info);
|
||||
* Opens the source.
|
||||
* @return 1 on success, < 0 on error
|
||||
* Error codes:
|
||||
* ISO_FILE_ALREADY_OPENNED
|
||||
* ISO_FILE_ALREADY_OPENED
|
||||
* ISO_FILE_ACCESS_DENIED
|
||||
* ISO_FILE_BAD_PATH
|
||||
* ISO_FILE_DOESNT_EXIST
|
||||
@ -2911,7 +2911,7 @@ int iso_file_source_open(IsoFileSource *src);
|
||||
* Error codes:
|
||||
* ISO_FILE_ERROR
|
||||
* ISO_NULL_POINTER
|
||||
* ISO_FILE_NOT_OPENNED
|
||||
* ISO_FILE_NOT_OPENED
|
||||
*
|
||||
* @since 0.6.2
|
||||
*/
|
||||
@ -2937,7 +2937,7 @@ int iso_file_source_close(IsoFileSource *src);
|
||||
* Error codes:
|
||||
* ISO_FILE_ERROR
|
||||
* ISO_NULL_POINTER
|
||||
* ISO_FILE_NOT_OPENNED
|
||||
* ISO_FILE_NOT_OPENED
|
||||
* ISO_WRONG_ARG_VALUE -> if count == 0
|
||||
* ISO_FILE_IS_DIR
|
||||
* ISO_OUT_OF_MEM
|
||||
@ -2965,7 +2965,7 @@ int iso_file_source_read(IsoFileSource *src, void *buf, size_t count);
|
||||
* Error codes:
|
||||
* ISO_FILE_ERROR
|
||||
* ISO_NULL_POINTER
|
||||
* ISO_FILE_NOT_OPENNED
|
||||
* ISO_FILE_NOT_OPENED
|
||||
* ISO_FILE_IS_NOT_DIR
|
||||
* 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
|
||||
|
||||
/** 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
|
||||
|
||||
/** 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
|
||||
|
||||
/** 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) */
|
||||
#define ISO_FILE_IS_DIR 0xE830FF7A
|
||||
|
@ -136,16 +136,16 @@ const char *iso_error_to_msg(int errcode)
|
||||
return "Trying to use an invalid file as boot image";
|
||||
case ISO_FILE_ERROR:
|
||||
return "Error on file operation";
|
||||
case ISO_FILE_ALREADY_OPENNED:
|
||||
return "Trying to open an already openned file";
|
||||
case ISO_FILE_ALREADY_OPENED:
|
||||
return "Trying to open an already opened file";
|
||||
case ISO_FILE_ACCESS_DENIED:
|
||||
return "Access to file is not allowed";
|
||||
case ISO_FILE_BAD_PATH:
|
||||
return "Incorrect path to file";
|
||||
case ISO_FILE_DOESNT_EXIST:
|
||||
return "The file does not exist in the filesystem";
|
||||
case ISO_FILE_NOT_OPENNED:
|
||||
return "Trying to read or close a file not openned";
|
||||
case ISO_FILE_NOT_OPENED:
|
||||
return "Trying to read or close a file not opened";
|
||||
case ISO_FILE_IS_DIR:
|
||||
return "Directory used where no dir is expected";
|
||||
case ISO_FILE_READ_ERROR:
|
||||
|
@ -231,7 +231,7 @@ int mem_open(IsoStream *stream)
|
||||
}
|
||||
data = (MemStreamData*)stream->data;
|
||||
if (data->offset != -1) {
|
||||
return ISO_FILE_ALREADY_OPENNED;
|
||||
return ISO_FILE_ALREADY_OPENED;
|
||||
}
|
||||
data->offset = 0;
|
||||
return ISO_SUCCESS;
|
||||
@ -246,7 +246,7 @@ int mem_close(IsoStream *stream)
|
||||
}
|
||||
data = (MemStreamData*)stream->data;
|
||||
if (data->offset == -1) {
|
||||
return ISO_FILE_NOT_OPENNED;
|
||||
return ISO_FILE_NOT_OPENED;
|
||||
}
|
||||
data->offset = -1;
|
||||
return ISO_SUCCESS;
|
||||
@ -275,7 +275,7 @@ int mem_read(IsoStream *stream, void *buf, size_t count)
|
||||
data = stream->data;
|
||||
|
||||
if (data->offset == -1) {
|
||||
return ISO_FILE_NOT_OPENNED;
|
||||
return ISO_FILE_NOT_OPENED;
|
||||
}
|
||||
|
||||
if (data->offset >= data->size) {
|
||||
|
@ -43,13 +43,13 @@ void test_mem_open()
|
||||
|
||||
/* try to open an already opened 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);
|
||||
CU_ASSERT_EQUAL(ret, 1);
|
||||
|
||||
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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user