diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2016-01-13 11:51:33 -0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2016-01-13 17:18:22 -0800 |
commit | 25b2e75312231659cd8460064e1892351171b00c (patch) | |
tree | 26565f0e4ce6f52841a20ce3d5a9b02d449ef219 /lib | |
parent | e9dfbbbce9f9ed1b33fc2c5d7a616582e9ea2e7e (diff) | |
download | android_external_f2fs-tools-25b2e75312231659cd8460064e1892351171b00c.tar.gz android_external_f2fs-tools-25b2e75312231659cd8460064e1892351171b00c.tar.bz2 android_external_f2fs-tools-25b2e75312231659cd8460064e1892351171b00c.zip |
f2fs-tools: avoid failure and warnings for android build
This patch fixes to resolve build failure and warnings when compiling it
under AOSP.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libf2fs.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/libf2fs.c b/lib/libf2fs.c index e9a1606..d61eb85 100644 --- a/lib/libf2fs.c +++ b/lib/libf2fs.c @@ -94,7 +94,7 @@ int utf8_to_utf16(u_int16_t *output, const char *input, size_t outsize, u_int16_t *outp = output; wchar_t wc; - while (inp - input < insize && *inp) { + while ((size_t)(inp - input) < insize && *inp) { inp = utf8_to_wchar(inp, &wc, insize - (inp - input)); if (inp == NULL) { DBG(0, "illegal UTF-8 sequence\n"); @@ -180,7 +180,7 @@ int utf16_to_utf8(char *output, const u_int16_t *input, size_t outsize, char *outp = output; wchar_t wc; - while (inp - input < insize && le16_to_cpu(*inp)) { + while ((size_t)(inp - input) < insize && le16_to_cpu(*inp)) { inp = utf16_to_wchar(inp, &wc, insize - (inp - input)); if (inp == NULL) { DBG(0, "illegal UTF-16 sequence\n"); @@ -503,8 +503,7 @@ void f2fs_init_configuration(struct f2fs_configuration *c) c->ro = 0; } -static int is_mounted(struct f2fs_configuration *c, - const char *mpt, const char *device) +static int is_mounted(const char *mpt, const char *device) { FILE *file = NULL; struct mntent *mnt = NULL; @@ -515,8 +514,10 @@ static int is_mounted(struct f2fs_configuration *c, while ((mnt = getmntent(file)) != NULL) { if (!strcmp(device, mnt->mnt_fsname)) { +#ifdef MNTOPT_RO if (hasmntopt(mnt, MNTOPT_RO)) config.ro = 1; +#endif break; } } @@ -529,7 +530,7 @@ int f2fs_dev_is_umounted(struct f2fs_configuration *c) struct stat st_buf; int ret = 0; - ret = is_mounted(c, MOUNTED, c->device_name); + ret = is_mounted(MOUNTED, c->device_name); if (ret) { MSG(0, "Info: Mounted device!\n"); return -1; @@ -539,7 +540,7 @@ int f2fs_dev_is_umounted(struct f2fs_configuration *c) * if failed due to /etc/mtab file not present * try with /proc/mounts. */ - ret = is_mounted(c, "/proc/mounts", c->device_name); + ret = is_mounted("/proc/mounts", c->device_name); if (ret) { MSG(0, "Info: Mounted device!\n"); return -1; |