Issue 29615 - W32-mingw: Check/improve sal patch
Summary: W32-mingw: Check/improve sal patch
Status: CLOSED WONT_FIX
Alias: None
Product: porting
Classification: Code
Component: code (show other issues)
Version: OOo 1.1.2
Hardware: All All
: P3 Trivial (vote)
Target Milestone: AOO PleaseHelp
Assignee: hennes.rohling
QA Contact: issues@porting
URL:
Keywords:
Depends on:
Blocks: 24588
  Show dependency tree
 
Reported: 2004-05-27 22:13 UTC by quetschke
Modified: 2010-11-10 22:42 UTC (History)
2 users (show)

See Also:
Issue Type: PATCH
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Patch for sal/ (91.58 KB, patch)
2004-05-27 22:14 UTC, quetschke
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description quetschke 2004-05-27 22:13:27 UTC
I would appreciate if someone would have a look at the sal patches
for the W32-mingw "port".

My knowledge of C++ is insufficient for this purpose, but I'm pretty sure
there are better ways to do this then sprinkling "#ifdef __MINGW32__"
all over sal/ .
Especially using wchar_t* instead of sal_Unicode* doesn't sound right.

vq->mh: Martin, can you please delegate this issue to someone who is literate
in this area and ask him if he/she is willing to help?

Patch in question follows.
Comment 1 quetschke 2004-05-27 22:14:31 UTC
Created attachment 15530 [details]
Patch for sal/
Comment 2 Martin Hollmichel 2004-06-02 12:36:03 UTC
mh->hro: is somebody of your team able to do the requested review ?

Comment 3 hennes.rohling 2004-06-11 09:37:42 UTC
Accepted.
Comment 4 hennes.rohling 2004-10-15 04:23:02 UTC
Not for OOo 2.0
Comment 5 quetschke 2004-10-16 04:21:24 UTC
vq@hro: Did you realize that this is a working but ugly patch for the really
existing and compilable cws_srx645_mingw branch?
You are not expected to put a lot of effort in it, but some comments/hints
would have been helpfull.

This is a proof of concept branch that is not supposed to get integrated as
is, so the Target OOo Later makes no sense at all, but a little help
in the last four months would have been appreciated.
Comment 6 hennes.rohling 2004-10-18 17:09:58 UTC
hro@vq: I already did a lot of support in the past but there are such things as
priorities. So if it's working on SRX645 why was the target OOo 2.0 ?

Just a few general comments:

All those DEFINE_UNICOWS_THUNK statements in ResolveThunk.cpp make the exports
unmaintainable as exporting was done through forward exporting uwinapi.dxp and
unicows.dxp.  I would appreciate a tool that generates intermediate output.


FindFirstVolumeW.cpp (FindNext... etc.) VolumeName is an output parameter so
LPCWSTR is wrong (though the linker ignores this, as the mingw header files do
not seem to contain FindFirstVolume etc.).

BTW: Uwinapi and unicows, was this ever tested on Windows9x/Me ? I can't find a
modification in solenv in wnt.mk that makes uwinapi the first library linked
against every module. Seems to me as alll the changes in uwinapi are useless, as
they will never be used.

In sal/inc/sal/types.h sal_Unicode is not "typedefed" to wchar_t. But instead
the code in osl is fragmented with #ifdef _MINGW32__ and cast statements to
convert from sal_Unicode to wchar_t and vice versa.

The global constructor destructor problem is solved in dllentry.c even for mingw
but when sal is linked dllentry is excluded for mingw. Does not make sense.

At some locations (tempfile.cxx) _alloca is replaced with malloc() and free(). I
feel this was just because _alloca was used in a macro that uses structured
exception handling (__try, __except) but _alloca should be availiable with mingw
too and is much faster and  better to maintain.

Comment 7 quetschke 2004-10-18 21:34:42 UTC
> hro@vq: I already did a lot of support in the past but there are such things as
> priorities.
He, don't kill the messenger ;) Klang vermutlich viel unfreundlicher als es
gemeint war :)

> So if it's working on SRX645 why was the target OOo 2.0 ?
Propably an oversight on my side.

This is tono's patch, I hope he can have a look at your comments. Thanks.

Comment 8 tono 2004-10-19 23:13:07 UTC
tono -> hro, vq
Thanks for your comments, hro.

I do not think DEFINE_UNICOWS_THUNK statements will cause major difficulties 
in exports maintenance in the future. I would expect no further enhancement in 
unicows.dll by Microsoft. Therefore, I think making a tool to generate them is 
not necessary. If they cause difficulties in maintaining uwinapi exports, it 
would be better to slpit them out into another C source I think.

Uwinapi and unicows are working on Windows9x/Me. They are linked before 
kernel32/user32 and tested my myself and thirano.

Dllentry is excluded for mingw because it is included in a SLB file cpposl.lib.

I will comment on issues in Find.*VolumeW, sal_Unicode and alloca in this 
weekend after testing your suggestions because I do not remember details why I 
did not do so :-P




Comment 9 tono 2004-10-24 07:56:41 UTC
tono -> hro, vq

I have done several tests.
MinGW does have Find.*VolumeW in its headers. So the right solution is to 
patch the MinGW header instead of patching FindFirstVolumeW.cpp.

I have tested alloca and it works with MinGW.

The issue of sal_Unicode is a bit complecated. In MSVC wchar_t is a typedef of 
unsigned short int, but it is not true in gcc. The sal project can be built 
with defining sal_Unicode as wchar_t and it will eliminate many castings but 
it will generate many casting requirements where we assign ushort value to 
sal_Unicode.
IMHO it might be safer to define sal_Unicode as unisigned short because it 
will limit the needs for casting in calling WIN32APIs and MSVCRT functions.

I would appreciate your comments.
Comment 10 tono 2005-01-16 03:18:17 UTC
I have tried "#define sal_Unicode wchar_t".

It seems to work well with WIN32APIs. I had to patch several headers including 
a jsdk header but it seems to be less work than "#define sal_Unicode wchar_t".

One critical issue is expat. Expat has a compile definition flag to switch XML 
characters among char, unsigned short and wchar_t. The latter two are for 
unicode characters but if we choose wchar_t, logging character, which normally 
is char type, also defined to be wchar_t type and source comment says that it 
would be encoded in UTF-16.

To avoid complicated situation, I am choosing to define unicode xml character 
as unsinged short and get compromised with "reinterpret_cast".

ToDo:
Split unicows thunking code out of ResolveThunk.cpp


Takashi Ono (tono)

Comment 11 hennes.rohling 2006-04-12 17:12:25 UTC
Outdated and obsolete issue.
Comment 12 hennes.rohling 2006-04-12 17:12:58 UTC
Closed
Comment 13 lgaterarin 2010-11-10 22:42:12 UTC
Created attachment 73784