}
#else /* def SEL_FILE_IGNORE_CASE */
int SFcompareEntries (const void *vp, const void *vq) {
- SFEntry *p = (SFEntry *) vp, *q = (SFEntry *) vq;
+ const SFEntry *p = (const SFEntry *) vp, *q = (const SFEntry *) vq;
return strcmp (p->real, q->real);
}
}
static int SFcompareLogins (const void *vp, const void *vq) {
- SFLogin *p = (SFLogin *) vp, *q = (SFLogin *) vq;
+ const SFLogin *p = (const SFLogin *) vp, *q = (const SFLogin *) vq;
return strcmp (p->name, q->name);
}
int attr_compare(const void *a, const void *b)
{
- attr_t *a1 = *(attr_t **) a;
- attr_t *a2 = *(attr_t **) b;
+ const attr_t *a1 = *(attr_t *const *) a;
+ const attr_t *a2 = *(attr_t *const *) b;
return STRCASECMP(a1->name, a2->name);
}
static int append_to_md5(void *chan, const char *str)
{
- md5_append(&pms, (unsigned char *) str, (int) strlen(str));
+ md5_append(&pms, (const unsigned char *) str, (int) strlen(str));
return 1;
}
static int colorcmpf(const void *a0, const void *a1)
{
- hsbcolor_t *p0 = (hsbcolor_t *) a0;
- hsbcolor_t *p1 = (hsbcolor_t *) a1;
+ const hsbcolor_t *p0 = (const hsbcolor_t *) a0;
+ const hsbcolor_t *p1 = (const hsbcolor_t *) a1;
int i = (p0->name[0] - p1->name[0]);
return (i ? i : strcmp(p0->name, p1->name));
}
head = tname;
if (G == 0)
- fprintf(stderr,"edge source %s target %s outside graph, ignored\n",(char*)tail,(char*)head);
+ fprintf(stderr,"edge source %s target %s outside graph, ignored\n",tail,head);
else {
bind_edge(tail, head);
c = 0;
for (n = 0; n < sizeof(int) * CHAR_BIT; n += CHAR_BIT) {
- switch (x = *((unsigned char *) s++)) {
+ switch (x = *((const unsigned char *) s++)) {
case '\\':
x = chresc(s - 1, &p);
s = (const char *) p;
void errorv(const char *id, int level, va_list ap)
{
- char *s;
+ const char *s;
int flags;
if (level < error_info.trace) return;
flags = level & ~ERROR_LEVEL;
level &= ERROR_LEVEL;
}
- if (level && ((s = error_info.id) || (s = (char *) id))) {
+ if (level && ((s = error_info.id) || (s = id))) {
if (flags & ERROR_USAGE)
sfprintf(sfstderr, "Usage: %s ", s);
else
char *fmtquote(const char *as, const char *qb, const char *qe, size_t n,
int flags)
{
- register unsigned char *s = (unsigned char *) as;
- register unsigned char *e = s + n;
+ register const unsigned char *s = (const unsigned char *) as;
+ register const unsigned char *e = s + n;
register char *b;
register int c;
register int escaped;
c = 4 * (n + 1);
if (qb)
- c += strlen((char *) qb);
+ c += strlen(qb);
if (qe)
- c += strlen((char *) qe);
+ c += strlen(qe);
b = buf = fmtbuf(c);
shell = 0;
if (qb) {
char *fmtesq(const char *as, const char *qs)
{
- return fmtquote(as, NiL, qs, strlen((char *) as), 0);
+ return fmtquote(as, NiL, qs, strlen(as), 0);
}
/*
char *fmtesc(const char *as)
{
- return fmtquote(as, NiL, NiL, strlen((char *) as), 0);
+ return fmtquote(as, NiL, NiL, strlen(as), 0);
}
}
}
if (lib) {
- if ((s = strrchr((char *) lib, ':')))
+ if ((s = strrchr(lib, ':')))
lib = (const char *) s + 1;
sfsprintf(tmp, sizeof(tmp), "lib/%s/%s", lib, name);
if (pathpath(buf, tmp, "", PATH_REGULAR))
static int colorcmpf(const void *p0, const void *p1)
{
- return strcasecmp(((hsvrgbacolor_t *) p0)->name, ((hsvrgbacolor_t *) p1)->name);
+ return strcasecmp(((const hsvrgbacolor_t *) p0)->name, ((const hsvrgbacolor_t *) p1)->name);
}
char *canontoken(char *str)
static int fontcmpf(const void *a, const void *b)
{
- return (strcasecmp(((PostscriptAlias*)a)->name, ((PostscriptAlias*)b)->name));
+ return (strcasecmp(((const PostscriptAlias*)a)->name, ((const PostscriptAlias*)b)->name));
}
static PostscriptAlias* translate_postscript_fontname(char* fontname)
}
static int comp_entities(const void *e1, const void *e2) {
- return strcmp(((struct entities_s *)e1)->name, ((struct entities_s *)e2)->name);
+ return strcmp(((const struct entities_s *)e1)->name, ((const struct entities_s *)e2)->name);
}
#define MAXENTLEN 8
*/
static int compFunction(const void *a, const void *b)
{
- int *ind1 = (int *) a;
- int *ind2 = (int *) b;
+ const int *ind1 = (const int *) a;
+ const int *ind2 = (const int *) b;
return (layerWidthInfo[*ind2].width >
layerWidthInfo[*ind1].width) - (layerWidthInfo[*ind2].width <
*/
static int compFunction3(const void *a, const void *b)
{
- nodeGroup_t **ind1 = (nodeGroup_t **) a, **ind2 = (nodeGroup_t **) b;
+ const nodeGroup_t **ind1 = (const nodeGroup_t **) a,
+ **ind2 = (const nodeGroup_t **) b;
if ((*ind2)->height == (*ind1)->height)
return ((*ind2)->width < (*ind1)->width) - ((*ind2)->width >
(*ind1)->width);
*/
static int ecmp(const void *v1, const void *v2)
{
- erec *e1 = (erec *) v1;
- erec *e2 = (erec *) v2;
+ const erec *e1 = (const erec *) v1;
+ const erec *e2 = (const erec *) v2;
if (e1->alpha > e2->alpha)
return 1;
else if (e1->alpha < e2->alpha)
}
}
- crc = crc32(crc, (unsigned char*)s, len);
+ crc = crc32(crc, (const unsigned char*)s, len);
z->next_in = (unsigned char*)s;
z->avail_in = len;
agerr(AGWARN, "Could not load \"%s\" - %s\n", p, "It was found, so perhaps one of its dependents was not. Try ldd.");
}
else {
- agerr(AGWARN, "Could not load \"%s\" - %s\n", p, (char *) lt_dlerror());
+ agerr(AGWARN, "Could not load \"%s\" - %s\n", p, lt_dlerror());
}
return NULL;
}
static int gvrender_comparestr(const void *s1, const void *s2)
{
- return strcmp(*(char **) s1, *(char **) s2);
+ return strcmp(*(char *const *) s1, *(char *const *) s2);
}
/* gvrender_resolve_color:
static int colorcmpf(const void *p0, const void *p1)
{
- return strcasecmp(((hsvrgbacolor_t *) p0)->name, ((hsvrgbacolor_t *) p1)->name);
+ return strcasecmp(((const hsvrgbacolor_t *) p0)->name, ((const hsvrgbacolor_t *) p1)->name);
}
static char *canontoken(char *str)
static int
bindingcmpf (const void *key, const void *ip)
{
- return strcmp (((gvprbinding*)key)->name, ((gvprbinding*)ip)->name);
+ return strcmp (((const gvprbinding*)key)->name, ((const gvprbinding*)ip)->name);
}
/* findBinding:
/* sort sites on y, then x, coord */
static int scomp(const void *S1, const void *S2)
{
- Site *s1, *s2;
+ const Site *s1, *s2;
- s1 = *(Site **) S1;
- s2 = *(Site **) S2;
+ s1 = *(Site *const *) S1;
+ s2 = *(Site *const *) S2;
if (s1->coord.y < s2->coord.y)
return (-1);
if (s1->coord.y > s2->coord.y)
static int comp_scan_points(const void *p, const void *q){
- scan_point *pp = (scan_point *) p;
- scan_point *qq = (scan_point *) q;
+ const scan_point *pp = (const scan_point *) p;
+ const scan_point *qq = (const scan_point *) q;
if (pp->x > qq->x){
return 1;
} else if (pp->x < qq->x){
}
static void NodePrint(const void* a) {
- scan_point *aa;
+ const scan_point *aa;
- aa = (scan_point *) a;
+ aa = (const scan_point *) a;
fprintf(stderr, "node {%d, %f, %d}\n", aa->node, aa->x, aa->status);
}
static float *place;
static int compare_incr(const void *a, const void *b)
{
- if (place[*(int *) a] > place[*(int *) b]) {
+ if (place[*(const int *) a] > place[*(const int *) b]) {
return 1;
- } else if (place[*(int *) a] < place[*(int *) b]) {
+ } else if (place[*(const int *) a] < place[*(const int *) b]) {
return -1;
}
return 0;
*/
static int cmpf(const void *X, const void *Y)
{
- ginfo *x = *(ginfo **) X;
- ginfo *y = *(ginfo **) Y;
+ const ginfo *x = *(ginfo *const *) X;
+ const ginfo *y = *(ginfo *const *) Y;
/* flip order to get descending array */
return (y->perim - x->perim);
}
*/
static int ucmpf(const void *X, const void *Y)
{
- ainfo* x = *(ainfo **) X;
- ainfo* y = *(ainfo **) Y;
+ const ainfo* x = *(ainfo *const *) X;
+ const ainfo* y = *(ainfo *const *) Y;
int dX = userVals[x->index];
int dY = userVals[y->index];
*/
static int acmpf(const void *X, const void *Y)
{
- ainfo* x = *(ainfo **) X;
- ainfo* y = *(ainfo **) Y;
+ const ainfo* x = *(ainfo *const *) X;
+ const ainfo* y = *(ainfo *const *) Y;
#if 0
if (x->height < y->height) return 1;
else if (x->height > y->height) return -1;
}
static int scomp(const void *s1, const void *s2){
- real *ss1, *ss2;
- ss1 = (real*) s1;
- ss2 = (real*) s2;
+ const real *ss1, *ss2;
+ ss1 = (const real*) s1;
+ ss2 = (const real*) s2;
if ((ss1)[1] > (ss2)[1]){
return -1;
}
static int comp_real(const void *x, const void *y){
- real *xx = (real*) x;
- real *yy = (real*) y;
+ const real *xx = (const real*) x;
+ const real *yy = (const real*) y;
if (*xx > *yy){
return 1;
#endif
if (sflags & SF_STRING) {
f = sfnew(f, (char *) file,
- file ? (size_t) strlen((char *) file) : (size_t)
+ file ? (size_t) strlen(file) : (size_t)
SF_UNBOUND, -1, sflags);
} else {
if (!file)
return NIL(Sfio_t *);
#if _has_oflags /* open the file */
- while ((fd = open((char *) file, oflags, SF_CREATMODE)) < 0
+ while ((fd = open(file, oflags, SF_CREATMODE)) < 0
&& errno == EINTR)
errno = 0;
#else
f.flags = SF_STRING | SF_READ;
f.bits = SF_PRIVATE;
f.mode = SF_READ;
- f.size = strlen((char *) s);
+ f.size = strlen(s);
f.data = f.next = f.endw = (uchar *) s;
f.endb = f.endr = f.data + f.size;
if (!(f->mode & SF_WRITE) && (f->flags & SF_RDWR) != SF_RDWR)
SFMTXRETURN(f, (ssize_t) (-1));
- if ((uchar *) buf != f->next &&
- (!f->rsrv || f->rsrv->data != (uchar *) buf))
+ if ((const uchar *) buf != f->next &&
+ (!f->rsrv || f->rsrv->data != (const uchar *) buf))
SFMTXRETURN(f, (ssize_t) (-1));
f->mode &= ~SF_PEEK;
}
static int comp_ascend(const void *s1, const void *s2){
- real *ss1, *ss2;
- ss1 = (real*) s1;
- ss2 = (real*) s2;
+ const real *ss1, *ss2;
+ ss1 = (const real*) s1;
+ ss2 = (const real*) s2;
if ((ss1)[0] > (ss2)[0]){
return 1;
}
static int comp_descend(const void *s1, const void *s2){
- real *ss1, *ss2;
- ss1 = (real*) s1;
- ss2 = (real*) s2;
+ const real *ss1, *ss2;
+ ss1 = (const real*) s1;
+ ss2 = (const real*) s2;
if ((ss1)[0] > (ss2)[0]){
return -1;
return 0;
}
static int comp_descend_int(const void *s1, const void *s2){
- int *ss1, *ss2;
- ss1 = (int*) s1;
- ss2 = (int*) s2;
+ const int *ss1, *ss2;
+ ss1 = (const int*) s1;
+ ss2 = (const int*) s2;
if ((ss1)[0] > (ss2)[0]){
return -1;
}
static int comp_ascend_int(const void *s1, const void *s2){
- int *ss1, *ss2;
- ss1 = (int*) s1;
- ss2 = (int*) s2;
+ const int *ss1, *ss2;
+ ss1 = (const int*) s1;
+ ss2 = (const int*) s2;
if ((ss1)[0] > (ss2)[0]){
return 1;