f-spot r4646 - in trunk: . src src/Cms



Author: sdelcroix
Date: Mon Dec  1 13:59:10 2008
New Revision: 4646
URL: http://svn.gnome.org/viewvc/f-spot?rev=4646&view=rev

Log:
fixing some gendarme warnings

2008-12-01  Stephane Delcroix  <sdelcroix novell com>

	* src/Cms/Profile.cs: remove underscores in method args

	* src/Cms/CmsException.cs:
	* src/Cms/SaveException.cs: new CmsException, move SaveException in its
	own file.

	* src/Cms/ColorCIExyY.cs:
	* src/Cms/GammaTable.cs:
	* src/Cms/Profile.cs: throws CmsException instead of Exception

Added:
   trunk/src/Cms/CmsException.cs
   trunk/src/Cms/SaveException.cs
Modified:
   trunk/ChangeLog
   trunk/src/Cms/ColorCIExyY.cs
   trunk/src/Cms/GammaTable.cs
   trunk/src/Cms/Profile.cs
   trunk/src/Makefile.am

Added: trunk/src/Cms/CmsException.cs
==============================================================================
--- (empty file)
+++ trunk/src/Cms/CmsException.cs	Mon Dec  1 13:59:10 2008
@@ -0,0 +1,32 @@
+/*
+ * Cms.CmsException.cs
+ *
+ * Author(s):
+ *	Stephane Delcroix  <stephane delcroix org>
+ *
+ * This is free software. See COPYING for details.
+ */
+
+using System;
+using System.Runtime.Serialization;
+
+namespace Cms {
+	[Serializable]
+	public class CmsException : System.Exception {
+		public CmsException (string message) : base (message)
+		{
+		}
+
+		protected CmsException (SerializationInfo info, StreamingContext context) : base (info, context)
+		{
+		}
+
+		public CmsException (string message, Exception innerException) : base (message, innerException)
+		{
+		}
+
+		public CmsException () : base ()
+		{
+		}
+	}
+}

Modified: trunk/src/Cms/ColorCIExyY.cs
==============================================================================
--- trunk/src/Cms/ColorCIExyY.cs	(original)
+++ trunk/src/Cms/ColorCIExyY.cs	Mon Dec  1 13:59:10 2008
@@ -57,7 +57,7 @@
 				string [] subs = line.Split ('\t');
 				int ptemp = int.Parse (subs [0]);
 				if (ptemp != temp)
-					throw new System.Exception (String.Format ("{0} != {1}", ptemp, temp));
+					throw new CmsException (String.Format ("{0} != {1}", ptemp, temp));
 				
 				double x = double.Parse (subs [1]);
 				double y = double.Parse (subs [2]);

Modified: trunk/src/Cms/GammaTable.cs
==============================================================================
--- trunk/src/Cms/GammaTable.cs	(original)
+++ trunk/src/Cms/GammaTable.cs	Mon Dec  1 13:59:10 2008
@@ -90,7 +90,7 @@
 			get {
 				unsafe {
 					if (handle.Handle == (IntPtr)0)
-						throw new Exception ();
+						throw new CmsException ();
 					
 					if (index < 0 || index >= Count)
 						throw new ArgumentOutOfRangeException (String.Format ("index {0} outside of count {1} for {2}", index, Count, handle.Handle));
@@ -102,7 +102,7 @@
 			set {
 				unsafe {
 					if (handle.Handle == (IntPtr)0)
-						throw new Exception ();
+						throw new CmsException ();
 					
 					if (index < 0 || index >= Count)
 						throw new ArgumentOutOfRangeException (String.Format ("index {0} outside of count {1} for handle {2}", index, Count, handle.Handle));

Modified: trunk/src/Cms/Profile.cs
==============================================================================
--- trunk/src/Cms/Profile.cs	(original)
+++ trunk/src/Cms/Profile.cs	Mon Dec  1 13:59:10 2008
@@ -73,12 +73,12 @@
 			return new Profile (NativeMethods.CmsCreateLabProfile (IntPtr.Zero));
 		}			
 
-		public static Profile CreateGray (ColorCIExyY white_point, GammaTable transfer)
+		public static Profile CreateGray (ColorCIExyY whitePoint, GammaTable transfer)
 		{
 			if (transfer == null)
-				return new Profile (NativeMethods.CmsCreateGrayProfile (ref white_point, new GammaTable (4096, 2.2).Handle));
+				return new Profile (NativeMethods.CmsCreateGrayProfile (ref whitePoint, new GammaTable (4096, 2.2).Handle));
 			else
-				return new Profile (NativeMethods.CmsCreateGrayProfile (ref white_point, transfer.Handle));
+				return new Profile (NativeMethods.CmsCreateGrayProfile (ref whitePoint, transfer.Handle));
 		}
 
 		public static Profile GetScreenProfile (Gdk.Screen screen)
@@ -124,8 +124,8 @@
 						      double Hue,
 						      double Saturation,
 						      GammaTable [] tables,
-						      ColorCIExyY src_wp,
-						      ColorCIExyY dest_wp)
+						      ColorCIExyY srcWp,
+						      ColorCIExyY destWp)
 		{
 			if (tables == null) {
 				GammaTable gamma = new GammaTable (1024, Math.Pow (10, -Bright/100));
@@ -138,7 +138,7 @@
 			System.Console.WriteLine ("b {0}", Bright);
 			System.Console.WriteLine ("c {0}", Contrast);
 			System.Console.WriteLine ("h {0}", Hue);
-			System.Console.WriteLine ("s {0} {1} {2}", Saturation, src_wp, dest_wp);
+			System.Console.WriteLine ("s {0} {1} {2}", Saturation, srcWp, destWp);
 			*/
 			return new Profile (NativeMethods.FCmsCreateBCHSWabstractProfile (nLUTPoints,
 									     Exposure,
@@ -146,8 +146,8 @@
 									     Contrast,
 									     Hue,
 									     Saturation,
-									     ref src_wp,
-									     ref dest_wp,
+									     ref srcWp,
+									     ref destWp,
 									     CopyHandles (tables)));
 		}
 
@@ -178,7 +178,7 @@
 			handle = new HandleRef (this, NativeMethods.CmsOpenProfileFromFile (path, "r"));
 
 			if (handle.Handle == IntPtr.Zero)
-				throw new Exception ("Error opening ICC profile in file " + path);
+				throw new CmsException ("Error opening ICC profile in file " + path);
 		}
 
 		public byte [] Save ()
@@ -218,7 +218,7 @@
 			}
 			
 			if (profileh == IntPtr.Zero)
-				throw new System.Exception ("Invalid Profile Data");
+				throw new CmsException ("Invalid Profile Data");
 			else 
 				this.handle = new HandleRef (this, profileh);
 		}
@@ -227,7 +227,7 @@
 			get {
 				ColorCIEXYZ wp;
 				if (!NativeMethods.CmsTakeMediaWhitePoint (out wp, handle))
-					throw new ApplicationException ("unable to retrieve white point from profile");
+					throw new CmsException ("unable to retrieve white point from profile");
 				return wp;
 			}
 		}
@@ -236,7 +236,7 @@
 			get {
 				ColorCIEXYZ black;
 				if (!NativeMethods.CmsTakeMediaBlackPoint (out black, handle))
-					throw new ApplicationException ("unable to retrieve white point from profile");
+					throw new CmsException ("unable to retrieve white point from profile");
 				
 				return black;
 			}
@@ -246,7 +246,7 @@
 			get {
 				ColorCIEXYZTriple colors;
 				if (!NativeMethods.CmsTakeColorants (out colors, handle))
-					throw new ApplicationException ("Unable to retrieve profile colorants");
+					throw new CmsException ("Unable to retrieve profile colorants");
 				
 				return colors;
 			}				
@@ -313,7 +313,7 @@
 		protected virtual void Cleanup ()
 		{
 			if (NativeMethods.CmsCloseProfile (this.Handle) == 0)
-				throw new Exception ("Error closing Handle");
+				throw new CmsException ("Error closing Handle");
 
 		}
 
@@ -324,21 +324,4 @@
 
 	}
 
-	public class SaveException : System.Exception {
-		public SaveException (string message) : base (message)
-		{
-		}
-
-		protected SaveException (SerializationInfo info, StreamingContext context) : base (info, context)
-		{
-		}
-
-		public SaveException (string message, Exception innerException) : base (message, innerException)
-		{
-		}
-
-		public SaveException () : base ()
-		{
-		}
-	}
 }

Added: trunk/src/Cms/SaveException.cs
==============================================================================
--- (empty file)
+++ trunk/src/Cms/SaveException.cs	Mon Dec  1 13:59:10 2008
@@ -0,0 +1,32 @@
+/*
+ * Cms.SaveException.cs
+ *
+ * Author(s):
+ *	Larry Ewing  <lewing novell com>
+ *
+ * This is free software. See COPYING for details.
+ */
+
+using System;
+using System.Runtime.Serialization;
+
+namespace Cms {
+	[Serializable]
+	public class SaveException : CmsException {
+		public SaveException (string message) : base (message)
+		{
+		}
+
+		protected SaveException (SerializationInfo info, StreamingContext context) : base (info, context)
+		{
+		}
+
+		public SaveException (string message, Exception innerException) : base (message, innerException)
+		{
+		}
+
+		public SaveException () : base ()
+		{
+		}
+	}
+}

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Mon Dec  1 13:59:10 2008
@@ -5,6 +5,7 @@
 
 CMS_CSDISTFILES =				\
 	$(srcdir)/Cms/CctTable.cs		\
+	$(srcdir)/Cms/CmsException.cs		\
 	$(srcdir)/Cms/ColorCIELab.cs		\
 	$(srcdir)/Cms/ColorCIELCh.cs		\
 	$(srcdir)/Cms/ColorCIExyY.cs		\
@@ -15,6 +16,7 @@
 	$(srcdir)/Cms/Intent.cs			\
 	$(srcdir)/Cms/NativeMethods.cs		\
 	$(srcdir)/Cms/Profile.cs		\
+	$(srcdir)/Cms/SaveException.cs		\
 	$(srcdir)/Cms/Transform.cs
 
 CORE_CSDISTFILES =				\



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