Formatting

This commit is contained in:
Maschell 2021-09-24 17:10:03 +02:00
parent b0f5c61cb0
commit 2a6a39bb21
2 changed files with 6 additions and 6 deletions

View File

@ -61,7 +61,7 @@ typedef enum {
* @brief Mounts the Application's RomFS. * @brief Mounts the Application's RomFS.
* @param name Device mount name. * @param name Device mount name.
*/ */
int32_t romfsMount(const char *name, const char * path, RomfsSource source); int32_t romfsMount(const char *name, const char *path, RomfsSource source);
/** /**
* @brief Mounts RomFS from an open file. * @brief Mounts RomFS from an open file.
@ -80,7 +80,7 @@ typedef struct {
uint64_t offset; ///< Length of the file's data. uint64_t offset; ///< Length of the file's data.
} romfs_fileInfo; } romfs_fileInfo;
int romfsGetFileInfoPerPath(const char* romfs, const char *path, romfs_fileInfo* out); int romfsGetFileInfoPerPath(const char *romfs, const char *path, romfs_fileInfo *out);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -44,14 +44,14 @@ static char __component[PATH_MAX + 1];
static romfs_dir *romFS_dir(romfs_mount *mount, uint32_t off) { static romfs_dir *romFS_dir(romfs_mount *mount, uint32_t off) {
if (off + sizeof(romfs_dir) > mount->header.dirTableSize) { return NULL; } if (off + sizeof(romfs_dir) > mount->header.dirTableSize) { return NULL; }
romfs_dir *curDir = ((romfs_dir * )((uint8_t *) mount->dirTable + off)); romfs_dir *curDir = ((romfs_dir *) ((uint8_t *) mount->dirTable + off));
if (off + sizeof(romfs_dir) + curDir->nameLen > mount->header.dirTableSize) { return NULL; } if (off + sizeof(romfs_dir) + curDir->nameLen > mount->header.dirTableSize) { return NULL; }
return curDir; return curDir;
} }
static romfs_file *romFS_file(romfs_mount *mount, uint32_t off) { static romfs_file *romFS_file(romfs_mount *mount, uint32_t off) {
if (off + sizeof(romfs_file) > mount->header.fileTableSize) { return NULL; } if (off + sizeof(romfs_file) > mount->header.fileTableSize) { return NULL; }
romfs_file *curFile = ((romfs_file * )((uint8_t *) mount->fileTable + off)); romfs_file *curFile = ((romfs_file *) ((uint8_t *) mount->fileTable + off));
if (off + sizeof(romfs_file) + curFile->nameLen > mount->header.fileTableSize) { return NULL; } if (off + sizeof(romfs_file) + curFile->nameLen > mount->header.fileTableSize) { return NULL; }
return curFile; return curFile;
} }
@ -386,7 +386,7 @@ static inline uint8_t normalizePathChar(uint8_t c) {
} }
static uint32_t calcHash(uint32_t parent, const uint8_t *name, uint32_t namelen, uint32_t total) { static uint32_t calcHash(uint32_t parent, const uint8_t *name, uint32_t namelen, uint32_t total) {
uint32_t hash = parent ^123456789; uint32_t hash = parent ^ 123456789;
uint32_t i; uint32_t i;
for (i = 0; i < namelen; i++) { for (i = 0; i < namelen; i++) {
hash = (hash >> 5) | (hash << 27); hash = (hash >> 5) | (hash << 27);
@ -437,7 +437,7 @@ static int searchForFile(romfs_mount *mount, romfs_dir *parent, const uint8_t *n
uint32_t curOff; uint32_t curOff;
*out = NULL; *out = NULL;
for (curOff = mount->fileHashTable[hash]; curOff != romFS_none; for (curOff = mount->fileHashTable[hash]; curOff != romFS_none;
curOff = curFile->nextHash) { curOff = curFile->nextHash) {
curFile = romFS_file(mount, curOff); curFile = romFS_file(mount, curOff);
if (curFile == NULL) { if (curFile == NULL) {
return EFAULT; return EFAULT;