Skip to content
Snippets Groups Projects
Verified Commit c1578952 authored by rahix's avatar rahix
Browse files

chore(api): Change fd type to int


Other existing API calls also use raw `int` for descriptors
so I think we should use it for file-functions as well.

Signed-off-by: default avatarRahix <rahix@rahix.de>
parent 8ea2dbd4
No related branches found
No related tags found
No related merge requests found
......@@ -465,23 +465,23 @@ API(API_LIGHT_SENSOR_STOP, int epic_light_sensor_stop());
/** */
API(
API_FILE_OPEN,
int32_t epic_file_open(const char* filename, const char* modeString)
int epic_file_open(const char* filename, const char* modeString)
);
/** */
API(API_FILE_CLOSE, int32_t epic_file_close(int32_t fd));
API(API_FILE_CLOSE, int epic_file_close(int fd));
/** */
API(API_FILE_READ, int32_t epic_file_read(int32_t fd, void* buf, uint32_t nbytes));
API(API_FILE_READ, int epic_file_read(int fd, void* buf, size_t nbytes));
/** */
API(
API_FILE_WRITE,
int32_t epic_file_write(int32_t fd, const void* buf, uint32_t nbytes)
int epic_file_write(int fd, const void* buf, size_t nbytes)
);
/** */
API(API_FILE_FLUSH, int32_t epic_file_flush(int32_t fd));
API(API_FILE_FLUSH, int epic_file_flush(int fd));
/** */
enum epic_stat_type {
......@@ -510,6 +510,6 @@ typedef struct epic_stat_t {
*
* :return: `0` on success, negative on error
*/
API(API_FILE_STAT, int32_t epic_file_stat(const char* path, epic_stat_t* stat));
API(API_FILE_STAT, int epic_file_stat(const char* path, epic_stat_t* stat));
#endif /* _EPICARDIUM_H */
......@@ -203,7 +203,7 @@ int get_fat_object(int i, enum FatObjectType expected, struct FatObject **res)
return 0;
}
int32_t epic_file_open(const char *filename, const char *modeString)
int epic_file_open(const char *filename, const char *modeString)
{
struct FatObject *o = NULL;
const char *mode_s = modeString;
......@@ -255,7 +255,7 @@ int32_t epic_file_open(const char *filename, const char *modeString)
return i;
}
int32_t epic_file_close(int32_t fd)
int epic_file_close(int fd)
{
int res;
struct FatObject *o;
......@@ -273,7 +273,7 @@ int32_t epic_file_close(int32_t fd)
return 0;
}
int32_t epic_file_read(int32_t fd, void *buf, uint32_t nbytes)
int epic_file_read(int fd, void *buf, size_t nbytes)
{
unsigned int nread = 0;
......@@ -292,7 +292,7 @@ int32_t epic_file_read(int32_t fd, void *buf, uint32_t nbytes)
return nread;
}
int32_t epic_file_write(int32_t fd, const void *buf, uint32_t nbytes)
int epic_file_write(int fd, const void *buf, size_t nbytes)
{
unsigned int nwritten = 0;
......@@ -310,7 +310,7 @@ int32_t epic_file_write(int32_t fd, const void *buf, uint32_t nbytes)
return nwritten;
}
int32_t epic_file_flush(int32_t fd)
int epic_file_flush(int fd)
{
int res;
struct FatObject *o;
......@@ -326,7 +326,7 @@ int32_t epic_file_flush(int32_t fd)
return 0;
}
int32_t epic_file_stat(const char *filename, epic_stat_t *stat)
int epic_file_stat(const char *filename, epic_stat_t *stat)
{
int res;
FILINFO finfo;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment