From 995e9397a88760fb785ec05e5f0bc9ca7c75aad7 Mon Sep 17 00:00:00 2001 From: Jonathan Westhues Date: Sat, 10 Jan 2009 00:18:54 -0800 Subject: [PATCH] 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] --- file.cpp | 8 ++++++++ srf/surface.h | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 srf/surface.h diff --git a/file.cpp b/file.cpp index 12de674..9fe96c9 100644 --- a/file.cpp +++ b/file.cpp @@ -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; diff --git a/srf/surface.h b/srf/surface.h new file mode 100644 index 0000000..80ed468 --- /dev/null +++ b/srf/surface.h @@ -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 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 trim; +}; + +class SShell { +public: + IdList allCurves; + IdList surface; +}; + +#endif +