1
1
mirror of https://github.com/theoludwig/libcproject.git synced 2024-11-08 22:31:31 +01:00

feat: add byte typedef

This commit is contained in:
Théo LUDWIG 2023-06-25 14:34:33 +02:00
parent eb798a619a
commit ce088f8ff5
Signed by: theoludwig
GPG Key ID: ADFE5A563D718F3B
2 changed files with 6 additions and 4 deletions

View File

@ -1,6 +1,6 @@
#include "filesystem.h"
int filesystem_read(char *path, uint8_t **file_content, off_t *file_size) {
int filesystem_read(char *path, byte **file_content, off_t *file_size) {
int file_descriptor = open(path, O_RDONLY);
if (file_descriptor == -1) {
return -1;
@ -15,7 +15,7 @@ int filesystem_read(char *path, uint8_t **file_content, off_t *file_size) {
return 0;
}
int filesystem_write(char *path, uint8_t *file_content, off_t file_size) {
int filesystem_write(char *path, byte *file_content, off_t file_size) {
int file_descriptor = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (file_descriptor == -1) {
return -1;

View File

@ -13,6 +13,8 @@
#include "string.h"
typedef uint8_t byte;
/**
* @brief Read the content of a file.
*
@ -24,7 +26,7 @@
* @retval 0 for success.
* @since v1.0.0
*/
int filesystem_read(char *path, uint8_t **file_content, off_t *file_size);
int filesystem_read(char *path, byte **file_content, off_t *file_size);
/**
* @brief Write the content to a file.
@ -37,7 +39,7 @@ int filesystem_read(char *path, uint8_t **file_content, off_t *file_size);
* @retval 0 for success.
* @since v1.0.0
*/
int filesystem_write(char *path, uint8_t *file_content, off_t file_size);
int filesystem_write(char *path, byte *file_content, off_t file_size);
/**
* @brief Get the mimetype of a file.