summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJooSeok Park <jooseok.park@samsung.com>2017-04-10 17:13:13 -0700
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>2017-04-10 17:13:13 -0700
commit4ecf2b65cfc18f41bb475bca5151fc82a8db8cb5 (patch)
tree0b37b0d2405d058ec731d72f4faa95bb517ef783
parent6fd900ac90384338d7d43bfb31c6118f8157372d (diff)
parent933b6a13ce891d014c356bea247412fbcdc5c483 (diff)
downloadiotcon-4ecf2b65cfc18f41bb475bca5151fc82a8db8cb5.tar.gz
iotcon-4ecf2b65cfc18f41bb475bca5151fc82a8db8cb5.tar.bz2
iotcon-4ecf2b65cfc18f41bb475bca5151fc82a8db8cb5.zip
Merge "Fix to assign string.Empty when Marshal.PtrToStringAnsi(XXXptr)'s XXXptr is IntPtr.Zero" into tizensubmit/tizen/20170411.001404accepted/tizen/unified/20170411.034906
-rwxr-xr-xTizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Attributes.cs2
-rwxr-xr-xTizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/IoTConnectivityClientManager.cs12
-rwxr-xr-xTizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/RemoteResource.cs6
-rwxr-xr-xTizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Representation.cs2
-rwxr-xr-xTizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Resource.cs2
-rwxr-xr-xTizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceQuery.cs4
6 files changed, 14 insertions, 14 deletions
diff --git a/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Attributes.cs b/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Attributes.cs
index 57a6e3a..7514598 100755
--- a/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Attributes.cs
+++ b/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Attributes.cs
@@ -546,7 +546,7 @@ namespace Tizen.Network.IoTConnectivity
Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get attributes");
throw IoTConnectivityErrorFactory.GetException(ret);
}
- Str = Marshal.PtrToStringAnsi(value);
+ Str = (value != IntPtr.Zero) ? Marshal.PtrToStringAnsi(value) : string.Empty;
_attributes.Add(key, Str);
break;
}
diff --git a/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/IoTConnectivityClientManager.cs b/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/IoTConnectivityClientManager.cs
index 066d8ce..5c057bd 100755
--- a/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/IoTConnectivityClientManager.cs
+++ b/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/IoTConnectivityClientManager.cs
@@ -753,8 +753,8 @@ namespace Tizen.Network.IoTConnectivity
PresenceReceivedEventArgs e = new PresenceReceivedEventArgs()
{
PresenceId = presenceId,
- HostAddress = Marshal.PtrToStringAnsi(host),
- Type = Marshal.PtrToStringAnsi(type),
+ HostAddress = (host != IntPtr.Zero) ? Marshal.PtrToStringAnsi(host) : string.Empty,
+ Type = (type != IntPtr.Zero) ? Marshal.PtrToStringAnsi(type) : string.Empty,
EventType = (PresenceEventType)trigger
};
@@ -797,10 +797,10 @@ namespace Tizen.Network.IoTConnectivity
{
RequestId = requestId,
EventContinue = true,
- Name = Marshal.PtrToStringAnsi(name),
- SpecVersion = Marshal.PtrToStringAnsi(specVersion),
- DeviceId = Marshal.PtrToStringAnsi(deviceId),
- DataModelVersion = Marshal.PtrToStringAnsi(dataModelVersion)
+ Name = (name != IntPtr.Zero) ? Marshal.PtrToStringAnsi(name) : string.Empty,
+ SpecVersion = (specVersion != IntPtr.Zero) ? Marshal.PtrToStringAnsi(specVersion) : string.Empty,
+ DeviceId = (deviceId != IntPtr.Zero) ? Marshal.PtrToStringAnsi(deviceId) : string.Empty,
+ DataModelVersion = (dataModelVersion != IntPtr.Zero) ? Marshal.PtrToStringAnsi(dataModelVersion) : string.Empty
};
return e;
diff --git a/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/RemoteResource.cs b/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/RemoteResource.cs
index ca57ffc..77c5c71 100755
--- a/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/RemoteResource.cs
+++ b/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/RemoteResource.cs
@@ -805,9 +805,9 @@ namespace Tizen.Network.IoTConnectivity
Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get device id");
throw IoTConnectivityErrorFactory.GetException(ret);
}
- DeviceId = Marshal.PtrToStringAnsi(deviceIdPtr);
- HostAddress = Marshal.PtrToStringAnsi(hostAddressPtr);
- UriPath = Marshal.PtrToStringAnsi(uriPathPtr);
+ DeviceId = (deviceIdPtr != IntPtr.Zero) ? Marshal.PtrToStringAnsi(deviceIdPtr) : string.Empty;
+ HostAddress = (hostAddressPtr != IntPtr.Zero) ? Marshal.PtrToStringAnsi(hostAddressPtr) : string.Empty;
+ UriPath = (uriPathPtr != IntPtr.Zero) ? Marshal.PtrToStringAnsi(uriPathPtr) : string.Empty;
Types = new ResourceTypes(typesHandle);
Interfaces = new ResourceInterfaces(interfacesHandle);
Policy = (ResourcePolicy)policy;
diff --git a/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Representation.cs b/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Representation.cs
index 81e6fbc..67a0eb2 100755
--- a/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Representation.cs
+++ b/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Representation.cs
@@ -105,7 +105,7 @@ namespace Tizen.Network.IoTConnectivity
Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to Get uri");
throw IoTConnectivityErrorFactory.GetException(ret);
}
- return Marshal.PtrToStringAnsi(path);
+ return (path != IntPtr.Zero) ? Marshal.PtrToStringAnsi(path) : string.Empty;
}
set
{
diff --git a/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Resource.cs b/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Resource.cs
index 763ba9e..e70d889 100755
--- a/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Resource.cs
+++ b/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Resource.cs
@@ -448,7 +448,7 @@ namespace Tizen.Network.IoTConnectivity
return new Request()
{
- HostAddress = Marshal.PtrToStringAnsi(hostAddressPtr),
+ HostAddress = (hostAddressPtr != IntPtr.Zero) ? Marshal.PtrToStringAnsi(hostAddressPtr) : string.Empty,
Options = opts,
Query = query,
Representation = representation
diff --git a/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceQuery.cs b/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceQuery.cs
index ecbc672..54153d0 100755
--- a/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceQuery.cs
+++ b/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceQuery.cs
@@ -106,7 +106,7 @@ namespace Tizen.Network.IoTConnectivity
Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get type");
return "";
}
- return Marshal.PtrToStringAnsi(type);
+ return (type != IntPtr.Zero) ? Marshal.PtrToStringAnsi(type) : string.Empty;
}
set
{
@@ -146,7 +146,7 @@ namespace Tizen.Network.IoTConnectivity
Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get interface");
return "";
}
- return Marshal.PtrToStringAnsi(iface);
+ return (iface != IntPtr.Zero) ? Marshal.PtrToStringAnsi(iface) : string.Empty;
}
set
{