Hi,
I made those changes. For i/o checks for fseek() and ftell(), here we
don't have to check for 10 bytes. That is need for set appearance from image
file. That I set it in another patch. For safe check here also iam checking
it now.
Thanks
--
A Srinivas
On Wed, Apr 6, 2011 at 12:30 AM, <[email protected]>wrote:
> Send poppler mailing list submissions to
> [email protected]
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.freedesktop.org/mailman/listinfo/poppler
> or, via email, send a message with subject or body 'help' to
> [email protected]
>
> You can reach the person managing the list at
> [email protected]
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of poppler digest..."
>
>
> Today's Topics:
>
> 1. Re: Patch: New additions in FileSpec (Pino Toscano)
> 2. Re: Patch: New additions in LinkRendition (Pino Toscano)
> 3. Re: patch: set the title for screen annotation (Pino Toscano)
> 4. Error in compiling poppler-optcontent.cc file (Sreenidhi T)
> 5. Re: Error in compiling poppler-optcontent.cc file
> (Albert Astals Cid)
> 6. Re: Patch: New additions in FileSpec (Albert Astals Cid)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 5 Apr 2011 15:41:49 +0200
> From: Pino Toscano <[email protected]>
> Subject: Re: [poppler] Patch: New additions in FileSpec
> To: [email protected]
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Alle marted? 5 aprile 2011, srinivas adicherla ha scritto:
> > +const char* getFileNameFromPath (const char *filePath) {
>
> - { goes on a new line
> - make the function static and remove its declaration from the .h
>
> > +static GBool getFileSpecObject(XRef *xref, Stream *stream, const
> > char* fileName, Object *obj) {
>
> { goes on a new line
>
> > + Object fileSpec, obj1, obj2;
> > + int length;
> > +
> > + fileSpec.initDict(xref);
> > + fileSpec.dictSet("Type", obj1.initName("Filespec"));
> > + fileSpec.dictSet("F", obj1.initString(new GooString(fileName)));
> > +
> > + GooString *name = new GooString(fileName);
>
> a new GooString(fileName) is already created for the "F" key, so just
> create it once, using it for "F" and passing it to
> pdfDocEncodingToUTF16, do not deleting it
>
> > + char *fileNameUTF16 = pdfDocEncodingToUTF16(name, &length);
> > + fileSpec.dictSet("UF", obj1.initString(new
> > GooString(fileNameUTF16, length)));
> > +
> > + delete(fileNameUTF16);
>
> as I already said in a previous review:
> | pdfDocEncodingToUTF16 returns a new char[], which you have to
> | delete [], not free() (as also Carlos said)
> there's a difference between delete and delete []
>
> > +GBool createFilespec (XRef *xref, GooString *filePathA, Object *obj)
> > {
>
> - { goes on a new line
> - proper naming, "FileSpec"
>
> > + fseek(fs, 0, SEEK_END);
> > + size = ftell(fs);
>
> as I already said:
> | you are missing any kind of check on the return values of the two, for
> | example on i/o errors or simply because the passed file could be even
> | shorter than 10 bytes
>
> --
> Pino Toscano
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: not available
> Type: application/pgp-signature
> Size: 190 bytes
> Desc: This is a digitally signed message part.
> URL: <
> http://lists.freedesktop.org/archives/poppler/attachments/20110405/c33c9e7a/attachment-0001.pgp
> >
>
> ------------------------------
>
> Message: 2
> Date: Tue, 5 Apr 2011 15:48:32 +0200
> From: Pino Toscano <[email protected]>
> Subject: Re: [poppler] Patch: New additions in LinkRendition
> To: [email protected]
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Alle marted? 5 aprile 2011, srinivas adicherla ha scritto:
> > + // Get the reference object of the corresponding action
> > + virtual Ref getRef() {};
>
> where's the return value?
>
> --
> Pino Toscano
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: not available
> Type: application/pgp-signature
> Size: 190 bytes
> Desc: This is a digitally signed message part.
> URL: <
> http://lists.freedesktop.org/archives/poppler/attachments/20110405/5c1b832c/attachment-0001.pgp
> >
>
> ------------------------------
>
> Message: 3
> Date: Tue, 5 Apr 2011 15:57:52 +0200
> From: Pino Toscano <[email protected]>
> Subject: Re: [poppler] patch: set the title for screen annotation
> To: [email protected]
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi,
>
> Alle marted? 5 aprile 2011, srinivas adicherla ha scritto:
> > +void AnnotScreen::setTitle(GooString *title) {
> > [...]
> > + obj1.initString(new_title->copy());
> > + update ("T", &obj1);
> > + delete new_title;
> > +}
>
> - the 'title' parameter is still shadowing the 'title' private member
> (so rename it)
> - instead of delete 'new_title', looks like you should set it as new
> 'title' (the private member), otherwise getTitle() will give the old
> title
>
> > +void
> > +poppler_annot_screen_set_title (PopplerAnnotScreen *poppler_annot,
> > + const gchar *title)
> > +{
> > [...]
> > + goo_tmp = new GooString (tmp, length);
> > + g_free (tmp);
> > +
> > + annot->setTitle (goo_tmp);
> > + delete (goo_tmp);
> > +}
>
> most probably goo_tmp can go on stack
>
> > +void poppler_annot_screen_set_title
> (PopplerAnnotScreen *poppler_annot,
> > +
> const gchar *title);
> >
> > +
>
> empty line added
>
> --
> Pino Toscano
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: not available
> Type: application/pgp-signature
> Size: 190 bytes
> Desc: This is a digitally signed message part.
> URL: <
> http://lists.freedesktop.org/archives/poppler/attachments/20110405/6acf332b/attachment-0001.pgp
> >
>
> ------------------------------
>
> Message: 4
> Date: Tue, 5 Apr 2011 20:36:36 +0530
> From: Sreenidhi T <[email protected]>
> Subject: [poppler] Error in compiling poppler-optcontent.cc file
> To: [email protected]
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset="utf-8"
>
> Hi,
>
> I am part of a team that works on porting a MAC OS application, that uses
> poppler version 10.7 ( available on Fink).
> On building the application, the compilation fails with the following
> error:
>
> CompileC
>
> obj/TeXworks.build/Default/TeXworks.build/Objects-normal/i386/poppler-optcontent.o
> ../../../../opt/kde4/mac/include/poppler/qt4/poppler-optcontent.cc normal
> i386 c++ com.apple.compilers.gcc.4_2
> cd /sw/src/fink.build/texworks-0.3-1/texworks-0.3
> setenv LANG en_US.US-ASCII
> /Developer/usr/bin/gcc-4.2 -x c++ -arch i386 -fmessage-length=0 -pipe
> -Wno-trigraphs -fpascal-strings -fasm-blocks -Os -mdynamic-no-pic
> -fvisibility=hidden -fvisibility-inlines-hidden -mmacosx-version-min=10.5
> -gdwarf-2
>
> -I/sw/src/fink.build/texworks-0.3-1/texworks-0.3/obj/TeXworks.build/Default/TeXworks.build/TeXworks.hmap
> -F/sw/src/fink.build/texworks-0.3-1/texworks-0.3/build/Default
> -I/sw/src/fink.build/texworks-0.3-1/texworks-0.3/build/Default/include
> -I/sw/lib/qt4-mac/include/QtUiTools
> -I/sw/lib/qt4-mac/lib/QtCore.framework/Versions/4/Headers
> -I/sw/lib/qt4-mac/include/QtCore
> -I/sw/lib/qt4-mac/lib/QtGui.framework/Versions/4/Headers
> -I/sw/lib/qt4-mac/include/QtGui
> -I/sw/lib/qt4-mac/lib/QtXml.framework/Versions/4/Headers
> -I/sw/lib/qt4-mac/include/QtXml
> -I/sw/lib/qt4-mac/lib/QtScriptTools.framework/Versions/4/Headers
> -I/sw/lib/qt4-mac/include/QtScriptTools
> -I/sw/lib/qt4-mac/lib/QtScript.framework/Versions/4/Headers
> -I/sw/lib/qt4-mac/include/QtScript -I/sw/lib/qt4-mac/include -Isrc
> -I/sw/include/poppler -I/sw/opt/kde4/mac/include/poppler/qt4
> -I/sw/include/hunspell -I/sw/lib/fontconfig2/include -Imoc -Iui
> -I/sw/opt/kde4/mac/include -I/System/Library/Frameworks
> -I/sw/lib/qt4-mac/mkspecs/macx-xcode
>
> -I/sw/src/fink.build/texworks-0.3-1/texworks-0.3/obj/TeXworks.build/Default/TeXworks.build/DerivedSources/i386
>
> -I/sw/src/fink.build/texworks-0.3-1/texworks-0.3/obj/TeXworks.build/Default/TeXworks.build/DerivedSources
> -pipe -DTW_BUILD_ID=personal -DHAVE_POPPLER_XPDF_HEADERS -fexceptions -g
> -Wall -W -DQT_SCRIPT_LIB -DQT_SCRIPTTOOLS_LIB -DQT_XML_LIB -DQT_GUI_LIB
> -DQT_CORE_LIB -DQT_SHARED -c
>
> /sw/src/fink.build/texworks-0.3-1/texworks-0.3/../../../../opt/kde4/mac/include/poppler/qt4/poppler-optcontent.cc
> -o
>
> /sw/src/fink.build/texworks-0.3-1/texworks-0.3/obj/TeXworks.build/Default/TeXworks.build/Objects-normal/i386/poppler-optcontent.o
>
>
> */sw/src/fink.build/texworks-0.3-1/texworks-0.3/../../../../opt/kde4/mac/include/poppler/qt4/poppler-optcontent.cc:428:34:
> error: poppler-optcontent.moc: No such file or directory*
>
> As seen in the above error message, the poppler-optcontent.moc file (which
> is included in the poppler-optcontent.cc file), is not available while
> compilation.
>
> The poppler 10.7 version's source folder also has only a file by the name
> poppler-optcontent.cc and no .moc file.
>
> Could anyone please provide some suggestions/ideas as to the cause for this
> error and for resolving the same.
>
>
> Thanks & Regards,
> Sreenidhi T
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://lists.freedesktop.org/archives/poppler/attachments/20110405/90e45264/attachment-0001.htm
> >
>
> ------------------------------
>
> Message: 5
> Date: Tue, 5 Apr 2011 18:40:48 +0100
> From: Albert Astals Cid <[email protected]>
> Subject: Re: [poppler] Error in compiling poppler-optcontent.cc file
> To: [email protected]
> Message-ID: <[email protected]>
> Content-Type: Text/Plain; charset="us-ascii"
>
> A Dimarts, 5 d'abril de 2011, Sreenidhi T va escriure:
> > Hi,
> >
> > I am part of a team that works on porting a MAC OS application, that uses
> > poppler version 10.7 ( available on Fink).
>
> Poppler 10.7 does not exist, might be 0.10.7 which is two years old. Try a
> new
> release.
>
> Albert
>
>
> ------------------------------
>
> Message: 6
> Date: Tue, 5 Apr 2011 18:41:18 +0100
> From: Albert Astals Cid <[email protected]>
> Subject: Re: [poppler] Patch: New additions in FileSpec
> To: [email protected]
> Message-ID: <[email protected]>
> Content-Type: Text/Plain; charset="us-ascii"
>
> A Dimarts, 5 d'abril de 2011, srinivas adicherla va escriure:
> > Hi all,
>
> Carlos/Pino can you handle this patchset?
>
> Albert
>
>
> ------------------------------
>
> _______________________________________________
> poppler mailing list
> [email protected]
> http://lists.freedesktop.org/mailman/listinfo/poppler
>
>
> End of poppler Digest, Vol 74, Issue 7
> **************************************
>
Index: poppler-0.16.2/poppler/FileSpec.cc
===================================================================
--- poppler-0.16.2/poppler/FileSpec.cc (revision 14)
+++ poppler-0.16.2/poppler/FileSpec.cc (working copy)
@@ -23,8 +23,26 @@
#include <config.h>
+#include "XRef.h"
#include "FileSpec.h"
+#include "PDFDocEncoding.h"
+static const char* getFileNameFromPath (const char *filePath)
+{
+ const char *filename;
+#ifdef _WIN32
+ filename = strrchr(filePath, '\\');
+#else
+ filename = strrchr(filePath, '/');
+#endif
+
+ if (filename)
+ filename++;
+ else
+ filename = filePath;
+ return filename;
+}
+
GBool getFileSpecName (Object *fileSpec, Object *fileName)
{
if (fileSpec->isString()) {
@@ -138,3 +156,65 @@
return gTrue;
}
+
+static GBool getFileSpecObject(XRef *xref, Stream *stream, const char* fileName, Object *obj)
+{
+ Object fileSpec, obj1, obj2;
+ int length;
+
+ GooString *filename = new GooString(fileName);
+ char *fileNameUTF16 = pdfDocEncodingToUTF16(filename, &length);
+
+ fileSpec.initDict(xref);
+ fileSpec.dictSet("Type", obj1.initName("Filespec"));
+ fileSpec.dictSet("F", obj1.initString(filename));
+ fileSpec.dictSet("UF", obj1.initString(new GooString(fileNameUTF16, length)));
+
+ delete []fileNameUTF16;
+ delete(filename);
+
+ obj1.initStream(stream);
+
+ Ref newRef = xref->addIndirectObject(&obj1);
+ obj2.initRef(newRef.num, newRef.gen);
+ obj1.initDict(xref);
+ obj1.dictSet("F", &obj2);
+ fileSpec.dictSet("EF", &obj1);
+
+ Ref ref = xref->addIndirectObject(&fileSpec);
+ obj->initRef(ref.num, ref.gen);
+
+ return gTrue;
+}
+
+GBool createFilespec (XRef *xref, GooString *filePathA, Object *obj)
+{
+ Object obj1, obj2;
+ FILE *fs;
+ unsigned int size = 0;
+
+ const char *filePath = filePathA->getCString();
+
+ if (!(fs = fopen(filePath, "rb"))) {
+ error(-1, "Couldn't open file '%s'", filePath);
+ obj->initNull();
+ }
+
+ if (fseek(fs, 0, SEEK_END)) {
+ error(-1, "fseek() failed in creating FileSpec Object");
+ return gFalse;
+ }
+
+ if (!(size = ftell(fs)))
+ return gFalse;
+
+ // Extract the video name from the file uri
+ const char *filename = getFileNameFromPath(filePath);
+
+ obj1.initDict(xref); // file stream eictionary
+ obj1.dictSet("Length", obj2.initInt(size));
+
+ FileStream *stream = new FileStream(fs, 0, 0, size, &obj1);
+
+ return getFileSpecObject (xref, stream, filename, obj);
+}
Index: poppler-0.16.2/poppler/FileSpec.h
===================================================================
--- poppler-0.16.2/poppler/FileSpec.h (revision 14)
+++ poppler-0.16.2/poppler/FileSpec.h (working copy)
@@ -20,5 +20,6 @@
GBool getFileSpecName (Object *fileSpec, Object *fileName);
GBool getFileSpecNameForPlatform (Object *fileSpec, Object *fileName);
+GBool createFilespec (XRef *xref, GooString *filepath, Object *obj);
#endif /* FILE_SPEC_H */
_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler