[poppler] 3 commits - goo/GooVector.h utils/HtmlLinks.cc utils/HtmlLinks.h utils/pdftohtml.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Sat Apr 24 05:11:31 PDT 2010


 goo/GooVector.h    |    5 +++--
 utils/HtmlLinks.cc |   15 ++-------------
 utils/HtmlLinks.h  |   16 ++++++++++++++--
 utils/pdftohtml.cc |   30 ++++++++++++++++++------------
 4 files changed, 37 insertions(+), 29 deletions(-)

New commits:
commit 07864c9e2a7a32b48bdbab92c8b2f79bce1d9f5b
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sat Apr 24 13:07:02 2010 +0100

    minor cleanups

diff --git a/utils/HtmlLinks.cc b/utils/HtmlLinks.cc
index 0fd093c..c0ca89a 100644
--- a/utils/HtmlLinks.cc
+++ b/utils/HtmlLinks.cc
@@ -18,6 +18,7 @@
 // under GPL version 2 or later
 //
 // Copyright (C) 2008 Boris Toloknov <tlknv at yandex.ru>
+// Copyright (C) 2010 Albert Astals Cid <aacid at kde.org>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
@@ -56,7 +57,7 @@ HtmlLink::HtmlLink(double xmin,double ymin,double xmax,double ymax,GooString * _
 }
 
 HtmlLink::~HtmlLink(){
- if (dest) delete dest;
+ delete dest;
 }
 
 GBool HtmlLink::isEqualDest(const HtmlLink& x) const{
@@ -69,18 +70,6 @@ GBool HtmlLink::inLink(double xmin,double ymin,double xmax,double ymax) const {
   return (y>Ymin)&&(xmin<Xmax)&&(xmax>Xmin);
  }
   
-
-HtmlLink& HtmlLink::operator=(const HtmlLink& x){
-  if (this==&x) return *this;
-  if (dest) {delete dest;dest=NULL;} 
-  Xmin=x.Xmin;
-  Ymin=x.Ymin;
-  Xmax=x.Xmax;
-  Ymax=x.Ymax;
-  dest=new GooString(x.dest);
-  return *this;
-} 
-
 static GooString* EscapeSpecialChars( GooString* s )
 {
     GooString* tmp = NULL;
diff --git a/utils/HtmlLinks.h b/utils/HtmlLinks.h
index 571c2a7..1212844 100644
--- a/utils/HtmlLinks.h
+++ b/utils/HtmlLinks.h
@@ -10,6 +10,20 @@
 //
 //========================================================================
 
+//========================================================================
+//
+// Modified under the Poppler project - http://poppler.freedesktop.org
+//
+// All changes made under the Poppler project to this file are licensed
+// under GPL version 2 or later
+//
+// Copyright (C) 2010 Albert Astals Cid <aacid at kde.org>
+//
+// To see a description of the changes please see the Changelog file that
+// came with your tarball or type make ChangeLog if you are building from git
+//
+//========================================================================
+
 #ifndef _HTML_LINKS
 #define _HTML_LINKS
 
@@ -28,9 +42,7 @@ private:
   GooString* dest;
 
 public:
-  HtmlLink(){dest=NULL;}
   HtmlLink(const HtmlLink& x);
-  HtmlLink& operator=(const HtmlLink& x);
   HtmlLink(double xmin,double ymin,double xmax,double ymax,GooString *_dest);
   ~HtmlLink();
   GBool isEqualDest(const HtmlLink& x) const;
commit e501eabb2f0775444a2bf64005a3a3f1ffa281b4
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sat Apr 24 13:06:12 2010 +0100

    Do not assume the parameter will have more than 5 chars

diff --git a/utils/pdftohtml.cc b/utils/pdftohtml.cc
index 0e0a376..3c74c6e 100644
--- a/utils/pdftohtml.cc
+++ b/utils/pdftohtml.cc
@@ -218,18 +218,24 @@ int main(int argc, char *argv[]) {
   // construct text file name
   if (argc == 3) {
     GooString* tmp = new GooString(argv[2]);
-    p=tmp->getCString()+tmp->getLength()-5;
-    if (!xml)
-      if (!strcmp(p, ".html") || !strcmp(p, ".HTML"))
-	htmlFileName = new GooString(tmp->getCString(),
-				   tmp->getLength() - 5);
-      else htmlFileName =new GooString(tmp);
-    else   
-      if (!strcmp(p, ".xml") || !strcmp(p, ".XML"))
-	htmlFileName = new GooString(tmp->getCString(),
-				   tmp->getLength() - 5);
-      else htmlFileName =new GooString(tmp);
-    
+    if (!xml) {
+      if (tmp->getLength() >= 5) {
+        p = tmp->getCString() + tmp->getLength() - 5;
+        if (!strcmp(p, ".html") || !strcmp(p, ".HTML")) {
+          htmlFileName = new GooString(tmp->getCString(), tmp->getLength() - 5);
+        }
+      }
+    } else {
+      if (tmp->getLength() >= 4) {
+        p = tmp->getCString() + tmp->getLength() - 4;
+        if (!strcmp(p, ".xml") || !strcmp(p, ".XML")) {
+          htmlFileName = new GooString(tmp->getCString(), tmp->getLength() - 4);
+        }
+      }
+    }
+    if (!htmlFileName) {
+      htmlFileName =new GooString(tmp);
+    }
     delete tmp;
   } else if (fileName->cmp("fd://0") == 0) {
       error(-1, "You have to provide an output filename when reading form stdin.");
commit 6cc4d571339214e9eeeb682ba48fb220cef905f9
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sat Apr 24 13:04:05 2010 +0100

    Fix end() to return the correct last valid value

diff --git a/goo/GooVector.h b/goo/GooVector.h
index d396c6f..e35fd8a 100644
--- a/goo/GooVector.h
+++ b/goo/GooVector.h
@@ -5,6 +5,7 @@
 // This file is licensed under the GPLv2 or later
 //
 // Copyright 2010 David Benjamin <davidben at mit.edu>
+// Copyright 2010 Albert Astals Cid <aacid at kde.org>
 //
 //========================================================================
 
@@ -58,8 +59,8 @@ public:
 
   iterator begin() { return m_data; }
   const_iterator begin() const { return m_data; }
-  iterator end() { return m_data + m_capacity; }
-  const_iterator end() const { return m_data + m_capacity; }
+  iterator end() { return m_data + m_size; }
+  const_iterator end() const { return m_data + m_size; }
 
   size_type size() const { return m_size; }
   size_type capacity() const { return m_capacity; }


More information about the poppler mailing list