(file) Return to VersionUtil.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / General

Diff for /pegasus/src/Pegasus/General/VersionUtil.cpp between version 1.1 and 1.2

version 1.1, 2009/06/26 09:02:55 version 1.2, 2009/07/17 06:56:14
Line 67 
Line 67 
               ((minorV1 == minorV2) && (updateV1 >= updateV2)))));               ((minorV1 == minorV2) && (updateV1 >= updateV2)))));
 } }
  
   Boolean VersionUtil::parseVersion(
       const String& version,
       Sint32& iMajor,
       Sint32& iMinor,
       Sint32& iUpdate)
   {
       const char CHAR_PERIOD = '.';
   
       if (!version.size())
       {
           return true;
       }
   
       iMajor = 0;
       iMinor = 0;
       iUpdate = 0;
   
       Uint32 indexM = 0;
       Uint32 sizeM = PEG_NOT_FOUND;
       Uint32 indexN = PEG_NOT_FOUND;
       Uint32 sizeN = PEG_NOT_FOUND;
       Uint32 indexU = PEG_NOT_FOUND;
   
       // If "V" specified as first character, ignore it
       if ((version[0] == 'V') || (version[0] == 'v'))
       {
           indexM = 1;
       }
   
       // Find the M, N, and U version fields delimited by '.' characters
   
       indexN = version.find(indexM, CHAR_PERIOD);
   
       if (indexN != PEG_NOT_FOUND)
       {
           sizeM = indexN++ - indexM;
   
           indexU = version.find(indexN, CHAR_PERIOD);
           if (indexU != PEG_NOT_FOUND)
           {
               sizeN = indexU++ - indexN;
           }
       }
   
       // Parse the major version
       char dummyChar;
       int numConversions = sscanf(
           version.subString(indexM, sizeM).getCString(),
           "%u%c",
           &iMajor,
           &dummyChar);
   
       if (numConversions != 1)
       {
           return false;
       }
   
       // Parse the minor version
       if (indexN != PEG_NOT_FOUND)
       {
           numConversions = sscanf(
               version.subString(indexN, sizeN).getCString(),
               "%u%c",
               &iMinor,
               &dummyChar);
   
           if (numConversions != 1)
           {
               return false;
           }
       }
   
       // Parse the update version
       if (indexU != PEG_NOT_FOUND)
       {
           numConversions = sscanf(
               version.subString(indexU).getCString(),
               "%u%c",
               &iUpdate,
               &dummyChar);
   
           if (numConversions != 1)
           {
               return false;
           }
       }
   
       return true;
   }
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END


Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2