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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user