From 61c80f9a54ba499b5897a43990b46cf9a67e60c0 Mon Sep 17 00:00:00 2001 From: Iru Cai Date: Sat, 29 Sep 2018 14:47:39 +0800 Subject: it's not memmove --- csrc/mkf_decompress.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/csrc/mkf_decompress.c b/csrc/mkf_decompress.c index ea9ac4f..ba0df17 100644 --- a/csrc/mkf_decompress.c +++ b/csrc/mkf_decompress.c @@ -662,27 +662,18 @@ void mkf_decompress(void *arg1, void *arg2) ecx = old_ecx + eax; if (dx == 0xfff) return; - old_ecx = ecx; + bx -= 0xfd; void *old_esi = esi; esi = edi - 1 - dx; - /* the following is a little bit tricky, - * if we use memcpy/memmove, the picture is broken - */ -#if 1 - ecx = bx; - do { + /* note that it's not memcpy/memmove!! */ + for (size_t i = 0; i < bx; i++) { *(uint8_t*)edi = *(uint8_t*)esi; edi++; esi++; - ecx--; - } while (ecx); -#else - memmove(edi, esi, bx); /* using rep movsb */ - edi += bx; /* by movsb */ -#endif + } + esi = old_esi; - ecx = old_ecx; } } -- cgit v1.2.3