Skip to content
Snippets Groups Projects
Commit dc2aa07d authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

fix const in snprintf

parent 5424371a
No related branches found
No related tags found
No related merge requests found
// $Id: GeoStringInterface.cpp,v 1.17 2008-02-23 15:30:07 geuzaine Exp $ // $Id: GeoStringInterface.cpp,v 1.18 2008-02-25 15:36:38 geuzaine Exp $
// //
// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
// //
...@@ -37,7 +37,7 @@ extern Context_T CTX; ...@@ -37,7 +37,7 @@ extern Context_T CTX;
// Some old systems don't have snprintf... Just call sprintf instead. // Some old systems don't have snprintf... Just call sprintf instead.
#if defined(HAVE_NO_SNPRINTF) #if defined(HAVE_NO_SNPRINTF)
int snprintf(const char *str, size_t size, const char* fmt, ...){ int snprintf(char *str, size_t size, const char* fmt, ...){
va_list args; va_list args;
va_start(args, fmt); va_start(args, fmt);
int ret = vsprintf(str, fmt, args); int ret = vsprintf(str, fmt, args);
......
// $Id: PViewDataGModel.cpp,v 1.19 2008-02-24 21:05:04 geuzaine Exp $ // $Id: PViewDataGModel.cpp,v 1.20 2008-02-25 15:36:38 geuzaine Exp $
// //
// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
// //
...@@ -24,9 +24,9 @@ ...@@ -24,9 +24,9 @@
#include "PViewDataGModel.h" #include "PViewDataGModel.h"
#include "MElement.h" #include "MElement.h"
#include "Message.h"
PViewDataGModel::PViewDataGModel(GModel *model) : _model(model) PViewDataGModel::PViewDataGModel(GModel *model) : _model(model)
{ {
// store vector of GEntities so we can index them efficiently // store vector of GEntities so we can index them efficiently
for(GModel::eiter it = _model->firstEdge(); it != _model->lastEdge(); ++it) for(GModel::eiter it = _model->firstEdge(); it != _model->lastEdge(); ++it)
...@@ -50,16 +50,19 @@ PViewDataGModel::PViewDataGModel(GModel *model) : _model(model) ...@@ -50,16 +50,19 @@ PViewDataGModel::PViewDataGModel(GModel *model) : _model(model)
When reading a .msh file: When reading a .msh file:
nodeData.resize(std::max(_model->getMaxNodeDataIndex(), numDataInFile)); if(nodeData[step - 1].size())
nodeData[step].values.resize(nodeData[step - 1].size());
else
nodeData[step].values.resize(numDataInFile);
loop over lines: loop over lines:
* get node number in file * get node number in file
* get vertex pointer from _model->getVertexByTag(num) * get vertex pointer from _model->getVertexByTag(num)
* if MVertex has no dataIndex: * if MVertex has no dataIndex:
increment it (need global value stored in GModel) increment it (need global value stored in GModel)
fill std::vector<double> tmp else
nodeData[step].push_back(tmp) use the one that's stored
else: * if(dataIndex > nodeData[step].size()) nodeData[step].resize(dataIndex + 1)
add data nodeData[step][dataIndex] * fill nodeData[step].value[dataIndex]
.msh file format: .msh file format:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment