Browse Source

error handling

master
tth 3 years ago
parent
commit
210af322b0
  1. 24
      lib/contrast.c

24
lib/contrast.c

@ -1,3 +1,7 @@ @@ -1,3 +1,7 @@
/*
* contrast.c - part of libfloatimg
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@ -9,6 +13,9 @@ @@ -9,6 +13,9 @@
extern int verbosity;
/* ---------------------------------------------------------------- */
/*
* if the second parameter is NULL, operate 'in-place'
*/
int fimg_square_root(FloatImg *s, FloatImg *d, double maxval)
{
int nbre, idx;
@ -23,6 +30,13 @@ if (s->type != FIMG_TYPE_RGB) { @@ -23,6 +30,13 @@ if (s->type != FIMG_TYPE_RGB) {
if (NULL==d) {
d = s;
}
else {
if (d->type != FIMG_TYPE_RGB) {
fprintf(stderr, "%s : dst type %d invalide\n",
__func__, d->type);
return -4;
}
}
nbre = s->width * s->height * 3;
@ -52,7 +66,7 @@ if (NULL==d) { @@ -52,7 +66,7 @@ if (NULL==d) {
else {
if (d->type != FIMG_TYPE_RGB) {
fprintf(stderr, "%s : dst type %d invalide\n",
__func__, s->type);
__func__, d->type);
return -4;
}
}
@ -73,7 +87,6 @@ return 0; @@ -73,7 +87,6 @@ return 0;
#macro Cos_01( X )
(0.5-0.5*cos( 3.141592654 * X))
#end
*/
int fimg_cos_01(FloatImg *s, FloatImg *d, double maxval)
{
@ -89,6 +102,13 @@ if (s->type != FIMG_TYPE_RGB) { @@ -89,6 +102,13 @@ if (s->type != FIMG_TYPE_RGB) {
if (NULL==d) {
d = s;
}
else {
if (d->type != FIMG_TYPE_RGB) {
fprintf(stderr, "%s : dst type %d invalide\n",
__func__, d->type);
return -4;
}
}
nbre = s->width * s->height * 3;

Loading…
Cancel
Save