clang-cl loplugin: basic
Change-Id: Ibb324ac81343d56038d18a4ee9b27b486df6e520 Reviewed-on: https://gerrit.libreoffice.org/29881 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
@@ -151,7 +151,7 @@ void VBATest::testMiscOLEStuff()
|
|||||||
fprintf(stderr, "macro result for %s\n", macroSource[ i ] );
|
fprintf(stderr, "macro result for %s\n", macroSource[ i ] );
|
||||||
fprintf(stderr, "macro returned:\n%s\n", OUStringToOString( pReturn->GetOUString(), RTL_TEXTENCODING_UTF8 ).getStr() );
|
fprintf(stderr, "macro returned:\n%s\n", OUStringToOString( pReturn->GetOUString(), RTL_TEXTENCODING_UTF8 ).getStr() );
|
||||||
}
|
}
|
||||||
CPPUNIT_ASSERT_MESSAGE("No return variable huh?", pReturn.get() != NULL );
|
CPPUNIT_ASSERT_MESSAGE("No return variable huh?", pReturn.get() != nullptr );
|
||||||
CPPUNIT_ASSERT_MESSAGE("Result not as expected", pReturn->GetOUString() == "OK" );
|
CPPUNIT_ASSERT_MESSAGE("Result not as expected", pReturn->GetOUString() == "OK" );
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@@ -62,7 +62,7 @@ using namespace css;
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
char * address(std::vector< char > & blob) {
|
char * address(std::vector< char > & blob) {
|
||||||
return blob.empty() ? 0 : &blob[0];
|
return blob.empty() ? nullptr : &blob[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
SbError convert(OUString const & source, OString * target) {
|
SbError convert(OUString const & source, OString * target) {
|
||||||
@@ -143,7 +143,7 @@ template< typename T > void add(
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::size_t alignment(SbxVariable * variable) {
|
std::size_t alignment(SbxVariable * variable) {
|
||||||
OSL_ASSERT(variable != 0);
|
OSL_ASSERT(variable != nullptr);
|
||||||
if ((variable->GetType() & SbxARRAY) == 0) {
|
if ((variable->GetType() & SbxARRAY) == 0) {
|
||||||
switch (variable->GetType()) {
|
switch (variable->GetType()) {
|
||||||
case SbxINTEGER:
|
case SbxINTEGER:
|
||||||
@@ -190,7 +190,7 @@ SbError marshal(
|
|||||||
SbError marshalString(
|
SbError marshalString(
|
||||||
SbxVariable * variable, bool special, MarshalData & data, void ** buffer)
|
SbxVariable * variable, bool special, MarshalData & data, void ** buffer)
|
||||||
{
|
{
|
||||||
OSL_ASSERT(variable != 0 && buffer != 0);
|
OSL_ASSERT(variable != nullptr && buffer != nullptr);
|
||||||
OString str;
|
OString str;
|
||||||
SbError e = convert(variable->GetOUString(), &str);
|
SbError e = convert(variable->GetOUString(), &str);
|
||||||
if (e != ERRCODE_NONE) {
|
if (e != ERRCODE_NONE) {
|
||||||
@@ -207,7 +207,7 @@ SbError marshalStruct(
|
|||||||
SbxVariable * variable, std::vector< char > & blob, std::size_t offset,
|
SbxVariable * variable, std::vector< char > & blob, std::size_t offset,
|
||||||
MarshalData & data)
|
MarshalData & data)
|
||||||
{
|
{
|
||||||
OSL_ASSERT(variable != 0);
|
OSL_ASSERT(variable != nullptr);
|
||||||
SbxArray * props = dynamic_cast<SbxObject*>( variable->GetObject() )->
|
SbxArray * props = dynamic_cast<SbxObject*>( variable->GetObject() )->
|
||||||
GetProperties();
|
GetProperties();
|
||||||
for (sal_uInt16 i = 0; i < props->Count(); ++i) {
|
for (sal_uInt16 i = 0; i < props->Count(); ++i) {
|
||||||
@@ -223,7 +223,7 @@ SbError marshalArray(
|
|||||||
SbxVariable * variable, std::vector< char > & blob, std::size_t offset,
|
SbxVariable * variable, std::vector< char > & blob, std::size_t offset,
|
||||||
MarshalData & data)
|
MarshalData & data)
|
||||||
{
|
{
|
||||||
OSL_ASSERT(variable != 0);
|
OSL_ASSERT(variable != nullptr);
|
||||||
SbxDimArray * arr = dynamic_cast<SbxDimArray*>( variable->GetObject() );
|
SbxDimArray * arr = dynamic_cast<SbxDimArray*>( variable->GetObject() );
|
||||||
int dims = arr->GetDims();
|
int dims = arr->GetDims();
|
||||||
std::vector< sal_Int32 > low(dims);
|
std::vector< sal_Int32 > low(dims);
|
||||||
@@ -255,7 +255,7 @@ SbError marshal(
|
|||||||
bool outer, SbxVariable * variable, bool special,
|
bool outer, SbxVariable * variable, bool special,
|
||||||
std::vector< char > & blob, std::size_t offset, MarshalData & data)
|
std::vector< char > & blob, std::size_t offset, MarshalData & data)
|
||||||
{
|
{
|
||||||
OSL_ASSERT(variable != 0);
|
OSL_ASSERT(variable != nullptr);
|
||||||
if (!(variable->GetFlags() & SbxFlagBits::Reference)) {
|
if (!(variable->GetFlags() & SbxFlagBits::Reference)) {
|
||||||
if ((variable->GetType() & SbxARRAY) == 0) {
|
if ((variable->GetType() & SbxARRAY) == 0) {
|
||||||
switch (variable->GetType()) {
|
switch (variable->GetType()) {
|
||||||
@@ -370,7 +370,7 @@ template< typename T > T read(void const ** pointer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void const * unmarshal(SbxVariable * variable, void const * data) {
|
void const * unmarshal(SbxVariable * variable, void const * data) {
|
||||||
OSL_ASSERT(variable != 0);
|
OSL_ASSERT(variable != nullptr);
|
||||||
if ((variable->GetType() & SbxARRAY) == 0) {
|
if ((variable->GetType() & SbxARRAY) == 0) {
|
||||||
switch (variable->GetType()) {
|
switch (variable->GetType()) {
|
||||||
case SbxINTEGER:
|
case SbxINTEGER:
|
||||||
@@ -438,7 +438,7 @@ void const * unmarshal(SbxVariable * variable, void const * data) {
|
|||||||
|
|
||||||
SbError unmarshalString(StringData const & data, SbxVariable & result) {
|
SbError unmarshalString(StringData const & data, SbxVariable & result) {
|
||||||
OUString str;
|
OUString str;
|
||||||
if (data.buffer != 0) {
|
if (data.buffer != nullptr) {
|
||||||
char const * p = static_cast< char const * >(data.buffer);
|
char const * p = static_cast< char const * >(data.buffer);
|
||||||
sal_Int32 len;
|
sal_Int32 len;
|
||||||
if (data.special) {
|
if (data.special) {
|
||||||
@@ -481,7 +481,7 @@ SbError call(
|
|||||||
bool special =
|
bool special =
|
||||||
dll.equalsIgnoreAsciiCase("KERNEL32.DLL") &&
|
dll.equalsIgnoreAsciiCase("KERNEL32.DLL") &&
|
||||||
(proc.name == OString("GetLogicalDriveStringsA"));
|
(proc.name == OString("GetLogicalDriveStringsA"));
|
||||||
for (int i = 1; i < (arguments == 0 ? 0 : arguments->Count()); ++i) {
|
for (int i = 1; i < (arguments == nullptr ? 0 : arguments->Count()); ++i) {
|
||||||
SbError e = marshal(
|
SbError e = marshal(
|
||||||
true, arguments->Get(i), special && i == 2, stack, stack.size(),
|
true, arguments->Get(i), special && i == 2, stack, stack.size(),
|
||||||
data);
|
data);
|
||||||
@@ -496,8 +496,8 @@ SbError call(
|
|||||||
// We fake all calls as being to a varargs function,
|
// We fake all calls as being to a varargs function,
|
||||||
// as this means any floating-point argument among the first four
|
// as this means any floating-point argument among the first four
|
||||||
// ones will end up in a XMM register where the callee expects it.
|
// ones will end up in a XMM register where the callee expects it.
|
||||||
sal_Int32 (*proc_i)(double d, ...) = (sal_Int32 (*)(double, ...)) proc.proc;
|
sal_Int32 (*proc_i)(double d, ...) = reinterpret_cast<sal_Int32 (*)(double, ...)>(proc.proc);
|
||||||
double (*proc_d)(double d, ...) = (double (*)(double, ...)) proc.proc;
|
double (*proc_d)(double d, ...) = reinterpret_cast<double (*)(double, ...)>(proc.proc);
|
||||||
|
|
||||||
sal_Int64 iRetVal = 0;
|
sal_Int64 iRetVal = 0;
|
||||||
double dRetVal = 0.0;
|
double dRetVal = 0.0;
|
||||||
@@ -511,50 +511,50 @@ SbError call(
|
|||||||
case SbxBOOL:
|
case SbxBOOL:
|
||||||
case SbxBYTE:
|
case SbxBYTE:
|
||||||
iRetVal =
|
iRetVal =
|
||||||
proc_i(*(double *)&stack[0*8],
|
proc_i(*reinterpret_cast<double *>(&stack[0*8]),
|
||||||
*(double *)&stack[1*8],
|
*reinterpret_cast<double *>(&stack[1*8]),
|
||||||
*(double *)&stack[2*8],
|
*reinterpret_cast<double *>(&stack[2*8]),
|
||||||
*(double *)&stack[3*8],
|
*reinterpret_cast<double *>(&stack[3*8]),
|
||||||
*(sal_uInt64 *)&stack[4*8],
|
*reinterpret_cast<sal_uInt64 *>(&stack[4*8]),
|
||||||
*(sal_uInt64 *)&stack[5*8],
|
*reinterpret_cast<sal_uInt64 *>(&stack[5*8]),
|
||||||
*(sal_uInt64 *)&stack[6*8],
|
*reinterpret_cast<sal_uInt64 *>(&stack[6*8]),
|
||||||
*(sal_uInt64 *)&stack[7*8],
|
*reinterpret_cast<sal_uInt64 *>(&stack[7*8]),
|
||||||
*(sal_uInt64 *)&stack[8*8],
|
*reinterpret_cast<sal_uInt64 *>(&stack[8*8]),
|
||||||
*(sal_uInt64 *)&stack[9*8],
|
*reinterpret_cast<sal_uInt64 *>(&stack[9*8]),
|
||||||
*(sal_uInt64 *)&stack[10*8],
|
*reinterpret_cast<sal_uInt64 *>(&stack[10*8]),
|
||||||
*(sal_uInt64 *)&stack[11*8],
|
*reinterpret_cast<sal_uInt64 *>(&stack[11*8]),
|
||||||
*(sal_uInt64 *)&stack[12*8],
|
*reinterpret_cast<sal_uInt64 *>(&stack[12*8]),
|
||||||
*(sal_uInt64 *)&stack[13*8],
|
*reinterpret_cast<sal_uInt64 *>(&stack[13*8]),
|
||||||
*(sal_uInt64 *)&stack[14*8],
|
*reinterpret_cast<sal_uInt64 *>(&stack[14*8]),
|
||||||
*(sal_uInt64 *)&stack[15*8],
|
*reinterpret_cast<sal_uInt64 *>(&stack[15*8]),
|
||||||
*(sal_uInt64 *)&stack[16*8],
|
*reinterpret_cast<sal_uInt64 *>(&stack[16*8]),
|
||||||
*(sal_uInt64 *)&stack[17*8],
|
*reinterpret_cast<sal_uInt64 *>(&stack[17*8]),
|
||||||
*(sal_uInt64 *)&stack[18*8],
|
*reinterpret_cast<sal_uInt64 *>(&stack[18*8]),
|
||||||
*(sal_uInt64 *)&stack[19*8]);
|
*reinterpret_cast<sal_uInt64 *>(&stack[19*8]));
|
||||||
break;
|
break;
|
||||||
case SbxSINGLE:
|
case SbxSINGLE:
|
||||||
case SbxDOUBLE:
|
case SbxDOUBLE:
|
||||||
dRetVal =
|
dRetVal =
|
||||||
proc_d(*(double *)&stack[0*8],
|
proc_d(*reinterpret_cast<double *>(&stack[0*8]),
|
||||||
*(double *)&stack[1*8],
|
*reinterpret_cast<double *>(&stack[1*8]),
|
||||||
*(double *)&stack[2*8],
|
*reinterpret_cast<double *>(&stack[2*8]),
|
||||||
*(double *)&stack[3*8],
|
*reinterpret_cast<double *>(&stack[3*8]),
|
||||||
*(sal_uInt64 *)&stack[4*8],
|
*reinterpret_cast<sal_uInt64 *>(&stack[4*8]),
|
||||||
*(sal_uInt64 *)&stack[5*8],
|
*reinterpret_cast<sal_uInt64 *>(&stack[5*8]),
|
||||||
*(sal_uInt64 *)&stack[6*8],
|
*reinterpret_cast<sal_uInt64 *>(&stack[6*8]),
|
||||||
*(sal_uInt64 *)&stack[7*8],
|
*reinterpret_cast<sal_uInt64 *>(&stack[7*8]),
|
||||||
*(sal_uInt64 *)&stack[8*8],
|
*reinterpret_cast<sal_uInt64 *>(&stack[8*8]),
|
||||||
*(sal_uInt64 *)&stack[9*8],
|
*reinterpret_cast<sal_uInt64 *>(&stack[9*8]),
|
||||||
*(sal_uInt64 *)&stack[10*8],
|
*reinterpret_cast<sal_uInt64 *>(&stack[10*8]),
|
||||||
*(sal_uInt64 *)&stack[11*8],
|
*reinterpret_cast<sal_uInt64 *>(&stack[11*8]),
|
||||||
*(sal_uInt64 *)&stack[12*8],
|
*reinterpret_cast<sal_uInt64 *>(&stack[12*8]),
|
||||||
*(sal_uInt64 *)&stack[13*8],
|
*reinterpret_cast<sal_uInt64 *>(&stack[13*8]),
|
||||||
*(sal_uInt64 *)&stack[14*8],
|
*reinterpret_cast<sal_uInt64 *>(&stack[14*8]),
|
||||||
*(sal_uInt64 *)&stack[15*8],
|
*reinterpret_cast<sal_uInt64 *>(&stack[15*8]),
|
||||||
*(sal_uInt64 *)&stack[16*8],
|
*reinterpret_cast<sal_uInt64 *>(&stack[16*8]),
|
||||||
*(sal_uInt64 *)&stack[17*8],
|
*reinterpret_cast<sal_uInt64 *>(&stack[17*8]),
|
||||||
*(sal_uInt64 *)&stack[18*8],
|
*reinterpret_cast<sal_uInt64 *>(&stack[18*8]),
|
||||||
*(sal_uInt64 *)&stack[19*8]);
|
*reinterpret_cast<sal_uInt64 *>(&stack[19*8]));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -590,7 +590,7 @@ SbError call(
|
|||||||
//TODO
|
//TODO
|
||||||
break;
|
break;
|
||||||
case SbxBOOL:
|
case SbxBOOL:
|
||||||
result.PutBool(static_cast< sal_Bool >(iRetVal));
|
result.PutBool(iRetVal);
|
||||||
break;
|
break;
|
||||||
case SbxBYTE:
|
case SbxBYTE:
|
||||||
result.PutByte(static_cast< sal_uInt8 >(iRetVal));
|
result.PutByte(static_cast< sal_uInt8 >(iRetVal));
|
||||||
@@ -599,7 +599,7 @@ SbError call(
|
|||||||
OSL_ASSERT(false);
|
OSL_ASSERT(false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
for (int i = 1; i < (arguments == 0 ? 0 : arguments->Count()); ++i) {
|
for (int i = 1; i < (arguments == nullptr ? 0 : arguments->Count()); ++i) {
|
||||||
arguments->Get(i)->ResetFlag(SbxFlagBits::Reference);
|
arguments->Get(i)->ResetFlag(SbxFlagBits::Reference);
|
||||||
//TODO: skipped for errors?!?
|
//TODO: skipped for errors?!?
|
||||||
}
|
}
|
||||||
@@ -621,14 +621,14 @@ SbError call(
|
|||||||
|
|
||||||
SbError getProcData(HMODULE handle, OUString const & name, ProcData * proc)
|
SbError getProcData(HMODULE handle, OUString const & name, ProcData * proc)
|
||||||
{
|
{
|
||||||
OSL_ASSERT(proc != 0);
|
OSL_ASSERT(proc != nullptr);
|
||||||
if (name.getLength() != 0 && name[0] == '@') { //TODO: "@" vs. "#"???
|
if (name.getLength() != 0 && name[0] == '@') { //TODO: "@" vs. "#"???
|
||||||
sal_Int32 n = name.copy(1).toInt32(); //TODO: handle bad input
|
sal_Int32 n = name.copy(1).toInt32(); //TODO: handle bad input
|
||||||
if (n <= 0 || n > 0xFFFF) {
|
if (n <= 0 || n > 0xFFFF) {
|
||||||
return ERRCODE_BASIC_BAD_ARGUMENT; //TODO: more specific errcode?
|
return ERRCODE_BASIC_BAD_ARGUMENT; //TODO: more specific errcode?
|
||||||
}
|
}
|
||||||
FARPROC p = GetProcAddress(handle, reinterpret_cast< LPCSTR >(n));
|
FARPROC p = GetProcAddress(handle, reinterpret_cast< LPCSTR >(n));
|
||||||
if (p != 0) {
|
if (p != nullptr) {
|
||||||
proc->name = OString("#") + OString::number(n);
|
proc->name = OString("#") + OString::number(n);
|
||||||
proc->proc = p;
|
proc->proc = p;
|
||||||
return ERRCODE_NONE;
|
return ERRCODE_NONE;
|
||||||
@@ -640,7 +640,7 @@ SbError getProcData(HMODULE handle, OUString const & name, ProcData * proc)
|
|||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
FARPROC p = GetProcAddress(handle, name8.getStr());
|
FARPROC p = GetProcAddress(handle, name8.getStr());
|
||||||
if (p != 0) {
|
if (p != nullptr) {
|
||||||
proc->name = name8;
|
proc->name = name8;
|
||||||
proc->proc = p;
|
proc->proc = p;
|
||||||
return ERRCODE_NONE;
|
return ERRCODE_NONE;
|
||||||
@@ -649,7 +649,7 @@ SbError getProcData(HMODULE handle, OUString const & name, ProcData * proc)
|
|||||||
if (i != -1) {
|
if (i != -1) {
|
||||||
name8 = name8.copy(0, i);
|
name8 = name8.copy(0, i);
|
||||||
p = GetProcAddress(handle, name8.getStr());
|
p = GetProcAddress(handle, name8.getStr());
|
||||||
if (p != 0) {
|
if (p != nullptr) {
|
||||||
proc->name = name8;
|
proc->name = name8;
|
||||||
proc->proc = p;
|
proc->proc = p;
|
||||||
return ERRCODE_NONE;
|
return ERRCODE_NONE;
|
||||||
@@ -657,14 +657,14 @@ SbError getProcData(HMODULE handle, OUString const & name, ProcData * proc)
|
|||||||
}
|
}
|
||||||
OString real(OString("_") + name8);
|
OString real(OString("_") + name8);
|
||||||
p = GetProcAddress(handle, real.getStr());
|
p = GetProcAddress(handle, real.getStr());
|
||||||
if (p != 0) {
|
if (p != nullptr) {
|
||||||
proc->name = real;
|
proc->name = real;
|
||||||
proc->proc = p;
|
proc->proc = p;
|
||||||
return ERRCODE_NONE;
|
return ERRCODE_NONE;
|
||||||
}
|
}
|
||||||
real = name8 + OString("A");
|
real = name8 + OString("A");
|
||||||
p = GetProcAddress(handle, real.getStr());
|
p = GetProcAddress(handle, real.getStr());
|
||||||
if (p != 0) {
|
if (p != nullptr) {
|
||||||
proc->name = real;
|
proc->name = real;
|
||||||
proc->proc = p;
|
proc->proc = p;
|
||||||
return ERRCODE_NONE;
|
return ERRCODE_NONE;
|
||||||
@@ -677,10 +677,10 @@ struct Dll: public salhelper::SimpleReferenceObject {
|
|||||||
private:
|
private:
|
||||||
typedef std::map< OUString, ProcData > Procs;
|
typedef std::map< OUString, ProcData > Procs;
|
||||||
|
|
||||||
virtual ~Dll();
|
virtual ~Dll() override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Dll(): handle(0) {}
|
Dll(): handle(nullptr) {}
|
||||||
|
|
||||||
SbError getProc(OUString const & name, ProcData * proc);
|
SbError getProc(OUString const & name, ProcData * proc);
|
||||||
|
|
||||||
@@ -689,7 +689,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
Dll::~Dll() {
|
Dll::~Dll() {
|
||||||
if (handle != 0 && !FreeLibrary(handle)) {
|
if (handle != nullptr && !FreeLibrary(handle)) {
|
||||||
OSL_TRACE("FreeLibrary(%p) failed with %u", handle, GetLastError());
|
OSL_TRACE("FreeLibrary(%p) failed with %u", handle, GetLastError());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -736,9 +736,9 @@ Dll * SbiDllMgr::Impl::getDll(OUString const & name) {
|
|||||||
if (i == dlls.end()) {
|
if (i == dlls.end()) {
|
||||||
i = dlls.insert(Dlls::value_type(name, new Dll)).first;
|
i = dlls.insert(Dlls::value_type(name, new Dll)).first;
|
||||||
HMODULE h = LoadLibraryW(reinterpret_cast<LPCWSTR>(name.getStr()));
|
HMODULE h = LoadLibraryW(reinterpret_cast<LPCWSTR>(name.getStr()));
|
||||||
if (h == 0) {
|
if (h == nullptr) {
|
||||||
dlls.erase(i);
|
dlls.erase(i);
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
i->second->handle = h;
|
i->second->handle = h;
|
||||||
}
|
}
|
||||||
@@ -754,7 +754,7 @@ SbError SbiDllMgr::Call(
|
|||||||
}
|
}
|
||||||
OUString dllName(fullDllName(library));
|
OUString dllName(fullDllName(library));
|
||||||
Dll * dll = impl_->getDll(dllName);
|
Dll * dll = impl_->getDll(dllName);
|
||||||
if (dll == 0) {
|
if (dll == nullptr) {
|
||||||
return ERRCODE_BASIC_BAD_DLL_LOAD;
|
return ERRCODE_BASIC_BAD_DLL_LOAD;
|
||||||
}
|
}
|
||||||
ProcData proc;
|
ProcData proc;
|
||||||
|
@@ -744,7 +744,7 @@ void SbiIoSystem::Shutdown()
|
|||||||
vcl::Window* pParent = Application::GetDefDialogParent();
|
vcl::Window* pParent = Application::GetDefDialogParent();
|
||||||
ScopedVclPtrInstance<MessBox>( pParent, WinBits( WB_OK ), OUString(), aOut )->Execute();
|
ScopedVclPtrInstance<MessBox>( pParent, WinBits( WB_OK ), OUString(), aOut )->Execute();
|
||||||
#else
|
#else
|
||||||
ScopedVclPtrInstance<MessBox>( GetpApp()->GetDefDialogParent(), WinBits( WB_OK ), OUString(), aOut )->Execute();
|
ScopedVclPtrInstance<MessBox>( Application::GetDefDialogParent(), WinBits( WB_OK ), OUString(), aOut )->Execute();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
aOut.clear();
|
aOut.clear();
|
||||||
|
@@ -420,7 +420,7 @@ RTLFUNC(CurDir)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
char* pBuffer = new char[ _MAX_PATH ];
|
char* pBuffer = new char[ _MAX_PATH ];
|
||||||
if ( _getdcwd( nCurDir, pBuffer, _MAX_PATH ) != 0 )
|
if ( _getdcwd( nCurDir, pBuffer, _MAX_PATH ) != nullptr )
|
||||||
{
|
{
|
||||||
rPar.Get(0)->PutString( OUString::createFromAscii( pBuffer ) );
|
rPar.Get(0)->PutString( OUString::createFromAscii( pBuffer ) );
|
||||||
}
|
}
|
||||||
|
@@ -285,7 +285,7 @@ RTLFUNC(CDec)
|
|||||||
(void)bWrite;
|
(void)bWrite;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
SbxDecimal* pDec = NULL;
|
SbxDecimal* pDec = nullptr;
|
||||||
if ( rPar.Count() == 2 )
|
if ( rPar.Count() == 2 )
|
||||||
{
|
{
|
||||||
SbxVariable *pSbxVariable = rPar.Get(1);
|
SbxVariable *pSbxVariable = rPar.Get(1);
|
||||||
|
@@ -92,28 +92,28 @@ void releaseDecimalPtr( SbxDecimal*& rpDecimal )
|
|||||||
|
|
||||||
bool SbxDecimal::operator -= ( const SbxDecimal &r )
|
bool SbxDecimal::operator -= ( const SbxDecimal &r )
|
||||||
{
|
{
|
||||||
HRESULT hResult = VarDecSub( &maDec, (LPDECIMAL)&r.maDec, &maDec );
|
HRESULT hResult = VarDecSub( &maDec, const_cast<LPDECIMAL>(&r.maDec), &maDec );
|
||||||
bool bRet = ( hResult == S_OK );
|
bool bRet = ( hResult == S_OK );
|
||||||
return bRet;
|
return bRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SbxDecimal::operator += ( const SbxDecimal &r )
|
bool SbxDecimal::operator += ( const SbxDecimal &r )
|
||||||
{
|
{
|
||||||
HRESULT hResult = VarDecAdd( &maDec, (LPDECIMAL)&r.maDec, &maDec );
|
HRESULT hResult = VarDecAdd( &maDec, const_cast<LPDECIMAL>(&r.maDec), &maDec );
|
||||||
bool bRet = ( hResult == S_OK );
|
bool bRet = ( hResult == S_OK );
|
||||||
return bRet;
|
return bRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SbxDecimal::operator /= ( const SbxDecimal &r )
|
bool SbxDecimal::operator /= ( const SbxDecimal &r )
|
||||||
{
|
{
|
||||||
HRESULT hResult = VarDecDiv( &maDec, (LPDECIMAL)&r.maDec, &maDec );
|
HRESULT hResult = VarDecDiv( &maDec, const_cast<LPDECIMAL>(&r.maDec), &maDec );
|
||||||
bool bRet = ( hResult == S_OK );
|
bool bRet = ( hResult == S_OK );
|
||||||
return bRet;
|
return bRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SbxDecimal::operator *= ( const SbxDecimal &r )
|
bool SbxDecimal::operator *= ( const SbxDecimal &r )
|
||||||
{
|
{
|
||||||
HRESULT hResult = VarDecMul( &maDec, (LPDECIMAL)&r.maDec, &maDec );
|
HRESULT hResult = VarDecMul( &maDec, const_cast<LPDECIMAL>(&r.maDec), &maDec );
|
||||||
bool bRet = ( hResult == S_OK );
|
bool bRet = ( hResult == S_OK );
|
||||||
return bRet;
|
return bRet;
|
||||||
}
|
}
|
||||||
@@ -135,7 +135,7 @@ bool SbxDecimal::isZero()
|
|||||||
|
|
||||||
SbxDecimal::CmpResult compare( const SbxDecimal &rLeft, const SbxDecimal &rRight )
|
SbxDecimal::CmpResult compare( const SbxDecimal &rLeft, const SbxDecimal &rRight )
|
||||||
{
|
{
|
||||||
HRESULT hResult = VarDecCmp( (LPDECIMAL)&rLeft.maDec, (LPDECIMAL)&rRight.maDec );
|
HRESULT hResult = VarDecCmp( const_cast<LPDECIMAL>(&rLeft.maDec), const_cast<LPDECIMAL>(&rRight.maDec) );
|
||||||
SbxDecimal::CmpResult eRes = (SbxDecimal::CmpResult)hResult;
|
SbxDecimal::CmpResult eRes = (SbxDecimal::CmpResult)hResult;
|
||||||
return eRes;
|
return eRes;
|
||||||
}
|
}
|
||||||
@@ -226,11 +226,11 @@ bool SbxDecimal::setString( OUString* pOUString )
|
|||||||
pBuffer[i] = ',';
|
pBuffer[i] = ',';
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
hResult = VarDecFromStr( (OLECHAR*)pBuffer.get(), nLANGID, 0, &maDec );
|
hResult = VarDecFromStr( pBuffer.get(), nLANGID, 0, &maDec );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hResult = VarDecFromStr( (OLECHAR*)pOUString->getStr(), nLANGID, 0, &maDec );
|
hResult = VarDecFromStr( pOUString->getStr(), nLANGID, 0, &maDec );
|
||||||
}
|
}
|
||||||
bRet = ( hResult == S_OK );
|
bRet = ( hResult == S_OK );
|
||||||
return bRet;
|
return bRet;
|
||||||
@@ -356,7 +356,7 @@ void SbxDecimal::getString( OUString& rString )
|
|||||||
|
|
||||||
OLECHAR sz[100];
|
OLECHAR sz[100];
|
||||||
BSTR aBStr = SysAllocString( sz );
|
BSTR aBStr = SysAllocString( sz );
|
||||||
if( aBStr != NULL )
|
if( aBStr != nullptr )
|
||||||
{
|
{
|
||||||
HRESULT hResult = VarBstrFromDec( &maDec, nLANGID, 0, &aBStr );
|
HRESULT hResult = VarBstrFromDec( &maDec, nLANGID, 0, &aBStr );
|
||||||
if( hResult == S_OK )
|
if( hResult == S_OK )
|
||||||
|
Reference in New Issue
Block a user