From 0e31f78dd6e29549899290eb2b05bf7bd158b8d7 Mon Sep 17 00:00:00 2001 From: Marian Beermann Date: Sat, 10 Jun 2017 10:12:06 +0200 Subject: [PATCH] cache sync: avoid "l" and such as a variable name, note vanilla changes --- src/borg/cache_sync/unpack.h | 13 ++++++------- src/borg/cache_sync/unpack_template.h | 5 +++++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/borg/cache_sync/unpack.h b/src/borg/cache_sync/unpack.h index d878dda7d..94172d424 100644 --- a/src/borg/cache_sync/unpack.h +++ b/src/borg/cache_sync/unpack.h @@ -288,7 +288,6 @@ static inline int unpack_callback_array_end(unpack_user* u) return 0; } } - return 0; } @@ -317,6 +316,7 @@ static inline int unpack_callback_map(unpack_user* u, unsigned int n) static inline int unpack_callback_map_item(unpack_user* u, unsigned int current) { (void)u; (void)current; + if(u->level == 1) { switch(u->expect) { case expect_map_item_end: @@ -340,7 +340,7 @@ static inline int unpack_callback_map_end(unpack_user* u) return 0; } -static inline int unpack_callback_raw(unpack_user* u, const char* b, const char* p, unsigned int l) +static inline int unpack_callback_raw(unpack_user* u, const char* b, const char* p, unsigned int length) { /* raw = what Borg uses for binary stuff and strings as well */ /* Note: p points to an internal buffer which contains l bytes. */ @@ -348,7 +348,7 @@ static inline int unpack_callback_raw(unpack_user* u, const char* b, const char* switch(u->expect) { case expect_key: - if(l != 32) { + if(length != 32) { SET_LAST_ERROR("Incorrect key length"); return -1; } @@ -356,7 +356,7 @@ static inline int unpack_callback_raw(unpack_user* u, const char* b, const char* u->expect = expect_size; break; case expect_chunks_map_key: - if(l == 6 && !memcmp("chunks", p, 6)) { + if(length == 6 && !memcmp("chunks", p, 6)) { u->expect = expect_chunks_begin; u->inside_chunks = 1; } else { @@ -369,13 +369,12 @@ static inline int unpack_callback_raw(unpack_user* u, const char* b, const char* return -1; } } - return 0; } -static inline int unpack_callback_bin(unpack_user* u, const char* b, const char* p, unsigned int l) +static inline int unpack_callback_bin(unpack_user* u, const char* b, const char* p, unsigned int length) { - (void)u; (void)b; (void)p; (void)l; + (void)u; (void)b; (void)p; (void)length; UNEXPECTED("bin"); return 0; } diff --git a/src/borg/cache_sync/unpack_template.h b/src/borg/cache_sync/unpack_template.h index 1ac262740..a6492da35 100644 --- a/src/borg/cache_sync/unpack_template.h +++ b/src/borg/cache_sync/unpack_template.h @@ -15,6 +15,11 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * + * This has been slightly adapted from the vanilla msgpack-{c, python} version. + * Since cache_sync does not intend to build an output data structure, + * msgpack_unpack_object and all of its uses was removed. */ #ifndef USE_CASE_RANGE