[babl] constify source argument of babl_process
- From: Ãyvind KolÃs <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [babl] constify source argument of babl_process
- Date: Thu, 15 Mar 2012 22:15:07 +0000 (UTC)
commit 5f21288bd2d011894bf139728eb3a185bcc6f4c1
Author: Ãyvind KolÃs <pippin gimp org>
Date: Thu Mar 15 22:11:56 2012 +0000
constify source argument of babl_process
babl/babl-conversion.c | 18 ++++++++--------
babl/babl-conversion.h | 10 ++++----
babl/babl-fish-path.c | 47 +++++++++++++++++++++----------------------
babl/babl-fish-reference.c | 36 ++++++++++++++++----------------
babl/babl-internal.h | 4 +-
babl/babl-types.h | 4 +-
babl/babl.h | 2 +-
7 files changed, 60 insertions(+), 61 deletions(-)
---
diff --git a/babl/babl-conversion.c b/babl/babl-conversion.c
index 446979d..0740d17 100644
--- a/babl/babl-conversion.c
+++ b/babl/babl-conversion.c
@@ -284,7 +284,7 @@ babl_conversion_new (void *first_arg,
static long
babl_conversion_linear_process (BablConversion *conversion,
- void *source,
+ const void *source,
void *destination,
long n)
{
@@ -293,7 +293,7 @@ babl_conversion_linear_process (BablConversion *conversion,
static long
babl_conversion_plane_process (BablConversion *conversion,
- void *source,
+ const void *source,
void *destination,
int src_pitch,
int dst_pitch,
@@ -311,10 +311,10 @@ babl_conversion_planar_process (BablConversion *conversion,
long n)
{
#ifdef USE_ALLOCA
- char **src_data = alloca (sizeof (void *) * source->components);
+ const char **src_data = alloca (sizeof (void *) * source->components);
char **dst_data = alloca (sizeof (void *) * destination->components);
#else
- char *src_data[BABL_MAX_COMPONENTS];
+ const char *src_data[BABL_MAX_COMPONENTS];
char *dst_data[BABL_MAX_COMPONENTS];
#endif
@@ -331,10 +331,10 @@ babl_conversion_planar_process (BablConversion *conversion,
}
long
-babl_conversion_process (Babl *babl,
- char *source,
- char *destination,
- long n)
+babl_conversion_process (Babl *babl,
+ const char *source,
+ char *destination,
+ long n)
{
BablConversion *conversion = (BablConversion *) babl;
@@ -344,7 +344,7 @@ babl_conversion_process (Babl *babl,
{
case BABL_CONVERSION_PLANE:
{
- void *src_data = NULL;
+ const void *src_data = NULL;
void *dst_data = NULL;
int src_pitch = 0;
int dst_pitch = 0;
diff --git a/babl/babl-conversion.h b/babl/babl-conversion.h
index fbbb279..7b6cd4d 100644
--- a/babl/babl-conversion.h
+++ b/babl/babl-conversion.h
@@ -28,11 +28,11 @@ Babl * babl_conversion (const char *name);
/* Signature of functions registered for reference type
* conversions,
*/
-typedef long (*BablFuncPlane) (char *src,
- char *dst,
- int src_pitch,
- int dst_pitch,
- long n);
+typedef long (*BablFuncPlane) (const char *src,
+ char *dst,
+ int src_pitch,
+ int dst_pitch,
+ long n);
typedef struct
diff --git a/babl/babl-fish-path.c b/babl/babl-fish-path.c
index da5e0b0..53cb658 100644
--- a/babl/babl-fish-path.c
+++ b/babl/babl-fish-path.c
@@ -64,10 +64,10 @@ get_path_instrumentation (FishPathInstrumentation *fpi,
double *path_error);
static long
-process_conversion_path (BablList *path,
- void *source_buffer,
- void *destination_buffer,
- long n);
+process_conversion_path (BablList *path,
+ const void *source_buffer,
+ void *destination_buffer,
+ long n);
static void
get_conversion_path (PathContext *pc,
@@ -312,24 +312,23 @@ babl_fish_path (const Babl *source,
}
static long
-babl_fish_path_process (Babl *babl,
- void *source,
- void *destination,
- long n)
+babl_fish_path_process (Babl *babl,
+ const void *source,
+ void *destination,
+ long n)
{
return process_conversion_path (babl->fish_path.conversion_list,
- source,
- destination,
- n);
+ source,
+ destination,
+ n);
}
-
static long
-babl_fish_process (Babl *babl,
- void *source,
- void *destination,
- long n)
+babl_fish_process (Babl *babl,
+ const void *source,
+ void *destination,
+ long n)
{
long ret = 0;
@@ -373,10 +372,10 @@ babl_fish_process (Babl *babl,
}
long
-babl_process (Babl *babl,
- void *source,
- void *destination,
- long n)
+babl_process (Babl *babl,
+ const void *source,
+ void *destination,
+ long n)
{
babl_assert (babl);
babl_assert (source);
@@ -405,10 +404,10 @@ babl_process (Babl *babl,
}
static long
-process_conversion_path (BablList *path,
- void *source_buffer,
- void *destination_buffer,
- long n)
+process_conversion_path (BablList *path,
+ const void *source_buffer,
+ void *destination_buffer,
+ long n)
{
int conversions = babl_list_size (path);
diff --git a/babl/babl-fish-reference.c b/babl/babl-fish-reference.c
index fa47ea9..4f90d12 100644
--- a/babl/babl-fish-reference.c
+++ b/babl/babl-fish-reference.c
@@ -92,11 +92,11 @@ babl_fish_reference (const Babl *source,
static void
-convert_to_double (BablFormat *source_fmt,
- BablImage *source,
- char *source_buf,
- char *source_double_buf,
- int n)
+convert_to_double (BablFormat *source_fmt,
+ const BablImage *source,
+ char *source_buf,
+ char *source_double_buf,
+ int n)
{
int i;
@@ -203,11 +203,11 @@ convert_from_double (BablFormat *destination_fmt,
static void
-ncomponent_convert_to_double (BablFormat *source_fmt,
- BablImage *source,
- char *source_buf,
- char *source_double_buf,
- int n)
+ncomponent_convert_to_double (BablFormat *source_fmt,
+ const BablImage *source,
+ char *source_buf,
+ char *source_double_buf,
+ int n)
{
BablImage *src_img;
BablImage *dst_img;
@@ -276,10 +276,10 @@ ncomponent_convert_from_double (BablFormat *destination_fmt,
static int
-process_same_model (Babl *babl,
- BablImage *source,
- BablImage *destination,
- long n)
+process_same_model (Babl *babl,
+ const BablImage *source,
+ BablImage *destination,
+ long n)
{
void *double_buf;
@@ -341,10 +341,10 @@ process_same_model (Babl *babl,
}
long
-babl_fish_reference_process (Babl *babl,
- BablImage *source,
- BablImage *destination,
- long n)
+babl_fish_reference_process (Babl *babl,
+ const BablImage *source,
+ BablImage *destination,
+ long n)
{
void *source_double_buf;
void *rgba_double_buf;
diff --git a/babl/babl-internal.h b/babl/babl-internal.h
index fbc45c3..02723a5 100644
--- a/babl/babl-internal.h
+++ b/babl/babl-internal.h
@@ -70,7 +70,7 @@ Babl * babl_conversion_find (const void *source,
double babl_conversion_error (BablConversion *conversion);
long babl_conversion_cost (BablConversion *conversion);
long babl_conversion_process (Babl *conversion,
- char *source,
+ const char *source,
char *destination,
long n);
@@ -83,7 +83,7 @@ Babl * babl_extension_quiet_log (void);
void babl_extension_deinit (void);
long babl_fish_reference_process (Babl *babl,
- BablImage *source,
+ const BablImage*source,
BablImage *destination,
long n);
diff --git a/babl/babl-types.h b/babl/babl-types.h
index 162e6c9..7871e3b 100644
--- a/babl/babl-types.h
+++ b/babl/babl-types.h
@@ -33,13 +33,13 @@ typedef union _Babl Babl;
/* Conversion function between linear data of a either a data types or
* color formats.
*/
-typedef long (*BablFuncLinear) (char *src,
+typedef long (*BablFuncLinear) (const char *src,
char *dst,
long n);
/* TypePlanar,ModelPlanar and FormatPlanar */
typedef long (*BablFuncPlanar) (int src_bands,
- char *src[],
+ const char *src[],
int src_pitch[],
int dst_bands,
char *dst[],
diff --git a/babl/babl.h b/babl/babl.h
index 2c248a5..49110d3 100644
--- a/babl/babl.h
+++ b/babl/babl.h
@@ -84,7 +84,7 @@ Babl * babl_fish (const void *source_format,
* returns number of pixels converted.
*/
long babl_process (Babl *babl_fish,
- void *source,
+ const void *source,
void *destination,
long n);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]