[gcab] Revert "decomp: fix gcc warning strict-overflow"



commit 5619f4cd2ca3108c8dea17ba656b5ce44a60ca29
Author: Marc-André Lureau <marcandre lureau redhat com>
Date:   Fri Jan 11 19:42:40 2019 +0400

    Revert "decomp: fix gcc warning strict-overflow"
    
    The warning doesn't happen with current build-sys.
    
    The overlapping behaviour is undefined with memcpy. memmove doesn't
    have the same semantic either than the loop. Let's revert!
    
    Fixes:
    https://gitlab.gnome.org/GNOME/gcab/issues/12
    
    This reverts commit e48074952743f53d8ac529d4debc421e7e0f6937.
    
    Signed-off-by: Marc-André Lureau <marcandre lureau redhat com>

 libgcab/decomp.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
---
diff --git a/libgcab/decomp.c b/libgcab/decomp.c
index 64d97f8..0c2b184 100644
--- a/libgcab/decomp.c
+++ b/libgcab/decomp.c
@@ -1015,9 +1015,7 @@ int LZXfdi_decomp(int inlen, int outlen, fdi_decomp_state *decomp_state) {
             window_posn += match_length;
 
             /* copy match data - no worries about destination wraps */
-            memcpy(rundest, runsrc, match_length);
-            rundest += match_length;
-            runsrc += match_length;
+            while (match_length-- > 0) *rundest++ = *runsrc++;
           }
         }
         break;
@@ -1106,9 +1104,7 @@ int LZXfdi_decomp(int inlen, int outlen, fdi_decomp_state *decomp_state) {
             window_posn += match_length;
 
             /* copy match data - no worries about destination wraps */
-            memcpy(rundest, runsrc, match_length);
-            rundest += match_length;
-            runsrc += match_length;
+            while (match_length-- > 0) *rundest++ = *runsrc++;
           }
         }
         break;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]