OSSP CVS Repository

ossp - Difference in ossp-pkg/var/var.c versions 1.96 and 1.97
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/var/var.c 1.96 -> 1.97

--- var.c        2003/02/10 21:15:41     1.96
+++ var.c        2003/02/14 18:19:28     1.97
@@ -329,7 +329,7 @@
 {
     char *p;
 
-    if ((p = malloc(len + 1)) == NULL)
+    if ((p = (char *)malloc(len + 1)) == NULL)
         return 0;
     memcpy(p, data, len);
     buf->begin = p;
@@ -350,7 +350,7 @@
     /* Is the tokenbuffer initialized at all? If not, allocate a
        standard-sized buffer to begin with. */
     if (output->begin == NULL) {
-        if ((output->begin = output->end = malloc(TOKENBUF_INITIAL_BUFSIZE)) == NULL)
+        if ((output->begin = output->end = (char *)malloc(TOKENBUF_INITIAL_BUFSIZE)) == NULL)
             return 0;
         output->buffer_size = TOKENBUF_INITIAL_BUFSIZE;
     }
@@ -365,7 +365,7 @@
         }
         /* ok, so copy the contents of output into an allocated buffer
            so that we can append that way. */
-        if ((tmp = malloc(output->end - output->begin + len + 1)) == NULL)
+        if ((tmp = (char *)malloc(output->end - output->begin + len + 1)) == NULL)
             return 0;
         memcpy(tmp, output->begin, output->end - output->begin);
         output->buffer_size = output->end - output->begin;
@@ -381,7 +381,7 @@
         do {
             new_size *= 2;
         } while ((new_size - (output->end - output->begin)) <= len);
-        if ((new_buffer = realloc((char *)output->begin, new_size)) == NULL)
+        if ((new_buffer = (char *)realloc((char *)output->begin, new_size)) == NULL)
             return 0;
         output->end = new_buffer + (output->end - output->begin);
         output->begin = new_buffer;
@@ -422,10 +422,10 @@
 
 static void
 expand_range(
-    char a, char b, char_class_t class)
+    char a, char b, char_class_t cclass)
 {
     do {
-        class[(int)a] = 1;
+        cclass[(int)a] = 1;
     }
     while (++a <= b);
     return;
@@ -433,23 +433,23 @@
 
 static var_rc_t
 expand_character_class(
-    const char *desc, char_class_t class)
+    const char *desc, char_class_t cclass)
 {
     size_t i;
 
     /* clear the class array. */
     for (i = 0; i < 256; ++i)
-        class[i] = 0;
+        cclass[i] = 0;
 
     /* walk through class description and set appropriate entries in array */
     while (*desc != NUL) {
         if (desc[1] == '-' && desc[2] != NUL) {
             if (desc[0] > desc[2])
                 return VAR_ERR_INCORRECT_CLASS_SPEC;
-            expand_range(desc[0], desc[2], class);
+            expand_range(desc[0], desc[2], cclass);
             desc += 3;
         } else {
-            class[(int) *desc] = 1;
+            cclass[(int) *desc] = 1;
             desc++;
         }
     }
@@ -912,7 +912,7 @@
     tokenbuf_t srcclass, dstclass;
     const char *p;
     int rc;
-    size_t i;
+    int i;
 
     tokenbuf_init(&srcclass);
     tokenbuf_init(&dstclass);
@@ -937,7 +937,7 @@
         tokenbuf_move(&tmp, data);
     }
     for (p = data->begin; p != data->end; ++p) {
-        for (i = 0; i <= (srcclass.end - srcclass.begin); ++i) {
+        for (i = 0; i <= (int)(srcclass.end - srcclass.begin); i++) {
             if (*p == srcclass.begin[i]) {
                 *((char *)p) = dstclass.begin[i];
                 break;
@@ -1775,7 +1775,7 @@
     int *result, int *failed)
 {
     const char *p;
-    char operator;
+    char op;
     int right;
     int rc;
 
@@ -1793,27 +1793,27 @@
     /* parse numerical operator */
     while (p != end) {
         if (*p == '+' || *p == '-') {
-            operator = *p++;
+            op = *p++;
             /* recursively parse right operand (light binding) */
             rc = parse_numexp(var, ctx, p, end, &right, failed);
             if (rc < 0)
                 return rc;
             p += rc;
-            if (operator == '+')
+            if (op == '+')
                 *result = (*result + right);
             else
                 *result = (*result - right);
         }
         else if (*p == '*' || *p == '/' || *p == '%') {
-            operator = *p++;
+            op = *p++;
             /* recursively parse right operand (string binding) */
             rc = parse_numexp_operand(var, ctx, p, end, &right, failed);
             if (rc < 0)
                 return rc;
             p += rc;
-            if (operator == '*')
+            if (op == '*')
                 *result = (*result * right);
-            else if (operator == '/') {
+            else if (op == '/') {
                 if (right == 0) {
                     if (*failed)
                         *result = 0;
@@ -1823,7 +1823,7 @@
                 else
                     *result = (*result / right);
             }
-            else if (operator == '%') {
+            else if (op == '%') {
                 if (right == 0) {
                     if (*failed)
                         *result = 0;
@@ -2110,7 +2110,7 @@
 }
 
 /* parse loop construct limits ("[...]{b,s,e}") */
-static var_rc_t
+static int
 parse_looplimits(
     var_t *var, var_parse_t *ctx,
     const char *begin, const char *end,
@@ -2233,7 +2233,7 @@
 }
 
 /* expand input in general */
-static var_rc_t
+static int
 parse_input(
     var_t *var, var_parse_t *ctx,
     const char *begin, const char *end,
@@ -2576,7 +2576,7 @@
 
     /* start the parsing */
     tokenbuf_init(&output);
-    rc = parse_input(var, &ctx, src_ptr, src_ptr+src_len, &output, 0);
+    rc = (var_rc_t)parse_input(var, &ctx, src_ptr, src_ptr+src_len, &output, 0);
 
     /* post-processing */
     if (rc >= 0) {
@@ -2724,8 +2724,8 @@
 {
     if (str == NULL)
         return VAR_RC(VAR_ERR_INVALID_ARGUMENT);
-    rc = 0 - rc;
-    if (rc < 0 || rc >= sizeof(var_errors) / sizeof(char *))
+    rc = (var_rc_t)(0 - rc);
+    if ((int)rc < 0 || (int)rc >= (int)(sizeof(var_errors) / sizeof(char *)))
         *str = "unknown error";
     else
         *str = (char *)var_errors[rc];

CVSTrac 2.0.1