[cairo-commit] pycairo/cairo cairomodule.c,1.41,1.42

Steve Chaplin commit at pdx.freedesktop.org
Wed Jun 1 17:18:29 PDT 2005


Committed by: stevech1097

Update of /cvs/cairo/pycairo/cairo
In directory gabe:/tmp/cvs-serv9469/cairo

Modified Files:
	cairomodule.c 
Log Message:
SC

Index: cairomodule.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/cairomodule.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- cairomodule.c	1 Jun 2005 12:38:11 -0000	1.41
+++ cairomodule.c	2 Jun 2005 00:18:27 -0000	1.42
@@ -42,56 +42,27 @@
 int
 Pycairo_Check_Status (cairo_status_t status)
 {
-    /* copy strings from cairo.c cairo_status_string() */
     switch (status) {
     case CAIRO_STATUS_SUCCESS:
 	return 0;
+    /* if appropriate - translate the status string into Python,
+     * else - use cairo_status_to_string()
+     */
     case CAIRO_STATUS_NO_MEMORY:
 	PyErr_NoMemory();
-	return 1;
+	break;
     case CAIRO_STATUS_INVALID_RESTORE:
 	PyErr_SetString(CairoError, "Context.restore without matching "
 			"Context.save");
-	return 1;
+	break;
     case CAIRO_STATUS_INVALID_POP_GROUP:
 	PyErr_SetString(CairoError, "Context.pop_group without matching "
 			"Context.push_group");
-	return 1;
-    case CAIRO_STATUS_NO_CURRENT_POINT:
-	PyErr_SetString(CairoError, "no current point defined");
-	return 1;
-    case CAIRO_STATUS_INVALID_MATRIX:
-	PyErr_SetString(CairoError, "invalid matrix (not invertible)");
-	return 1;
-    case CAIRO_STATUS_NO_TARGET_SURFACE:
-	PyErr_SetString(CairoError, "no target surface has been set");
-	return 1;
-    case CAIRO_STATUS_NULL_POINTER:
-	PyErr_SetString(CairoError, "NULL pointer");
-	return 1;
-    case CAIRO_STATUS_INVALID_STRING:
-	PyErr_SetString(CairoError, "input string not valid UTF-8");
-	return 1;
-    case CAIRO_STATUS_INVALID_PATH_DATA:
-	PyErr_SetString(CairoError, "invalid path data not valid");
-	return 1;
-    case CAIRO_STATUS_READ_ERROR:
-	PyErr_SetString(CairoError, "error while reading from input stream");
-	return 1;
-    case CAIRO_STATUS_WRITE_ERROR:
-	PyErr_SetString(CairoError, "error while writing to output stream");
-	return 1;
-    case CAIRO_STATUS_SURFACE_FINISHED:
-	PyErr_SetString(CairoError, "the target surface has been finished");
-	return 1;
-    case CAIRO_STATUS_SURFACE_TYPE_MISMATCH:
-	PyErr_SetString(CairoError, "the surface type is not appropriate for "
-			"the operation");
-	return 1;
+	break;
     default:
-	PyErr_SetString(CairoError, "<unknown error status>");
-	return 1;
+	PyErr_SetString(CairoError, cairo_status_to_string (status));
     }
+    return 1;
 }
 
 




More information about the cairo-commit mailing list