Re: dom - r23449 - abiword/trunk/plugins/mathview/xp

From: Dominic Lachowicz <domlachowicz_at_gmail.com>
Date: Thu Apr 10 2008 - 17:33:36 CEST

This fixes 11328 on Windows (the "mathml doesn't work" bug). Please backport.

Short story - don't do printf("%s", NULL) - it's behavior is
undefined, and will crash on Windows.

On Thu, Apr 10, 2008 at 11:01 AM, <cvs@abisource.com> wrote:
>
> Author: dom
> Date: 2008-04-10 17:01:25 +0200 (Thu, 10 Apr 2008)
> New Revision: 23449
>
> Modified:
> abiword/trunk/plugins/mathview/xp/gr_Abi_ComputerModernShaper.cpp
> abiword/trunk/plugins/mathview/xp/gr_Abi_DefaultShaper.cpp
> abiword/trunk/plugins/mathview/xp/gr_Abi_StandardSymbolsShaper.cpp
> Log:
> don't pass nulls to findFont. sprintf can't handle nulls
>
> Modified: abiword/trunk/plugins/mathview/xp/gr_Abi_ComputerModernShaper.cpp
> ===================================================================
> --- abiword/trunk/plugins/mathview/xp/gr_Abi_ComputerModernShaper.cpp 2008-04-10 14:52:15 UTC (rev 23448)
> +++ abiword/trunk/plugins/mathview/xp/gr_Abi_ComputerModernShaper.cpp 2008-04-10 15:01:25 UTC (rev 23449)
> @@ -51,7 +51,7 @@
> static char fontFamily[128];
> sprintf(fontFamily, "%s", getFamily()->nameOfFont(fontName, designSize).c_str());
>
> - GR_Font* font = m_pGraphics->findFont(fontFamily, "normal", NULL, "normal", NULL, fontSize,NULL);
> + GR_Font* font = m_pGraphics->findFont(fontFamily, "normal", "", "normal", "", fontSize, "");
> UT_ASSERT(font);
>
> return GR_Abi_CharArea::create(getGraphics(), font, size, toTTFGlyphIndex(getFamily()->encIdOfFontNameId(fontName), index));
>
> Modified: abiword/trunk/plugins/mathview/xp/gr_Abi_DefaultShaper.cpp
> ===================================================================
> --- abiword/trunk/plugins/mathview/xp/gr_Abi_DefaultShaper.cpp 2008-04-10 14:52:15 UTC (rev 23448)
> +++ abiword/trunk/plugins/mathview/xp/gr_Abi_DefaultShaper.cpp 2008-04-10 15:01:25 UTC (rev 23449)
> @@ -111,7 +111,7 @@
> sprintf(fontSize, "%dpt", static_cast<int>(context.getSize().toFloat() + 0.5f));
>
> const AbiTextProperties& props = getTextProperties(variant);
> - GR_Font* font = m_pGraphics->findFont(props.family, props.style, NULL, props.weight, NULL, fontSize,NULL);
> + GR_Font* font = m_pGraphics->findFont(props.family, props.style, "", props.weight, "", fontSize, "");
> UT_ASSERT(font);
>
> SmartPtr<GR_Abi_AreaFactory> factory = smart_cast<GR_Abi_AreaFactory>(context.getFactory());
>
> Modified: abiword/trunk/plugins/mathview/xp/gr_Abi_StandardSymbolsShaper.cpp
> ===================================================================
> --- abiword/trunk/plugins/mathview/xp/gr_Abi_StandardSymbolsShaper.cpp 2008-04-10 14:52:15 UTC (rev 23448)
> +++ abiword/trunk/plugins/mathview/xp/gr_Abi_StandardSymbolsShaper.cpp 2008-04-10 15:01:25 UTC (rev 23449)
> @@ -45,7 +45,7 @@
> static char fontSize[128];
> sprintf(fontSize, "%dpt", static_cast<int>(size.toFloat() + 0.5f));
>
> - GR_Font* font = m_pGraphics->findFont("Symbol", "normal", NULL, "normal", NULL, fontSize,NULL);
> + GR_Font* font = m_pGraphics->findFont("Symbol", "normal", "", "normal", "", fontSize, "");
> UT_ASSERT(font);
> UT_UCS4Char ch = static_cast<UT_UCS4Char>(static_cast<unsigned char>(index));
> return factory->charArea(getGraphics(), font, size, ch);
>
> -----------------------------------------------
> To unsubscribe from this list, send a message to
> abisource-cvs-commit-request@abisource.com with the word
> unsubscribe in the message body.
>

-- 
Counting bodies like sheep to the rhythm of the war drums.
Received on Thu Apr 10 17:39:20 2008

This archive was generated by hypermail 2.1.8 : Thu Apr 10 2008 - 17:39:20 CEST