[mono/monodevelop] c46d8e31: [MacInterop] code cleanup

"Jeffrey Stedfast ([email protected])" <[email protected]>
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <0000014214b5f82e-51a07a31-d966-4a89-b876-8bafa3106416-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/monodevelop
  Compare: https://github.com/mono/monodevelop/compare/ce69a4617277...c46d8e31bb87

   Commit: c46d8e31bb87c8f28ea2cbabab86ccc312dc39bb
   Author: Jeffrey Stedfast <[email protected]> (jstedfast)
     Date: 2013-11-01 17:27:19 GMT
      URL: https://github.com/mono/monodevelop/commit/c46d8e31bb87c8f28ea2cbabab86ccc312dc39bb

[MacInterop] code cleanup

Changed paths:
  M main/src/addins/MacPlatform/MacInterop/Keychain.cs

Modified: main/src/addins/MacPlatform/MacInterop/Keychain.cs
===================================================================
@@ -249,19 +249,20 @@ static string CFStringGetString (IntPtr handle)
 			if (handle == IntPtr.Zero)
 				return null;
 			
-			string str;
-			
-			int l = CFStringGetLength (handle);
-			IntPtr u = CFStringGetCharactersPtr (handle);
+			int length = CFStringGetLength (handle);
+			var unicode = CFStringGetCharactersPtr (handle);
 			IntPtr buffer = IntPtr.Zero;
-			if (u == IntPtr.Zero){
-				CFRange r = new CFRange (0, l);
-				buffer = Marshal.AllocCoTaskMem (l * 2);
-				CFStringGetCharacters (handle, r, buffer);
-				u = buffer;
+			string str;
+
+			if (unicode == IntPtr.Zero){
+				var range = new CFRange (0, length);
+				buffer = Marshal.AllocCoTaskMem (length * 2);
+				CFStringGetCharacters (handle, range, buffer);
+				unicode = buffer;
 			}
+
 			unsafe {
-				str = new string ((char *) u, 0, l);
+				str = new string ((char *) unicode, 0, length);
 			}
 			
 			if (buffer != IntPtr.Zero)
@@ -272,34 +273,6 @@ static string CFStringGetString (IntPtr handle)
 		
 		#endregion
 
-		#region CFMutableDictionary
-
-//		struct CFDictionaryKeyCallBacks {
-//			CFIndex version;
-//			CFDictionaryRetainCallBack retain;
-//			CFDictionaryReleaseCallBack release;
-//			CFDictionaryCopyDescriptionCallBack copyDescription;
-//			CFDictionaryEqualCallBack equal;
-//			CFDictionaryHashCallBack hash;
-//		};
-//
-//		struct CFDictionaryValueCallBacks {
-//			CFIndex version;
-//			CFDictionaryRetainCallBack retain;
-//			CFDictionaryReleaseCallBack release;
-//			CFDictionaryCopyDescriptionCallBack copyDescription;
-//			CFDictionaryEqualCallBack equal;
-//		};
-
-		// use kCFTypeDictionaryKeyCallBacks and kCFTypeDictionaryValueCallBacks
-
-		// CFDictionaryRef CFDictionaryCreate (CFAllocatorRef allocator, const void **keys, const void **values, CFIndex numValues, const CFDictionaryKeyCallBacks *keyCallBacks, const CFDictionaryValueCallBacks *valueCallBacks);
-		// CFMutableDictionaryRef CFDictionaryCreateMutable (CFAllocatorRef allocator, CFIndex capacity, const CFDictionaryKeyCallBacks *keyCallBacks, const CFDictionaryValueCallBacks *valueCallBacks);
-
-		// void CFDictionaryAddValue (CFMutableDictionaryRef theDict, const void *key, const void *value);
-
-		#endregion
-
 		static string GetError (OSStatus status)
 		{
 			IntPtr str = IntPtr.Zero;


_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.