Bug 32496 - Fixes for build issues using Visual Studio 2008/2010 toolchain
Summary: Fixes for build issues using Visual Studio 2008/2010 toolchain
Status: RESOLVED FIXED
Alias: None
Product: poppler
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: All Windows (All)
: medium normal
Assignee: poppler-bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-18 06:27 UTC by Philip Lorenz
Modified: 2010-12-19 06:10 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Use Guint rather than uint in FontInfo.cc (738 bytes, application/octet-stream)
2010-12-18 06:27 UTC, Philip Lorenz
Details
Export annotation structs in Qt4 frontend (1.08 KB, patch)
2010-12-18 06:27 UTC, Philip Lorenz
Details | Splinter Review
Fixes type cast issues with Visual Studio compiler (909 bytes, patch)
2010-12-18 06:28 UTC, Philip Lorenz
Details | Splinter Review

Description Philip Lorenz 2010-12-18 06:27:28 UTC
Created attachment 41235 [details]
Use Guint rather than uint in FontInfo.cc

While building Poppler using the Visual Studio toolchain I ran into several small issues. Attached are three small patches fixing the issues I encountered.

Patch #1: FontConfig.cc uses uint which is not known by the compiler. 
Patch #2: Qt4 Frontend: The structs defined within the Annotation class are not marked as exported. This causes problem when linking against the produced DLL.
Patch #3: 
MSDN says (http://msdn.microsoft.com/de-de/library/14h5k7ff%28VS.80%29.aspx) that the buffer should be of type struct _stat. Secondly, fileName2 has to be type casted to a wchar_t which should be fine.

However, in the else case I am not sure whether _wstat or the _stat version of the command should be used (I am not too familiar with Windows encoding issues between the different releases).

All patches were made against 0.15.3 but should apply just fine to todays git version.
Comment 1 Philip Lorenz 2010-12-18 06:27:58 UTC
Created attachment 41236 [details] [review]
Export annotation structs in Qt4 frontend
Comment 2 Philip Lorenz 2010-12-18 06:28:41 UTC
Created attachment 41237 [details] [review]
Fixes type cast issues with Visual Studio compiler
Comment 3 Albert Astals Cid 2010-12-18 10:02:58 UTC
I'm a little confused of why you need
-    if (_wstat(fileName2, &buf) == 0) {
+    if (_wstat((const wchar_t *) fileName2, &buf) == 0) {
if fileName2 is already a wchar_t array and thus a const wchar_t *
Comment 4 Philip Lorenz 2010-12-19 02:22:26 UTC
(In reply to comment #3)
> I'm a little confused of why you need
> -    if (_wstat(fileName2, &buf) == 0) {
> +    if (_wstat((const wchar_t *) fileName2, &buf) == 0) {
> if fileName2 is already a wchar_t array and thus a const wchar_t *

Ok I must've looked at the wrong line when the compiler notified me about it. I guess the compilation error was caused by the _wstat call in the else branch a couple of lines below.
Comment 5 Albert Astals Cid 2010-12-19 05:06:16 UTC
Patch 1 is there from another bug, i've commited patch 2.

I'm a bit concerned patch 3 might break mingw builds though (not sure _stat is available there).
Comment 6 Philip Lorenz 2010-12-19 05:22:28 UTC
(In reply to comment #5)
> Patch 1 is there from another bug, i've commited patch 2.
> 
> I'm a bit concerned patch 3 might break mingw builds though (not sure _stat is
> available there).

I have just checked with MinGW 4.4.0 available from Nokia (at ftp://ftp.qt.nokia.com/misc/MinGW-gcc440_1.zip) and it does know about _stat (in sys/stat.h). The same also applies to MinGW 3.4.2 also available from the Qt FTP.
Comment 7 Hib Eris 2010-12-19 05:34:24 UTC
Comment on attachment 41237 [details] [review]
Fixes type cast issues with Visual Studio compiler

What is the reason for changing the use of _wstat() to _stat() in the else statement?
Comment 8 Philip Lorenz 2010-12-19 05:42:25 UTC
(In reply to comment #7)
> (From update of attachment 41237 [details] [review])
> What is the reason for changing the use of _wstat() to _stat() in the else
> statement?

The else branch seems to be the fallback for non-NT based versions of Windows (e.g. Windows 9x, ...) which do not support wide character strings. I don't know why _wstat was used in this branch as, similarly to _wfopen, it is not available on those systems (see the Requirements section in http://msdn.microsoft.com/en-us/library/14h5k7ff%28v=VS.80%29.aspx).
Comment 9 Hib Eris 2010-12-19 05:54:54 UTC
(In reply to comment #8)
> (In reply to comment #7)
> > (From update of attachment 41237 [details] [review] [details])
> > What is the reason for changing the use of _wstat() to _stat() in the else
> > statement?
> 
> The else branch seems to be the fallback for non-NT based versions of Windows
> (e.g. Windows 9x, ...) which do not support wide character strings. I don't
> know why _wstat was used in this branch as, similarly to _wfopen, it is not
> available on those systems (see the Requirements section in
> http://msdn.microsoft.com/en-us/library/14h5k7ff%28v=VS.80%29.aspx).

Ah, I see now, thanks. I think the non-NT based branch was never tested recently then. Using _stat instead of _wstat seems fine for me then.
Comment 10 Albert Astals Cid 2010-12-19 06:10:05 UTC
Ok, i've commited all the patches.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.