diff --git a/LICENSE b/LICENSE index 9feba16..9b802d2 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2014-2017 Armink (armink.ztl@gmail.com) +Copyright (c) 2014-2018 Armink (armink.ztl@gmail.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/easyflash/inc/easyflash.h b/easyflash/inc/easyflash.h index 9848ff2..5a80585 100644 --- a/easyflash/inc/easyflash.h +++ b/easyflash/inc/easyflash.h @@ -1,7 +1,7 @@ /* * This file is part of the EasyFlash Library. * - * Copyright (c) 2014-2017, Armink, + * Copyright (c) 2014-2018, Armink, * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -67,7 +67,7 @@ if (!(EXPR)) \ while (1); \ } /* EasyFlash software version number */ -#define EF_SW_VERSION "3.0.3" +#define EF_SW_VERSION "3.0.4" typedef struct _ef_env{ char *key; diff --git a/easyflash/src/ef_env.c b/easyflash/src/ef_env.c index 1383471..7407dc9 100644 --- a/easyflash/src/ef_env.c +++ b/easyflash/src/ef_env.c @@ -1,7 +1,7 @@ /* * This file is part of the EasyFlash Library. * - * Copyright (c) 2014-2016, Armink, + * Copyright (c) 2014-2018, Armink, * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -246,7 +246,11 @@ static void set_env_end_addr(uint32_t end_addr) { * @return size */ static size_t get_env_data_size(void) { - return get_env_end_addr() - get_env_data_addr(); + if (get_env_end_addr() > get_env_data_addr()) { + return get_env_end_addr() - get_env_data_addr(); + } else { + return 0; + } } /** @@ -255,7 +259,11 @@ static size_t get_env_data_size(void) { * @return bytes */ static size_t get_env_user_used_size(void) { - return get_env_end_addr() - get_env_system_addr(); + if (get_env_end_addr() > get_env_system_addr()) { + return get_env_end_addr() - get_env_system_addr(); + } else { + return 0; + } } /** diff --git a/easyflash/src/ef_env_wl.c b/easyflash/src/ef_env_wl.c index 7e1e01e..219e1be 100644 --- a/easyflash/src/ef_env_wl.c +++ b/easyflash/src/ef_env_wl.c @@ -1,7 +1,7 @@ /* * This file is part of the EasyFlash Library. * - * Copyright (c) 2015-2017, Armink, + * Copyright (c) 2015-2018, Armink, * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -262,7 +262,11 @@ static void set_env_detail_end_addr(uint32_t end_addr) { * @return size */ static size_t get_env_detail_size(void) { - return get_env_detail_end_addr() - get_env_detail_addr(); + if (get_env_detail_end_addr() > get_env_detail_addr()) { + return get_env_detail_end_addr() - get_env_detail_addr(); + } else { + return 0; + } } /** @@ -274,7 +278,11 @@ static size_t get_env_detail_size(void) { */ /* must be initialized */ static size_t get_env_user_used_size(void) { - return get_env_detail_end_addr() - get_cur_using_data_addr(); + if (get_env_detail_end_addr() > get_cur_using_data_addr()) { + return get_env_detail_end_addr() - get_cur_using_data_addr(); + } else { + return 0; + } } /**