Revert "int => unsigned..."
authorStefan Metzmacher <metze@samba.org>
Wed, 3 Feb 2010 13:37:04 +0000 (14:37 +0100)
committerStefan Metzmacher <metze@samba.org>
Thu, 4 Feb 2010 13:53:42 +0000 (14:53 +0100)
This reverts commit c16be643da8343c15581c4f414a4925cf68b5727.

source4/lib/ldb/common/ldb_attributes.c
source4/lib/ldb/common/ldb_controls.c
source4/lib/ldb/common/ldb_dn.c
source4/lib/ldb/common/ldb_msg.c
source4/lib/ldb/ldb_ildap/ldb_ildap.c
source4/lib/ldb/ldb_ldap/ldb_ldap.c
source4/lib/ldb/ldb_map/ldb_map.c
source4/lib/ldb/ldb_map/ldb_map_outbound.c
source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c
source4/lib/ldb/ldb_tdb/ldb_index.c
source4/lib/ldb/ldb_tdb/ldb_search.c

index 45d22533cf327b483210c94d16a43fad4bf64f3f..87657a134e5def6e5f788ce232d67c5eb6e3930f 100644 (file)
@@ -122,13 +122,9 @@ static const struct ldb_schema_attribute *ldb_schema_attribute_by_name_internal(
        struct ldb_context *ldb,
        const char *name)
 {
-       /* for binary search we need signed variables */
-       long long int i, e, b;
-       int r;
+       int i, e, b = 0, r;
        const struct ldb_schema_attribute *def = &ldb_attribute_default;
 
-       b = 0;
-
        /* as handlers are sorted, '*' must be the first if present */
        if (strcmp(ldb->schema.attributes[0].name, "*") == 0) {
                def = &ldb->schema.attributes[0];
@@ -139,6 +135,7 @@ static const struct ldb_schema_attribute *ldb_schema_attribute_by_name_internal(
        e = ldb->schema.num_attributes - 1;
 
        while (b <= e) {
+
                i = (b + e) / 2;
 
                r = ldb_attr_cmp(name, ldb->schema.attributes[i].name);
index 5bafdbdf9c8735b8c71464a3353759c76093268a..8da43ab9b1aec317655c8434d3d281f3657cff28 100644 (file)
@@ -37,7 +37,7 @@
 /* returns NULL if not found */
 struct ldb_control *ldb_request_get_control(struct ldb_request *req, const char *oid)
 {
-       unsigned int i;
+       int i;
 
        if (req->controls != NULL) {
                for (i = 0; req->controls[i]; i++) {
@@ -56,7 +56,7 @@ struct ldb_control *ldb_request_get_control(struct ldb_request *req, const char
 /* returns NULL if not found */
 struct ldb_control *ldb_reply_get_control(struct ldb_reply *rep, const char *oid)
 {
-       unsigned int i;
+       int i;
 
        if (rep->controls != NULL) {
                for (i = 0; rep->controls[i]; i++) {
@@ -77,7 +77,7 @@ the "exclude" control */
 int save_controls(struct ldb_control *exclude, struct ldb_request *req, struct ldb_control ***saver)
 {
        struct ldb_control **lcs;
-       unsigned int i, j;
+       int i, j;
 
        *saver = req->controls;
        for (i = 0; req->controls[i]; i++);
@@ -110,7 +110,7 @@ struct ldb_control **controls_except_specified(struct ldb_control **controls_in,
                                               struct ldb_control *exclude)
 {
        struct ldb_control **lcs = NULL;
-       unsigned int i, j;
+       int i, j;
 
        for (i = 0; controls_in && controls_in[i]; i++);
 
@@ -147,7 +147,7 @@ struct ldb_control **controls_except_specified(struct ldb_control **controls_in,
 /* return True if any, False if none */
 int check_critical_controls(struct ldb_control **controls)
 {
-       unsigned int i;
+       int i;
 
        if (controls == NULL) {
                return 0;
@@ -164,7 +164,7 @@ int check_critical_controls(struct ldb_control **controls)
 
 int ldb_request_add_control(struct ldb_request *req, const char *oid, bool critical, void *data)
 {
-       unsigned int i, n;
+       unsigned i, n;
        struct ldb_control **ctrls;
        struct ldb_control *ctrl;
 
@@ -238,7 +238,7 @@ int ldb_reply_add_control(struct ldb_reply *ares, const char *oid, bool critical
 
 struct ldb_control **ldb_parse_control_strings(struct ldb_context *ldb, void *mem_ctx, const char **control_strings)
 {
-       unsigned int i;
+       int i;
        struct ldb_control **ctrl;
 
        char *error_string = NULL;
@@ -312,8 +312,7 @@ struct ldb_control **ldb_parse_control_strings(struct ldb_context *ldb, void *me
                        struct ldb_dirsync_control *control;
                        const char *p;
                        char cookie[1024];
-                       int crit, flags, ret;
-                       unsigned max_attrs;
+                       int crit, flags, max_attrs, ret;
                       
                        cookie[0] = '\0';
                        p = &(control_strings[i][8]);
index 374a71a016dcdc8b81ca3f2f9d6e42700b241c41..252a0c632b16178277b5ab3e14c4d603f5c9b69a 100644 (file)
@@ -740,7 +740,7 @@ bool ldb_dn_validate(struct ldb_dn *dn)
 
 const char *ldb_dn_get_linearized(struct ldb_dn *dn)
 {
-       unsigned int i, len;
+       int i, len;
        char *d, *n;
 
        if ( ! dn || ( dn->invalid)) return NULL;
@@ -805,8 +805,8 @@ static int ldb_dn_extended_component_compare(const void *p1, const void *p2)
 char *ldb_dn_get_extended_linearized(void *mem_ctx, struct ldb_dn *dn, int mode)
 {
        const char *linearized = ldb_dn_get_linearized(dn);
-       char *p = NULL;
-       unsigned int i;
+       char *p;
+       int i;
 
        if (!linearized) {
                return NULL;
@@ -909,8 +909,7 @@ char *ldb_dn_alloc_linearized(void *mem_ctx, struct ldb_dn *dn)
 
 static bool ldb_dn_casefold_internal(struct ldb_dn *dn)
 {
-       unsigned int i;
-       int ret;
+       int i, ret;
 
        if ( ! dn || dn->invalid) return false;
 
@@ -955,7 +954,7 @@ failed:
 
 const char *ldb_dn_get_casefold(struct ldb_dn *dn)
 {
-       unsigned int i, len;
+       int i, len;
        char *d, *n;
 
        if (dn->casefold) return dn->casefold;
@@ -1111,8 +1110,7 @@ int ldb_dn_compare_base(struct ldb_dn *base, struct ldb_dn *dn)
 
 int ldb_dn_compare(struct ldb_dn *dn0, struct ldb_dn *dn1)
 {
-       unsigned int i;
-       int ret;
+       int i, ret;
 
        if (( ! dn0) || dn0->invalid || ! dn1 || dn1->invalid) {
                return -1;
@@ -1591,7 +1589,7 @@ bool ldb_dn_add_child_fmt(struct ldb_dn *dn, const char *child_fmt, ...)
 
 bool ldb_dn_remove_base_components(struct ldb_dn *dn, unsigned int num)
 {
-       long long int i;
+       int i;
 
        if ( ! ldb_dn_validate(dn)) {
                return false;
@@ -1634,7 +1632,7 @@ bool ldb_dn_remove_base_components(struct ldb_dn *dn, unsigned int num)
 
 bool ldb_dn_remove_child_components(struct ldb_dn *dn, unsigned int num)
 {
-       unsigned int i, j;
+       int i, j;
 
        if ( ! ldb_dn_validate(dn)) {
                return false;
@@ -1709,7 +1707,7 @@ struct ldb_dn *ldb_dn_get_parent(void *mem_ctx, struct ldb_dn *dn)
 
 */
 static char *ldb_dn_canonical(void *mem_ctx, struct ldb_dn *dn, int ex_format) {
-       long long int i;
+       int i;
        TALLOC_CTX *tmpctx;
        char *cracked = NULL;
        const char *format = (ex_format ? "\n" : "/" );
@@ -1721,7 +1719,7 @@ static char *ldb_dn_canonical(void *mem_ctx, struct ldb_dn *dn, int ex_format) {
        tmpctx = talloc_new(mem_ctx);
 
        /* Walk backwards down the DN, grabbing 'dc' components at first */
-       for (i = dn->comp_num - 1; i >= 0; i--) {
+       for (i = dn->comp_num - 1 ; i >= 0; i--) {
                if (ldb_attr_cmp(dn->components[i].name, "dc") != 0) {
                        break;
                }
@@ -1876,7 +1874,7 @@ int ldb_dn_set_component(struct ldb_dn *dn, int num,
 const struct ldb_val *ldb_dn_get_extended_component(struct ldb_dn *dn,
                                                    const char *name)
 {
-       unsigned int i;
+       int i;
        if ( ! ldb_dn_validate(dn)) {
                return NULL;
        }
@@ -1892,7 +1890,7 @@ int ldb_dn_set_extended_component(struct ldb_dn *dn,
                                  const char *name, const struct ldb_val *val)
 {
        struct ldb_dn_ext_component *p;
-       unsigned int i;
+       int i;
        struct ldb_val v2;
 
        if ( ! ldb_dn_validate(dn)) {
index 0a64e79979de3a57a2193bcb5ee4eff83e5d30c4..04761f8867c2b77d29c3bc132111b9309d7b9263 100644 (file)
@@ -776,7 +776,7 @@ int ldb_msg_copy_attr(struct ldb_message *msg, const char *attr, const char *rep
 */
 void ldb_msg_remove_element(struct ldb_message *msg, struct ldb_message_element *el)
 {
-       ptrdiff_t n = (el - msg->elements);
+       int n = (el - msg->elements);
        if (n >= msg->num_elements) {
                /* should we abort() here? */
                return;
index 23d6d62b85e83695171a6a9990cdcdc3f5a9a531..6eb2e1719c8b2b50abe52506037b9263e01c1e74 100644 (file)
@@ -109,13 +109,13 @@ static void ildb_auto_done_callback(struct tevent_context *ev,
   convert a ldb_message structure to a list of ldap_mod structures
   ready for ildap_add() or ildap_modify()
 */
-static struct ldap_mod **ildb_msg_to_mods(void *mem_ctx, unsigned int *num_mods,
+static struct ldap_mod **ildb_msg_to_mods(void *mem_ctx, int *num_mods,
                                          const struct ldb_message *msg,
                                          int use_flags)
 {
        struct ldap_mod **mods;
        unsigned int i;
-       unsigned int n = 0;
+       int n = 0;
 
        /* allocate maximum number of elements needed */
        mods = talloc_array(mem_ctx, struct ldap_mod *, msg->num_elements+1);
@@ -214,8 +214,8 @@ static void ildb_callback(struct ldap_request *req)
        char *referral;
        bool callback_failed;
        bool request_done;
-       unsigned int i;
        int ret;
+       int i;
 
        ac = talloc_get_type(req->async.private_data, struct ildb_context);
        ldb = ldb_module_get_ctx(ac->module);
@@ -432,7 +432,7 @@ static int ildb_search(struct ildb_context *ac)
        struct ldb_context *ldb;
        struct ldb_request *req = ac->req;
        struct ldap_message *msg;
-       unsigned int n;
+       int n;
 
        ldb = ldb_module_get_ctx(ac->module);
 
@@ -493,7 +493,7 @@ static int ildb_add(struct ildb_context *ac)
        struct ldb_request *req = ac->req;
        struct ldap_message *msg;
        struct ldap_mod **mods;
-       unsigned int i,n;
+       int i,n;
 
        msg = new_ldap_message(req);
        if (msg == NULL) {
@@ -537,7 +537,7 @@ static int ildb_modify(struct ildb_context *ac)
        struct ldb_request *req = ac->req;
        struct ldap_message *msg;
        struct ldap_mod **mods;
-       unsigned int i,n;
+       int i,n;
 
        msg = new_ldap_message(req);
        if (msg == NULL) {
index 78d31f464f1fbe540dd56c3f2e44091b5f850d68..0d75491e915bfd21d7d1e50f82d0bf752bf5d310 100644 (file)
@@ -138,7 +138,7 @@ static int lldb_add_msg_attr(struct ldb_context *ldb,
                             struct ldb_message *msg, 
                             const char *attr, struct berval **bval)
 {
-       unsigned int count, i;
+       int count, i;
        struct ldb_message_element *el;
 
        count = ldap_count_values_len(bval);
@@ -483,8 +483,8 @@ static bool lldb_parse_result(struct lldb_context *ac, LDAPMessage *result)
        bool callback_failed;
        bool request_done;
        bool lret;
-       unsigned int i;
        int ret;
+       int i;
 
        ldb = ldb_module_get_ctx(ac->module);
 
index 2f3a9c439c7fc039b7f358cb0e681d184e15b043..483222ec2044d417720879f3af08d4820fd5b2d1 100644 (file)
@@ -473,8 +473,7 @@ struct ldb_dn *ldb_dn_map_local(struct ldb_module *module, void *mem_ctx, struct
        enum ldb_map_attr_type map_type;
        const char *name;
        struct ldb_val value;
-       unsigned int i;
-       int ret;
+       int i, ret;
 
        if (dn == NULL) {
                return NULL;
@@ -549,8 +548,7 @@ struct ldb_dn *ldb_dn_map_remote(struct ldb_module *module, void *mem_ctx, struc
        enum ldb_map_attr_type map_type;
        const char *name;
        struct ldb_val value;
-       unsigned int i;
-       int ret;
+       int i, ret;
 
        if (dn == NULL) {
                return NULL;
index 836aec9b1bd7d2862f166e56ffc7cd8bb06ff0ad..7860a1c8db3ca7101ffd1b4761a19a5a93ec00d8 100644 (file)
@@ -1057,7 +1057,7 @@ int map_return_entry(struct map_context *ac, struct ldb_reply *ares)
        struct ldb_message_element *el;
        const char * const *attrs;
        struct ldb_context *ldb;
-       unsigned int i;
+       int i;
 
        ldb = ldb_module_get_ctx(ac->module);
 
index 82ce123df0b23f0d30394e64665d9fe282bd7817..fcf1c117242d55a4d1645cd8b0bf735638dd8402 100644 (file)
@@ -667,8 +667,7 @@ static int lsqlite3_search_callback(void *result, int col_num, char **cols, char
        struct lsql_context *ac;
        struct ldb_message *msg;
        long long eid;
-       unsigned int i;
-       int ret;
+       int i, ret;
 
        ac = talloc_get_type(result, struct lsql_context);
        ldb = ldb_module_get_ctx(ac->module);
index 0068f8c1ecb9e54b3efcc0b6d2b08259cf6ce497..33a5529615556a6860bb905a8bf4d6a5767188b8 100644 (file)
@@ -1284,8 +1284,7 @@ int ltdb_index_del_value(struct ldb_module *module, struct ldb_dn *dn,
        struct ldb_context *ldb;
        struct ldb_dn *dn_key;
        const char *dn_str;
-       unsigned int i;
-       int ret;
+       int ret, i;
        struct dn_list *list;
 
        ldb = ldb_module_get_ctx(module);
index 04cc72fef0bc434d3e03dd57ce973a5fdbccffbc..268c2f3c353bea328265d8e03b2ae8513ee7e9a4 100644 (file)
@@ -145,7 +145,7 @@ static struct ldb_message *ltdb_pull_attrs(struct ldb_module *module,
                                           const char * const *attrs)
 {
        struct ldb_message *ret;
-       unsigned int i;
+       int i;
 
        ret = talloc(mem_ctx, struct ldb_message);
        if (!ret) {
@@ -325,7 +325,7 @@ int ltdb_add_attr_results(struct ldb_module *module,
  */
 int ltdb_filter_attrs(struct ldb_message *msg, const char * const *attrs)
 {
-       unsigned int i, keep_all = 0;
+       int i, keep_all = 0;
 
        if (attrs) {
                /* check for special attrs */