Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
8f7c677d
Kaydet (Commit)
8f7c677d
authored
Nis 02, 2014
tarafından
Takeshi Abe
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Avoid possible resource leaks by boost::scoped_array
Change-Id: Ibf92b3098c50388d8b6d27f4476e613a1f8918b5
üst
7fcab08f
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
53 additions
and
65 deletions
+53
-65
olecomponent.cxx
embeddedobj/source/msole/olecomponent.cxx
+18
-19
xplugin.cxx
extensions/source/plugin/base/xplugin.cxx
+5
-4
mediator.cxx
extensions/source/plugin/unx/mediator.cxx
+6
-7
formcomponenthandler.cxx
extensions/source/propctrlr/formcomponenthandler.cxx
+2
-2
grid.cxx
extensions/source/scanner/grid.cxx
+4
-6
sane.cxx
extensions/source/scanner/sane.cxx
+13
-20
sanedlg.cxx
extensions/source/scanner/sanedlg.cxx
+5
-7
No files found.
embeddedobj/source/msole/olecomponent.cxx
Dosyayı görüntüle @
8f7c677d
...
@@ -40,6 +40,7 @@
...
@@ -40,6 +40,7 @@
#include <advisesink.hxx>
#include <advisesink.hxx>
#include <oleembobj.hxx>
#include <oleembobj.hxx>
#include <mtnotification.hxx>
#include <mtnotification.hxx>
#include <boost/scoped_array.hpp>
using
namespace
::
com
::
sun
::
star
;
using
namespace
::
com
::
sun
::
star
;
using
namespace
::
comphelper
;
using
namespace
::
comphelper
;
...
@@ -286,7 +287,7 @@ sal_Bool OleComponentNative_Impl::ConvertDataForFlavor( const STGMEDIUM& aMedium
...
@@ -286,7 +287,7 @@ sal_Bool OleComponentNative_Impl::ConvertDataForFlavor( const STGMEDIUM& aMedium
{
{
// first the GDI-metafile must be generated
// first the GDI-metafile must be generated
unsigned
char
*
pBuf
=
NULL
;
boost
::
scoped_array
<
unsigned
char
>
pBuf
;
sal_uInt32
nBufSize
=
0
;
sal_uInt32
nBufSize
=
0
;
OUString
aFormat
;
OUString
aFormat
;
...
@@ -297,23 +298,23 @@ sal_Bool OleComponentNative_Impl::ConvertDataForFlavor( const STGMEDIUM& aMedium
...
@@ -297,23 +298,23 @@ sal_Bool OleComponentNative_Impl::ConvertDataForFlavor( const STGMEDIUM& aMedium
if
(
pMF
)
if
(
pMF
)
{
{
nBufSize
=
GetMetaFileBitsEx
(
pMF
->
hMF
,
0
,
NULL
)
+
22
;
nBufSize
=
GetMetaFileBitsEx
(
pMF
->
hMF
,
0
,
NULL
)
+
22
;
pBuf
=
new
unsigned
char
[
nBufSize
]
;
pBuf
.
reset
(
new
unsigned
char
[
nBufSize
])
;
// TODO/LATER: the unit size must be calculated correctly
// TODO/LATER: the unit size must be calculated correctly
*
(
(
long
*
)
pBuf
)
=
0x9ac6cdd7L
;
*
(
(
long
*
)
pBuf
.
get
()
)
=
0x9ac6cdd7L
;
*
(
(
short
*
)(
pBuf
+
6
))
=
(
SHORT
)
0
;
*
(
(
short
*
)(
pBuf
.
get
()
+
6
))
=
(
SHORT
)
0
;
*
(
(
short
*
)(
pBuf
+
8
))
=
(
SHORT
)
0
;
*
(
(
short
*
)(
pBuf
.
get
()
+
8
))
=
(
SHORT
)
0
;
*
(
(
short
*
)(
pBuf
+
10
))
=
(
SHORT
)
pMF
->
xExt
;
*
(
(
short
*
)(
pBuf
.
get
()
+
10
))
=
(
SHORT
)
pMF
->
xExt
;
*
(
(
short
*
)(
pBuf
+
12
))
=
(
SHORT
)
pMF
->
yExt
;
*
(
(
short
*
)(
pBuf
.
get
()
+
12
))
=
(
SHORT
)
pMF
->
yExt
;
*
(
(
short
*
)(
pBuf
+
14
))
=
(
USHORT
)
2540
;
*
(
(
short
*
)(
pBuf
.
get
()
+
14
))
=
(
USHORT
)
2540
;
if
(
nBufSize
&&
nBufSize
==
GetMetaFileBitsEx
(
pMF
->
hMF
,
nBufSize
-
22
,
pBuf
+
22
)
)
if
(
nBufSize
&&
nBufSize
==
GetMetaFileBitsEx
(
pMF
->
hMF
,
nBufSize
-
22
,
pBuf
.
get
()
+
22
)
)
{
{
if
(
aFlavor
.
MimeType
.
matchAsciiL
(
"application/x-openoffice-wmf;windows_formatname=
\"
Image WMF
\"
"
,
57
)
)
if
(
aFlavor
.
MimeType
.
matchAsciiL
(
"application/x-openoffice-wmf;windows_formatname=
\"
Image WMF
\"
"
,
57
)
)
{
{
aResult
<<=
uno
::
Sequence
<
sal_Int8
>
(
(
sal_Int8
*
)
pBuf
,
nBufSize
);
aResult
<<=
uno
::
Sequence
<
sal_Int8
>
(
(
sal_Int8
*
)
pBuf
.
get
()
,
nBufSize
);
bAnyIsReady
=
sal_True
;
bAnyIsReady
=
sal_True
;
}
}
}
}
...
@@ -325,12 +326,12 @@ sal_Bool OleComponentNative_Impl::ConvertDataForFlavor( const STGMEDIUM& aMedium
...
@@ -325,12 +326,12 @@ sal_Bool OleComponentNative_Impl::ConvertDataForFlavor( const STGMEDIUM& aMedium
{
{
aFormat
=
"image/x-emf"
;
aFormat
=
"image/x-emf"
;
nBufSize
=
GetEnhMetaFileBits
(
aMedium
.
hEnhMetaFile
,
0
,
NULL
);
nBufSize
=
GetEnhMetaFileBits
(
aMedium
.
hEnhMetaFile
,
0
,
NULL
);
pBuf
=
new
unsigned
char
[
nBufSize
]
;
pBuf
.
reset
(
new
unsigned
char
[
nBufSize
])
;
if
(
nBufSize
&&
nBufSize
==
GetEnhMetaFileBits
(
aMedium
.
hEnhMetaFile
,
nBufSize
,
pBuf
)
)
if
(
nBufSize
&&
nBufSize
==
GetEnhMetaFileBits
(
aMedium
.
hEnhMetaFile
,
nBufSize
,
pBuf
.
get
()
)
)
{
{
if
(
aFlavor
.
MimeType
.
matchAsciiL
(
"application/x-openoffice-emf;windows_formatname=
\"
Image EMF
\"
"
,
57
)
)
if
(
aFlavor
.
MimeType
.
matchAsciiL
(
"application/x-openoffice-emf;windows_formatname=
\"
Image EMF
\"
"
,
57
)
)
{
{
aResult
<<=
uno
::
Sequence
<
sal_Int8
>
(
(
sal_Int8
*
)
pBuf
,
nBufSize
);
aResult
<<=
uno
::
Sequence
<
sal_Int8
>
(
(
sal_Int8
*
)
pBuf
.
get
()
,
nBufSize
);
bAnyIsReady
=
sal_True
;
bAnyIsReady
=
sal_True
;
}
}
}
}
...
@@ -339,12 +340,12 @@ sal_Bool OleComponentNative_Impl::ConvertDataForFlavor( const STGMEDIUM& aMedium
...
@@ -339,12 +340,12 @@ sal_Bool OleComponentNative_Impl::ConvertDataForFlavor( const STGMEDIUM& aMedium
{
{
aFormat
=
"image/x-MS-bmp"
;
aFormat
=
"image/x-MS-bmp"
;
nBufSize
=
GetBitmapBits
(
aMedium
.
hBitmap
,
0
,
NULL
);
nBufSize
=
GetBitmapBits
(
aMedium
.
hBitmap
,
0
,
NULL
);
pBuf
=
new
unsigned
char
[
nBufSize
]
;
pBuf
.
reset
(
new
unsigned
char
[
nBufSize
])
;
if
(
nBufSize
&&
nBufSize
==
sal
::
static_int_cast
<
ULONG
>
(
GetBitmapBits
(
aMedium
.
hBitmap
,
nBufSize
,
pBuf
)
)
)
if
(
nBufSize
&&
nBufSize
==
sal
::
static_int_cast
<
ULONG
>
(
GetBitmapBits
(
aMedium
.
hBitmap
,
nBufSize
,
pBuf
.
get
()
)
)
)
{
{
if
(
aFlavor
.
MimeType
.
matchAsciiL
(
"application/x-openoffice-bitmap;windows_formatname=
\"
Bitmap
\"
"
,
54
)
)
if
(
aFlavor
.
MimeType
.
matchAsciiL
(
"application/x-openoffice-bitmap;windows_formatname=
\"
Bitmap
\"
"
,
54
)
)
{
{
aResult
<<=
uno
::
Sequence
<
sal_Int8
>
(
(
sal_Int8
*
)
pBuf
,
nBufSize
);
aResult
<<=
uno
::
Sequence
<
sal_Int8
>
(
(
sal_Int8
*
)
pBuf
.
get
()
,
nBufSize
);
bAnyIsReady
=
sal_True
;
bAnyIsReady
=
sal_True
;
}
}
}
}
...
@@ -357,12 +358,10 @@ sal_Bool OleComponentNative_Impl::ConvertDataForFlavor( const STGMEDIUM& aMedium
...
@@ -357,12 +358,10 @@ sal_Bool OleComponentNative_Impl::ConvertDataForFlavor( const STGMEDIUM& aMedium
&&
aFlavor
.
DataType
==
m_aSupportedGraphFormats
[
nInd
].
DataType
&&
aFlavor
.
DataType
==
m_aSupportedGraphFormats
[
nInd
].
DataType
&&
aFlavor
.
DataType
==
getCppuType
(
(
const
uno
::
Sequence
<
sal_Int8
>*
)
0
)
)
&&
aFlavor
.
DataType
==
getCppuType
(
(
const
uno
::
Sequence
<
sal_Int8
>*
)
0
)
)
{
{
bAnyIsReady
=
ConvertBufferToFormat
(
(
void
*
)
pBuf
,
nBufSize
,
aFormat
,
aResult
);
bAnyIsReady
=
ConvertBufferToFormat
(
(
void
*
)
pBuf
.
get
()
,
nBufSize
,
aFormat
,
aResult
);
break
;
break
;
}
}
}
}
delete
[]
pBuf
;
}
}
return
bAnyIsReady
;
return
bAnyIsReady
;
...
...
extensions/source/plugin/base/xplugin.cxx
Dosyayı görüntüle @
8f7c677d
...
@@ -60,6 +60,8 @@
...
@@ -60,6 +60,8 @@
#include <stdio.h>
#include <stdio.h>
#endif
#endif
#include <boost/scoped_array.hpp>
using
namespace
com
::
sun
::
star
;
using
namespace
com
::
sun
::
star
;
using
namespace
com
::
sun
::
star
::
io
;
using
namespace
com
::
sun
::
star
::
io
;
using
namespace
com
::
sun
::
star
::
beans
;
using
namespace
com
::
sun
::
star
::
beans
;
...
@@ -1085,21 +1087,20 @@ void PluginInputStream::writeBytes( const Sequence<sal_Int8>& Buffer ) throw(std
...
@@ -1085,21 +1087,20 @@ void PluginInputStream::writeBytes( const Sequence<sal_Int8>& Buffer ) throw(std
{
{
nBytes
=
(
nBytes
>
nPos
-
m_nWritePos
)
?
nPos
-
m_nWritePos
:
nBytes
;
nBytes
=
(
nBytes
>
nPos
-
m_nWritePos
)
?
nPos
-
m_nWritePos
:
nBytes
;
char
*
pBuffer
=
new
char
[
nBytes
]
;
boost
::
scoped_array
<
char
>
pBuffer
(
new
char
[
nBytes
])
;
m_aFileStream
.
Seek
(
m_nWritePos
);
m_aFileStream
.
Seek
(
m_nWritePos
);
nBytes
=
m_aFileStream
.
Read
(
pBuffer
,
nBytes
);
nBytes
=
m_aFileStream
.
Read
(
pBuffer
.
get
()
,
nBytes
);
int32_t
nBytesRead
=
0
;
int32_t
nBytesRead
=
0
;
try
try
{
{
nBytesRead
=
m_pPlugin
->
getPluginComm
()
->
NPP_Write
(
nBytesRead
=
m_pPlugin
->
getPluginComm
()
->
NPP_Write
(
m_pPlugin
->
getNPPInstance
(),
&
m_aNPStream
,
m_nWritePos
,
nBytes
,
pBuffer
);
m_pPlugin
->
getNPPInstance
(),
&
m_aNPStream
,
m_nWritePos
,
nBytes
,
pBuffer
.
get
()
);
}
}
catch
(
...
)
catch
(
...
)
{
{
nBytesRead
=
0
;
nBytesRead
=
0
;
}
}
delete
[]
pBuffer
;
if
(
nBytesRead
<
0
)
if
(
nBytesRead
<
0
)
{
{
...
...
extensions/source/plugin/unx/mediator.cxx
Dosyayı görüntüle @
8f7c677d
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
#include <plugin/unx/mediator.hxx>
#include <plugin/unx/mediator.hxx>
#include <sal/log.hxx>
#include <sal/log.hxx>
#include <vcl/svapp.hxx>
#include <vcl/svapp.hxx>
#include <boost/scoped_array.hpp>
#define MEDIATOR_MAGIC 0xf7a8d2f4
#define MEDIATOR_MAGIC 0xf7a8d2f4
...
@@ -93,15 +94,14 @@ sal_uLong Mediator::SendMessage( sal_uLong nBytes, const char* pBytes, sal_uLong
...
@@ -93,15 +94,14 @@ sal_uLong Mediator::SendMessage( sal_uLong nBytes, const char* pBytes, sal_uLong
if
(
!
m_bValid
)
if
(
!
m_bValid
)
return
nMessageID
;
return
nMessageID
;
sal_uLong
*
pBuffer
=
new
sal_uLong
[
(
nBytes
/
sizeof
(
sal_uLong
))
+
4
]
;
boost
::
scoped_array
<
sal_uLong
>
pBuffer
(
new
sal_uLong
[
(
nBytes
/
sizeof
(
sal_uLong
))
+
4
])
;
pBuffer
[
0
]
=
nMessageID
;
pBuffer
[
0
]
=
nMessageID
;
pBuffer
[
1
]
=
nBytes
;
pBuffer
[
1
]
=
nBytes
;
pBuffer
[
2
]
=
MEDIATOR_MAGIC
;
pBuffer
[
2
]
=
MEDIATOR_MAGIC
;
memcpy
(
&
pBuffer
[
3
],
pBytes
,
(
size_t
)
nBytes
);
memcpy
(
&
pBuffer
[
3
],
pBytes
,
(
size_t
)
nBytes
);
ssize_t
nToWrite
=
nBytes
+
3
*
sizeof
(
sal_uLong
);
ssize_t
nToWrite
=
nBytes
+
3
*
sizeof
(
sal_uLong
);
bool
bSuccess
=
(
nToWrite
==
write
(
m_nSocket
,
pBuffer
,
nToWrite
));
bool
bSuccess
=
(
nToWrite
==
write
(
m_nSocket
,
pBuffer
.
get
()
,
nToWrite
));
SAL_WARN_IF
(
!
bSuccess
,
"extensions.plugin"
,
"short write"
);
SAL_WARN_IF
(
!
bSuccess
,
"extensions.plugin"
,
"short write"
);
delete
[]
pBuffer
;
return
nMessageID
;
return
nMessageID
;
}
}
...
@@ -206,15 +206,15 @@ void MediatorListener::run()
...
@@ -206,15 +206,15 @@ void MediatorListener::run()
{
{
if
(
nHeader
[
0
]
==
0
&&
nHeader
[
1
]
==
0
)
if
(
nHeader
[
0
]
==
0
&&
nHeader
[
1
]
==
0
)
return
;
return
;
char
*
pBuffer
=
new
char
[
nHeader
[
1
]
]
;
boost
::
scoped_array
<
char
>
pBuffer
(
new
char
[
nHeader
[
1
]
])
;
if
(
m_pMediator
&&
(
sal_uLong
)
read
(
m_pMediator
->
m_nSocket
,
pBuffer
,
nHeader
[
1
]
)
==
nHeader
[
1
]
)
if
(
m_pMediator
&&
(
sal_uLong
)
read
(
m_pMediator
->
m_nSocket
,
pBuffer
.
get
()
,
nHeader
[
1
]
)
==
nHeader
[
1
]
)
{
{
::
osl
::
MutexGuard
aMyGuard
(
m_aMutex
);
::
osl
::
MutexGuard
aMyGuard
(
m_aMutex
);
{
{
osl
::
MutexGuard
osl
::
MutexGuard
aGuard
(
m_pMediator
->
m_aQueueMutex
);
aGuard
(
m_pMediator
->
m_aQueueMutex
);
MediatorMessage
*
pMessage
=
MediatorMessage
*
pMessage
=
new
MediatorMessage
(
nHeader
[
0
],
nHeader
[
1
],
pBuffer
);
new
MediatorMessage
(
nHeader
[
0
],
nHeader
[
1
],
pBuffer
.
get
()
);
m_pMediator
->
m_aMessageQueue
.
push_back
(
pMessage
);
m_pMediator
->
m_aMessageQueue
.
push_back
(
pMessage
);
}
}
m_pMediator
->
m_aNewMessageCdtn
.
set
();
m_pMediator
->
m_aNewMessageCdtn
.
set
();
...
@@ -228,7 +228,6 @@ void MediatorListener::run()
...
@@ -228,7 +228,6 @@ void MediatorListener::run()
<<
nHeader
[
1
]
<<
", ... }"
);
<<
nHeader
[
1
]
<<
", ... }"
);
bRun
=
false
;
bRun
=
false
;
}
}
delete
[]
pBuffer
;
}
}
else
else
{
{
...
...
extensions/source/propctrlr/formcomponenthandler.cxx
Dosyayı görüntüle @
8f7c677d
...
@@ -100,6 +100,7 @@
...
@@ -100,6 +100,7 @@
#include <sal/macros.h>
#include <sal/macros.h>
#include <limits>
#include <limits>
#include <boost/scoped_array.hpp>
#define GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:"
#define GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:"
...
@@ -381,7 +382,7 @@ namespace pcr
...
@@ -381,7 +382,7 @@ namespace pcr
sal_Int32
nNewCount
=
aNewStrings
.
getLength
();
sal_Int32
nNewCount
=
aNewStrings
.
getLength
();
// Create new Ids
// Create new Ids
OUString
*
pNewPureIds
=
new
OUString
[
nNewCount
]
;
boost
::
scoped_array
<
OUString
>
pNewPureIds
(
new
OUString
[
nNewCount
])
;
OUString
aIdStrBase
=
aDot
;
OUString
aIdStrBase
=
aDot
;
Any
aNameAny
=
m_xComponent
->
getPropertyValue
(
PROPERTY_NAME
);
Any
aNameAny
=
m_xComponent
->
getPropertyValue
(
PROPERTY_NAME
);
OUString
sControlName
;
OUString
sControlName
;
...
@@ -478,7 +479,6 @@ namespace pcr
...
@@ -478,7 +479,6 @@ namespace pcr
{}
{}
}
}
}
}
delete
[]
pNewPureIds
;
}
}
}
}
}
}
...
...
extensions/source/scanner/grid.cxx
Dosyayı görüntüle @
8f7c677d
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
// for ::std::sort
// for ::std::sort
#include <algorithm>
#include <algorithm>
#include <boost/scoped_array.hpp>
ResId
SaneResId
(
sal_uInt32
);
ResId
SaneResId
(
sal_uInt32
);
...
@@ -258,8 +259,8 @@ void GridWindow::computeNew()
...
@@ -258,8 +259,8 @@ void GridWindow::computeNew()
int
i
;
int
i
;
// get node arrays
// get node arrays
double
*
nodex
=
new
double
[
nSorted
]
;
boost
::
scoped_array
<
double
>
nodex
(
new
double
[
nSorted
])
;
double
*
nodey
=
new
double
[
nSorted
]
;
boost
::
scoped_array
<
double
>
nodey
(
new
double
[
nSorted
])
;
for
(
i
=
0L
;
i
<
nSorted
;
i
++
)
for
(
i
=
0L
;
i
<
nSorted
;
i
++
)
transform
(
m_aHandles
[
i
].
maPos
,
nodex
[
i
],
nodey
[
i
]
);
transform
(
m_aHandles
[
i
].
maPos
,
nodex
[
i
],
nodey
[
i
]
);
...
@@ -267,7 +268,7 @@ void GridWindow::computeNew()
...
@@ -267,7 +268,7 @@ void GridWindow::computeNew()
for
(
i
=
0
;
i
<
m_nValues
;
i
++
)
for
(
i
=
0
;
i
<
m_nValues
;
i
++
)
{
{
double
x
=
m_pXValues
[
i
];
double
x
=
m_pXValues
[
i
];
m_pNewYValues
[
i
]
=
interpolate
(
x
,
nodex
,
nodey
,
nSorted
);
m_pNewYValues
[
i
]
=
interpolate
(
x
,
nodex
.
get
(),
nodey
.
get
()
,
nSorted
);
if
(
m_bCutValues
)
if
(
m_bCutValues
)
{
{
if
(
m_pNewYValues
[
i
]
>
m_fMaxY
)
if
(
m_pNewYValues
[
i
]
>
m_fMaxY
)
...
@@ -276,9 +277,6 @@ void GridWindow::computeNew()
...
@@ -276,9 +277,6 @@ void GridWindow::computeNew()
m_pNewYValues
[
i
]
=
m_fMinY
;
m_pNewYValues
[
i
]
=
m_fMinY
;
}
}
}
}
delete
[]
nodex
;
delete
[]
nodey
;
}
}
}
}
...
...
extensions/source/scanner/sane.cxx
Dosyayı görüntüle @
8f7c677d
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
#include <sys/types.h>
#include <sys/types.h>
#include <sal/config.h>
#include <sal/config.h>
#include <sal/macros.h>
#include <sal/macros.h>
#include <boost/scoped_array.hpp>
#if (OSL_DEBUG_LEVEL > 1) || defined DBG_UTIL
#if (OSL_DEBUG_LEVEL > 1) || defined DBG_UTIL
#include <stdarg.h>
#include <stdarg.h>
...
@@ -357,14 +358,13 @@ sal_Bool Sane::GetOptionValue( int n, OString& rRet )
...
@@ -357,14 +358,13 @@ sal_Bool Sane::GetOptionValue( int n, OString& rRet )
sal_Bool
bSuccess
=
sal_False
;
sal_Bool
bSuccess
=
sal_False
;
if
(
!
maHandle
||
mppOptions
[
n
]
->
type
!=
SANE_TYPE_STRING
)
if
(
!
maHandle
||
mppOptions
[
n
]
->
type
!=
SANE_TYPE_STRING
)
return
sal_False
;
return
sal_False
;
char
*
pRet
=
new
char
[
mppOptions
[
n
]
->
size
+
1
]
;
boost
::
scoped_array
<
char
>
pRet
(
new
char
[
mppOptions
[
n
]
->
size
+
1
])
;
SANE_Status
nStatus
=
ControlOption
(
n
,
SANE_ACTION_GET_VALUE
,
pRet
);
SANE_Status
nStatus
=
ControlOption
(
n
,
SANE_ACTION_GET_VALUE
,
pRet
.
get
()
);
if
(
nStatus
==
SANE_STATUS_GOOD
)
if
(
nStatus
==
SANE_STATUS_GOOD
)
{
{
bSuccess
=
sal_True
;
bSuccess
=
sal_True
;
rRet
=
pRet
;
rRet
=
pRet
.
get
()
;
}
}
delete
[]
pRet
;
return
bSuccess
;
return
bSuccess
;
}
}
...
@@ -376,8 +376,8 @@ sal_Bool Sane::GetOptionValue( int n, double& rRet, int nElement )
...
@@ -376,8 +376,8 @@ sal_Bool Sane::GetOptionValue( int n, double& rRet, int nElement )
mppOptions
[
n
]
->
type
!=
SANE_TYPE_FIXED
)
)
mppOptions
[
n
]
->
type
!=
SANE_TYPE_FIXED
)
)
return
sal_False
;
return
sal_False
;
SANE_Word
*
pRet
=
new
SANE_Word
[
mppOptions
[
n
]
->
size
/
sizeof
(
SANE_Word
)]
;
boost
::
scoped_array
<
SANE_Word
>
pRet
(
new
SANE_Word
[
mppOptions
[
n
]
->
size
/
sizeof
(
SANE_Word
)])
;
SANE_Status
nStatus
=
ControlOption
(
n
,
SANE_ACTION_GET_VALUE
,
pRet
);
SANE_Status
nStatus
=
ControlOption
(
n
,
SANE_ACTION_GET_VALUE
,
pRet
.
get
()
);
if
(
nStatus
==
SANE_STATUS_GOOD
)
if
(
nStatus
==
SANE_STATUS_GOOD
)
{
{
bSuccess
=
sal_True
;
bSuccess
=
sal_True
;
...
@@ -386,7 +386,6 @@ sal_Bool Sane::GetOptionValue( int n, double& rRet, int nElement )
...
@@ -386,7 +386,6 @@ sal_Bool Sane::GetOptionValue( int n, double& rRet, int nElement )
else
else
rRet
=
SANE_UNFIX
(
pRet
[
nElement
]
);
rRet
=
SANE_UNFIX
(
pRet
[
nElement
]
);
}
}
delete
[]
pRet
;
return
bSuccess
;
return
bSuccess
;
}
}
...
@@ -396,13 +395,10 @@ sal_Bool Sane::GetOptionValue( int n, double* pSet )
...
@@ -396,13 +395,10 @@ sal_Bool Sane::GetOptionValue( int n, double* pSet )
mppOptions
[
n
]
->
type
==
SANE_TYPE_INT
)
)
mppOptions
[
n
]
->
type
==
SANE_TYPE_INT
)
)
return
sal_False
;
return
sal_False
;
SANE_Word
*
pFixedSet
=
new
SANE_Word
[
mppOptions
[
n
]
->
size
/
sizeof
(
SANE_Word
)]
;
boost
::
scoped_array
<
SANE_Word
>
pFixedSet
(
new
SANE_Word
[
mppOptions
[
n
]
->
size
/
sizeof
(
SANE_Word
)])
;
SANE_Status
nStatus
=
ControlOption
(
n
,
SANE_ACTION_GET_VALUE
,
pFixedSet
);
SANE_Status
nStatus
=
ControlOption
(
n
,
SANE_ACTION_GET_VALUE
,
pFixedSet
.
get
()
);
if
(
nStatus
!=
SANE_STATUS_GOOD
)
if
(
nStatus
!=
SANE_STATUS_GOOD
)
{
delete
[]
pFixedSet
;
return
sal_False
;
return
sal_False
;
}
for
(
size_t
i
=
0
;
i
<
mppOptions
[
n
]
->
size
/
sizeof
(
SANE_Word
);
i
++
)
for
(
size_t
i
=
0
;
i
<
mppOptions
[
n
]
->
size
/
sizeof
(
SANE_Word
);
i
++
)
{
{
if
(
mppOptions
[
n
]
->
type
==
SANE_TYPE_FIXED
)
if
(
mppOptions
[
n
]
->
type
==
SANE_TYPE_FIXED
)
...
@@ -410,7 +406,6 @@ sal_Bool Sane::GetOptionValue( int n, double* pSet )
...
@@ -410,7 +406,6 @@ sal_Bool Sane::GetOptionValue( int n, double* pSet )
else
else
pSet
[
i
]
=
(
double
)
pFixedSet
[
i
];
pSet
[
i
]
=
(
double
)
pFixedSet
[
i
];
}
}
delete
[]
pFixedSet
;
return
sal_True
;
return
sal_True
;
}
}
...
@@ -447,15 +442,14 @@ sal_Bool Sane::SetOptionValue( int n, double fSet, int nElement )
...
@@ -447,15 +442,14 @@ sal_Bool Sane::SetOptionValue( int n, double fSet, int nElement )
SANE_Status
nStatus
;
SANE_Status
nStatus
;
if
(
mppOptions
[
n
]
->
size
/
sizeof
(
SANE_Word
)
>
1
)
if
(
mppOptions
[
n
]
->
size
/
sizeof
(
SANE_Word
)
>
1
)
{
{
SANE_Word
*
pSet
=
new
SANE_Word
[
mppOptions
[
n
]
->
size
/
sizeof
(
SANE_Word
)]
;
boost
::
scoped_array
<
SANE_Word
>
pSet
(
new
SANE_Word
[
mppOptions
[
n
]
->
size
/
sizeof
(
SANE_Word
)])
;
nStatus
=
ControlOption
(
n
,
SANE_ACTION_GET_VALUE
,
pSet
);
nStatus
=
ControlOption
(
n
,
SANE_ACTION_GET_VALUE
,
pSet
.
get
()
);
if
(
nStatus
==
SANE_STATUS_GOOD
)
if
(
nStatus
==
SANE_STATUS_GOOD
)
{
{
pSet
[
nElement
]
=
mppOptions
[
n
]
->
type
==
SANE_TYPE_INT
?
pSet
[
nElement
]
=
mppOptions
[
n
]
->
type
==
SANE_TYPE_INT
?
(
SANE_Word
)
fSet
:
SANE_FIX
(
fSet
);
(
SANE_Word
)
fSet
:
SANE_FIX
(
fSet
);
nStatus
=
ControlOption
(
n
,
SANE_ACTION_SET_VALUE
,
pSet
);
nStatus
=
ControlOption
(
n
,
SANE_ACTION_SET_VALUE
,
pSet
.
get
()
);
}
}
delete
[]
pSet
;
}
}
else
else
{
{
...
@@ -475,7 +469,7 @@ sal_Bool Sane::SetOptionValue( int n, double* pSet )
...
@@ -475,7 +469,7 @@ sal_Bool Sane::SetOptionValue( int n, double* pSet )
if
(
!
maHandle
||
(
mppOptions
[
n
]
->
type
!=
SANE_TYPE_INT
&&
if
(
!
maHandle
||
(
mppOptions
[
n
]
->
type
!=
SANE_TYPE_INT
&&
mppOptions
[
n
]
->
type
!=
SANE_TYPE_FIXED
)
)
mppOptions
[
n
]
->
type
!=
SANE_TYPE_FIXED
)
)
return
sal_False
;
return
sal_False
;
SANE_Word
*
pFixedSet
=
new
SANE_Word
[
mppOptions
[
n
]
->
size
/
sizeof
(
SANE_Word
)]
;
boost
::
scoped_array
<
SANE_Word
>
pFixedSet
(
new
SANE_Word
[
mppOptions
[
n
]
->
size
/
sizeof
(
SANE_Word
)])
;
for
(
size_t
i
=
0
;
i
<
mppOptions
[
n
]
->
size
/
sizeof
(
SANE_Word
);
i
++
)
for
(
size_t
i
=
0
;
i
<
mppOptions
[
n
]
->
size
/
sizeof
(
SANE_Word
);
i
++
)
{
{
if
(
mppOptions
[
n
]
->
type
==
SANE_TYPE_FIXED
)
if
(
mppOptions
[
n
]
->
type
==
SANE_TYPE_FIXED
)
...
@@ -483,8 +477,7 @@ sal_Bool Sane::SetOptionValue( int n, double* pSet )
...
@@ -483,8 +477,7 @@ sal_Bool Sane::SetOptionValue( int n, double* pSet )
else
else
pFixedSet
[
i
]
=
(
SANE_Word
)
pSet
[
i
];
pFixedSet
[
i
]
=
(
SANE_Word
)
pSet
[
i
];
}
}
SANE_Status
nStatus
=
ControlOption
(
n
,
SANE_ACTION_SET_VALUE
,
pFixedSet
);
SANE_Status
nStatus
=
ControlOption
(
n
,
SANE_ACTION_SET_VALUE
,
pFixedSet
.
get
()
);
delete
[]
pFixedSet
;
if
(
nStatus
!=
SANE_STATUS_GOOD
)
if
(
nStatus
!=
SANE_STATUS_GOOD
)
return
sal_False
;
return
sal_False
;
return
sal_True
;
return
sal_True
;
...
...
extensions/source/scanner/sanedlg.cxx
Dosyayı görüntüle @
8f7c677d
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
#include <math.h>
#include <math.h>
#include <sal/macros.h>
#include <sal/macros.h>
#include <rtl/strbuf.hxx>
#include <rtl/strbuf.hxx>
#include <boost/scoped_array.hpp>
ResId
SaneResId
(
sal_uInt32
nID
)
ResId
SaneResId
(
sal_uInt32
nID
)
{
{
...
@@ -439,20 +440,17 @@ IMPL_LINK( SaneDlg, ClickBtnHdl, Button*, pButton )
...
@@ -439,20 +440,17 @@ IMPL_LINK( SaneDlg, ClickBtnHdl, Button*, pButton )
case
SANE_TYPE_INT
:
case
SANE_TYPE_INT
:
{
{
int
nElements
=
mrSane
.
GetOptionElements
(
mnCurrentOption
);
int
nElements
=
mrSane
.
GetOptionElements
(
mnCurrentOption
);
double
*
x
=
new
double
[
nElements
]
;
boost
::
scoped_array
<
double
>
x
(
new
double
[
nElements
])
;
double
*
y
=
new
double
[
nElements
]
;
boost
::
scoped_array
<
double
>
y
(
new
double
[
nElements
])
;
for
(
int
i
=
0
;
i
<
nElements
;
i
++
)
for
(
int
i
=
0
;
i
<
nElements
;
i
++
)
x
[
i
]
=
(
double
)
i
;
x
[
i
]
=
(
double
)
i
;
mrSane
.
GetOptionValue
(
mnCurrentOption
,
y
);
mrSane
.
GetOptionValue
(
mnCurrentOption
,
y
.
get
()
);
GridWindow
aGrid
(
x
,
y
,
nElements
,
this
);
GridWindow
aGrid
(
x
.
get
(),
y
.
get
()
,
nElements
,
this
);
aGrid
.
SetText
(
mrSane
.
GetOptionName
(
mnCurrentOption
)
);
aGrid
.
SetText
(
mrSane
.
GetOptionName
(
mnCurrentOption
)
);
aGrid
.
setBoundings
(
0
,
mfMin
,
nElements
,
mfMax
);
aGrid
.
setBoundings
(
0
,
mfMin
,
nElements
,
mfMax
);
if
(
aGrid
.
Execute
()
&&
aGrid
.
getNewYValues
()
)
if
(
aGrid
.
Execute
()
&&
aGrid
.
getNewYValues
()
)
mrSane
.
SetOptionValue
(
mnCurrentOption
,
aGrid
.
getNewYValues
()
);
mrSane
.
SetOptionValue
(
mnCurrentOption
,
aGrid
.
getNewYValues
()
);
delete
[]
x
;
delete
[]
y
;
}
}
break
;
break
;
case
SANE_TYPE_BOOL
:
case
SANE_TYPE_BOOL
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment