Tolerate files with \r characters in them; we would never write

such a file, but mailers might mangle them.

[git-p4: depot-paths = "//depot/solvespace/": change = 1891]
This commit is contained in:
Jonathan Westhues 2009-01-10 00:18:54 -08:00
parent 984956cbc7
commit 995e9397a8
2 changed files with 60 additions and 0 deletions

View File

@ -315,6 +315,10 @@ bool SolveSpace::LoadFromFile(char *filename) {
while(fgets(line, sizeof(line), fh)) {
char *s = strchr(line, '\n');
if(s) *s = '\0';
// We should never get files with \r characters in them, but mailers
// will sometimes mangle attachments.
s = strchr(line, '\r');
if(s) *s = '\0';
if(*line == '\0') continue;
@ -364,6 +368,10 @@ bool SolveSpace::LoadEntitiesFromFile(char *file, EntityList *le, SMesh *m) {
while(fgets(line, sizeof(line), fh)) {
char *s = strchr(line, '\n');
if(s) *s = '\0';
// We should never get files with \r characters in them, but mailers
// will sometimes mangle attachments.
s = strchr(line, '\r');
if(s) *s = '\0';
if(*line == '\0') continue;

52
srf/surface.h Normal file
View File

@ -0,0 +1,52 @@
#ifndef __SURFACE_H
#define __SURFACE_H
class hSCurve;
class hSSurface;
class hSCurve {
public:
DWORD v;
};
class SCurve {
public:
hSCurve h;
SList<Vector> pts;
hSSurface srfA;
hSSurface srfB;
};
class STrimBy {
public:
hSCurve curve;
Vector start;
Vector finish;
Vector out; // a vector pointing out of the contour
};
class hSSurface {
public:
DWORD v;
};
class SSurface {
public:
hSSurface h;
Vector ctrl[4][4];
double weight[4];
SList<STrimBy> trim;
};
class SShell {
public:
IdList<SCurve,hSCurve> allCurves;
IdList<SSurface,hSSurface> surface;
};
#endif