s3-lib: use TYPESAFE_QSORT() in remaining s3 library code
authorAndrew Tridgell <tridge@samba.org>
Sat, 13 Feb 2010 23:00:49 +0000 (10:00 +1100)
committerAndrew Tridgell <tridge@samba.org>
Sun, 14 Feb 2010 07:44:20 +0000 (18:44 +1100)
the sort_query_replies() in nmblib.c is a TODO. It uses a hack that
treats a char* as a structure. I've left that one alone for now.

source3/libads/dns.c
source3/libsmb/libsmb_xattr.c
source3/libsmb/nmblib.c

index 1765f95ca0e5c5ec1b20d0b9a6f5d34a956e6515..2fa6f18c77e390a2aeeb2a044cc5ebfa16ab2643 100644 (file)
@@ -563,7 +563,7 @@ static NTSTATUS ads_dns_lookup_srv( TALLOC_CTX *ctx,
                }
        }
 
-       qsort( dcs, idx, sizeof(struct dns_rr_srv), QSORT_CAST dnssrvcmp );
+       TYPESAFE_QSORT(dcs, idx, dnssrvcmp );
 
        *dclist = dcs;
        *numdcs = idx;
index 27c3e123995d16f889aeb6e088c6ad37079a3c81..cbdca4e748c032aa9996300fc0d369cac7ebe4c7 100644 (file)
@@ -145,8 +145,7 @@ sort_acl(SEC_ACL *the_acl)
        uint32 i;
        if (!the_acl) return;
 
-       qsort(the_acl->aces, the_acl->num_aces, sizeof(the_acl->aces[0]),
-              QSORT_CAST ace_compare);
+       TYPESAFE_QSORT(the_acl->aces, the_acl->num_aces, ace_compare);
 
        for (i=1;i<the_acl->num_aces;) {
                if (sec_ace_equal(&the_acl->aces[i-1], &the_acl->aces[i])) {
index 1a2106675b47c17575ab34703bc9603a18301531..150e1f6af9f0e05f760978dc9e7d71e8fbdc2145 100644 (file)
@@ -1232,6 +1232,10 @@ void sort_query_replies(char *data, int n, struct in_addr ip)
 
        putip(sort_ip, (char *)&ip);
 
+       /* TODO:
+          this can't use TYPESAFE_QSORT() as the types are wrong.
+          It should be fixed to use a real type instead of char*
+       */
        qsort(data, n, 6, QSORT_CAST name_query_comp);
 }