X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=blobdiff_plain;f=yaffs_nameval.c;h=b85536522ebe654f977a46da88fb6526b51c12a4;hp=478248e651a996928f9157f9cfc984afa07a64f7;hb=5758b7a95a391ac8e4d631fbea9fd409d1130a62;hpb=21b2dedaa32ab309f6d1daec966528b7586bd207 diff --git a/yaffs_nameval.c b/yaffs_nameval.c index 478248e..b855365 100644 --- a/yaffs_nameval.c +++ b/yaffs_nameval.c @@ -1,8 +1,7 @@ /* * YAFFS: Yet Another Flash File System. A NAND-flash specific file system. * - * Copyright (C) 2002-2011 Aleph One Ltd. - * for Toby Churchill Ltd and Brightstar Engineering + * Copyright (C) 2002-2018 Aleph One Ltd. * * Created by Charles Manning * @@ -28,6 +27,7 @@ #include "yaffs_nameval.h" #include "yaffs_guts.h" #include "yportenv.h" +#include "yaffs_endian.h" static int nval_find(struct yaffs_dev *dev, const char *xb, int xb_size, const YCHAR *name, @@ -47,7 +47,7 @@ static int nval_find(struct yaffs_dev *dev, return pos; } pos += size; - if (pos < xb_size - sizeof(size)) { + if (pos < (int)(xb_size - sizeof(size))) { memcpy(&size, xb + pos, sizeof(size)); yaffs_do_endian_s32(dev, &size); @@ -69,7 +69,7 @@ static int nval_used(struct yaffs_dev *dev, const char *xb, int xb_size) while (size > 0 && (size < xb_size) && (pos + size < xb_size)) { pos += size; - if (pos < xb_size - sizeof(size)) { + if (pos < (int)(xb_size - sizeof(size))) { memcpy(&size, xb + pos, sizeof(size)); yaffs_do_endian_s32(dev, &size); } else @@ -192,7 +192,7 @@ int nval_list(struct yaffs_dev *dev, const char *xb, int xb_size, char *buf, int memcpy(&size, xb + pos, sizeof(size)); yaffs_do_endian_s32(dev, &size); - while (size > sizeof(size) && + while (size > (int)(sizeof(size)) && size <= xb_size && (pos + size) < xb_size && !filled) { @@ -213,7 +213,7 @@ int nval_list(struct yaffs_dev *dev, const char *xb, int xb_size, char *buf, int filled = 1; } pos += size; - if (pos < xb_size - sizeof(size)) { + if (pos < (int)(xb_size - sizeof(size))) { memcpy(&size, xb + pos, sizeof(size)); yaffs_do_endian_s32(dev, &size); }