[poppler] 2 commits - poppler/Annot.cc poppler/Form.cc poppler/Form.h qt4/src

Pino Toscano pino at kemper.freedesktop.org
Sun Feb 27 07:25:08 PST 2011


 poppler/Annot.cc        |   12 ++++++------
 poppler/Form.cc         |    6 +++---
 poppler/Form.h          |    2 +-
 qt4/src/poppler-form.cc |    7 ++-----
 4 files changed, 12 insertions(+), 15 deletions(-)

New commits:
commit 5b24ee2c934feea1b7d46c8ec423d1c547258be2
Author: Pino Toscano <pino at kde.org>
Date:   Sun Feb 27 16:24:22 2011 +0100

    annots: 'CA', 'RC' and 'AC' are strings, not names

diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index 7c0ba8d..1475db3 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -790,22 +790,22 @@ AnnotAppearanceCharacs::AnnotAppearanceCharacs(Dict *dict) {
   }
   obj1.free();
 
-  if (dict->lookup("CA", &obj1)->isName()) {
-    normalCaption = new GooString(obj1.getName());
+  if (dict->lookup("CA", &obj1)->isString()) {
+    normalCaption = new GooString(obj1.getString());
   } else {
     normalCaption = NULL;
   }
   obj1.free();
 
-  if (dict->lookup("RC", &obj1)->isName()) {
-    rolloverCaption = new GooString(obj1.getName());
+  if (dict->lookup("RC", &obj1)->isString()) {
+    rolloverCaption = new GooString(obj1.getString());
   } else {
     rolloverCaption = NULL;
   }
   obj1.free();
 
-  if (dict->lookup("AC", &obj1)->isName()) {
-    alternateCaption = new GooString(obj1.getName());
+  if (dict->lookup("AC", &obj1)->isString()) {
+    alternateCaption = new GooString(obj1.getString());
   } else {
     alternateCaption = NULL;
   }
commit e64f6cb23e9a564b3f80daea9abcfe8bb29189eb
Author: Pino Toscano <pino at kde.org>
Date:   Sun Feb 27 15:22:32 2011 +0100

    make getOnStr() return the GooString* instead of its char*
    
    ... and modify its use accordingly
    this way it is easier to check for a numm onStr, without the risk of dereferencing a NULL pointer

diff --git a/poppler/Form.cc b/poppler/Form.cc
index 7ca27cb..4e1b8e1 100644
--- a/poppler/Form.cc
+++ b/poppler/Form.cc
@@ -289,10 +289,10 @@ void FormWidgetButton::setState (GBool astate, GBool calledByParent)
   //update appearance
   char *offStr = "Off";
   Object obj1;
-  obj1.initName(state?getOnStr():offStr);
+  obj1.initName(state ? onStr->getCString() : offStr);
   updateField ("V", &obj1);
 
-  obj1.initName(state?getOnStr():offStr);
+  obj1.initName(state ? onStr->getCString() : offStr);
   //modify the Appearance State entry as well
   obj.getDict()->set("AS", &obj1);
   //notify the xref about the update
@@ -1028,7 +1028,7 @@ GBool FormFieldButton::setState (int num, GBool s)
         FormWidgetButton* actChild = static_cast<FormWidgetButton*>(widgets[active_child]);
         if (actChild->getOnStr()) {
           Object obj1;
-          obj1.initName(actChild->getOnStr());
+          obj1.initName(actChild->getOnStr()->getCString());
 	  obj.getDict()->set("V", &obj1);
 	  xref->setModifiedObject(&obj, ref);
         }
diff --git a/poppler/Form.h b/poppler/Form.h
index 5f40945..b38b92f 100644
--- a/poppler/Form.h
+++ b/poppler/Form.h
@@ -152,7 +152,7 @@ public:
   void setState (GBool state, GBool calledByParent=gFalse);
   GBool getState ();
 
-  char* getOnStr () { return onStr->getCString(); }
+  GooString* getOnStr() { return onStr; }
 
   void loadDefaults();
 
diff --git a/qt4/src/poppler-form.cc b/qt4/src/poppler-form.cc
index 815a8df..40376e5 100644
--- a/qt4/src/poppler-form.cc
+++ b/qt4/src/poppler-form.cc
@@ -200,11 +200,8 @@ FormFieldButton::ButtonType FormFieldButton::buttonType() const
 QString FormFieldButton::caption() const
 {
   FormWidgetButton* fwb = static_cast<FormWidgetButton*>(m_formData->fm);
-  // HACK push buttons seems to have a null GooString for the caption
-  if (fwb->getButtonType() == formButtonPush)
-    return QString();
-
-  return fwb->getOnStr() ? QString::fromUtf8(fwb->getOnStr()) : QString();
+  GooString *goo = fwb->getOnStr();
+  return goo ? QString::fromUtf8(goo->getCString()) : QString();
 }
 
 bool FormFieldButton::state() const


More information about the poppler mailing list