Changeset 348 for cpp/frams/param/param.cpp
- Timestamp:
- 04/09/15 23:51:28 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/param/param.cpp
r343 r348 301 301 ws = get(i); 302 302 quoteTilde(ws); 303 w = ws ;303 w = ws.c_str(); 304 304 if (ws.len() > 50) cr = 1; 305 305 else for (t = w; *t; t++) if ((*t == 10) || (*t == 13)) { cr = 1; break; } … … 372 372 { // string - special case 373 373 SString str = getString(i); 374 if (strContainsOneOf(str , ", \\\n\r\t\""))374 if (strContainsOneOf(str.c_str(), ", \\\n\r\t\"")) 375 375 { 376 376 t += "\""; … … 403 403 { 404 404 if (linenum) (*linenum)++; 405 const char* t = (const char*)buf;405 const char* t = buf.c_str(); 406 406 p0 = t; while ((*p0 == ' ') || (*p0 == '\t')) p0++; 407 407 if (!*p0) break; … … 419 419 czytdotyldy(f, s); 420 420 int lfcount = 1; 421 const char* tmp = s ;421 const char* tmp = s.c_str(); 422 422 while (tmp) 423 423 if ((tmp = strchr(tmp, '\n'))) … … 430 430 if (linenum && (flags(i)&PARAM_LINECOMMENT)) 431 431 s = SString::sprintf("@file %s\n@line %d\n", f->VgetPath(), *linenum + 1) + s; 432 set(i, (const char*)s);432 set(i, s.c_str()); 433 433 if (linenum) 434 434 (*linenum) += lfcount; … … 445 445 { 446 446 SString name(p0, p_len); 447 FMprintf("ParamInterface", "load", FMLV_WARN, "Unknown property '%s' while reading object '%s' (ignored)", (const char*)name, getName());447 FMprintf("ParamInterface", "load", FMLV_WARN, "Unknown property '%s' while reading object '%s' (ignored)", name.c_str(), getName()); 448 448 } 449 449 … … 454 454 if (linenum) 455 455 { 456 const char* tmp = s ;456 const char* tmp = s.c_str(); 457 457 int lfcount = 1; 458 458 while (tmp) … … 562 562 if (v.type == TObj) 563 563 { 564 FMprintf("ParamInterface", "set", FMLV_WARN, "Getting integer value from object reference (%s)", (const char*)v.getString());564 FMprintf("ParamInterface", "set", FMLV_WARN, "Getting integer value from object reference (%s)", v.getString().c_str()); 565 565 return 0; 566 566 } 567 567 else 568 return setInt(i, (const char*)v.getString());568 return setInt(i, v.getString().c_str()); 569 569 } 570 570 case 'f': … … 574 574 if (v.type == TObj) 575 575 { 576 FMprintf("ParamInterface", "set", FMLV_WARN, "Getting floating point value from object reference (%s)", (const char*)v.getString());576 FMprintf("ParamInterface", "set", FMLV_WARN, "Getting floating point value from object reference (%s)", v.getString().c_str()); 577 577 return 0; 578 578 } 579 579 else 580 return setDouble(i, (const char*)v.getString());580 return setDouble(i, v.getString().c_str()); 581 581 } 582 582 case 's': { SString t = v.getString(); return setString(i, t); } … … 990 990 static const char *getline(const SString &s, int &poz, int &len) 991 991 { 992 const char *beg = (const char*)s+ poz;993 if (poz >= s.len()) { poz = s.len(); len = 0; return (const char*)s+ s.len(); }992 const char *beg = s.c_str() + poz; 993 if (poz >= s.len()) { poz = s.len(); len = 0; return s.c_str() + s.len(); } 994 994 const char *lf = strchr(beg, '\n'); 995 if (!lf) { lf = (const char*)s+ s.len() - 1; poz = s.len(); }996 else { poz = (int)(lf - (const char*)s) + 1; if (poz > s.len()) poz = s.len(); }995 if (!lf) { lf = s.c_str() + s.len() - 1; poz = s.len(); } 996 else { poz = (int)(lf - s.c_str()) + 1; if (poz > s.len()) poz = s.len(); } 997 997 while (lf >= beg) if ((*lf == '\n') || (*lf == '\r')) lf--; else break; 998 998 len = (int)(lf - beg) + 1; … … 1014 1014 SString tmpvalue; 1015 1015 if (poz >= s.len()) return fields_loaded; 1016 t = (const char*)s+ poz;1016 t = s.c_str() + poz; 1017 1017 1018 1018 lin = getline(s, poz, len); // all fields must be encoded in a single line … … 1060 1060 { 1061 1061 SString name(t, (int)(equals_sign - t)); 1062 FMprintf("Param", "load2", FMLV_WARN, "Unknown property '%s' while reading object '%s' (ignored)", (const char*)name, getName());1062 FMprintf("Param", "load2", FMLV_WARN, "Unknown property '%s' while reading object '%s' (ignored)", name.c_str(), getName()); 1063 1063 } 1064 1064 t = equals_sign + 1; // t=value … … 1081 1081 tmpvalue.copyFrom(quote + 1, (int)(quote2 - quote) - 1); 1082 1082 sstringUnquote(tmpvalue); 1083 value = tmpvalue ;1083 value = tmpvalue.c_str(); 1084 1084 valstop = quote2; 1085 1085 }
Note: See TracChangeset
for help on using the changeset viewer.