Skip to content

Commit

Permalink
chrome: sqsh_file_content returns uint8_t now.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gottox committed Aug 2, 2023
1 parent d5bca7d commit 163e330
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/read_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ main(int argc, char *argv[]) {
struct SqshArchive *archive = sqsh_archive_new(argv[1], NULL, NULL);
assert(archive != NULL);

char *content = sqsh_file_content(archive, argv[2]);
uint8_t *content = sqsh_file_content(archive, argv[2]);
assert(content != NULL);
size_t size = sqsh_file_size(archive, argv[2]);

Expand Down
2 changes: 1 addition & 1 deletion include/sqsh_chrome.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ bool sqsh_file_exists(struct SqshArchive *archive, const char *path);
*
* @return The content of the file on success, NULL on error.
*/
char *sqsh_file_content(struct SqshArchive *archive, const char *path);
uint8_t *sqsh_file_content(struct SqshArchive *archive, const char *path);

/**
* @brief retrieves the size of a file.
Expand Down
6 changes: 3 additions & 3 deletions lib/chrome/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ sqsh_file_exists(struct SqshArchive *archive, const char *path) {
return exists;
}

char *
uint8_t *
sqsh_file_content(struct SqshArchive *archive, const char *path) {
int rv = 0;
struct SqshFileIterator iterator = {0};
struct SqshInode *inode = NULL;
char *content = NULL;
uint8_t *content = NULL;

inode = sqsh_open(archive, path, &rv);
if (rv < 0) {
Expand All @@ -82,7 +82,7 @@ sqsh_file_content(struct SqshArchive *archive, const char *path) {
}

size_t file_size = sqsh_inode_file_size(inode);
content = calloc(file_size + 1, sizeof(char));
content = calloc(file_size + 1, sizeof(*content));
if (content == NULL) {
rv = -SQSH_ERROR_MALLOC_FAILED;
goto out;
Expand Down

0 comments on commit 163e330

Please sign in to comment.