Skip to content

Commit 2fd915e

Browse files
authored
Merge branch 'master' into classic-tutorial
2 parents 031abd1 + 27d84fc commit 2fd915e

File tree

6 files changed

+5
-139
lines changed

6 files changed

+5
-139
lines changed

src/Core/Persistent/Pstreams.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
# include <io.h>
6363
#endif
6464

65+
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
6566
#pragma GCC diagnostic ignored "-Wunknown-warning-option"
6667
//TODO: new one from M1/Big Sur build
6768
#pragma GCC diagnostic ignored "-Wfortify-source"

src/Core/Utils/Legacy/FileUtils.cc

Lines changed: 0 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -64,123 +64,6 @@ namespace bsys=boost::system;
6464

6565
namespace SCIRun {
6666

67-
////////////////////////////////////////////////////////////
68-
//
69-
// InsertStringInFile
70-
//
71-
// If "match" is found in "filename", then add "add_text" text
72-
// to the file _after_ the location of the matched text.
73-
//
74-
// Normally, I would just use sed via system() to edit a file,
75-
// but for some reason system() calls never work from Dataflow
76-
// processes in linux. Oh well, sed isn't natively available
77-
// under windows, so I'd have to do something like this anyhow
78-
// - Chris Moulding
79-
80-
void
81-
InsertStringInFile(char* filename, const char* match, const char* add_text)
82-
{
83-
/// @todo: rewrite in C++
84-
char* newfilename = new char[strlen(filename)+2];
85-
char c;
86-
sprintf(newfilename,"%s~",filename);
87-
FILE* ifile;
88-
FILE* ofile;
89-
90-
/* create a copy of the original file */
91-
ifile = fopen(filename,"r");
92-
93-
if( !ifile ) {
94-
printf( "ERROR: In Core/Util/FileUtils.cc: InsertStringInFile:\n" );
95-
printf(" File '%s' does not exist!\n", filename );
96-
printf( " There is something seriously wrong with your SCIRun installation.\n");
97-
printf( " Please contact [email protected].\n");
98-
exit( 1 );
99-
}
100-
101-
ofile = fopen(newfilename,"w");
102-
103-
c = (char)fgetc(ifile);
104-
while (c!=(char)EOF) {
105-
fprintf(ofile,"%c",c);
106-
c = (char)fgetc(ifile);
107-
}
108-
fclose(ifile);
109-
fclose(ofile);
110-
111-
// Search the copy for an instance of "match"...
112-
int index1 = 0;
113-
unsigned int index2 = 0;
114-
int foundat = -1;
115-
ifile = fopen(newfilename,"r");
116-
c = (char)fgetc(ifile);
117-
while (c!=(char)EOF) {
118-
if (c==match[index2]) {
119-
foundat = index1 + strlen(match);
120-
while (index2<strlen(match) && c!=(char)EOF && c==match[index2]) {
121-
c = (char)fgetc(ifile);
122-
index1++;
123-
index2++;
124-
}
125-
if( foundat >= 0 && index2 != strlen(match) ) {
126-
foundat = -1;
127-
index2 = 0;
128-
} else {
129-
break;
130-
}
131-
}
132-
c = (char)fgetc(ifile);
133-
index1++;
134-
}
135-
fclose(ifile);
136-
137-
// If an instance of match was found, insert the indicated string...
138-
if( foundat >= 0 ) {
139-
index1 = 0;
140-
ifile = fopen(newfilename,"r");
141-
ofile = fopen(filename,"w");
142-
c = (char)fgetc(ifile);
143-
while (c!=(char)EOF) {
144-
if( index1 == foundat ) {
145-
fprintf( ofile, "%s", add_text );
146-
}
147-
fprintf(ofile,"%c",c);
148-
c = (char)fgetc(ifile);
149-
index1++;
150-
}
151-
fclose(ifile);
152-
fclose(ofile);
153-
}
154-
}
155-
156-
std::map<int,char*>*
157-
GetFilenamesEndingWith(const char* d, const char* ext)
158-
{
159-
std::map<int,char*>* newmap = nullptr;
160-
dirent* file = nullptr;
161-
DIR* dir = opendir(d);
162-
char* newstring = nullptr;
163-
164-
if (!dir)
165-
return nullptr;
166-
167-
newmap = new std::map<int,char*>;
168-
169-
file = readdir(dir);
170-
while (file) {
171-
if ((strlen(file->d_name)>=strlen(ext)) &&
172-
(strcmp(&(file->d_name[strlen(file->d_name)-strlen(ext)]),ext)==0)) {
173-
newstring = new char[strlen(file->d_name)+1];
174-
sprintf(newstring,"%s",file->d_name);
175-
newmap->insert(std::pair<int,char*>(newmap->size(),newstring));
176-
}
177-
file = readdir(dir);
178-
}
179-
180-
closedir(dir);
181-
return newmap;
182-
}
183-
18467
std::string
18568
substituteTilde( const std::string & dirstr ) {
18669
std::string realdirstr = dirstr;

src/Core/Utils/Legacy/FileUtils.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,6 @@
4848

4949
namespace SCIRun {
5050

51-
////////////////////////////////////
52-
/// InsertStringInFile()
53-
/// Inserts "insert" in front of all occurrances of
54-
/// "match" within the file named "filename"
55-
56-
SCISHARE void InsertStringInFile(char* filename, const char* match, const char* insert);
57-
58-
59-
////////////////////////////////////
60-
/// GetFilenamesEndingWith()
61-
/// returns a std::map of strings that contains
62-
/// all the files with extension "ext" inside
63-
/// the directory named "dir"
64-
65-
SCISHARE std::map<int,char*>* GetFilenamesEndingWith(const char* dir,
66-
const char* ext);
67-
6851
SCISHARE std::vector<std::string> GetFilenamesStartingWith(const std::string & dir,
6952
const std::string & prefix);
7053

src/Graphics/Datatypes/Tests/GLMTests.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#include <gtest/gtest.h>
3232
#include <glm/gtc/matrix_transform.hpp>
3333
#include <glm/gtc/type_ptr.hpp>
34-
#include <glm/gtx/string_cast.hpp>
3534
#include <glm/mat4x4.hpp>
3635
#include <glm/vec3.hpp>
3736

src/Interface/Modules/Render/ES/ObjectTransformCalculators.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#include <Interface/Modules/Render/ES/ObjectTransformCalculators.h>
3030
#include <Interface/Modules/Render/ES/SRCamera.h>
3131
#include <glm/gtx/transform.hpp>
32-
#include <glm/gtx/string_cast.hpp>
3332
#include <Core/Math/MiscMath.h>
3433
#include <glm/gtx/vec_swizzle.hpp>
3534

src/Modules/Visualization/ShowColorMapModule.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,13 +200,13 @@ GeometryBaseHandle ShowColorMap::buildGeometryObject(ColorMapHandle cm, ModuleSt
200200

201201
auto geom(makeShared<GeometryObjectSpire>(*this, idname, false));
202202

203-
//geom->setColorMap(cm->getColorMapName());
204203
geom->ibos().push_back(geomIBO);
205204
geom->vbos().push_back(geomVBO);
206205
geom->passes().push_back(pass);
207206

208207
//text
209-
char str2[128];
208+
constexpr int valueBufferSize = 128;
209+
char str2[valueBufferSize];
210210
std::stringstream sd;
211211
sd << "%." << sigdig << "g";
212212
std::vector<Vector> txt_coords;
@@ -226,7 +226,8 @@ GeometryBaseHandle ShowColorMap::buildGeometryObject(ColorMapHandle cm, ModuleSt
226226
for (double i = 0.; i <= 1.000000001; i += increment)
227227
{
228228
std::stringstream lineStream;
229-
sprintf(str2, sd.str().c_str(), (i / cm->getColorMapRescaleScale() - cm->getColorMapRescaleShift()) * scale);
229+
const double colorValue = (i / cm->getColorMapRescaleScale() - cm->getColorMapRescaleShift()) * scale;
230+
snprintf(str2, valueBufferSize, sd.str().c_str(), colorValue);
230231
lineStream << str2 << " " << state->getValue(Units).toString();
231232
const auto line = lineStream.str();
232233
bool ds = displaySide == 0;

0 commit comments

Comments
 (0)