pkgsrc-Bugs archive

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

pkg/44870: recent print/epdfview doesn't work with linearized PDFs



>Number:         44870
>Category:       pkg
>Synopsis:       recent print/epdfview doesn't work with linearized PDFs.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Apr 16 15:00:00 +0000 2011
>Originator:     IWAMOTO Toshihiro
>Release:        NetBSD 5.0_STABLE
>Organization:
        none
>Environment:
System: NetBSD pepper 5.0_STABLE NetBSD 5.0_STABLE (PEPPER) #4: Fri Nov 13 
11:27:28 JST 2009 
toshii%primula.my@localhost.domain:/usr/src/netbsd-5/sys/arch/i386/compile/PEPPER
 i386
Architecture: i386
Machine: i386
>Description:
        In poppler 0.16.3, PopplerDocument's linearized property is gboolean,
        while it used be gchar* in 0.14.5.  Epdfview expects the latter.
        This mismatch causes "1" to be passed to g_strdup and generates SEGV.
        A fix patch is attached.

>How-To-Repeat:
        Open a linearized PDF file.
>Fix:
        Use the following pkgsrc patches.
        Alternatively, epdfview's svn repository seems to have this
        bugfix and some more (not verified).


$NetBSD$

--- src/IDocument.cxx.orig      2009-03-01 06:00:35.000000000 +0900
+++ src/IDocument.cxx
@@ -135,7 +135,7 @@ IDocument::IDocument ()
     m_FindPage = 0;
     m_Format = NULL;
     m_Keywords = NULL;
-    m_Linearized = NULL;
+    m_Linearized = 0;
     m_ModifiedDate = NULL;
     m_PageCache = NULL;
     m_PageCacheAge = 0;
@@ -164,7 +164,6 @@ IDocument::~IDocument ()
     g_free (m_FileName);
     g_free (m_Format);
     g_free (m_Keywords);
-    g_free (m_Linearized);
     g_free (m_ModifiedDate);
     g_free (m_Password);
     g_free (m_Producer);
@@ -755,11 +754,11 @@ IDocument::setFormat (gchar *format)
 const gchar *
 IDocument::getLinearized ()
 {
-    if ( NULL == m_Linearized )
+    if ( !m_Linearized )
     {
         return "No";
     }
-    return m_Linearized;
+    return "Yes";
 }
 
 ///
@@ -769,12 +768,9 @@ IDocument::getLinearized ()
 ///                   otherwise. IDocument will free it.
 ///
 void
-IDocument::setLinearized (gchar *linearized)
+IDocument::setLinearized (gboolean linearized)
 {
-    gchar *oldLinearized = m_Linearized;
-    m_Linearized = g_strdup (linearized);
-    g_free (oldLinearized);
-    g_free (linearized);
+    m_Linearized = linearized;
 }
 
 ///
$NetBSD$

--- src/IDocument.h.orig        2009-03-01 06:00:35.000000000 +0900
+++ src/IDocument.h
@@ -306,7 +306,7 @@ namespace ePDFView 
             const gchar *getFormat (void);
             void setFormat (gchar *format);
             const gchar *getLinearized (void);
-            void setLinearized (gchar *linearized);
+            void setLinearized (gboolean linearized);
             const gchar *getCreationDate (void);
             void setCreationDate (gchar *date);
             const gchar *getModifiedDate (void);
@@ -382,7 +382,7 @@ namespace ePDFView 
             /// The document's keyword.
             gchar *m_Keywords;
             /// Tells if the document is linearized or not.
-            gchar *m_Linearized;
+            gboolean m_Linearized;
             /// The document's modification date and time.
             gchar *m_ModifiedDate;
             /// @brief The list of classes that will receive notifications
$NetBSD$

--- src/PDFDocument.cxx.orig    2009-03-01 06:00:35.000000000 +0900
+++ src/PDFDocument.cxx
@@ -324,7 +324,7 @@ PDFDocument::loadMetadata (void)
     gchar *format = NULL;
     gchar *keywords = NULL;
     PopplerPageLayout layout = POPPLER_PAGE_LAYOUT_UNSET;
-    gchar *linearized = NULL;
+    gboolean linearized = 0;
     GTime modDate;
     PopplerPageMode mode = POPPLER_PAGE_MODE_UNSET;
     gchar *producer = NULL;
@@ -680,13 +680,13 @@ PDFDocument::setTextSelection (DocumentR
 
     //for get text we must exchange y coordinate, don't ask me where logic 
here.
     PopplerRectangle textRect = { rect->getX1() / getZoom(),
-                                  (pageHeight - rect->getY2() / getZoom()),
-                                  rect->getX2() * getZoom() / getZoom(),
-                                  (pageHeight - rect->getY1() / getZoom())};
+                                  rect->getY1() / getZoom(),
+                                  rect->getX2() / getZoom(),
+                                  rect->getY2() / getZoom()};
     repairEmpty(textRect);
 
 #if defined (HAVE_POPPLER_0_6_0)
-    gchar *text = poppler_page_get_text(page, POPPLER_SELECTION_GLYPH,
+    gchar *text = poppler_page_get_selected_text(page, POPPLER_SELECTION_GLYPH,
             &textRect);
 #else // !HAVE_POPPLER_0_6_0
     gchar *text = poppler_page_get_text(page, &textRect);



Home | Main Index | Thread Index | Old Index