You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/12/13 19:26:56 UTC
[2/3] incubator-mynewt-core git commit: Fix usage of FILE flags
Fix usage of FILE flags
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/24525f50
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/24525f50
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/24525f50
Branch: refs/heads/develop
Commit: 24525f501c57cd3a502f427014965136a01d3ead
Parents: 06251fe
Author: Fabio Utzig <ut...@utzig.org>
Authored: Fri Dec 9 09:35:16 2016 -0200
Committer: Christopher Collins <cc...@apache.org>
Committed: Tue Dec 13 11:26:11 2016 -0800
----------------------------------------------------------------------
fs/fatfs/src/mynewt_glue.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/24525f50/fs/fatfs/src/mynewt_glue.c
----------------------------------------------------------------------
diff --git a/fs/fatfs/src/mynewt_glue.c b/fs/fatfs/src/mynewt_glue.c
index c1dde99..0f45cfb 100644
--- a/fs/fatfs/src/mynewt_glue.c
+++ b/fs/fatfs/src/mynewt_glue.c
@@ -143,19 +143,18 @@ fatfs_open(const char *path, uint8_t access_flags, struct fs_file **out_fs_file)
}
mode = FA_OPEN_EXISTING;
- switch (access_flags) {
- case FS_ACCESS_READ:
+ if (access_flags & FS_ACCESS_READ) {
mode |= FA_READ;
- break;
- case FS_ACCESS_WRITE:
+ }
+ if (access_flags & FS_ACCESS_WRITE) {
mode |= FA_WRITE;
- break;
- case FS_ACCESS_APPEND:
+ }
+ if (access_flags & FS_ACCESS_APPEND) {
mode |= FA_OPEN_APPEND;
- break;
- case FS_ACCESS_TRUNCATE:
+ }
+ if (access_flags & FS_ACCESS_TRUNCATE) {
+ mode &= ~FA_OPEN_EXISTING;
mode |= FA_CREATE_ALWAYS;
- break;
}
res = f_open(out_file, path, mode);
@@ -219,7 +218,7 @@ fatfs_read(struct fs_file *fs_file, uint32_t len, void *out_data,
FRESULT res;
FIL *file = (FIL *)fs_file;
- res = f_read(file, out_data, len, out_len);
+ res = f_read(file, out_data, len, (UINT *)out_len);
return fatfs_to_vfs_error(res);
}