LGTM: [skip ci] fix: Local variable hides global variable

A local variable or parameter that hides a global variable of the same name.
This may be confusing. Consider renaming one of the variables.
This commit is contained in:
wmayer
2020-07-26 19:30:24 +02:00
parent 8dc95874a2
commit 48f9085746
4 changed files with 15 additions and 43 deletions

View File

@@ -34,6 +34,7 @@
#include <Inventor/nodes/SoSeparator.h>
#include <Inventor/nodes/SoSwitch.h>
#include <Inventor/details/SoDetail.h>
#include "SoFCDB.h"
#include "ViewProvider.h"
#include "WidgetFactory.h"
@@ -621,37 +622,10 @@ void ViewProviderPy::setSwitchNode(Py::Object)
}
static char * buffer;
static size_t buffer_size = 0;
static void *
buffer_realloc(void * bufptr, size_t size)
{
buffer = (char *)realloc(bufptr, size);
buffer_size = size;
return buffer;
}
static SbString
buffer_writeaction(SoNode * root)
{
SoOutput out;
buffer = (char *)malloc(1024);
buffer_size = 1024;
out.setBuffer(buffer, buffer_size, buffer_realloc);
SoWriteAction wa(&out);
wa.apply(root);
SbString s(buffer);
free(buffer);
return s;
}
Py::String ViewProviderPy::getIV(void) const
{
SbString buf = buffer_writeaction(getViewProviderPtr()->getRoot());
return Py::String(buf.getString());
std::string buf = Gui::SoFCDB::writeNodesToString(getViewProviderPtr()->getRoot());
return Py::String(buf);
}
Py::Object ViewProviderPy::getIcon(void) const