summaryrefslogtreecommitdiff
path: root/svx/source/xoutdev
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2018-05-18 16:26:37 +0200
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2018-05-22 06:56:18 +0200
commit57cc8b2e4f93b3a93ce9ac46a2a98eb2a799faa3 (patch)
tree2d5fb1b6a33825d20d4ef23e9ea6ed820fde99d9 /svx/source/xoutdev
parent13596e704e4b48e8b0892867b3f3fc351a2729f9 (diff)
Fix svg to base64 conversion
This reverts part of ab14a9708d2937bc767c14542610ce91b56dda1e which had a questionable fix by unconditionally removing the first 8 bytes of the svg which led to svgs starting with rsion="1.0" encoding="utf-8"?> instead of <?xml version="1.0" encoding="utf-8"?> Change-Id: I8c4d78db1794473d20ddd77019ae81b88be0bb03 Reviewed-on: https://gerrit.libreoffice.org/54550 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'svx/source/xoutdev')
-rw-r--r--svx/source/xoutdev/_xoutbmp.cxx20
1 files changed, 1 insertions, 19 deletions
diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx
index 1e57b09bfe3c..3fc0110ed9e7 100644
--- a/svx/source/xoutdev/_xoutbmp.cxx
+++ b/svx/source/xoutdev/_xoutbmp.cxx
@@ -393,25 +393,7 @@ bool XOutBitmap::GraphicToBase64(const Graphic& rGraphic, OUString& rOUString)
css::uno::Sequence<sal_Int8> aOStmSeq( static_cast<sal_Int8 const *>(aOStm.GetData()),aOStm.Tell() );
OUStringBuffer aStrBuffer;
::comphelper::Base64::encode(aStrBuffer,aOStmSeq);
- OUString aEncodedBase64Image = aStrBuffer.makeStringAndClear();
- if( aLink.GetType() == GfxLinkType::NativeSvg )
- {
- sal_Int32 ite(8);
- sal_Int32 nBufferLength(aOStmSeq.getLength());
- const sal_Int8* pBuffer = aOStmSeq.getConstArray();
- css::uno::Sequence<sal_Int8> newTempSeq = aOStmSeq; // creates new Sequence to remove front 8 bits of garbage and encodes in base64
- sal_Int8 *pOutBuffer = newTempSeq.getArray();
- while(ite < nBufferLength)
- {
- *pOutBuffer++ = pBuffer[ite];
- ite++;
- }
- ::comphelper::Base64::encode(aStrBuffer, newTempSeq);
- aEncodedBase64Image = aStrBuffer.makeStringAndClear();
- sal_Int32 SVGFixLength = aEncodedBase64Image.getLength();
- aEncodedBase64Image = aEncodedBase64Image.replaceAt(SVGFixLength - 12, SVGFixLength, "") + "PC9zdmc+Cg=="; // removes rear 12 bits of garbage and adds svg closing tag in base64
- }
- rOUString = aMimeType + ";base64," + aEncodedBase64Image;
+ rOUString = aMimeType + ";base64," + aStrBuffer.makeStringAndClear();
return true;
}