Check for valid path status value before calling _cairo_set_error

cairo_status_t is a signed type, so we need to check for invalid codes
that are < 0 as well.

Also removes the MSVC goop in path-data.c that was attempting to work
around the assert earlier.
This commit is contained in:
Vladimir Vukicevic 2006-09-11 12:36:41 -07:00 committed by U-CYCLONE\Vladimir Vukicevic
parent bcc13ede9b
commit 924bbd06f3
2 changed files with 2 additions and 12 deletions

View file

@ -2923,7 +2923,8 @@ cairo_append_path (cairo_t *cr,
}
if (path->status) {
if (path->status <= CAIRO_STATUS_LAST_STATUS)
if (path->status > CAIRO_STATUS_SUCCESS &&
path->status <= CAIRO_STATUS_LAST_STATUS)
_cairo_set_error (cr, path->status);
else
_cairo_set_error (cr, CAIRO_STATUS_INVALID_STATUS);

11
test/path-data.c Executable file → Normal file
View file

@ -143,10 +143,6 @@ draw (cairo_t *cr, int width, int height)
return CAIRO_TEST_SUCCESS;
}
#ifdef _MSC_VER
#include <crtdbg.h>
#endif
int
main (void)
{
@ -155,13 +151,6 @@ main (void)
cairo_path_t path;
cairo_surface_t *surface;
#ifdef _MSC_VER
/* This test triggers an assert, and we don't want an assert dialog;
* have to do this here since the assert happens before cairo_test() */
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);
_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
#endif
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 1, 1);
/* Test a few error cases for cairo_append_path_data */