gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r12540 - Extractor/src/plugins


From: gnunet
Subject: [GNUnet-SVN] r12540 - Extractor/src/plugins
Date: Sat, 14 Aug 2010 22:38:08 +0200

Author: grothoff
Date: 2010-08-14 22:38:08 +0200 (Sat, 14 Aug 2010)
New Revision: 12540

Modified:
   Extractor/src/plugins/odf_extractor.c
Log:
fixing space squashing

Modified: Extractor/src/plugins/odf_extractor.c
===================================================================
--- Extractor/src/plugins/odf_extractor.c       2010-08-14 20:35:34 UTC (rev 
12539)
+++ Extractor/src/plugins/odf_extractor.c       2010-08-14 20:38:08 UTC (rev 
12540)
@@ -68,41 +68,49 @@
   char * buf = NULL;
   size_t buf_size = 0;
 
-  if (EXTRACTOR_UNZIP_OK == EXTRACTOR_common_unzip_local_file(uf,
-                             "mimetype",
-                             CASESENSITIVITY)) {
-    if ( (EXTRACTOR_UNZIP_OK == 
EXTRACTOR_common_unzip_get_current_file_info(uf,
-                                         &file_info,
-                                         filename_inzip,
-                                         sizeof(filename_inzip),
-                                         NULL,
-                                         0,
-                                         NULL,
-                                         0) &&
-         (EXTRACTOR_UNZIP_OK == 
EXTRACTOR_common_unzip_open_current_file3(uf,NULL, NULL, 0)) ) ) {
-      buf_size = file_info.uncompressed_size;
-
-      if (buf_size > 1024) {
+  if (EXTRACTOR_UNZIP_OK != EXTRACTOR_common_unzip_local_file(uf,
+                                                             "mimetype",
+                                                             CASESENSITIVITY))
+    return NULL;
+  if ( (EXTRACTOR_UNZIP_OK == EXTRACTOR_common_unzip_get_current_file_info(uf,
+                                                                          
&file_info,
+                                                                          
filename_inzip,
+                                                                          
sizeof(filename_inzip),
+                                                                          NULL,
+                                                                          0,
+                                                                          NULL,
+                                                                          0) &&
+       (EXTRACTOR_UNZIP_OK == EXTRACTOR_common_unzip_open_current_file3(uf, 
NULL, NULL, 0)) ) ) {
+    buf_size = file_info.uncompressed_size;
+    
+    if (buf_size > 1024) 
+      {
        /* way too large! */
-      } else if (NULL == (buf = malloc(1 + buf_size))) {
+      }
+    else if (NULL == (buf = malloc(1 + buf_size))) 
+      {
        /* memory exhausted! */
-      } else if (buf_size != (size_t) 
EXTRACTOR_common_unzip_read_current_file(uf,buf,buf_size)) {
-        free(buf);
-        buf = NULL;
-      } else {
+      } 
+    else if (buf_size != (size_t) 
EXTRACTOR_common_unzip_read_current_file(uf,buf,buf_size)) 
+      {
+       free(buf);
+       buf = NULL;
+      }
+    else 
+      {
        /* found something */
-        buf[buf_size] = '\0';
-        while ( (0 > buf_size) &&
+       buf[buf_size] = '\0';
+       while ( (0 < buf_size) &&
                isspace( (unsigned char) buf[buf_size - 1]))
-          buf[--buf_size] = '\0';
-        if('\0' == buf[0]) {
-          free(buf);
-          buf = NULL;
-        }
+         buf[--buf_size] = '\0';
+       if ('\0' == buf[0]) 
+         {
+           free(buf);
+           buf = NULL;
+         }
       }
-    }
-    EXTRACTOR_common_unzip_close_current_file(uf);
   }
+  EXTRACTOR_common_unzip_close_current_file(uf);  
   return buf;
 }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]