[Libreoffice-bugs] [Bug 122034] New: Replace deprecated WinAPI functions with their recommended substitutions
bugzilla-daemon at bugs.documentfoundation.org
bugzilla-daemon at bugs.documentfoundation.org
Wed Dec 12 08:01:41 UTC 2018
https://bugs.documentfoundation.org/show_bug.cgi?id=122034
Bug ID: 122034
Summary: Replace deprecated WinAPI functions with their
recommended substitutions
Product: LibreOffice
Version: unspecified
Hardware: All
OS: All
Status: UNCONFIRMED
Keywords: easyHack, skillCpp, skillWindows
Severity: normal
Priority: medium
Component: LibreOffice
Assignee: libreoffice-bugs at lists.freedesktop.org
Reporter: mikekaganski at hotmail.com
Throughout the Win-specific part of the codebase, we have some deprecated
WinAPI functions used. For example, CreateDIBPatternBrush [1] is used in GDI
code. This might have different degree of consequences, from performance
(deprecated functions are most probably internally implemented as wrappers over
up-to-date API, with inevitable overhead; some obsolete API requires more
processing, like using GlobalAlloc to obtain memory handle for
CreateDIBPatternBrush), to possible loss of compatibility/functionality (some
of obsolete functions may not support some newer OS functions).
This easy hack is about looking through the WinAPI functions used in the code,
and checking if they are obsoleted by some newer/recommended API, and
ultimately replacing those deprecated functions (with required modifications
around that).
This requires first obtaining the list of such functions. This might be done
e.g. using tools like Dependencies, [2] which can list imports of a module:
> C:\Dependencies_x64_Release\Dependencies.exe -imports c:\lo\core\instdir\program\gdipluscanvaslo.dll
and analyzing the output related to system libraries (KERNEL32.DLL, GDI32.DLL,
etc).
Then, reading of the identified functions' documentation is required. [3] For
each deprecated function found, the place where it's used should be found in
the codebase. Some of the usages might come from external libraries; this easy
hack is only about internal usages.
Not every usage of a deprecated function might require replacement; I cannot
come with an example when it might be undesirable, but it is possible. So when
reading the documentation, one must pay close attention to details about
differences in behavior of the obsolete and recommended APIs.
[1]
https://docs.microsoft.com/en-us/windows/desktop/api/wingdi/nf-wingdi-createdibpatternbrush
[2] https://github.com/lucasg/Dependencies
[3] https://docs.microsoft.com/en-us/windows/desktop/api/index
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20181212/3a5eff96/attachment.html>
More information about the Libreoffice-bugs
mailing list