diff options
author | karl <karl> | 2014-08-05 14:34:06 +0000 |
---|---|---|
committer | karl <karl> | 2014-08-05 14:34:06 +0000 |
commit | d43d59fb840fa564abc6bdf504f1ddb64a3ef410 (patch) | |
tree | 2bd9261229745432f7ecbbcb81bb41d122eac47e | |
parent | 70f2a89302900e19d43ce489ddb9c105f9f58a22 (diff) | |
download | tog-pegasus-cvsupdate.zip tog-pegasus-cvsupdate.tar.gz tog-pegasus-cvsupdate.tar.xz |
TITLE: Compiling on windows platform causes warning messages from
cimcli code
DESCRIPTION: Made 64 to 32 bit conversion explicit. Removed stringPrintf local to use common String function appendPrintf,
removed some unused includes, removed some unused parameters.
-rw-r--r-- | src/Clients/cimcli/CIMCLIClient.cpp | 18 | ||||
-rw-r--r-- | src/Clients/cimcli/CIMCLIClient.h | 3 | ||||
-rw-r--r-- | src/Clients/cimcli/CIMCLICommand.cpp | 1 | ||||
-rw-r--r-- | src/Clients/cimcli/CIMCLICommon.cpp | 67 | ||||
-rw-r--r-- | src/Clients/cimcli/CIMCLICommon.h | 17 | ||||
-rw-r--r-- | src/Clients/cimcli/CIMCLIHelp.cpp | 11 | ||||
-rw-r--r-- | src/Clients/cimcli/CIMCLIOptionStruct.h | 1 | ||||
-rw-r--r-- | src/Clients/cimcli/CIMCLIOptions.cpp | 2 | ||||
-rw-r--r-- | src/Clients/cimcli/CIMCLIOutput.cpp | 26 | ||||
-rw-r--r-- | src/Clients/cimcli/Makefile | 2 | ||||
-rw-r--r-- | src/Clients/cimcli/ObjectBuilder.cpp | 29 | ||||
-rw-r--r-- | src/Clients/cimcli/ObjectBuilder.h | 9 |
12 files changed, 59 insertions, 127 deletions
diff --git a/src/Clients/cimcli/CIMCLIClient.cpp b/src/Clients/cimcli/CIMCLIClient.cpp index 880fbd6..8eeba89 100644 --- a/src/Clients/cimcli/CIMCLIClient.cpp +++ b/src/Clients/cimcli/CIMCLIClient.cpp @@ -42,7 +42,6 @@ #include <Pegasus/Common/XmlWriter.h> #include <Pegasus/Common/Tracer.h> #include <Pegasus/Common/StringConversion.h> -#include <Pegasus/Common/ArrayInternal.h> #include <Pegasus/Common/PegasusVersion.h> @@ -50,6 +49,8 @@ #include <Pegasus/Common/Print.h> #include <Pegasus/Common/HashTable.h> #include <Pegasus/Common/Pegasus_inl.h> +#include <Pegasus/Common/PegasusAssert.h> +#include <Pegasus/General/Stopwatch.h> #include "CIMCLIClient.h" @@ -2418,13 +2419,6 @@ struct classTreeEntry } }; -// Create a Pegasus array type for classTreeEntry -#include <Pegasus/Common/ArrayIterator.h> -#define PEGASUS_ARRAY_T classTreeEntry -# include <Pegasus/Common/ArrayInter.h> -# include <Pegasus/Common/ArrayImpl.h> -#undef PEGASUS_ARRAY_T - /* Class defining the container for classTreeEntry items. As classes are analyzed, classTreeEntry items are put into this container and at the @@ -2757,14 +2751,6 @@ struct instanceCounter } }; -// Define array of instanceCounter struct - -#include <Pegasus/Common/ArrayIterator.h> -#define PEGASUS_ARRAY_T instanceCounter -# include <Pegasus/Common/ArrayInter.h> -# include <Pegasus/Common/ArrayImpl.h> -#undef PEGASUS_ARRAY_T - // find an instance in array of instanceCounter. Returns true if found static bool _findInstance(Array<instanceCounter>& x, String& name, Uint32& pos) { diff --git a/src/Clients/cimcli/CIMCLIClient.h b/src/Clients/cimcli/CIMCLIClient.h index 02814f0..f73695c 100644 --- a/src/Clients/cimcli/CIMCLIClient.h +++ b/src/Clients/cimcli/CIMCLIClient.h @@ -34,8 +34,7 @@ #include <Pegasus/Common/Config.h> #include <Clients/cimcli/Linkage.h> -#include <Pegasus/Common/PegasusAssert.h> -#include <Pegasus/General/Stopwatch.h> + #include "CIMCLIOptionStruct.h" diff --git a/src/Clients/cimcli/CIMCLICommand.cpp b/src/Clients/cimcli/CIMCLICommand.cpp index 0b24949..78dab7d 100644 --- a/src/Clients/cimcli/CIMCLICommand.cpp +++ b/src/Clients/cimcli/CIMCLICommand.cpp @@ -46,7 +46,6 @@ are defined in CIMCLIOptions. */ #include <Pegasus/Common/Config.h> -#include <Pegasus/Common/PegasusAssert.h> #include <Pegasus/Common/Constants.h> #include <Pegasus/Common/Threads.h> #include <Pegasus/Common/Tracer.h> diff --git a/src/Clients/cimcli/CIMCLICommon.cpp b/src/Clients/cimcli/CIMCLICommon.cpp index 33e82ca..042e40b 100644 --- a/src/Clients/cimcli/CIMCLICommon.cpp +++ b/src/Clients/cimcli/CIMCLICommon.cpp @@ -371,6 +371,15 @@ Real64 strToReal(const char * str, CIMType type) "Value conversion error. $0. type $1\n", str, cimTypeToString(type)); } + if (type == CIMTYPE_REAL32) + { + if ((r64 > 3.4E+38f) || (r64 < -3.4E38f)) + { + cimcliMsg::exit(CIMCLI_INPUT_ERR, + "Value Invalid size. $0. type $1\n", + str, cimTypeToString(type)); + } + } return r64; } @@ -419,64 +428,6 @@ void setExpectedExitCode(Uint32 exitCode) ** issues internally. ** ***************************************************************************/ -// Function to return a formatted char* from a va_list. -// Allocates space for the returned char* and repeats the -// build process until the allocated space is large enough -// to hold the result. This is internal only and the core function -// used by stringPrintf and stringVPrintf - -static char* charVPrintf(const char* format, va_list ap) -{ - // Iniitial allocation size. This is a guess assuming that - // most printfs are one or two lines long - int allocSize = 256; - - int rtnSize; - char *p; - - // initial allocate for output - if ((p = (char*)malloc(allocSize)) == NULL) - { - return 0; - } - - // repeat formatting with increased realloc until it works. - do - { - rtnSize = vsnprintf(p, allocSize, format, ap); - - // return if successful if not negative and - // returns less than allocated size. - if (rtnSize > -1 && rtnSize < allocSize) - { - return p; - } - - // increment alloc size. Assumes that positive return is - // expected size and negative is error. - allocSize = (rtnSize > -1)? (rtnSize + 1) : allocSize * 2; - - } while((p = (char*)peg_inln_realloc(p, allocSize)) != NULL); - - // return error code if realloc failed - return 0; -} -// Formatting function that returns a Pegasus String object. -String stringPrintf(const char* format, ...) -{ - va_list ap; - va_start(ap, format); - - // Format into allocated memory - char* rtnCharPtr = charVPrintf(format, ap); - va_end(ap); - - // Free allocated memory and return formatted output in String - String rtnString(rtnCharPtr); - free(rtnCharPtr); - - return(rtnString); -} String fillString(Uint32 count, const char x) { diff --git a/src/Clients/cimcli/CIMCLICommon.h b/src/Clients/cimcli/CIMCLICommon.h index 6d5f4ff..c4a0d84 100644 --- a/src/Clients/cimcli/CIMCLICommon.h +++ b/src/Clients/cimcli/CIMCLICommon.h @@ -33,12 +33,8 @@ #define _CLI_COMMON_H #include <Pegasus/Common/Config.h> -#include <Pegasus/Common/PegasusAssert.h> #include <Clients/cimcli/Linkage.h> #include <Pegasus/Common/CIMPropertyList.h> -#include <Pegasus/Common/Formatter.h> - -#include <Pegasus/Common/CIMInstance.h> #include <Pegasus/Common/MessageLoader.h> #include <cstdarg> PEGASUS_NAMESPACE_BEGIN @@ -336,19 +332,6 @@ Uint32 PEGASUS_CLI_LINKAGE cimcliExitRtn(Uint32 exitCode); void setExpectedExitCode(Uint32 expectedExitCode); /** - * Return a Pegasus String formatted string in allocated memory - * based on the input format definition string and the variable - * number of arguments that follow the format string. - * - * @param format containing the C++ printf format definition. - * @param ... variable number of input parameters dependent on - * the format definition input parameter - * @return String with formatted string. - */ - -String PEGASUS_CLI_LINKAGE stringPrintf(const char* format, ...); - -/** Remap a long string into a multi-line string that can be positioned on a line starting at pos and with length defined for each line. Each output line consists of fill parameter to diff --git a/src/Clients/cimcli/CIMCLIHelp.cpp b/src/Clients/cimcli/CIMCLIHelp.cpp index bffbd35..985816b 100644 --- a/src/Clients/cimcli/CIMCLIHelp.cpp +++ b/src/Clients/cimcli/CIMCLIHelp.cpp @@ -105,8 +105,8 @@ void showOperations(const char* pgmName, Uint32 lineLength) OperationTableEntry thisOperation = operations.next(); cout << endl; - String opString = stringPrintf( - "%-5s %-21s ", + String opString; + opString.appendPrintf("%-5s %-21s ", thisOperation.ShortCut, thisOperation.OperationName); @@ -215,7 +215,8 @@ Boolean showOperationUsage(const char* cmd, OptionManager& om, OperationExampleEntry example = operations.getExampleEntry(); // format the shortcut and // command string into a single output string. - String opString = stringPrintf( + String opString; + opString.appendPrintf( "%-5s %-21s ", thisOperation.ShortCut, thisOperation.OperationName); @@ -248,8 +249,8 @@ Boolean showOperationUsage(const char* cmd, OptionManager& om, << endl; // Output the common Options information - String commonOpStr = - stringPrintf("%s", "Common Options are : \n"); + String commonOpStr; + commonOpStr.appendPrintf("%s", "Common Options are : \n"); commonOpStr.append(commonOptions); diff --git a/src/Clients/cimcli/CIMCLIOptionStruct.h b/src/Clients/cimcli/CIMCLIOptionStruct.h index 3542504..77df9f7 100644 --- a/src/Clients/cimcli/CIMCLIOptionStruct.h +++ b/src/Clients/cimcli/CIMCLIOptionStruct.h @@ -35,6 +35,7 @@ #include <Pegasus/Common/Config.h> #include <Clients/cimcli/Linkage.h> #include <Pegasus/Common/PegasusAssert.h> +#include <Pegasus/General/Stopwatch.h> #include <Pegasus/Client/CIMClient.h> #include <Clients/cimcli/CIMCLIClient.h> diff --git a/src/Clients/cimcli/CIMCLIOptions.cpp b/src/Clients/cimcli/CIMCLIOptions.cpp index 067dca1..1097b29 100644 --- a/src/Clients/cimcli/CIMCLIOptions.cpp +++ b/src/Clients/cimcli/CIMCLIOptions.cpp @@ -878,7 +878,7 @@ Boolean CheckCommonOptionValues(OptionManager& om, char** argv, Options& opts) { pList.append(CIMName(pListString[i])); } - catch (InvalidNameException& e) + catch (InvalidNameException&) { throw OMInvalidOptionValue("propertyList", properties); } diff --git a/src/Clients/cimcli/CIMCLIOutput.cpp b/src/Clients/cimcli/CIMCLIOutput.cpp index cc9e3a3..885edb5 100644 --- a/src/Clients/cimcli/CIMCLIOutput.cpp +++ b/src/Clients/cimcli/CIMCLIOutput.cpp @@ -114,7 +114,18 @@ static int _compareKeyBinding(const CIMKeyBinding& kb1, kb2.getValue().getCString(), uValue2)) { - rtn = (uValue2 - uValue1); + if ((uValue2 - uValue1) > 0) + { + rtn = 1; + } + else if (((uValue2 - uValue1) == 0)) + { + return 0; + } + else + { + return -1; + } } else { @@ -132,7 +143,18 @@ static int _compareKeyBinding(const CIMKeyBinding& kb1, kb2.getValue().getCString(), sValue2)) { - rtn = (sValue2 - sValue1); + if ((sValue2 - sValue1) > 0) + { + rtn = 1; + } + else if (((sValue2 - sValue1) == 0)) + { + return 0; + } + else + { + return -1; + } } else { diff --git a/src/Clients/cimcli/Makefile b/src/Clients/cimcli/Makefile index e65077b..c98472a 100644 --- a/src/Clients/cimcli/Makefile +++ b/src/Clients/cimcli/Makefile @@ -39,7 +39,7 @@ LIBRARIES = \ pegcommon \ pegcliutils - LOCAL_DEFINES = -DPEGASUS_INTERNALONLY +LOCAL_DEFINES = -DPEGASUS_CLI_INTERNAL -DPEGASUS_INTERNALONLY EXTRA_INCLUDES = $(SYS_INCLUDES) diff --git a/src/Clients/cimcli/ObjectBuilder.cpp b/src/Clients/cimcli/ObjectBuilder.cpp index e25f338..e5fac22 100644 --- a/src/Clients/cimcli/ObjectBuilder.cpp +++ b/src/Clients/cimcli/ObjectBuilder.cpp @@ -40,20 +40,14 @@ #include "CIMCLIClient.h" #include "ObjectBuilder.h" #include "CIMCLICommon.h" -#include <Pegasus/Common/ArrayInternal.h> -#include <Pegasus/Common/ArrayIterator.h> + #include <Clients/cliutils/CsvStringParse.h> PEGASUS_USING_STD; PEGASUS_NAMESPACE_BEGIN -// Define a Pegasus array implementation for the tokenItem type -#define PEGASUS_ARRAY_T tokenItem -# include <Pegasus/Common/ArrayImpl.h> -#undef PEGASUS_ARRAY_T - // Diagnostic dislays activated if verboseTest set to true below. This is -// compile time used for developer tests only. Tjis should be disabled +// compile time used for developer tests only. This should be disabled // before code is released or automated tests run. bool verboseTest = false; #define VCOUT if (verboseTest) cout << "LINE=" << __LINE__ << " TST " @@ -407,14 +401,15 @@ Boolean _stringToArrayValue( val.set(a); break; } - + // Limits are checked in common functions for all of the integer + // types below case CIMTYPE_UINT8: { Array<Uint8> a; val.get(a); while(strl.more()) { - a.append(strToUint(strl.next().getCString(), type)); + a.append((Uint8)strToUint(strl.next().getCString(), type)); } val.set(a); break; @@ -426,7 +421,7 @@ Boolean _stringToArrayValue( val.get(a); while(strl.more()) { - a.append(strToSint(strl.next().getCString(), type)); + a.append((Sint8)strToSint(strl.next().getCString(), type)); } val.set(a); break; @@ -438,7 +433,7 @@ Boolean _stringToArrayValue( val.get(a); while(strl.more()) { - a.append(strToUint(strl.next().getCString(), type)); + a.append((Uint16)strToUint(strl.next().getCString(), type)); } val.set(a); break; @@ -450,7 +445,7 @@ Boolean _stringToArrayValue( val.get(a); while(strl.more()) { - a.append(strToSint(strl.next().getCString(), type)); + a.append((Sint16)strToSint(strl.next().getCString(), type)); } val.set(a); break; @@ -462,7 +457,7 @@ Boolean _stringToArrayValue( val.get(a); while(strl.more()) { - a.append(strToUint(strl.next().getCString(), type)); + a.append((Uint32)strToUint(strl.next().getCString(), type)); } val.set(a); break; @@ -474,7 +469,7 @@ Boolean _stringToArrayValue( val.get(a); while(strl.more()) { - a.append(strToSint(strl.next().getCString(), type)); + a.append((Sint32)strToSint(strl.next().getCString(), type)); } val.set(a); break; @@ -510,7 +505,7 @@ Boolean _stringToArrayValue( val.get(a); while(strl.more()) { - a.append(strToSint(strl.next().getCString(), type)); + a.append((Real32)strToReal(strl.next().getCString(), type)); } val.set(a); break; @@ -522,7 +517,7 @@ Boolean _stringToArrayValue( val.get(a); while(strl.more()) { - a.append(strToSint(strl.next().getCString(), type)); + a.append(strToReal(strl.next().getCString(), type)); } val.set(a); break; diff --git a/src/Clients/cimcli/ObjectBuilder.h b/src/Clients/cimcli/ObjectBuilder.h index a40d49b..b851113 100644 --- a/src/Clients/cimcli/ObjectBuilder.h +++ b/src/Clients/cimcli/ObjectBuilder.h @@ -32,8 +32,8 @@ #define _CLI_ObjectBuilder_h #include <Pegasus/Common/Config.h> -#include <Pegasus/Common/PegasusAssert.h> #include <Clients/cimcli/Linkage.h> +#include <Pegasus/Common/PegasusAssert.h> #include <Pegasus/Client/CIMClient.h> /* @@ -117,13 +117,8 @@ public: // required by Array template tokenItem() {} private: -}; -// Define a Pegasus Array for the tokenItem type -// Implementation defined in cpp file -#define PEGASUS_ARRAY_T tokenItem -# include <Pegasus/Common/ArrayInter.h> -#undef PEGASUS_ARRAY_T +}; // Define the class that builds instances and parameters from command line // input. |