[NUI] Fix svace issue
authorhuiyu.eun <huiyu.eun@samsung.com>
Wed, 8 Sep 2021 06:00:41 +0000 (15:00 +0900)
committerSeoyeon2Kim <34738918+Seoyeon2Kim@users.noreply.github.com>
Mon, 13 Sep 2021 07:33:23 +0000 (16:33 +0900)
-Checker: API.CSHARP.CULTURE

WID:1125388 Method float.Parse(string) is culture specific.
Its usage can cause unexpected behaviour.
It is recommended to add IFormatProvider argument into invocation.

Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
src/Tizen.NUI/src/public/BaseComponents/LottieAnimationView.cs
src/Tizen.NUI/src/public/Common/Color.cs

index 7c2e261..c2cfad8 100755 (executable)
@@ -19,6 +19,7 @@ using global::System;
 using global::System.Runtime.InteropServices;
 using System.ComponentModel;
 using System.Collections.Generic;
+using System.Globalization;
 
 namespace Tizen.NUI.BaseComponents
 {
@@ -935,11 +936,11 @@ namespace Tizen.NUI.BaseComponents
             string[] parts = pair.Split(',');
             if (parts.Length == 1)
             {
-                return new LottieFrameInfo(Int32.Parse(parts[0].Trim()));
+                return new LottieFrameInfo(Int32.Parse(parts[0].Trim(), CultureInfo.InvariantCulture));
             }
             else if (parts.Length == 2)
             {
-                return new LottieFrameInfo(Int32.Parse(parts[0].Trim()), Int32.Parse(parts[1].Trim()));
+                return new LottieFrameInfo(Int32.Parse(parts[0].Trim(), CultureInfo.InvariantCulture), Int32.Parse(parts[1].Trim(), CultureInfo.InvariantCulture));
             }
 
             Tizen.Log.Error("NUI", $"Can not convert string {pair} to LottieFrameInfo");
index 8bf8721..05f66ce 100755 (executable)
@@ -18,6 +18,7 @@
 using System;
 using Tizen.NUI.Binding;
 using System.ComponentModel;
+using System.Globalization;
 
 namespace Tizen.NUI
 {
@@ -1029,7 +1030,7 @@ namespace Tizen.NUI
                         R = Math.Min(1.0f, ((float)Convert.ToInt32(components[0], 10)) / 255.0f);
                         G = Math.Min(1.0f, ((float)Convert.ToInt32(components[1], 10)) / 255.0f);
                         B = Math.Min(1.0f, ((float)Convert.ToInt32(components[2], 10)) / 255.0f);
-                        A = Math.Min(1.0f, float.Parse(components[3]));
+                        A = Math.Min(1.0f, float.Parse(components[3], CultureInfo.InvariantCulture));
                     }
                 }
             }