X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/729e4ab9bc6618bc3d8a898e575df7f4019e29ca..f3c0d7a59d99c2a94c6b8822291f0e42be3773c9:/icuSources/tools/ctestfw/uperf.cpp diff --git a/icuSources/tools/ctestfw/uperf.cpp b/icuSources/tools/ctestfw/uperf.cpp index 2c33dcf6..0735f8a8 100644 --- a/icuSources/tools/ctestfw/uperf.cpp +++ b/icuSources/tools/ctestfw/uperf.cpp @@ -1,11 +1,14 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /******************************************************************** * COPYRIGHT: - * Copyright (c) 2002-2009, International Business Machines Corporation and + * Copyright (c) 2002-2012, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ -/* z/OS needs this definition for timeval */ -#include "platform_xopen_source_extended.h" +// Defines _XOPEN_SOURCE for access to POSIX functions. +// Must be before any other #includes. +#include "uposixdefs.h" #include "unicode/uperf.h" #include "uoptions.h" @@ -14,6 +17,9 @@ #include #if !UCONFIG_NO_CONVERSION + +UPerfFunction::~UPerfFunction() {} + static const char delim = '/'; static int32_t execCount = 0; UPerfTest* UPerfTest::gTest = NULL; @@ -203,6 +209,12 @@ void UPerfTest::init(UOption addOptions[], int32_t addOptionsCount, } ULine* UPerfTest::getLines(UErrorCode& status){ + if (U_FAILURE(status)) { + return NULL; + } + if (lines != NULL) { + return lines; // don't do it again + } lines = new ULine[MAXLINES]; int maxLines = MAXLINES; numLines=0; @@ -312,7 +324,7 @@ void UPerfTest::setPath( char* pathVal ) } // call individual tests, to be overriden to call implementations -UPerfFunction* UPerfTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* par ) +UPerfFunction* UPerfTest::runIndexedTest( int32_t /*index*/, UBool /*exec*/, const char* & /*name*/, char* /*par*/ ) { // to be overriden by a method like: /* @@ -323,7 +335,6 @@ UPerfFunction* UPerfTest::runIndexedTest( int32_t index, UBool exec, const char* } */ fprintf(stderr,"*** runIndexedTest needs to be overriden! ***"); - name = ""; exec = exec; index = index; par = par; return NULL; } @@ -484,8 +495,7 @@ void UPerfTest::usage( void ) this->runIndexedTest( index, FALSE, name ); if (!name) break; - fprintf(stdout,name); - fprintf(stdout,"\n"); + fprintf(stdout, "%s\n", name); index++; }while (name && (name[0] != 0)); verbose = save_verbose;