Changeset 348 for cpp/frams/util/extvalue.cpp
- Timestamp:
- 04/09/15 23:51:28 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/util/extvalue.cpp
r337 r348 269 269 if (tmp.len() > 30) tmp = tmp.substr(0, 30) + "..."; 270 270 if (type == TString) tmp = SString("\"") + tmp + SString("\""); 271 FMprintf("ExtValue", "getObjectTarget", FMLV_WARN, "%s object expected, %s found", classname, (const char*)tmp);271 FMprintf("ExtValue", "getObjectTarget", FMLV_WARN, "%s object expected, %s found", classname, tmp.c_str()); 272 272 } 273 273 return NULL; … … 329 329 static ExtValue::CompareResult compareString(const SString &a, const SString &b) 330 330 { 331 const char* s1 = (const char*)a;332 const char* s2 = (const char*)b;331 const char* s1 = a.c_str(); 332 const char* s2 = b.c_str(); 333 333 return longsign(strcmp(s1, s2)); 334 334 } … … 415 415 if (context->v1 && context->v2) 416 416 msg += SString::sprintf(": %s %s %s", 417 (const char*)context->v1->typeAndValue(),417 context->v1->typeAndValue().c_str(), 418 418 cmp_op_names[op - CmpFIRST], 419 (const char*)context->v2->typeAndValue());420 } 421 FMprintf("ExtValue", "interpretCompare", FMLV_ERROR, "%s", (const char*)msg);419 context->v2->typeAndValue().c_str()); 420 } 421 FMprintf("ExtValue", "interpretCompare", FMLV_ERROR, "%s", msg.c_str()); 422 422 ret = -1; 423 423 } … … 448 448 { 449 449 case TDouble: 450 FMprintf("ExtValue", "add", FMLV_WARN, "Adding %s to %s", (const char*)src.typeAndValue(), (const char*)typeAndValue());450 FMprintf("ExtValue", "add", FMLV_WARN, "Adding %s to %s", src.typeAndValue().c_str(), typeAndValue().c_str()); 451 451 setDouble(double(getInt()) + src.getDouble()); 452 452 return; … … 487 487 default:; 488 488 } 489 FMprintf("ExtValue", "add", FMLV_ERROR, "Can't add %s to %s", (const char*)src.typeAndValue(), (const char*)typeAndValue());489 FMprintf("ExtValue", "add", FMLV_ERROR, "Can't add %s to %s", src.typeAndValue().c_str(), typeAndValue().c_str()); 490 490 } 491 491 … … 502 502 return; 503 503 case TDouble: 504 FMprintf("ExtValue", "subtract", FMLV_WARN, "Subtracting %s from %s", (const char*)src.typeAndValue(), (const char*)typeAndValue());504 FMprintf("ExtValue", "subtract", FMLV_WARN, "Subtracting %s from %s", src.typeAndValue().c_str(), typeAndValue().c_str()); 505 505 setDouble(double(getInt()) - src.getDouble()); 506 506 return; … … 520 520 default:; 521 521 } 522 FMprintf("ExtValue", "subtract", FMLV_ERROR, "Can't subtract %s from %s", (const char*)src.typeAndValue(), (const char*)typeAndValue());522 FMprintf("ExtValue", "subtract", FMLV_ERROR, "Can't subtract %s from %s", src.typeAndValue().c_str(), typeAndValue().c_str()); 523 523 } 524 524 … … 535 535 return; 536 536 case TDouble: 537 FMprintf("ExtValue", "multiply", FMLV_WARN, "Multiplying %s by %s", (const char*)typeAndValue(), (const char*)src.typeAndValue());537 FMprintf("ExtValue", "multiply", FMLV_WARN, "Multiplying %s by %s", typeAndValue().c_str(), src.typeAndValue().c_str()); 538 538 setDouble(double(getInt())*src.getDouble()); 539 539 return; … … 591 591 default:; 592 592 } 593 FMprintf("ExtValue", "multiply", FMLV_WARN, "Can't multiply %s by %s", (const char*)typeAndValue(), (const char*)src.typeAndValue());593 FMprintf("ExtValue", "multiply", FMLV_WARN, "Can't multiply %s by %s", typeAndValue().c_str(), src.typeAndValue().c_str()); 594 594 } 595 595 … … 621 621 if (a == 0.0) 622 622 { 623 FMprintf("ExtValue", "divide", FMLV_CRITICAL, "Division by zero: %s/0.0", (const char*)getString());623 FMprintf("ExtValue", "divide", FMLV_CRITICAL, "Division by zero: %s/0.0", getString().c_str()); 624 624 setInvalid(); 625 625 } … … 630 630 if (!finite(tmp)) 631 631 { 632 FMprintf("ExtValue", "divide", FMLV_CRITICAL, "Overflow %s/%g", (const char*)getString(), a); setInvalid();632 FMprintf("ExtValue", "divide", FMLV_CRITICAL, "Overflow %s/%g", getString().c_str(), a); setInvalid(); 633 633 } 634 634 else … … 652 652 return; 653 653 case TDouble: 654 FMprintf("ExtValue", "divide", FMLV_WARN, "Dividing %s by %s", (const char*)typeAndValue(), (const char*)src.typeAndValue());654 FMprintf("ExtValue", "divide", FMLV_WARN, "Dividing %s by %s", typeAndValue().c_str(), src.typeAndValue().c_str()); 655 655 divDouble(src.ddata()); 656 656 return; … … 674 674 default:; 675 675 } 676 FMprintf("ExtValue", "divide", FMLV_ERROR, "Can't divide %s by %s", (const char*)typeAndValue(), (const char*)src.typeAndValue());676 FMprintf("ExtValue", "divide", FMLV_ERROR, "Can't divide %s by %s", typeAndValue().c_str(), src.typeAndValue().c_str()); 677 677 } 678 678 … … 687 687 // ^-cur ^-next 688 688 // ^^^^^^^^^^___sub 689 const char* begin = (const char*)fmt, *end = begin + fmt.len(), *curr = begin;689 const char* begin = fmt.c_str(), *end = begin + fmt.len(), *curr = begin; 690 690 int type = 0; 691 691 … … 733 733 switch (type) 734 734 { 735 case 'd': a = args.getNext(); ret += SString::sprintf( (const char*)sub, a ? a->getInt() : 0); break;736 case 'f': a = args.getNext(); ret += SString::sprintf( (const char*)sub, a ? a->getDouble() : 0); break;737 case 's': {a = args.getNext(); SString tmp; if (a) tmp = a->getString(); ret += SString::sprintf( (const char*)sub, (const char*)tmp); } break;735 case 'd': a = args.getNext(); ret += SString::sprintf(sub.c_str(), a ? a->getInt() : 0); break; 736 case 'f': a = args.getNext(); ret += SString::sprintf(sub.c_str(), a ? a->getDouble() : 0); break; 737 case 's': {a = args.getNext(); SString tmp; if (a) tmp = a->getString(); ret += SString::sprintf(sub.c_str(), tmp.c_str()); } break; 738 738 case 't': case 'T': 739 739 { … … 779 779 780 780 case TObj: case TUnknown: case TInvalid: 781 FMprintf("ExtValue", "modulo", FMLV_WARN, "Can't apply modulo to %s", (const char*)typeDescription());781 FMprintf("ExtValue", "modulo", FMLV_WARN, "Can't apply modulo to %s", typeDescription().c_str()); 782 782 783 783 default:; … … 835 835 case TInt: return idata(); 836 836 case TDouble: return (int)ddata(); 837 case TString: return getInt( (const char*)sdata());837 case TString: return getInt(sdata().c_str()); 838 838 case TObj: 839 FMprintf("ExtValue", "getInt", FMLV_WARN, "Getting integer value from object reference (%s)", (const char*)getString());839 FMprintf("ExtValue", "getInt", FMLV_WARN, "Getting integer value from object reference (%s)", getString().c_str()); 840 840 return (paInt)(intptr_t)odata().param; 841 841 default:; … … 850 850 case TDouble: return ddata(); 851 851 case TInt: return (double)idata(); 852 case TString: return getDouble( (const char*)sdata());852 case TString: return getDouble(sdata().c_str()); 853 853 case TObj: 854 FMprintf("ExtValue", "getDouble", FMLV_WARN, "Getting floating point value from object reference (%s)", (const char*)getString());854 FMprintf("ExtValue", "getDouble", FMLV_WARN, "Getting floating point value from object reference (%s)", getString().c_str()); 855 855 return (double)(intptr_t)odata().param; 856 856 default:; … … 1095 1095 ExtValue tmp; 1096 1096 ret = tmp.deserialize(ret); 1097 ParamInterface *cls = findDeserializableClass(clsname );1097 ParamInterface *cls = findDeserializableClass(clsname.c_str()); 1098 1098 if (cls && (tmp.getType() != TUnknown) && (tmp.getType() != TInvalid)) 1099 1099 { … … 1134 1134 } 1135 1135 setEmpty(); 1136 FMprintf("ExtValue", "deserialize", FMLV_WARN, "object of class \"%s\" could not be deserialized", (const char*)clsname);1136 FMprintf("ExtValue", "deserialize", FMLV_WARN, "object of class \"%s\" could not be deserialized", clsname.c_str()); 1137 1137 return ret; 1138 1138 }
Note: See TracChangeset
for help on using the changeset viewer.