Add 0 for patch and minor version if it is not provided 07/112307/4
authorJunghyun Yeon <jungh.yeon@samsung.com>
Tue, 31 Jan 2017 05:41:22 +0000 (14:41 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Wed, 1 Feb 2017 10:11:47 +0000 (02:11 -0800)
- Tizen version policy doesn't display patch version if it is 0.
But user can "type" it into api-version of application and it cause
compare issue on VersionNumber class.
- So add 0 as patch or minor version if it is not provided by default

Change-Id: Ic21e16d3cf8642b89ab98bedd79bbe529dde2df8
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
src/manifest_parser/utils/version_number.cc
src/manifest_parser/utils/version_number.h

index 340d80f4107510b2f05d007c01be9a4b3357ff2e..8ab372e36da96b84840f00306306d26dc51bbb18 100644 (file)
@@ -30,6 +30,9 @@ VersionNumber::VersionNumber(const std::string& str) {
     }
     parts_.push_back(value);
   }
+
+  for (int i = 3 - parts_.size(); i > 0; i--)
+    parts_.push_back(0);
 }
 
 bool VersionNumber::IsValid() const {
index 964efffd4cb974ac6959ce6f565aecfdf3f1b77e..36c227a8e225b9cc8fbd7eb5fe2d224c6bbb696e 100644 (file)
@@ -46,7 +46,7 @@ class VersionNumber {
    *    0 <= b <= 255
    *    0 <= c <= 65535
    *
-   * b and c part are optional
+   * b and c part are optional but code will consider as 0 if doesn't exists
    *
    * @return true if version is ok
    */