Use errno for result errors

Make new enumeration for data transport status and use errno
style error numbers for errors.
This commit is contained in:
Wim Taymans 2017-11-13 09:41:41 +01:00
parent dda28b1589
commit 6fb0f580ea
86 changed files with 2019 additions and 1988 deletions

View file

@ -17,6 +17,8 @@
* Boston, MA 02110-1301, USA.
*/
#include <errno.h>
typedef enum {
GRAY = 0,
YELLOW,
@ -135,21 +137,21 @@ static int drawing_data_init(DrawingData * dd, struct impl *this, char *data)
if ((format->media_type != this->type.media_type.video) ||
(format->media_subtype != this->type.media_subtype.raw))
return SPA_RESULT_NOT_IMPLEMENTED;
return -ENOTSUP;
if (format->info.raw.format == this->type.video_format.RGB) {
dd->draw_pixel = draw_pixel_rgb;
} else if (format->info.raw.format == this->type.video_format.UYVY) {
dd->draw_pixel = draw_pixel_uyvy;
} else
return SPA_RESULT_NOT_IMPLEMENTED;
return -ENOTSUP;
dd->line = data;
dd->width = size->width;
dd->height = size->height;
dd->stride = this->stride;
return SPA_RESULT_OK;
return 0;
}
static inline void draw_pixels(DrawingData * dd, int offset, Color color, int length)
@ -264,8 +266,7 @@ static int draw(struct impl *this, char *data)
init_colors();
res = drawing_data_init(&dd, this, data);
if (res != SPA_RESULT_OK)
if ((res = drawing_data_init(&dd, this, data)) < 0)
return res;
pattern = this->props.pattern;
@ -274,7 +275,7 @@ static int draw(struct impl *this, char *data)
else if (pattern == this->type.pattern_snow)
draw_snow(&dd);
else
return SPA_RESULT_NOT_IMPLEMENTED;
return -ENOTSUP;
return SPA_RESULT_OK;
return 0;
}