Changeset: 65982bf70e5d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=65982bf70e5d
Modified Files:
clients/Tests/exports.stable.out
monetdb5/modules/atoms/color.c
monetdb5/modules/atoms/color.h
monetdb5/modules/kernel/batcolor.c
Branch: default
Log Message:
Use const in color.c.
diffs (truncated from 368 to 300 lines):
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -860,23 +860,23 @@ str CLRbatStr(bat *ret, const bat *l);
str CLRbatValue(bat *ret, const bat *l);
str CLRbatValueInt(bat *ret, const bat *l);
str CLRbatycc(bat *ret, const bat *l, const bat *bid2, const bat *bid3);
-str CLRblue(int *b, color *c);
-str CLRcb(int *g, color *c);
-str CLRcolor(color *c, str *val);
-str CLRcr(int *r, color *c);
-str CLRgreen(int *g, color *c);
-str CLRhsv(color *c, flt *h, flt *s, flt *v);
-str CLRhue(flt *r, color *c);
-str CLRhueInt(int *r, color *c);
-str CLRluminance(int *r, color *c);
-str CLRred(int *r, color *c);
-str CLRrgb(color *rgb, int *r, int *g, int *b);
-str CLRsaturation(flt *g, color *c);
-str CLRsaturationInt(int *g, color *c);
-str CLRstr(str *val, color *c);
-str CLRvalue(flt *b, color *c);
-str CLRvalueInt(int *b, color *c);
-str CLRycc(color *c, int *y, int *cr, int *cb);
+str CLRblue(int *b, const color *c);
+str CLRcb(int *g, const color *c);
+str CLRcolor(color *c, const char **val);
+str CLRcr(int *r, const color *c);
+str CLRgreen(int *g, const color *c);
+str CLRhsv(color *c, const flt *h, const flt *s, const flt *v);
+str CLRhue(flt *r, const color *c);
+str CLRhueInt(int *r, const color *c);
+str CLRluminance(int *r, const color *c);
+str CLRred(int *r, const color *c);
+str CLRrgb(color *rgb, const int *r, const int *g, const int *b);
+str CLRsaturation(flt *g, const color *c);
+str CLRsaturationInt(int *g, const color *c);
+str CLRstr(str *val, const color *c);
+str CLRvalue(flt *b, const color *c);
+str CLRvalueInt(int *b, const color *c);
+str CLRycc(color *c, const int *y, const int *cr, const int *cb);
str CLTActions(bat *ret);
str CLTInfo(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
str CLTLastCommand(bat *ret);
@@ -2010,8 +2010,8 @@ str closeRef;
void clrDeclarations(MalBlkPtr mb);
void clrFunction(InstrPtr p);
void clrInstruction(InstrPtr p);
-int color_fromstr(char *colorStr, int *len, color **c);
-int color_tostr(char **colorStr, int *len, color *c);
+int color_fromstr(const char *colorStr, int *len, color **c);
+int color_tostr(char **colorStr, int *len, const color *c);
str columnBindRef;
str columnRef;
str commitRef;
diff --git a/monetdb5/modules/atoms/color.c b/monetdb5/modules/atoms/color.c
--- a/monetdb5/modules/atoms/color.c
+++ b/monetdb5/modules/atoms/color.c
@@ -61,9 +61,9 @@ CLRhextoint(char h, char l)
}
int
-color_fromstr(char *colorStr, int *len, color **c)
+color_fromstr(const char *colorStr, int *len, color **c)
{
- char *p = colorStr;
+ const char *p = colorStr;
if (*len < (int) sizeof(color) || *c == NULL) {
GDKfree(*c);
@@ -94,7 +94,7 @@ color_fromstr(char *colorStr, int *len,
}
int
-color_tostr(char **colorStr, int *len, color *c)
+color_tostr(char **colorStr, int *len, const color *c)
{
color sc = *c;
@@ -118,7 +118,7 @@ color_tostr(char **colorStr, int *len, c
}
str
-CLRstr(str *s, color *c)
+CLRstr(str *s, const color *c)
{
int len = 0;
str t = 0;
@@ -129,28 +129,28 @@ CLRstr(str *s, color *c)
}
str
-CLRrgb(color *rgb, int *r, int *g, int *b)
+CLRrgb(color *rgb, const int *r, const int *g, const int *b)
{
*rgb = (color) (((*r & 0xFF) << 16) | ((*g & 0xFF) << 8) | (*b & 0xFF));
return (MAL_SUCCEED);
}
str
-CLRred(int *r, color *c)
+CLRred(int *r, const color *c)
{
*r = (int) ((*c >> 16) & 0xFF);
return (MAL_SUCCEED);
}
str
-CLRgreen(int *g, color *c)
+CLRgreen(int *g, const color *c)
{
*g = (int) ((*c >> 8) & 0xFF);
return (MAL_SUCCEED);
}
str
-CLRblue(int *b, color *c)
+CLRblue(int *b, const color *c)
{
*b = (int) (*c & 0xFF);
return (MAL_SUCCEED);
@@ -199,7 +199,7 @@ color_rgb2hsv(float *h, float *s, float
}
str
-CLRhsv(color *c, flt *h, flt *s, flt *v)
+CLRhsv(color *c, const flt *h, const flt *s, const flt *v)
{
int r, g, b;
float Rtmp, Gtmp, Btmp;
@@ -253,7 +253,7 @@ CLRhsv(color *c, flt *h, flt *s, flt *v)
}
str
-CLRhue(flt *f, color *c)
+CLRhue(flt *f, const color *c)
{
float h, s, v;
@@ -263,7 +263,7 @@ CLRhue(flt *f, color *c)
}
str
-CLRhueInt(int *f, color *c)
+CLRhueInt(int *f, const color *c)
{
float h, s, v;
@@ -273,7 +273,7 @@ CLRhueInt(int *f, color *c)
}
str
-CLRsaturation(flt *f, color *c)
+CLRsaturation(flt *f, const color *c)
{
float h, s, v;
@@ -283,7 +283,7 @@ CLRsaturation(flt *f, color *c)
}
str
-CLRsaturationInt(int *f, color *c)
+CLRsaturationInt(int *f, const color *c)
{
float h, s, v;
@@ -293,7 +293,7 @@ CLRsaturationInt(int *f, color *c)
}
str
-CLRvalue(flt *f, color *c)
+CLRvalue(flt *f, const color *c)
{
float h, s, v;
@@ -303,7 +303,7 @@ CLRvalue(flt *f, color *c)
}
str
-CLRvalueInt(int *f, color *c)
+CLRvalueInt(int *f, const color *c)
{
float h, s, v;
@@ -318,7 +318,7 @@ CLRvalueInt(int *f, color *c)
#endif
str
-CLRycc(color *c, int *y, int *cr, int *cb)
+CLRycc(color *c, const int *y, const int *cr, const int *cb)
{
int r, g, b;
float Y = (float) *y;
@@ -335,7 +335,7 @@ CLRycc(color *c, int *y, int *cr, int *c
}
str
-CLRluminance(int *y, color *c)
+CLRluminance(int *y, const color *c)
{
int r = (int) ((*c >> 16) & 0xFF);
int g = (int) ((*c >> 8) & 0xFF);
@@ -347,7 +347,7 @@ CLRluminance(int *y, color *c)
}
str
-CLRcr(int *cr, color *c)
+CLRcr(int *cr, const color *c)
{
int r = (int) ((*c >> 16) & 0xFF);
int g = (int) ((*c >> 8) & 0xFF);
@@ -358,7 +358,7 @@ CLRcr(int *cr, color *c)
}
str
-CLRcb(int *cb, color *c)
+CLRcb(int *cb, const color *c)
{
int r = (int) ((*c >> 16) & 0xFF);
int g = (int) ((*c >> 8) & 0xFF);
@@ -369,7 +369,7 @@ CLRcb(int *cb, color *c)
}
str
-CLRcolor(color *c, str *val)
+CLRcolor(color *c, const char **val)
{
int len = (int) strlen(*val);
diff --git a/monetdb5/modules/atoms/color.h b/monetdb5/modules/atoms/color.h
--- a/monetdb5/modules/atoms/color.h
+++ b/monetdb5/modules/atoms/color.h
@@ -10,25 +10,25 @@
#define _COLOR_H
typedef unsigned int color;
-mal_export str CLRstr(str *val, color *c);
-mal_export str CLRcolor(color *c, str *val);
-mal_export str CLRred(int *r, color *c);
-mal_export str CLRgreen(int *g, color *c);
-mal_export str CLRblue(int *b, color *c);
-mal_export str CLRhue(flt *r, color *c);
-mal_export str CLRsaturation(flt *g, color *c);
-mal_export str CLRvalue(flt *b, color *c);
-mal_export str CLRhueInt(int *r, color *c);
-mal_export str CLRsaturationInt(int *g, color *c);
-mal_export str CLRvalueInt(int *b, color *c);
-mal_export str CLRluminance(int *r, color *c);
-mal_export str CLRcr(int *r, color *c);
-mal_export str CLRcb(int *g, color *c);
-mal_export str CLRhsv(color *c, flt *h, flt *s, flt *v);
-mal_export str CLRrgb(color *rgb, int *r, int *g, int *b);
-mal_export str CLRycc(color *c, int *y, int *cr, int *cb);
-mal_export int color_fromstr(char *colorStr, int *len, color **c);
-mal_export int color_tostr(char **colorStr, int *len, color *c);
+mal_export str CLRstr(str *val, const color *c);
+mal_export str CLRcolor(color *c, const char **val);
+mal_export str CLRred(int *r, const color *c);
+mal_export str CLRgreen(int *g, const color *c);
+mal_export str CLRblue(int *b, const color *c);
+mal_export str CLRhue(flt *r, const color *c);
+mal_export str CLRsaturation(flt *g, const color *c);
+mal_export str CLRvalue(flt *b, const color *c);
+mal_export str CLRhueInt(int *r, const color *c);
+mal_export str CLRsaturationInt(int *g, const color *c);
+mal_export str CLRvalueInt(int *b, const color *c);
+mal_export str CLRluminance(int *r, const color *c);
+mal_export str CLRcr(int *r, const color *c);
+mal_export str CLRcb(int *g, const color *c);
+mal_export str CLRhsv(color *c, const flt *h, const flt *s, const flt *v);
+mal_export str CLRrgb(color *rgb, const int *r, const int *g, const int *b);
+mal_export str CLRycc(color *c, const int *y, const int *cr, const int *cb);
+mal_export int color_fromstr(const char *colorStr, int *len, color **c);
+mal_export int color_tostr(char **colorStr, int *len, const color *c);
#define color_nil ((color)int_nil)
diff --git a/monetdb5/modules/kernel/batcolor.c
b/monetdb5/modules/kernel/batcolor.c
--- a/monetdb5/modules/kernel/batcolor.c
+++ b/monetdb5/modules/kernel/batcolor.c
@@ -20,13 +20,13 @@
#include "monetdb_config.h"
#include "batcolor.h"
-#define BATwalk(NAME,FUNC,TYPE1,TYPE2)
\
+#define BATwalk(NAME,FUNC,TYPE1,NIL,TYPE2)
\
str CLRbat##NAME(bat *ret, const bat *l)
\
{
\
BATiter bi;
\
BAT *bn, *b;
\
BUN p,q;
\
- TYPE1 *x;
\
+ const TYPE1 *x;
\
TYPE2 y, *yp = &y;
\
\
if( (b= BATdescriptor(*l)) == NULL )
\
@@ -44,8 +44,8 @@ str CLRbat##NAME(bat *ret, const bat *l)
bi = bat_iterator(b);
\
\
BATloop(b, p, q) {
\
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list