apphandler: convert major verion if greater than or equal to 2000
For the platforms use year as major version, it would expect to have
major version between 0 - 99. If the major version is greater than or
equal to 2000, it is treated as a year and converted to 0 - 99.
Change-Id: Iad13f8175499a86c279cd69fdc759d9425e89546
Signed-off-by: Potin Lai <potin.lai@quantatw.com>
diff --git a/apphandler.cpp b/apphandler.cpp
index 20a529d..7b7bc81 100644
--- a/apphandler.cpp
+++ b/apphandler.cpp
@@ -532,7 +532,18 @@
{ // failed to convert major string
return -1;
}
- r.major = val & 0x7F;
+
+ if (val >= 2000)
+ { // For the platforms use year as major version, it would expect to
+ // have major version between 0 - 99. If the major version is
+ // greater than or equal to 2000, it is treated as a year and
+ // converted to 0 - 99.
+ r.major = val % 100;
+ }
+ else
+ {
+ r.major = val & 0x7F;
+ }
}
// convert minor