diff options
-rw-r--r-- | binfilter/bf_svtools/source/filter.vcl/wmf/svt_wmfwr.cxx | 6 | ||||
-rw-r--r-- | filter/source/pdf/impdialog.cxx | 12 | ||||
-rw-r--r-- | filter/source/pdf/impdialog.hrc | 7 | ||||
-rw-r--r-- | filter/source/pdf/impdialog.hxx | 2 | ||||
-rw-r--r-- | filter/source/pdf/impdialog.src | 15 | ||||
-rw-r--r-- | filter/source/pdf/pdfexport.cxx | 138 | ||||
-rw-r--r-- | filter/source/pdf/pdfexport.hxx | 1 | ||||
-rw-r--r-- | filter/source/svg/svgwriter.cxx | 10 | ||||
-rw-r--r-- | hwpfilter/source/cspline.cpp | 1 | ||||
-rw-r--r-- | hwpfilter/source/himgutil.cpp | 3 | ||||
-rw-r--r-- | hwpfilter/source/hwpfile.cpp | 5 | ||||
-rw-r--r-- | hwpfilter/source/hwpreader.cxx | 10 | ||||
-rw-r--r-- | hwpfilter/source/lexer.cpp | 2 |
13 files changed, 137 insertions, 75 deletions
diff --git a/binfilter/bf_svtools/source/filter.vcl/wmf/svt_wmfwr.cxx b/binfilter/bf_svtools/source/filter.vcl/wmf/svt_wmfwr.cxx index bcc51cb41..96d2ce113 100644 --- a/binfilter/bf_svtools/source/filter.vcl/wmf/svt_wmfwr.cxx +++ b/binfilter/bf_svtools/source/filter.vcl/wmf/svt_wmfwr.cxx @@ -715,7 +715,7 @@ void WMFWriter::WMFRecord_Polygon(const Polygon & rPoly) Polygon aSimplePoly; if ( rPoly.HasFlags() ) - rPoly.GetSimple( aSimplePoly ); + rPoly.AdaptiveSubdivide( aSimplePoly ); else aSimplePoly = rPoly; nSize = aSimplePoly.GetSize(); @@ -730,7 +730,7 @@ void WMFWriter::WMFRecord_PolyLine(const Polygon & rPoly) USHORT nSize,i; Polygon aSimplePoly; if ( rPoly.HasFlags() ) - rPoly.GetSimple( aSimplePoly ); + rPoly.AdaptiveSubdivide( aSimplePoly ); else aSimplePoly = rPoly; nSize=aSimplePoly.GetSize(); @@ -752,7 +752,7 @@ void WMFWriter::WMFRecord_PolyPolygon(const PolyPolygon & rPolyPoly) if ( aSimplePolyPoly[ i ].HasFlags() ) { Polygon aSimplePoly; - aSimplePolyPoly[ i ].GetSimple( aSimplePoly ); + aSimplePolyPoly[ i ].AdaptiveSubdivide( aSimplePoly ); aSimplePolyPoly[ i ] = aSimplePoly; } } diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx index dff72eb8d..c8d2c49a4 100644 --- a/filter/source/pdf/impdialog.cxx +++ b/filter/source/pdf/impdialog.cxx @@ -79,6 +79,7 @@ ImpPDFTabDialog::ImpPDFTabDialog( Window* pParent, mbIsSkipEmptyPages( sal_True ), mnFormsType( 0 ), mbExportFormFields( sal_True ), + mbAllowDuplicateFieldNames( sal_False ), mbExportBookmarks( sal_True ), mnOpenBookmarkLevels( -1 ), @@ -192,6 +193,7 @@ ImpPDFTabDialog::ImpPDFTabDialog( Window* pParent, mbExportFormFields = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportFormFields" ) ), sal_True ); if ( ( mnFormsType < 0 ) || ( mnFormsType > 3 ) ) mnFormsType = 0; + mbAllowDuplicateFieldNames = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "AllowDuplicateFieldNames" ) ), sal_False ); //prepare values for the Viewer tab page mbHideViewerToolbar = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "HideViewerToolbar" ) ), sal_False ); @@ -323,6 +325,7 @@ Sequence< PropertyValue > ImpPDFTabDialog::GetFilterData() */ maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "FormsType" ) ), mnFormsType ); maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportFormFields" ) ), mbExportFormFields ); + maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "AllowDuplicateFieldNames" ) ), mbAllowDuplicateFieldNames ); if( GetTabPage( RID_PDF_TAB_VPREFER ) ) ( ( ImpPDFTabViewerPage* )GetTabPage( RID_PDF_TAB_VPREFER ) )->GetFilterConfigItem( this ); @@ -432,6 +435,7 @@ ImpPDFTabGeneralPage::ImpPDFTabGeneralPage( Window* pParent, mbExportFormFieldsUserSelection( sal_False ), maFtFormsFormat( this, ResId( FT_FORMSFORMAT, *paResMgr ) ), maLbFormsFormat( this, ResId( LB_FORMSFORMAT, *paResMgr ) ), + maCbAllowDuplicateFieldNames( this, ResId( CB_ALLOWDUPLICATEFIELDNAMES, *paResMgr ) ), maCbExportBookmarks( this, ResId( CB_EXPORTBOOKMARKS, *paResMgr ) ), maCbExportNotes( this, ResId( CB_EXPORTNOTES, *paResMgr ) ), @@ -531,7 +535,9 @@ void ImpPDFTabGeneralPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent maLbFormsFormat.SelectEntryPos( (sal_uInt16)paParent->mnFormsType ); maLbFormsFormat.Enable( paParent->mbExportFormFields ); - + maCbAllowDuplicateFieldNames.Check( paParent->mbAllowDuplicateFieldNames ); + maCbAllowDuplicateFieldNames.Enable( paParent->mbExportFormFields ); + if ( mbIsPresentation ) maCbExportNotes.Check( paParent->mbExportNotesBoth ); else @@ -605,6 +611,7 @@ void ImpPDFTabGeneralPage::GetFilterConfigItem( ImpPDFTabDialog* paParent ) * ever be an additional form submit format this could get invalid. */ paParent->mnFormsType = (sal_Int32) maLbFormsFormat.GetSelectEntryPos(); + paParent->mbAllowDuplicateFieldNames = maCbAllowDuplicateFieldNames.IsChecked(); } // ----------------------------------------------------------------------------- @@ -628,6 +635,7 @@ IMPL_LINK( ImpPDFTabGeneralPage, TogglePagesHdl, void*, EMPTYARG ) IMPL_LINK( ImpPDFTabGeneralPage, ToggleExportFormFieldsHdl, void*, EMPTYARG ) { maLbFormsFormat.Enable( maCbExportFormFields.IsChecked() ); + maCbAllowDuplicateFieldNames.Enable( maCbExportFormFields.IsChecked() ); return 0; } @@ -680,6 +688,7 @@ IMPL_LINK( ImpPDFTabGeneralPage, ToggleExportPDFAHdl, void*, EMPTYARG ) sal_Bool bPDFA1Sel = maCbPDFA1b.IsChecked(); maFtFormsFormat.Enable( !bPDFA1Sel ); maLbFormsFormat.Enable( !bPDFA1Sel ); + maCbAllowDuplicateFieldNames.Enable( !bPDFA1Sel ); if(bPDFA1Sel) { //store the values of subordinate controls @@ -1165,6 +1174,7 @@ void ImpPDFTabSecurityPage::ImplPwdPushButton( const String & i_rDlgTitle, Strin aPwdDialog.SetMinLen( 0 ); aPwdDialog.ShowExtras( SHOWEXTRAS_CONFIRM ); aPwdDialog.SetText( i_rDlgTitle ); + aPwdDialog.AllowAsciiOnly(); if( aPwdDialog.Execute() == RET_OK ) //OK issued get password and set it io_rDestPassword = aPwdDialog.GetPassword(); enablePermissionControls(); diff --git a/filter/source/pdf/impdialog.hrc b/filter/source/pdf/impdialog.hrc index 8eb652dc9..5f0fa073c 100644 --- a/filter/source/pdf/impdialog.hrc +++ b/filter/source/pdf/impdialog.hrc @@ -83,10 +83,11 @@ #define CB_EXPORTFORMFIELDS 20 #define FT_FORMSFORMAT 21 #define LB_FORMSFORMAT 22 -#define CB_EXPORTEMPTYPAGES 23 -#define CB_ADDSTREAM 24 +#define CB_ALLOWDUPLICATEFIELDNAMES 23 +#define CB_EXPORTEMPTYPAGES 24 +#define CB_ADDSTREAM 25 -#define CB_PDFA_1B_SELECT 25 +#define CB_PDFA_1B_SELECT 26 #define FL_OLD_PAGES 51 #define RB_OLD_ALL 52 diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx index 0d19c7b93..51e2eb81e 100644 --- a/filter/source/pdf/impdialog.hxx +++ b/filter/source/pdf/impdialog.hxx @@ -103,6 +103,7 @@ protected: sal_Bool mbAddStream; sal_Int32 mnFormsType; sal_Bool mbExportFormFields; + sal_Bool mbAllowDuplicateFieldNames; sal_Bool mbExportBookmarks; sal_Int32 mnOpenBookmarkLevels; @@ -192,6 +193,7 @@ class ImpPDFTabGeneralPage : public SfxTabPage sal_Bool mbExportFormFieldsUserSelection; FixedText maFtFormsFormat; ListBox maLbFormsFormat; + CheckBox maCbAllowDuplicateFieldNames; CheckBox maCbExportBookmarks; CheckBox maCbExportNotes; diff --git a/filter/source/pdf/impdialog.src b/filter/source/pdf/impdialog.src index 50e00438e..3e5dd3b1b 100644 --- a/filter/source/pdf/impdialog.src +++ b/filter/source/pdf/impdialog.src @@ -196,23 +196,30 @@ TabPage RID_PDF_TAB_GENER < "XML" ; > ; }; }; + CheckBox CB_ALLOWDUPLICATEFIELDNAMES + { + Pos = MAP_APPFONT( 30, 178 ); + Size = MAP_APPFONT( 128, 10 ); + TabStop = TRUE; + Text [ en-US ] = "Allow duplicate field ~names"; + }; CheckBox CB_EXPORTBOOKMARKS { - Pos = MAP_APPFONT ( 12 , 180 ) ; + Pos = MAP_APPFONT ( 12 , 190 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; TabStop = TRUE ; Text[ en-US ] = "Export ~bookmarks"; }; CheckBox CB_EXPORTNOTES { - Pos = MAP_APPFONT ( 12 , 193 ) ; + Pos = MAP_APPFONT ( 12 , 203 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; TabStop = TRUE ; Text[ en-US ] = "~Export comments"; }; CheckBox CB_EXPORTEMPTYPAGES { - Pos = MAP_APPFONT ( 12 , 206 ) ; + Pos = MAP_APPFONT ( 12 , 216 ) ; Size = MAP_APPFONT ( 158 , 16 ) ; TabStop = TRUE ; WordBreak = TRUE ; @@ -220,7 +227,7 @@ TabPage RID_PDF_TAB_GENER }; CheckBox CB_ADDSTREAM { - Pos = MAP_APPFONT ( 12 , 224 ) ; + Pos = MAP_APPFONT ( 12 , 235 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; TabStop = TRUE ; Text[ en-US ] = "Create ~hybrid file"; diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx index 8b45d4f98..816f3fcbc 100644 --- a/filter/source/pdf/pdfexport.cxx +++ b/filter/source/pdf/pdfexport.cxx @@ -131,6 +131,7 @@ PDFExport::PDFExport( const Reference< XComponent >& rxSrcDoc, Reference< task:: mnQuality ( 90 ), mnFormsFormat ( 0 ), mbExportFormFields ( sal_True ), + mbAllowDuplicateFieldNames ( sal_False ), mnProgressValue ( 0 ), mbRemoveTransparencies ( sal_False ), mbWatermark ( sal_False ), @@ -462,6 +463,8 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue rFilterData[ nData ].Value >>= mbExportFormFields; else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "FormsType" ) ) ) rFilterData[ nData ].Value >>= mnFormsFormat; + else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "AllowDuplicateFieldNames" ) ) ) + rFilterData[ nData ].Value >>= mbAllowDuplicateFieldNames; //viewer properties else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "HideViewerToolbar" ) ) ) rFilterData[ nData ].Value >>= mbHideViewerToolbar; @@ -707,6 +710,7 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue aContext.SubmitFormat = PDFWriter::FDF; break; } + aContext.AllowDuplicateFieldNames = mbAllowDuplicateFieldNames; //get model Reference< frame::XModel > xModel( mxSrcDoc, UNO_QUERY ); @@ -1208,72 +1212,84 @@ sal_Bool PDFExport::ImplWriteActions( PDFWriter& rWriter, PDFExtOutDevData* pPDF const Point& rPos = pA->GetPoint(); const Size& rSize= pA->GetSize(); const Gradient& rTransparenceGradient = pA->GetGradient(); - - const Size aDstSizeTwip( rDummyVDev.PixelToLogic( rDummyVDev.LogicToPixel( rSize ), MAP_TWIP ) ); - sal_Int32 nMaxBmpDPI = mbUseLosslessCompression ? 300 : 72; - if ( mbReduceImageResolution ) + + // special case constant alpha value + if( rTransparenceGradient.GetStartColor() == rTransparenceGradient.GetEndColor() ) { - if ( nMaxBmpDPI > mnMaxImageResolution ) - nMaxBmpDPI = mnMaxImageResolution; + const Color aTransCol( rTransparenceGradient.GetStartColor() ); + const USHORT nTransPercent = aTransCol.GetLuminance() * 100 / 255; + rWriter.BeginTransparencyGroup(); + ImplWriteActions( rWriter, NULL, aTmpMtf, rDummyVDev ); + rWriter.EndTransparencyGroup( Rectangle( rPos, rSize ), nTransPercent ); } - const sal_Int32 nPixelX = (sal_Int32)((double)aDstSizeTwip.Width() * (double)nMaxBmpDPI / 1440.0); - const sal_Int32 nPixelY = (sal_Int32)((double)aDstSizeTwip.Height() * (double)nMaxBmpDPI / 1440.0); - if ( nPixelX && nPixelY ) + else { - Size aDstSizePixel( nPixelX, nPixelY ); - VirtualDevice* pVDev = new VirtualDevice; - if( pVDev->SetOutputSizePixel( aDstSizePixel ) ) + const Size aDstSizeTwip( rDummyVDev.PixelToLogic( rDummyVDev.LogicToPixel( rSize ), MAP_TWIP ) ); + sal_Int32 nMaxBmpDPI = mbUseLosslessCompression ? 300 : 72; + if ( mbReduceImageResolution ) + { + if ( nMaxBmpDPI > mnMaxImageResolution ) + nMaxBmpDPI = mnMaxImageResolution; + } + const sal_Int32 nPixelX = (sal_Int32)((double)aDstSizeTwip.Width() * (double)nMaxBmpDPI / 1440.0); + const sal_Int32 nPixelY = (sal_Int32)((double)aDstSizeTwip.Height() * (double)nMaxBmpDPI / 1440.0); + if ( nPixelX && nPixelY ) { - Bitmap aPaint, aMask; - AlphaMask aAlpha; - Point aPoint; - - MapMode aMapMode( rDummyVDev.GetMapMode() ); - aMapMode.SetOrigin( aPoint ); - pVDev->SetMapMode( aMapMode ); - Size aDstSize( pVDev->PixelToLogic( aDstSizePixel ) ); - - Point aMtfOrigin( aTmpMtf.GetPrefMapMode().GetOrigin() ); - if ( aMtfOrigin.X() || aMtfOrigin.Y() ) - aTmpMtf.Move( -aMtfOrigin.X(), -aMtfOrigin.Y() ); - double fScaleX = (double)aDstSize.Width() / (double)aTmpMtf.GetPrefSize().Width(); - double fScaleY = (double)aDstSize.Height() / (double)aTmpMtf.GetPrefSize().Height(); - if( fScaleX != 1.0 || fScaleY != 1.0 ) - aTmpMtf.Scale( fScaleX, fScaleY ); - aTmpMtf.SetPrefMapMode( aMapMode ); - - // create paint bitmap - aTmpMtf.WindStart(); - aTmpMtf.Play( pVDev, aPoint, aDstSize ); - aTmpMtf.WindStart(); - - pVDev->EnableMapMode( FALSE ); - aPaint = pVDev->GetBitmap( aPoint, aDstSizePixel ); - pVDev->EnableMapMode( TRUE ); - - // create mask bitmap - pVDev->SetLineColor( COL_BLACK ); - pVDev->SetFillColor( COL_BLACK ); - pVDev->DrawRect( Rectangle( aPoint, aDstSize ) ); - pVDev->SetDrawMode( DRAWMODE_WHITELINE | DRAWMODE_WHITEFILL | DRAWMODE_WHITETEXT | - DRAWMODE_WHITEBITMAP | DRAWMODE_WHITEGRADIENT ); - aTmpMtf.WindStart(); - aTmpMtf.Play( pVDev, aPoint, aDstSize ); - aTmpMtf.WindStart(); - pVDev->EnableMapMode( FALSE ); - aMask = pVDev->GetBitmap( aPoint, aDstSizePixel ); - pVDev->EnableMapMode( TRUE ); - - // create alpha mask from gradient - pVDev->SetDrawMode( DRAWMODE_GRAYGRADIENT ); - pVDev->DrawGradient( Rectangle( aPoint, aDstSize ), rTransparenceGradient ); - pVDev->SetDrawMode( DRAWMODE_DEFAULT ); - pVDev->EnableMapMode( FALSE ); - pVDev->DrawMask( aPoint, aDstSizePixel, aMask, Color( COL_WHITE ) ); - aAlpha = pVDev->GetBitmap( aPoint, aDstSizePixel ); - ImplWriteBitmapEx( rWriter, rDummyVDev, rPos, rSize, BitmapEx( aPaint, aAlpha ) ); + Size aDstSizePixel( nPixelX, nPixelY ); + VirtualDevice* pVDev = new VirtualDevice; + if( pVDev->SetOutputSizePixel( aDstSizePixel ) ) + { + Bitmap aPaint, aMask; + AlphaMask aAlpha; + Point aPoint; + + MapMode aMapMode( rDummyVDev.GetMapMode() ); + aMapMode.SetOrigin( aPoint ); + pVDev->SetMapMode( aMapMode ); + Size aDstSize( pVDev->PixelToLogic( aDstSizePixel ) ); + + Point aMtfOrigin( aTmpMtf.GetPrefMapMode().GetOrigin() ); + if ( aMtfOrigin.X() || aMtfOrigin.Y() ) + aTmpMtf.Move( -aMtfOrigin.X(), -aMtfOrigin.Y() ); + double fScaleX = (double)aDstSize.Width() / (double)aTmpMtf.GetPrefSize().Width(); + double fScaleY = (double)aDstSize.Height() / (double)aTmpMtf.GetPrefSize().Height(); + if( fScaleX != 1.0 || fScaleY != 1.0 ) + aTmpMtf.Scale( fScaleX, fScaleY ); + aTmpMtf.SetPrefMapMode( aMapMode ); + + // create paint bitmap + aTmpMtf.WindStart(); + aTmpMtf.Play( pVDev, aPoint, aDstSize ); + aTmpMtf.WindStart(); + + pVDev->EnableMapMode( FALSE ); + aPaint = pVDev->GetBitmap( aPoint, aDstSizePixel ); + pVDev->EnableMapMode( TRUE ); + + // create mask bitmap + pVDev->SetLineColor( COL_BLACK ); + pVDev->SetFillColor( COL_BLACK ); + pVDev->DrawRect( Rectangle( aPoint, aDstSize ) ); + pVDev->SetDrawMode( DRAWMODE_WHITELINE | DRAWMODE_WHITEFILL | DRAWMODE_WHITETEXT | + DRAWMODE_WHITEBITMAP | DRAWMODE_WHITEGRADIENT ); + aTmpMtf.WindStart(); + aTmpMtf.Play( pVDev, aPoint, aDstSize ); + aTmpMtf.WindStart(); + pVDev->EnableMapMode( FALSE ); + aMask = pVDev->GetBitmap( aPoint, aDstSizePixel ); + pVDev->EnableMapMode( TRUE ); + + // create alpha mask from gradient + pVDev->SetDrawMode( DRAWMODE_GRAYGRADIENT ); + pVDev->DrawGradient( Rectangle( aPoint, aDstSize ), rTransparenceGradient ); + pVDev->SetDrawMode( DRAWMODE_DEFAULT ); + pVDev->EnableMapMode( FALSE ); + pVDev->DrawMask( aPoint, aDstSizePixel, aMask, Color( COL_WHITE ) ); + aAlpha = pVDev->GetBitmap( aPoint, aDstSizePixel ); + ImplWriteBitmapEx( rWriter, rDummyVDev, rPos, rSize, BitmapEx( aPaint, aAlpha ) ); + } + delete pVDev; } - delete pVDev; } } break; diff --git a/filter/source/pdf/pdfexport.hxx b/filter/source/pdf/pdfexport.hxx index 497730605..b5f24cf4a 100644 --- a/filter/source/pdf/pdfexport.hxx +++ b/filter/source/pdf/pdfexport.hxx @@ -77,6 +77,7 @@ private: sal_Int32 mnQuality; sal_Int32 mnFormsFormat; sal_Bool mbExportFormFields; + sal_Bool mbAllowDuplicateFieldNames; sal_Int32 mnProgressValue; sal_Bool mbRemoveTransparencies; diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx index f97cc2162..764553bdf 100644 --- a/filter/source/svg/svgwriter.cxx +++ b/filter/source/svg/svgwriter.cxx @@ -620,7 +620,15 @@ void SVGActionWriter::ImplWritePolyPolygon( const PolyPolygon& rPolyPoly, sal_Bo { const Polygon& rPoly = rPolyPoly[ i ]; const USHORT nSize = rPoly.GetSize(); - Polygon aMappedPoly( nSize ); + + // #i102224# congratulations, this throws away the curve flags + // and makes ANY curved polygon look bad. The Flags HAVE to be + // copied, too. It's NOT enough to copy the mapped points. Just + // copy the original polygon completely and REPLACE the points + + // old: Polygon aMappedPoly( nSize ); + // new: + Polygon aMappedPoly(rPoly); for( USHORT n = 0; n < nSize; n++ ) aMappedPoly[ n ] = ImplMap( rPoly[ n ] ); diff --git a/hwpfilter/source/cspline.cpp b/hwpfilter/source/cspline.cpp index 4423f94f4..2d16c30e8 100644 --- a/hwpfilter/source/cspline.cpp +++ b/hwpfilter/source/cspline.cpp @@ -171,5 +171,6 @@ void PeriodicSpline (int N, double* x, double* a, double*& b, double*& c, d[i] = oneThird*(c[i+1]-c[i])/h[i]; } + delete[] h; sys.DeleteMatrix(N+1,mat); } diff --git a/hwpfilter/source/himgutil.cpp b/hwpfilter/source/himgutil.cpp index 932463203..0e2cc2c39 100644 --- a/hwpfilter/source/himgutil.cpp +++ b/hwpfilter/source/himgutil.cpp @@ -106,7 +106,8 @@ const char *GetEmbImgname(const EmPicture * empic) char *ptr; const char *ext; - tmpnam(fname); + if (tmpnam(fname) == NULL) + return NULL; if (!empic || !empic->name[0] || (0 == (ptr = strrchr(fname, DIRSEP)))) return NULL; switch (ImageMagicType((uchar *) empic->data)) diff --git a/hwpfilter/source/hwpfile.cpp b/hwpfilter/source/hwpfile.cpp index a33a68135..cdd5cef7d 100644 --- a/hwpfilter/source/hwpfile.cpp +++ b/hwpfilter/source/hwpfile.cpp @@ -72,6 +72,9 @@ HWPFile::HWPFile(void) */ HWPFile::~HWPFile(void) { + if (oledata) + delete oledata; + if (hiodev) delete hiodev; @@ -345,6 +348,8 @@ bool HWPFile::TagsRead(void) } break; case FILETAG_OLE_OBJECT: + if (oledata) + delete oledata; oledata = new OlePicture(size); oledata->Read(*this); break; diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx index 530a72c12..f561a475f 100644 --- a/hwpfilter/source/hwpreader.cxx +++ b/hwpfilter/source/hwpreader.cxx @@ -4476,10 +4476,20 @@ void HwpReader::makePictureDRAW(HWPDrawingObject *drawobj, Picture * hbox) if( bIsNatural == sal_False ){ PeriodicSpline(n, tarr, xarr, xb, carr, darr); + // prevent memory leak + delete[] carr; + carr = 0; + delete[] darr; + darr = 0; PeriodicSpline(n, tarr, yarr, yb, carr, darr); } else{ NaturalSpline(n, tarr, xarr, xb, carr, darr); + // prevent memory leak + delete[] carr; + carr = 0; + delete[] darr; + darr = 0; NaturalSpline(n, tarr, yarr, yb, carr, darr); } diff --git a/hwpfilter/source/lexer.cpp b/hwpfilter/source/lexer.cpp index 3c75116ef..34a9e0886 100644 --- a/hwpfilter/source/lexer.cpp +++ b/hwpfilter/source/lexer.cpp @@ -1126,7 +1126,7 @@ YY_MALLOC_DECL /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) +#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, |