fix: Remove qml M126 warning 77/22477/1 8.99.1 8.99.2 8.99.3 8.99.4 8.99.5 icefish/8.99.1 icefish/8.99.2 icefish/8.99.3 icefish/8.99.4 icefish/8.99.5 icefish_8.99.1 icefish_8.99.2 icefish_8.99.3 icefish_8.99.4 icefish_8.99.5
authorLi Xiaoming <lixm.fnst@cn.fujitsu.com>
Sun, 22 Sep 2019 12:56:19 +0000 (20:56 +0800)
committerLi Xiaoming <lixm.fnst@cn.fujitsu.com>
Sun, 22 Sep 2019 12:56:19 +0000 (20:56 +0800)
Message:
== and != may perform type coercion, use === or !== to avoid it.

Description:
The non-strict equality comparison is allowed to convert its arguments
to a common type. That can lead to unexpected results such as
' \t\r\n' == 0 being true. Use the strict equality operators === and
!== and be explicit about conversions you require.

Bug-AGL: SPEC-2814

Change-Id: I4dd5848797f445d082242a5c5e2a0148ea790dc0
Signed-off-by: Li Xiaoming <lixm.fnst@cn.fujitsu.com>
app/api/GPS.qml
app/api/GeoFence.qml
app/forms/RouteList.qml
app/map/MapComponent.qml
app/map/Marker.qml
app/mapviewer.qml

index 679c66e..95c7712 100644 (file)
@@ -55,7 +55,7 @@ WebSocket {
             case msgid.event:
                 var payload = JSON.parse(JSON.stringify(json[2]))
                 var event = payload.event
-                if (event == "gps/location") {
+                if (event === "gps/location") {
                     var data = json[2].data
                     var latitude = data.latitude
                     var longitude = data.longitude
index 7061984..a39eecb 100644 (file)
@@ -55,7 +55,7 @@ WebSocket {
             case msgid.event:
                 var payload = JSON.parse(JSON.stringify(json[2]))
                 var event = payload.event
-                if (event == "geofence/fence") {
+                if (event === "geofence/fence") {
                     var data = json[2].data
                     console.log("geofence event - name: " + data.name + " state: " + data.state)
                 }
index 27fa572..e37b581 100644 (file)
@@ -79,8 +79,8 @@ ListView {
             }
         }
         //! [routeinfomodel2]
-        totalTravelTime = routeModel.count == 0 ? "" : Helper.formatTime(routeModel.get(0).travelTime)
-        totalDistance = routeModel.count == 0 ? "" : Helper.formatDistance(routeModel.get(0).distance)
+        totalTravelTime = routeModel.count === 0 ? "" : Helper.formatTime(routeModel.get(0).travelTime)
+        totalDistance = routeModel.count === 0 ? "" : Helper.formatDistance(routeModel.get(0).distance)
     }
 //! [routeinfomodel3]
 }
index 161038c..87ad74a 100644 (file)
@@ -181,7 +181,7 @@ Map {
     {
         var count = map.mapItems.length
         var co = Qt.createComponent(item+'.qml')
-        if (co.status == Component.Ready) {
+        if (co.status === Component.Ready) {
             var o = co.createObject(map)
             o.setGeometry(map.markers, currentMarker)
             map.addMapItem(o)
@@ -204,13 +204,13 @@ Map {
         var myArray = new Array()
         var count = map.markers.length
         for (var i = 0; i<count; i++){
-            if (index != i) myArray.push(map.markers[i])
+            if (index !== i) myArray.push(map.markers[i])
         }
 
         map.removeMapItem(map.markers[index])
         map.markers[index].destroy()
         map.markers = myArray
-        if (markers.length == 0) markerCounter = 0
+        if (markers.length === 0) markerCounter = 0
     }
 
     function calculateMarkerRoute()
@@ -526,7 +526,7 @@ Map {
                 }
 
                 onPositionChanged: {
-                    if (mouse.button == Qt.LeftButton) {
+                    if (mouse.button === Qt.LeftButton) {
                         map.lastX = mouse.x + parent.x
                         map.lastY = mouse.y + parent.y
                     }
@@ -596,7 +596,7 @@ Map {
                         if (pressed) parent.radius = parent.center.distanceTo(
                                          map.toCoordinate(Qt.point(mouse.x, mouse.y)))
                     }
-                    if (mouse.button == Qt.LeftButton) {
+                    if (mouse.button === Qt.LeftButton) {
                         map.lastX = mouse.x + parent.x
                         map.lastY = mouse.y + parent.y
                     }
@@ -656,7 +656,7 @@ Map {
         }
 
         onPositionChanged: {
-            if (mouse.button == Qt.LeftButton) {
+            if (mouse.button === Qt.LeftButton) {
                 map.lastX = mouse.x
                 map.lastY = mouse.y
             }
index 3c0ed17..ada7954 100644 (file)
@@ -74,7 +74,7 @@ MapQuickItem {
                 map.pressY = mouse.y
                 map.currentMarker = -1
                 for (var i = 0; i< map.markers.length; i++){
-                    if (marker == map.markers[i]){
+                    if (marker === map.markers[i]){
                         map.currentMarker = i
                         break
                     }
index 6240600..a92a9fd 100644 (file)
@@ -449,8 +449,8 @@ ApplicationWindow {
                 stackView.showMessage(qsTr("Coordinates"),text);
             }
             onGeocodeFinished:{
-                if (map.geocodeModel.status == GeocodeModel.Ready) {
-                    if (map.geocodeModel.count == 0) {
+                if (map.geocodeModel.status === GeocodeModel.Ready) {
+                    if (map.geocodeModel.count === 0) {
                         stackView.showMessage(qsTr("Geocode Error"),qsTr("Unsuccessful geocode"))
                     } else if (map.geocodeModel.count > 1) {
                         stackView.showMessage(qsTr("Ambiguous geocode"), map.geocodeModel.count + " " +
@@ -458,7 +458,7 @@ ApplicationWindow {
                     } else {
                         stackView.showMessage(qsTr("Location"), geocodeMessage(),page)
                     }
-                } else if (map.geocodeModel.status == GeocodeModel.Error) {
+                } else if (map.geocodeModel.status === GeocodeModel.Error) {
                     stackView.showMessage(qsTr("Geocode Error"),qsTr("Unsuccessful geocode"))
                 }
             }
@@ -467,10 +467,10 @@ ApplicationWindow {
             onShowGeocodeInfo: stackView.showMessage(qsTr("Location"),geocodeMessage(),page)
 
             onErrorChanged: {
-                if (map.error != Map.NoError) {
+                if (map.error !== Map.NoError) {
                     var title = qsTr("ProviderError")
                     var message =  map.errorString + "<br/><br/><b>" + qsTr("Try to select other provider") + "</b>"
-                    if (map.error == Map.MissingRequiredParameterError)
+                    if (map.error === Map.MissingRequiredParameterError)
                         message += "<br/>" + qsTr("or see") + " \'mapviewer --help\' "
                                 + qsTr("how to pass plugin parameters.")
                     stackView.showMessage(title,message);