Added more 'const'
authoraland <aland>
Sat, 15 Dec 2007 20:45:09 +0000 (20:45 +0000)
committeraland <aland>
Sat, 15 Dec 2007 20:45:09 +0000 (20:45 +0000)
src/include/libradius.h
src/lib/valuepair.c

index fca0e4a..6f3ea9f 100644 (file)
@@ -325,8 +325,8 @@ void                pairmove(VALUE_PAIR **to, VALUE_PAIR **from);
 void           pairmove2(VALUE_PAIR **to, VALUE_PAIR **from, int attr);
 VALUE_PAIR     *pairparsevalue(VALUE_PAIR *vp, const char *value);
 VALUE_PAIR     *pairmake(const char *attribute, const char *value, int operator);
-VALUE_PAIR     *pairread(char **ptr, FR_TOKEN *eol);
-FR_TOKEN       userparse(char *buffer, VALUE_PAIR **first_pair);
+VALUE_PAIR     *pairread(const char **ptr, FR_TOKEN *eol);
+FR_TOKEN       userparse(const char *buffer, VALUE_PAIR **first_pair);
 VALUE_PAIR     *readvp2(FILE *fp, int *pfiledone, const char *errprefix);
 
 /*
index 6889f45..b060542 100644 (file)
@@ -1225,7 +1225,7 @@ static VALUE_PAIR *pairmake_any(const char *attribute, const char *value,
                                return NULL;
                        }
 
-                       if ((q - p) >= sizeof(buffer)) {
+                       if ((size_t) (q - p) >= sizeof(buffer)) {
                                librad_log("Vendor name too long in attribute name \"%s\"", attribute);
                                return NULL;
                        }
@@ -1551,12 +1551,12 @@ static const int valid_attr_name[256] = {
  *     Read a valuepair from a buffer, and advance pointer.
  *     Sets *eol to T_EOL if end of line was encountered.
  */
-VALUE_PAIR *pairread(char **ptr, FR_TOKEN *eol)
+VALUE_PAIR *pairread(const char **ptr, FR_TOKEN *eol)
 {
        char            buf[64];
        char            attr[64];
-       char            value[512];
-       char            *p, *q;
+       char            value[512], *q;
+       const char      *p;
        FR_TOKEN        token, t, xlat;
        VALUE_PAIR      *vp;
        size_t          len;
@@ -1703,10 +1703,10 @@ VALUE_PAIR *pairread(char **ptr, FR_TOKEN *eol)
  *     Read one line of attribute/value pairs. This might contain
  *     multiple pairs seperated by comma's.
  */
-FR_TOKEN userparse(char *buffer, VALUE_PAIR **first_pair)
+FR_TOKEN userparse(const char *buffer, VALUE_PAIR **first_pair)
 {
        VALUE_PAIR      *vp;
-       char            *p;
+       const char      *p;
        FR_TOKEN        last_token = T_OP_INVALID;
        FR_TOKEN        previous_token;