<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hello,</p>
<p>IMHO the use of sal_IntPtr in FontList class is wrong.</p>
<p>It's been there since 43135665bf9093c52f424069bcf83d50a93bdc0c:</p>
<p>author Fridrich Štrba <a class="moz-txt-link-rfc2396E" href="mailto:fridrich.strba@bluewin.ch"><fridrich.strba@bluewin.ch></a>
2013-06-10 12:49:33 +0200<br>
committer Fridrich Štrba <a class="moz-txt-link-rfc2396E" href="mailto:fridrich.strba@bluewin.ch"><fridrich.strba@bluewin.ch></a>
2013-06-10 14:03:34 +0200<br>
commit 43135665bf9093c52f424069bcf83d50a93bdc0c (patch)<br>
tree 079359e37353f3a936656a9d3aeff2e3577cc353<br>
parent 378b2522b40004ca5f5b6de0b4eda0ac13d4153d (diff)<br>
mingw64: use integers able to contain a size in svtools<br>
Change-Id: Id5505f75a2331be682b74d085a7959fc4bf07df8<br>
<br>
</p>
<p>Let's take a look at the 2 vars:<br>
</p>
<p>1) aStdSizeAry</p>
<p>it's a static array containing values from 0 to 960.</p>
<p>(see
<a class="moz-txt-link-freetext" href="https://opengrok.libreoffice.org/xref/core/svtools/source/control/ctrltool.cxx?r=770ca016#38">https://opengrok.libreoffice.org/xref/core/svtools/source/control/ctrltool.cxx?r=770ca016#38</a>)</p>
<p>2) mpSizeAry</p>
<p>git grep -n mpSizeAry in core repo gives:<br>
include/svtools/ctrltool.hxx:149:
mpSizeAry;<br>
svtools/source/control/ctrltool.cxx:749: mpSizeAry.reset();<br>
svtools/source/control/ctrltool.cxx:772: mpSizeAry.reset(new
sal_IntPtr[nDevSizeCount+1] );<br>
svtools/source/control/ctrltool.cxx:779:
mpSizeAry[nRealCount] = nOldHeight;<br>
svtools/source/control/ctrltool.cxx:783: mpSizeAry[nRealCount]
= 0;<br>
svtools/source/control/ctrltool.cxx:786: return
mpSizeAry.get();<br>
</p>
<p>so the elements are only initialized thanks to "nOldHeight" which
itself is declared as a long and is initialized with
"aSize.Height()"</p>
<p>(see
<a class="moz-txt-link-freetext" href="https://opengrok.libreoffice.org/xref/core/svtools/source/control/ctrltool.cxx?r=770ca016#778">https://opengrok.libreoffice.org/xref/core/svtools/source/control/ctrltool.cxx?r=770ca016#778</a>).</p>
<p>Indeed, according to include/tools/gen.hxx, "Height()" returns a
long, so "nOldHeight" is ok.<br>
</p>
<p>(see
<a class="moz-txt-link-freetext" href="https://opengrok.libreoffice.org/xref/core/include/tools/gen.hxx?r=32090b01#189">https://opengrok.libreoffice.org/xref/core/include/tools/gen.hxx?r=32090b01#189</a>)<br>
</p>
<p><br>
</p>
<p>I know there has been some problem about types of attributes of
Size, there's even been an attempt to use sal_Int32 but reverted
with d36f7c5bd2115fcdd26ba8ff7b6a0446dea70bd4</p>
<p>"Revert "long->sal_Int32 in tools/gen.hxx"</p>
<i>This reverts commit </i><i><a
href="https://cgit.freedesktop.org/libreoffice/core/commit/?id=8bc951daf79decbd8a599a409c6d33c5456710e0">8bc951daf79decbd8a599a409c6d33c5456710e0</a></i><i>.
As discussed at
<a class="moz-txt-link-rfc2396E" href="https://lists.freedesktop.org/archives/libreoffice/2018-April/079955.html"><https://lists.freedesktop.org/archives/libreoffice/2018-April/079955.html></a>
"long->sal_Int32 in tools/gen.hxx", that commit caused lots of
problems with
signed integer overflow, and the original plan was to redo it to
consistently
use sal_Int64 instead of sal_Int32.
<a class="moz-txt-link-rfc2396E" href="https://gerrit.libreoffice.org/#/c/52471/"><https://gerrit.libreoffice.org/#/c/52471/></a>
"sal_Int32->sal_Int64 in tools/gen.hxx" tried that. However, it
failed
miserably on Windows, causing odd failures like not writing out
Pictures/*.svm
streams out into .odp during CppunitTest_sd_export_ooxml2. So the
next best
approach is to just revert the original commit, at least for now.
Includes revert of follow-up </i><i><a
href="https://cgit.freedesktop.org/libreoffice/core/commit/?id=8c50aff2175e85c54957d98ce32af40a3a87e168">8c50aff2175e85c54957d98ce32af40a3a87e168</a></i><i>
"Fix
Library_vclplug_qt5"."</i>
<p>Anyway for the moment do you think we could change the use of
sal_IntPtr for these quoted elements into long types?</p>
<p>Julien<br>
</p>
</body>
</html>