pdf-devel
[Top][All Lists]
Advanced

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

[pdf-devel] [pdf_fsys_item_p] function failed with an existing file


From: antoine . humbert
Subject: [pdf-devel] [pdf_fsys_item_p] function failed with an existing file
Date: Sun, 18 Jan 2009 16:25:38 +0100 (CET)

Hello,

when using the pdf_fsys_item_p function with an exsiting file, the function 
return PDF_FALSE.

path to file has been initialized with 
pdfHostEncoding = pdf_text_get_host_encoding();
pdf_text_from_unicode("/path/to/test.pdf", 17, pdfHostEncoding, &text);

a call to pdf_fsys_item_p(NULL, test) return PDF_FALSE however 
/path/to/test.pdf exists

an strace on the program call show that the access() function is called with 
following parameters :
access("/path/to/test.pdf \251\4\10q", R_OK)     = -1 ENOENT (No such file or 
directory)

It seems that string parameter given to access is incorrect. It looks like the 
string in the pdf_text_t struct is not NULL terminated.

Also, when getting pdf_text_t string to output the result, like this :
pdf_text_get_host(&pdfString, &pdfStringSize, inputFile, pdfHostEncoding);

a printf("%d - %s", pdfStringSize, pdfString) gives
17 - /path/to/test.pdf \251\4\10q

I have to do pdfString[pdfStringSize] = 0 before calling the printf function to 
have the correct output :
17 - /path/to/test.pdf



Antoine Humbert




reply via email to

[Prev in Thread] Current Thread [Next in Thread]