mirror of
https://git.disroot.org/80486DX2-66/polonium.git
synced 2024-12-26 15:10:40 +05:30
file_type.c: rename function is_valid_file
to validate_file
This commit is contained in:
parent
9ffe827c0f
commit
bfc881b658
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
/* macros: lambdas */
|
/* macros: lambdas */
|
||||||
#define FILE_TYPE_CHECK_RET(ext, type) do { \
|
#define FILE_TYPE_CHECK_RET(ext, type) do { \
|
||||||
enum file_validation_status status = is_valid_file(file, type); \
|
enum file_validation_status status = validate_file(file, type); \
|
||||||
\
|
\
|
||||||
if (status == FILE_IO_ERROR) \
|
if (status == FILE_IO_ERROR) \
|
||||||
return FILE_TYPE_ERROR; \
|
return FILE_TYPE_ERROR; \
|
||||||
@ -22,7 +22,7 @@
|
|||||||
/* function definitions */
|
/* function definitions */
|
||||||
static enum file_validation_status header_check(FILE* file, const char* id,
|
static enum file_validation_status header_check(FILE* file, const char* id,
|
||||||
size_t length);
|
size_t length);
|
||||||
static enum file_validation_status is_valid_file(FILE* file, file_type_t type);
|
static enum file_validation_status validate_file(FILE* file, file_type_t type);
|
||||||
|
|
||||||
/* function implementations */
|
/* function implementations */
|
||||||
static enum file_validation_status header_check(FILE* file, const char* id,
|
static enum file_validation_status header_check(FILE* file, const char* id,
|
||||||
@ -41,7 +41,7 @@ static enum file_validation_status header_check(FILE* file, const char* id,
|
|||||||
return VALID_FILE;
|
return VALID_FILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum file_validation_status is_valid_file(FILE* file, file_type_t type) {
|
static enum file_validation_status validate_file(FILE* file, file_type_t type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case FILE_TYPE_BMP: return header_check(file, "BM", 2);
|
case FILE_TYPE_BMP: return header_check(file, "BM", 2);
|
||||||
case FILE_TYPE_WAV: return header_check(file, "RIFF", 4);
|
case FILE_TYPE_WAV: return header_check(file, "RIFF", 4);
|
||||||
|
Loading…
Reference in New Issue
Block a user