summaryrefslogtreecommitdiff
path: root/ucb
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-11-10 13:36:34 +0200
committerNoel Grandin <noelgrandin@gmail.com>2015-11-11 07:16:20 +0000
commitdb17d3c17c40d6b0e92392cf3c6e343d1d17b771 (patch)
tree9d562fcf764e7717df9585ef0e735a12ea4aaa16 /ucb
parent2ce9e4be4a438203382cb9cca824ce3e90647f3a (diff)
new loplugin: memoryvar
detect when we can convert a new/delete sequence on a local variable to use std::unique_ptr Change-Id: Iecae4e4197eccdfacfce2eed39aa4a69e4a660bc Reviewed-on: https://gerrit.libreoffice.org/19884 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'ucb')
-rw-r--r--ucb/source/ucp/webdav-neon/LockSequence.cxx20
1 files changed, 2 insertions, 18 deletions
diff --git a/ucb/source/ucp/webdav-neon/LockSequence.cxx b/ucb/source/ucp/webdav-neon/LockSequence.cxx
index 8d57e764d83d..60808f945bf3 100644
--- a/ucb/source/ucp/webdav-neon/LockSequence.cxx
+++ b/ucb/source/ucp/webdav-neon/LockSequence.cxx
@@ -31,14 +31,11 @@
#include <ne_xml.h>
#include <osl/diagnose.h>
#include "LockSequence.hxx"
+#include <memory>
using namespace webdav_ucp;
using namespace com::sun::star;
-#define BEEHIVE_BUGS_WORKAROUND
-
-
-
struct LockSequenceParseContext
{
ucb::Lock * pLock;
@@ -130,11 +127,7 @@ extern "C" int LockSequence_startelement_callback(
extern "C" int LockSequence_chardata_callback(
void *userdata,
int state,
-#ifdef BEEHIVE_BUGS_WORKAROUND
- const char *buf1,
-#else
const char *buf,
-#endif
size_t len )
{
LockSequenceParseContext * pCtx
@@ -142,15 +135,10 @@ extern "C" int LockSequence_chardata_callback(
if ( !pCtx->pLock )
pCtx->pLock = new ucb::Lock;
-#ifdef BEEHIVE_BUGS_WORKAROUND
// Beehive sends XML values containing trailing newlines.
- if ( buf1[ len - 1 ] == 0x0a )
+ if ( buf[ len - 1 ] == 0x0a )
len--;
- char * buf = new char[ len + 1 ]();
- strncpy( buf, buf1, len );
-#endif
-
switch ( state )
{
case STATE_DEPTH:
@@ -237,10 +225,6 @@ extern "C" int LockSequence_chardata_callback(
}
-#ifdef BEEHIVE_BUGS_WORKAROUND
- delete [] buf;
-#endif
-
return 0; // zero to continue, non-zero to abort parsing
}