mingw: simplify PATH handling
[gitweb.git] / ref-filter.c
index 3a640448fd83e6cf0bda8ddda081757d5941361e..1fc5e9970db1b821384e61942db856504ce46902 100644 (file)
@@ -351,7 +351,7 @@ struct ref_formatting_state {
 struct atom_value {
        const char *s;
        void (*handler)(struct atom_value *atomv, struct ref_formatting_state *state);
-       unsigned long ul; /* used for sorting when not FIELD_STR */
+       uintmax_t value; /* used for sorting when not FIELD_STR */
        struct used_atom *atom;
 };
 
@@ -723,7 +723,7 @@ static void grab_common_values(struct atom_value *val, int deref, struct object
                if (!strcmp(name, "objecttype"))
                        v->s = typename(obj->type);
                else if (!strcmp(name, "objectsize")) {
-                       v->ul = sz;
+                       v->value = sz;
                        v->s = xstrfmt("%lu", sz);
                }
                else if (deref)
@@ -770,8 +770,8 @@ static void grab_commit_values(struct atom_value *val, int deref, struct object
                        v->s = xstrdup(oid_to_hex(&commit->tree->object.oid));
                }
                else if (!strcmp(name, "numparent")) {
-                       v->ul = commit_list_count(commit->parents);
-                       v->s = xstrfmt("%lu", v->ul);
+                       v->value = commit_list_count(commit->parents);
+                       v->s = xstrfmt("%lu", (unsigned long)v->value);
                }
                else if (!strcmp(name, "parent")) {
                        struct commit_list *parents;
@@ -849,7 +849,7 @@ static void grab_date(const char *buf, struct atom_value *v, const char *atomnam
 {
        const char *eoemail = strstr(buf, "> ");
        char *zone;
-       unsigned long timestamp;
+       timestamp_t timestamp;
        long tz;
        struct date_mode date_mode = { DATE_NORMAL };
        const char *formatp;
@@ -868,18 +868,18 @@ static void grab_date(const char *buf, struct atom_value *v, const char *atomnam
 
        if (!eoemail)
                goto bad;
-       timestamp = strtoul(eoemail + 2, &zone, 10);
-       if (timestamp == ULONG_MAX)
+       timestamp = parse_timestamp(eoemail + 2, &zone, 10);
+       if (timestamp == TIME_MAX)
                goto bad;
        tz = strtol(zone, NULL, 10);
        if ((tz == LONG_MIN || tz == LONG_MAX) && errno == ERANGE)
                goto bad;
        v->s = xstrdup(show_date(timestamp, tz, &date_mode));
-       v->ul = timestamp;
+       v->value = timestamp;
        return;
  bad:
        v->s = "";
-       v->ul = 0;
+       v->value = 0;
 }
 
 /* See grab_values */
@@ -1941,9 +1941,9 @@ static int cmp_ref_sorting(struct ref_sorting *s, struct ref_array_item *a, stru
        else if (cmp_type == FIELD_STR)
                cmp = cmp_fn(va->s, vb->s);
        else {
-               if (va->ul < vb->ul)
+               if (va->value < vb->value)
                        cmp = -1;
-               else if (va->ul == vb->ul)
+               else if (va->value == vb->value)
                        cmp = cmp_fn(a->refname, b->refname);
                else
                        cmp = 1;