f-spot r3951 - in trunk: . src/Utils



Author: sdelcroix
Date: Tue May 20 13:04:30 2008
New Revision: 3951
URL: http://svn.gnome.org/viewvc/f-spot?rev=3951&view=rev

Log:
2008-05-20  Stephane Delcroix  <sdelcroix novell com>

	* src/Utils/*: Fixing 8 gendarme warning


Modified:
   trunk/ChangeLog
   trunk/src/Utils/DbUtils.cs
   trunk/src/Utils/GtkUtil.cs
   trunk/src/Utils/Unix.cs
   trunk/src/Utils/UriUtils.cs

Modified: trunk/src/Utils/DbUtils.cs
==============================================================================
--- trunk/src/Utils/DbUtils.cs	(original)
+++ trunk/src/Utils/DbUtils.cs	Tue May 20 13:04:30 2008
@@ -12,8 +12,8 @@
 
 namespace FSpot.Utils
 {
-	public class DbUtils {
-	#if USE_CORRECT_FUNCTION
+	public static class DbUtils {
+#if USE_CORRECT_FUNCTION
 		public static DateTime DateTimeFromUnixTime (long unix_time)
 		{
 			DateTime date_time = new DateTime (1970, 1, 1);
@@ -24,7 +24,7 @@
 		{
 			return (long) (date_time.ToUniversalTime () - new DateTime (1970, 1, 1)).TotalSeconds;
 		}
-	#else
+#else
 		public static DateTime DateTimeFromUnixTime (long unix_time)
 		{
 			DateTime date_time = new DateTime (1970, 1, 1).ToLocalTime ();
@@ -35,6 +35,6 @@
 		{
 			return (long) (date_time - new DateTime (1970, 1, 1).ToLocalTime ()).TotalSeconds;
 		}
-	#endif
+#endif
 	}
 }

Modified: trunk/src/Utils/GtkUtil.cs
==============================================================================
--- trunk/src/Utils/GtkUtil.cs	(original)
+++ trunk/src/Utils/GtkUtil.cs	Tue May 20 13:04:30 2008
@@ -12,7 +12,7 @@
 
 namespace FSpot.Utils
 {
-	public class GtkUtil {
+	public static class GtkUtil {
 		public static Gtk.MenuItem MakeMenuItem (Gtk.Menu menu, string l, EventHandler e)
 		{
 			return MakeMenuItem (menu, l, e, true);

Modified: trunk/src/Utils/Unix.cs
==============================================================================
--- trunk/src/Utils/Unix.cs	(original)
+++ trunk/src/Utils/Unix.cs	Tue May 20 13:04:30 2008
@@ -1,24 +1,27 @@
 using System.Runtime.InteropServices;
 
 namespace FSpot.Utils {
-	public class Unix {
+	public static class Unix {
+		internal static class NativeMethods
+		{
+			[DllImport ("libc", EntryPoint="rename", CharSet = CharSet.Auto)]
+			public static extern int Rename (string oldpath, string newpath);
+
+			[DllImport ("libc", EntryPoint="mkstemp")]
+			public static extern int MkSTemp (byte []template);
+		}
 
-		[DllImport ("libc")]
-		static extern int rename (string oldpath, string newpath);
-		
 		public static int Rename (string oldpath, string newpath)
 		{
-			return rename (oldpath, newpath);
+			return NativeMethods.Rename (oldpath, newpath);
 		}
 
-		[DllImport ("libc")]
-		static extern int mkstemp (byte []template);
 
 		public static Mono.Unix.UnixStream MakeSafeTemp (ref string template)
 		{
 			byte [] template_bytes = System.Text.Encoding.UTF8.GetBytes (template + ".XXXXXX\0");
 
-			int fd = mkstemp (template_bytes);
+			int fd = NativeMethods.MkSTemp (template_bytes);
 
 			if (fd < 0) {
 				//Mono.Unix.Error error = Mono.Unix.Stdlib.GetLastError ();

Modified: trunk/src/Utils/UriUtils.cs
==============================================================================
--- trunk/src/Utils/UriUtils.cs	(original)
+++ trunk/src/Utils/UriUtils.cs	Tue May 20 13:04:30 2008
@@ -13,7 +13,7 @@
 
 namespace FSpot.Utils
 {
-	public class UriUtils
+	public static class UriUtils
 	{
 		public static string UriToStringEscaped (Uri uri)
 		{



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]