[Libreoffice-commits] libcdr.git: src/conv

Fridrich Štrba fridrich.strba at bluewin.ch
Wed Jul 20 20:52:47 UTC 2016


 src/conv/raw/cdr2raw.cpp   |   18 +++++++++++-------
 src/conv/raw/cmx2raw.cpp   |   18 +++++++++++-------
 src/conv/svg/cdr2xhtml.cpp |   14 ++++++--------
 src/conv/svg/cmx2xhtml.cpp |   14 ++++++--------
 src/conv/text/cdr2text.cpp |    6 ++----
 src/conv/text/cmx2text.cpp |    6 ++----
 6 files changed, 38 insertions(+), 38 deletions(-)

New commits:
commit 114c8366a2ca6f664d5c13aba5ee1066e9b86633
Author: Fridrich Štrba <fridrich.strba at bluewin.ch>
Date:   Wed Jul 20 22:52:21 2016 +0200

    Fix a thinko
    
    Change-Id: I3f75add6454e1d9be7d9e2971dd7232e18e4c6e3

diff --git a/src/conv/raw/cdr2raw.cpp b/src/conv/raw/cdr2raw.cpp
index bd464ff..8a21498 100644
--- a/src/conv/raw/cdr2raw.cpp
+++ b/src/conv/raw/cdr2raw.cpp
@@ -78,16 +78,20 @@ int main(int argc, char *argv[])
   {
     if (!libcdr::CMXDocument::isSupported(&input))
     {
-      fprintf(stderr, "ERROR: Unsupported file format!\n");
+      fprintf(stderr, "ERROR: Unsupported file format (unsupported version) or file is encrypted!\n");
+      return 1;
+    }
+    else if (!libcdr::CMXDocument::parse(&input, &painter))
+    {
+      fprintf(stderr, "ERROR: Parsing of document failed!\n");
       return 1;
     }
-
-    libcdr::CMXDocument::parse(&input, &painter);
-
-    return 0;
   }
-
-  libcdr::CDRDocument::parse(&input, &painter);
+  else if (!libcdr::CDRDocument::parse(&input, &painter))
+  {
+    fprintf(stderr, "ERROR: Parsing of document failed!\n");
+    return 1;
+  }
 
   return 0;
 }
diff --git a/src/conv/raw/cmx2raw.cpp b/src/conv/raw/cmx2raw.cpp
index 4ae0bf8..ebc5ddc 100644
--- a/src/conv/raw/cmx2raw.cpp
+++ b/src/conv/raw/cmx2raw.cpp
@@ -78,16 +78,20 @@ int main(int argc, char *argv[])
   {
     if (!libcdr::CDRDocument::isSupported(&input))
     {
-      fprintf(stderr, "ERROR: Unsupported file format!\n");
+      fprintf(stderr, "ERROR: Unsupported file format (unsupported version) or file is encrypted!\n");
+      return 1;
+    }
+    else if (!libcdr::CDRDocument::parse(&input, &painter))
+    {
+      fprintf(stderr, "ERROR: Parsing of document failed!\n");
       return 1;
     }
-
-    libcdr::CDRDocument::parse(&input, &painter);
-
-    return 0;
   }
-
-  libcdr::CMXDocument::parse(&input, &painter);
+  else if (!libcdr::CMXDocument::parse(&input, &painter))
+  {
+    fprintf(stderr, "ERROR: Parsing of document failed!\n");
+    return 1;
+  }
 
   return 0;
 }
diff --git a/src/conv/svg/cdr2xhtml.cpp b/src/conv/svg/cdr2xhtml.cpp
index c918e94..4a9245c 100644
--- a/src/conv/svg/cdr2xhtml.cpp
+++ b/src/conv/svg/cdr2xhtml.cpp
@@ -71,26 +71,24 @@ int main(int argc, char *argv[])
 
   librevenge::RVNGFileStream input(file);
   librevenge::RVNGStringVector output;
-  librevenge::RVNGSVGDrawingGenerator generator(output, "svg");
+  librevenge::RVNGSVGDrawingGenerator painter(output, "svg");
 
   if (!libcdr::CDRDocument::isSupported(&input))
   {
     if (!libcdr::CMXDocument::isSupported(&input))
     {
-      std::cerr << "ERROR: Unsupported file format!" << std::endl;
+      fprintf(stderr, "ERROR: Unsupported file format (unsupported version) or file is encrypted!\n");
       return 1;
     }
-
-    if (!libcdr::CMXDocument::parse(&input, &generator))
+    else if (!libcdr::CMXDocument::parse(&input, &painter))
     {
-      std::cerr << "ERROR: SVG Generation failed!" << std::endl;
+      fprintf(stderr, "ERROR: Parsing of document failed!\n");
       return 1;
     }
   }
-
-  if (!libcdr::CDRDocument::parse(&input, &generator))
+  else if (!libcdr::CDRDocument::parse(&input, &painter))
   {
-    std::cerr << "ERROR: SVG Generation failed!" << std::endl;
+    fprintf(stderr, "ERROR: Parsing of document failed!\n");
     return 1;
   }
 
diff --git a/src/conv/svg/cmx2xhtml.cpp b/src/conv/svg/cmx2xhtml.cpp
index a399175..54aaf92 100644
--- a/src/conv/svg/cmx2xhtml.cpp
+++ b/src/conv/svg/cmx2xhtml.cpp
@@ -71,26 +71,24 @@ int main(int argc, char *argv[])
 
   librevenge::RVNGFileStream input(file);
   librevenge::RVNGStringVector output;
-  librevenge::RVNGSVGDrawingGenerator generator(output, "svg");
+  librevenge::RVNGSVGDrawingGenerator painter(output, "svg");
 
   if (!libcdr::CMXDocument::isSupported(&input))
   {
     if (!libcdr::CDRDocument::isSupported(&input))
     {
-      std::cerr << "ERROR: Unsupported file format!" << std::endl;
+      fprintf(stderr, "ERROR: Unsupported file format (unsupported version) or file is encrypted!\n");
       return 1;
     }
-
-    if (!libcdr::CDRDocument::parse(&input, &generator))
+    else if (!libcdr::CDRDocument::parse(&input, &painter))
     {
-      std::cerr << "ERROR: SVG Generation failed!" << std::endl;
+      fprintf(stderr, "ERROR: Parsing of document failed!\n");
       return 1;
     }
   }
-
-  if (!libcdr::CMXDocument::parse(&input, &generator))
+  else if (!libcdr::CMXDocument::parse(&input, &painter))
   {
-    std::cerr << "ERROR: SVG Generation failed!" << std::endl;
+    fprintf(stderr, "ERROR: Parsing of document failed!\n");
     return 1;
   }
 
diff --git a/src/conv/text/cdr2text.cpp b/src/conv/text/cdr2text.cpp
index f2ff22b..e9f6c94 100644
--- a/src/conv/text/cdr2text.cpp
+++ b/src/conv/text/cdr2text.cpp
@@ -79,15 +79,13 @@ int main(int argc, char *argv[])
       fprintf(stderr, "ERROR: Unsupported file format (unsupported version) or file is encrypted!\n");
       return 1;
     }
-
-    if (!libcdr::CMXDocument::parse(&input, &painter))
+    else if (!libcdr::CMXDocument::parse(&input, &painter))
     {
       fprintf(stderr, "ERROR: Parsing of document failed!\n");
       return 1;
     }
   }
-
-  if (!libcdr::CDRDocument::parse(&input, &painter))
+  else if (!libcdr::CDRDocument::parse(&input, &painter))
   {
     fprintf(stderr, "ERROR: Parsing of document failed!\n");
     return 1;
diff --git a/src/conv/text/cmx2text.cpp b/src/conv/text/cmx2text.cpp
index a06da46..e533371 100644
--- a/src/conv/text/cmx2text.cpp
+++ b/src/conv/text/cmx2text.cpp
@@ -78,15 +78,13 @@ int main(int argc, char *argv[])
       fprintf(stderr, "ERROR: Unsupported file format (unsupported version) or file is encrypted!\n");
       return 1;
     }
-
-    if (!libcdr::CDRDocument::parse(&input, &painter))
+    else if (!libcdr::CDRDocument::parse(&input, &painter))
     {
       fprintf(stderr, "ERROR: Parsing of document failed!\n");
       return 1;
     }
   }
-
-  if (!libcdr::CMXDocument::parse(&input, &painter))
+  else if (!libcdr::CMXDocument::parse(&input, &painter))
   {
     fprintf(stderr, "ERROR: Parsing of document failed!\n");
     return 1;


More information about the Libreoffice-commits mailing list