[gimp/gimp-2-8] initialize length to appease cppcheck



commit fc7fce4bc9ee80a822a607ad88baaa81053bcbe5
Author: Nils Philippsen <nils redhat com>
Date:   Thu Nov 28 17:43:14 2013 +0100

    initialize length to appease cppcheck
    
    The code was technically correct previously: It wrote the uninitialized
    length only as a placeholder to overwrite it later on. Yet it's better
    to not confuse tools (or people) analysing the code. Besides that having
    0 for the length in the file while the payload is being written may aid
    debugging e.g. crashes in that code later on.
    
    (cherry picked from commit 2e6af22686cba732a10dce3a066349083a4f1498)

 app/xcf/xcf-save.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/app/xcf/xcf-save.c b/app/xcf/xcf-save.c
index 1be1560..50809df 100644
--- a/app/xcf/xcf-save.c
+++ b/app/xcf/xcf-save.c
@@ -952,7 +952,7 @@ xcf_save_prop (XcfInfo    *info,
 
         if (gimp_parasite_list_persistent_length (list) > 0)
           {
-            guint32 base, length;
+            guint32 base, length = 0;
             long    pos;
 
             xcf_write_prop_type_check_error (info, prop_type);
@@ -997,7 +997,7 @@ xcf_save_prop (XcfInfo    *info,
 
     case PROP_PATHS:
       {
-        guint32 base, length;
+        guint32 base, length = 0;
         glong   pos;
 
         xcf_write_prop_type_check_error (info, prop_type);
@@ -1063,7 +1063,7 @@ xcf_save_prop (XcfInfo    *info,
 
     case PROP_VECTORS:
       {
-        guint32 base, length;
+        guint32 base, length = 0;
         glong   pos;
 
         xcf_write_prop_type_check_error (info, prop_type);


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