From 5323bd2c4efc3796c35e25fc5111aad7dead65f6 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Mon, 22 Aug 2005 19:21:31 +0000 Subject: file loading: fixed recognition of stringified directory names svn path=/trunk/; revision=3446 --- externals/grill/pool/readme.txt | 1 + externals/grill/pool/source/pool.cpp | 27 +++++++++++++-------------- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'externals/grill/pool') diff --git a/externals/grill/pool/readme.txt b/externals/grill/pool/readme.txt index e9c21b82..092a4f75 100644 --- a/externals/grill/pool/readme.txt +++ b/externals/grill/pool/readme.txt @@ -88,6 +88,7 @@ Version history: - improved reading of legacy data by Frank Barknecht - use statically allocated lists where feasible - bug fix: [reset( didn't reset the current dir +- file loading: fixed recognition of stringified directory names 0.2.0: - attributes (pool,private,echodir,absdir) diff --git a/externals/grill/pool/source/pool.cpp b/externals/grill/pool/source/pool.cpp index 7fd1c289..e99f8cf5 100644 --- a/externals/grill/pool/source/pool.cpp +++ b/externals/grill/pool/source/pool.cpp @@ -467,7 +467,7 @@ BL pooldir::Copy(pooldir *p,I depth,BL cut) } -static char *ReadAtom(char *c,A *a) +static const char *ReadAtom(const char *c,A &a) { // skip leading whitespace while(*c && isspace(*c)) ++c; @@ -522,18 +522,15 @@ static char *ReadAtom(char *c,A *a) fres = (float)strtod(tmp,&endp); if(!issymbol && !*endp && endp != tmp) { #endif - if(a) { - int ires = (int)fres; // try a cast - if(fres == ires) - flext::SetInt(*a,ires); - else - flext::SetFloat(*a,fres); - } + int ires = (int)fres; // try a cast + if(fres == ires) + flext::SetInt(a,ires); + else + flext::SetFloat(a,fres); } // no, it's a symbol - else { - if(a) flext::SetString(*a,tmp); - } + else + flext::SetString(a,tmp); return c; } @@ -543,8 +540,8 @@ static BL ParseAtoms(C *tmp,flext::AtomList &l) const int MAXATOMS = 1024; int cnt = 0; t_atom atoms[MAXATOMS]; - for(char *t = tmp; *t && cnt < MAXATOMS; ++cnt) { - t = ReadAtom(t,&atoms[cnt]); + for(const char *t = tmp; *t && cnt < MAXATOMS; ++cnt) { + t = ReadAtom(t,atoms[cnt]); if(!t) break; } l(cnt,atoms); @@ -817,12 +814,14 @@ BL pooldir::LdDirXMLRec(istream &is,I depth,BL mkdir,AtomList &d) } else { t_atom &dkey = d[d.Count()-1]; + FLEXT_ASSERT(IsSymbol(dkey)); const char *ds = GetString(dkey); FLEXT_ASSERT(ds); if(*ds) post("pool - XML load: dir key already given, ignoring new key"); else - SetString(dkey,s.c_str()); + ReadAtom(s.c_str(),dkey); + ret = true; } if(!ret) post("pool - error interpreting XML value (%s)",s.c_str()); -- cgit v1.2.1