From c832d635b159ee26497ee245c99d161df598319f Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 11 Aug 2009 11:55:46 +0200 Subject: [PATCH] ISstream::read improvements - following Andy's idea to return values as label whenever possible eg, 1.2e6 -> 1200000 but left it commented out - avoid buffer overflow in ISstream::read(word&). Is the 'if (fail())' check itself actually in the correct place?? - other minor cosmetic changes --- applications/test/tokenizeTest/tokenizeTest.C | 86 +++++--- src/OpenFOAM/db/IOstreams/Sstreams/ISstream.C | 197 +++++++++--------- src/OpenFOAM/global/argList/argList.C | 12 +- 3 files changed, 171 insertions(+), 124 deletions(-) diff --git a/applications/test/tokenizeTest/tokenizeTest.C b/applications/test/tokenizeTest/tokenizeTest.C index deb675ee00..99bc599984 100644 --- a/applications/test/tokenizeTest/tokenizeTest.C +++ b/applications/test/tokenizeTest/tokenizeTest.C @@ -33,6 +33,7 @@ Description #include "IOstreams.H" #include "IFstream.H" #include "IStringStream.H" +#include "cpuTime.H" using namespace Foam; @@ -44,41 +45,76 @@ int main(int argc, char *argv[]) argList::noParallel(); argList::validArgs.insert("string .. stringN"); argList::validOptions.insert("file", "name"); + argList::validOptions.insert("repeat", "count"); argList args(argc, argv, false, true); - forAll(args.additionalArgs(), argI) - { - const string& rawArg = args.additionalArgs()[argI]; - Info<< "input string: " << rawArg << nl; + label repeat = 1; + args.optionReadIfPresent