Kaydet (Commit) 99fa8d59 authored tarafından Caolán McNamara's avatar Caolán McNamara

Resolves: tdf#120003 missing prefix to link url in .doc import

regression from...

commit 9b77f814
Author: Caolán McNamara <caolanm@redhat.com>
Date:   Thu Apr 6 15:08:45 2017 +0100

    ditch ReadRawUniString

three argument lclGetString32 variant mistaken for two argument lclGetString32
variant

Change-Id: I163aad0de7873487d9f9c8b6c28d162159fe7ad4
Reviewed-on: https://gerrit.libreoffice.org/61884
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 7e3ee167
......@@ -528,14 +528,6 @@ inline OString read_uInt8_lenPrefixed_uInt8s_ToOString(SvStream& rStrm)
return read_uInt8s_ToOString(rStrm, nUnits);
}
/// Attempt to read a pascal-style length (of type prefix) prefixed sequence of
/// 8bit units to an OUString
inline OUString read_uInt32_lenPrefixed_uInt8s_ToOUString(SvStream& rStrm,
rtl_TextEncoding eEnc)
{
return OStringToOUString(read_uInt32_lenPrefixed_uInt8s_ToOString(rStrm), eEnc);
}
inline OUString read_uInt16_lenPrefixed_uInt8s_ToOUString(SvStream& rStrm,
rtl_TextEncoding eEnc)
{
......
......@@ -253,7 +253,15 @@ void SwWW8ImplReader::ReadEmbeddedData(SvStream& rStrm, SwDocShell const * pDocS
// UNC path
if( ::get_flag( nFlags, WW8_HLINK_UNC ) )
{
xLongName.reset(new OUString(read_uInt32_lenPrefixed_uInt16s_ToOUString(rStrm)));
// MS-OSHARED: An unsigned integer that specifies the number of Unicode characters in the
// string field, including the null-terminating character.
sal_uInt32 nStrLen(0);
rStrm.ReadUInt32(nStrLen);
if (nStrLen)
{
xLongName.reset(new OUString(read_uInt16s_ToOUString(rStrm, nStrLen - 1)));
rStrm.SeekRel(sizeof(sal_Unicode)); // skip null-byte at end
}
lclGetAbsPath( *xLongName, 0 , pDocShell);
}
// file link or URL
......@@ -264,7 +272,16 @@ void SwWW8ImplReader::ReadEmbeddedData(SvStream& rStrm, SwDocShell const * pDocS
if( memcmp(aGuid, aGuidFileMoniker, 16) == 0 )
{
rStrm.ReadUInt16( nLevel );
xShortName.reset(new OUString(read_uInt32_lenPrefixed_uInt8s_ToOUString(rStrm, GetCharSetFromLanguage())));
// MS-OSHARED: An unsigned integer that specifies the number of
// ANSI characters in ansiPath, including the terminating NULL character
sal_uInt32 nUnits = 0;
rStrm.ReadUInt32(nUnits);
if (nUnits)
{
OString sStr(read_uInt8s_ToOString(rStrm, nUnits - 1));
rStrm.SeekRel(sizeof(sal_uInt8)); // skip null-byte at end
xShortName.reset(new OUString(sStr.getStr(), sStr.getLength(), GetCharSetFromLanguage()));
}
rStrm.SeekRel( 24 );
sal_uInt32 nStrLen(0);
......@@ -275,7 +292,8 @@ void SwWW8ImplReader::ReadEmbeddedData(SvStream& rStrm, SwDocShell const * pDocS
rStrm.ReadUInt32( nStrLen );
nStrLen /= 2;
rStrm.SeekRel( 2 );
xLongName.reset(new OUString(read_uInt32_lenPrefixed_uInt16s_ToOUString(rStrm)));
// MS-OSHARED: This array MUST not include a terminating NULL character.
xLongName.reset(new OUString(read_uInt16s_ToOUString(rStrm, nStrLen)));
lclGetAbsPath( *xLongName, nLevel, pDocShell);
}
else
......@@ -283,10 +301,18 @@ void SwWW8ImplReader::ReadEmbeddedData(SvStream& rStrm, SwDocShell const * pDocS
}
else if( memcmp(aGuid, aGuidUrlMoniker, 16) == 0 )
{
// MS-OSHARED: An unsigned integer that specifies the size of this
// structure in bytes, excluding the size of the length field. The
// value of this field MUST be ... the byte size of the url
// field (including the terminating NULL character)
sal_uInt32 nStrLen(0);
rStrm.ReadUInt32( nStrLen );
nStrLen /= 2;
xLongName.reset(new OUString(read_uInt32_lenPrefixed_uInt16s_ToOUString(rStrm)));
if (nStrLen)
{
xLongName.reset(new OUString(read_uInt16s_ToOUString(rStrm, nStrLen - 1)));
rStrm.SeekRel(sizeof(sal_Unicode)); // skip null-byte at end
}
if( !::get_flag( nFlags, WW8_HLINK_ABS ) )
lclGetAbsPath( *xLongName, 0 ,pDocShell);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment