summaryrefslogtreecommitdiff
path: root/source4/lib/registry
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/registry')
-rw-r--r--source4/lib/registry/dir.c6
-rw-r--r--source4/lib/registry/interface.c6
-rw-r--r--source4/lib/registry/ldb.c13
-rw-r--r--source4/lib/registry/local.c4
-rw-r--r--source4/lib/registry/patchfile.c4
-rw-r--r--source4/lib/registry/regf.c22
-rw-r--r--source4/lib/registry/registry.h4
-rw-r--r--source4/lib/registry/tools/regshell.c14
-rw-r--r--source4/lib/registry/tools/regtree.c2
-rw-r--r--source4/lib/registry/util.c6
10 files changed, 41 insertions, 40 deletions
diff --git a/source4/lib/registry/dir.c b/source4/lib/registry/dir.c
index 42946bceec..4380dce74e 100644
--- a/source4/lib/registry/dir.c
+++ b/source4/lib/registry/dir.c
@@ -159,7 +159,7 @@ static WERROR reg_dir_key_by_index(TALLOC_CTX *mem_ctx,
{
struct dirent *e;
const struct dir_key *dk = talloc_get_type(k, struct dir_key);
- int i = 0;
+ unsigned int i = 0;
DIR *d;
d = opendir(dk->path);
@@ -342,14 +342,14 @@ static WERROR reg_dir_get_value(TALLOC_CTX *mem_ctx,
}
static WERROR reg_dir_enum_value(TALLOC_CTX *mem_ctx,
- struct hive_key *key, int idx,
+ struct hive_key *key, uint32_t idx,
const char **name,
uint32_t *type, DATA_BLOB *data)
{
const struct dir_key *dk = talloc_get_type(key, struct dir_key);
DIR *d;
struct dirent *e;
- int i;
+ unsigned int i;
d = opendir(dk->path);
if (d == NULL) {
diff --git a/source4/lib/registry/interface.c b/source4/lib/registry/interface.c
index 81ca2c39bc..5d24f6da74 100644
--- a/source4/lib/registry/interface.c
+++ b/source4/lib/registry/interface.c
@@ -44,7 +44,7 @@ const struct reg_predefined_key reg_predefined_keys[] = {
/** Obtain name of specific hkey. */
_PUBLIC_ const char *reg_get_predef_name(uint32_t hkey)
{
- int i;
+ unsigned int i;
for (i = 0; reg_predefined_keys[i].name; i++) {
if (reg_predefined_keys[i].handle == hkey)
return reg_predefined_keys[i].name;
@@ -58,7 +58,7 @@ _PUBLIC_ WERROR reg_get_predefined_key_by_name(struct registry_context *ctx,
const char *name,
struct registry_key **key)
{
- int i;
+ unsigned int i;
for (i = 0; reg_predefined_keys[i].name; i++) {
if (!strcasecmp(reg_predefined_keys[i].name, name))
@@ -150,7 +150,7 @@ _PUBLIC_ WERROR reg_key_get_info(TALLOC_CTX *mem_ctx,
*/
_PUBLIC_ WERROR reg_key_get_subkey_by_index(TALLOC_CTX *mem_ctx,
const struct registry_key *key,
- int idx, const char **name,
+ uint32_t idx, const char **name,
const char **keyclass,
NTTIME *last_changed_time)
{
diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c
index 68639f5b5c..8ed4b5d847 100644
--- a/source4/lib/registry/ldb.c
+++ b/source4/lib/registry/ldb.c
@@ -34,7 +34,7 @@ struct ldb_key_data
struct ldb_context *ldb;
struct ldb_dn *dn;
struct ldb_message **subkeys, **values;
- int subkey_count, value_count;
+ unsigned int subkey_count, value_count;
};
static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx,
@@ -329,7 +329,7 @@ static WERROR ldb_get_default_value(TALLOC_CTX *mem_ctx, struct hive_key *k,
}
static WERROR ldb_get_value_by_id(TALLOC_CTX *mem_ctx, struct hive_key *k,
- int idx, const char **name,
+ uint32_t idx, const char **name,
uint32_t *data_type, DATA_BLOB *data)
{
struct ldb_key_data *kd = talloc_get_type(k, struct ldb_key_data);
@@ -572,7 +572,8 @@ static WERROR ldb_del_value (struct hive_key *key, const char *child)
static WERROR ldb_del_key(const struct hive_key *key, const char *name)
{
- int i, ret;
+ unsigned int i;
+ int ret;
struct ldb_key_data *parentkd = talloc_get_type(key, struct ldb_key_data);
struct ldb_dn *ldap_path;
TALLOC_CTX *mem_ctx = talloc_init("ldb_del_key");
@@ -711,7 +712,7 @@ static WERROR ldb_set_value(struct hive_key *parent,
ret = ldb_add(kd->ldb, msg);
if (ret == LDB_ERR_ENTRY_ALREADY_EXISTS) {
- int i;
+ unsigned int i;
for (i = 0; i < msg->num_elements; i++) {
if (msg->elements[i].flags != LDB_FLAG_MOD_DELETE)
msg->elements[i].flags = LDB_FLAG_MOD_REPLACE;
@@ -778,7 +779,7 @@ static WERROR ldb_get_key_info(TALLOC_CTX *mem_ctx,
if (max_subkeynamelen != NULL) {
- int i;
+ unsigned int i;
struct ldb_message_element *el;
*max_subkeynamelen = 0;
@@ -790,7 +791,7 @@ static WERROR ldb_get_key_info(TALLOC_CTX *mem_ctx,
}
if (max_valnamelen != NULL || max_valbufsize != NULL) {
- int i;
+ unsigned int i;
struct ldb_message_element *el;
W_ERROR_NOT_OK_RETURN(cache_values(kd));
diff --git a/source4/lib/registry/local.c b/source4/lib/registry/local.c
index a3aee06b13..458239b9e0 100644
--- a/source4/lib/registry/local.c
+++ b/source4/lib/registry/local.c
@@ -167,7 +167,7 @@ static WERROR local_create_key(TALLOC_CTX *mem_ctx,
struct local_key *local_parent;
struct hive_key *hivekey;
const char **elements;
- int i;
+ unsigned int i;
const char *last_part;
last_part = strrchr(name, '\\');
@@ -328,7 +328,7 @@ WERROR reg_mount_hive(struct registry_context *rctx,
struct registry_local *reg_local = talloc_get_type(rctx,
struct registry_local);
struct mountpoint *mp = talloc(rctx, struct mountpoint);
- int i = 0;
+ unsigned int i = 0;
mp->path.predefined_key = key_id;
mp->prev = mp->next = NULL;
diff --git a/source4/lib/registry/patchfile.c b/source4/lib/registry/patchfile.c
index 0631e760cb..19e27f5837 100644
--- a/source4/lib/registry/patchfile.c
+++ b/source4/lib/registry/patchfile.c
@@ -44,7 +44,7 @@ WERROR reg_generate_diff_key(struct registry_key *oldkey,
const struct reg_diff_callbacks *callbacks,
void *callback_data)
{
- int i;
+ unsigned int i;
struct registry_key *t1 = NULL, *t2 = NULL;
char *tmppath;
const char *keyname1;
@@ -256,7 +256,7 @@ _PUBLIC_ WERROR reg_generate_diff(struct registry_context *ctx1,
const struct reg_diff_callbacks *callbacks,
void *callback_data)
{
- int i;
+ unsigned int i;
WERROR error;
for (i = 0; reg_predefined_keys[i].name; i++) {
diff --git a/source4/lib/registry/regf.c b/source4/lib/registry/regf.c
index 5bc2335236..ddb917d15a 100644
--- a/source4/lib/registry/regf.c
+++ b/source4/lib/registry/regf.c
@@ -64,7 +64,7 @@ struct regf_key_data {
static struct hbin_block *hbin_by_offset(const struct regf_data *data,
uint32_t offset, uint32_t *rel_offset)
{
- int i;
+ unsigned int i;
for (i = 0; data->hbins[i]; i++) {
if (offset >= data->hbins[i]->offset_from_first &&
@@ -86,7 +86,7 @@ static struct hbin_block *hbin_by_offset(const struct regf_data *data,
static uint32_t regf_hdr_checksum(const uint8_t *buffer)
{
uint32_t checksum = 0, x;
- int i;
+ unsigned int i;
for (i = 0; i < 0x01FB; i+= 4) {
x = IVAL(buffer, i);
@@ -161,7 +161,7 @@ static DATA_BLOB hbin_alloc(struct regf_data *data, uint32_t size,
DATA_BLOB ret;
uint32_t rel_offset = -1; /* Relative offset ! */
struct hbin_block *hbin = NULL;
- int i;
+ unsigned int i;
*offset = 0;
@@ -340,7 +340,7 @@ static uint32_t hbin_store_resize(struct regf_data *data,
int32_t orig_size;
int32_t needed_size;
int32_t possible_size;
- int i;
+ unsigned int i;
SMB_ASSERT(orig_offset > 0);
@@ -504,7 +504,7 @@ static struct regf_key_data *regf_get_key(TALLOC_CTX *ctx,
static WERROR regf_get_value(TALLOC_CTX *ctx, struct hive_key *key,
- int idx, const char **name,
+ uint32_t idx, const char **name,
uint32_t *data_type, DATA_BLOB *data)
{
const struct regf_key_data *private_data =
@@ -567,7 +567,7 @@ static WERROR regf_get_value_by_name(TALLOC_CTX *mem_ctx,
struct hive_key *key, const char *name,
uint32_t *type, DATA_BLOB *data)
{
- int i;
+ unsigned int i;
const char *vname;
WERROR error;
@@ -1551,7 +1551,7 @@ static WERROR regf_del_value (struct hive_key *key, const char *name)
uint32_t vk_offset;
bool found_offset = false;
DATA_BLOB values;
- uint32_t i;
+ unsigned int i;
if (nk->values_offset == -1) {
return WERR_BADFILE;
@@ -1627,7 +1627,7 @@ static WERROR regf_del_key(const struct hive_key *parent, const char *name)
if (key->nk->subkeys_offset != -1) {
char *sk_name;
struct hive_key *sk = (struct hive_key *)key;
- int i = key->nk->num_subkeys;
+ unsigned int i = key->nk->num_subkeys;
while (i--) {
/* Get subkey information. */
error = regf_get_subkey_by_index(parent_nk, sk, 0,
@@ -1653,7 +1653,7 @@ static WERROR regf_del_key(const struct hive_key *parent, const char *name)
char *val_name;
struct hive_key *sk = (struct hive_key *)key;
DATA_BLOB data;
- int i = key->nk->num_values;
+ unsigned int i = key->nk->num_values;
while (i--) {
/* Get value information. */
error = regf_get_value(parent_nk, sk, 0,
@@ -1878,7 +1878,7 @@ static WERROR regf_set_value(struct hive_key *key, const char *name,
static WERROR regf_save_hbin(struct regf_data *regf)
{
struct tdr_push *push = tdr_push_init(regf, regf->iconv_convenience);
- int i;
+ unsigned int i;
W_ERROR_HAVE_NO_MEMORY(push);
@@ -2053,7 +2053,7 @@ WERROR reg_open_regf_file(TALLOC_CTX *parent_ctx, const char *location,
struct regf_data *regf;
struct regf_hdr *regf_hdr;
struct tdr_pull *pull;
- int i;
+ unsigned int i;
regf = (struct regf_data *)talloc_zero(parent_ctx, struct regf_data);
diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h
index a97d9f6184..eeabaefb92 100644
--- a/source4/lib/registry/registry.h
+++ b/source4/lib/registry/registry.h
@@ -88,7 +88,7 @@ struct hive_operations {
* Retrieve a registry value with a specific index.
*/
WERROR (*enum_value) (TALLOC_CTX *mem_ctx,
- struct hive_key *key, int idx,
+ struct hive_key *key, uint32_t idx,
const char **name, uint32_t *type,
DATA_BLOB *data);
@@ -411,7 +411,7 @@ WERROR reg_key_get_info(TALLOC_CTX *mem_ctx,
uint32_t *max_valbufsize);
WERROR reg_key_get_subkey_by_index(TALLOC_CTX *mem_ctx,
const struct registry_key *key,
- int idx,
+ uint32_t idx,
const char **name,
const char **classname,
NTTIME *last_mod_time);
diff --git a/source4/lib/registry/tools/regshell.c b/source4/lib/registry/tools/regshell.c
index 2bacaac6bc..003cbd15e0 100644
--- a/source4/lib/registry/tools/regshell.c
+++ b/source4/lib/registry/tools/regshell.c
@@ -266,7 +266,7 @@ static WERROR cmd_print(struct regshell_context *ctx, int argc, char **argv)
static WERROR cmd_ls(struct regshell_context *ctx, int argc, char **argv)
{
- int i;
+ unsigned int i;
WERROR error;
uint32_t valuetype;
DATA_BLOB valuedata;
@@ -388,7 +388,7 @@ static struct {
static WERROR cmd_help(struct regshell_context *ctx,
int argc, char **argv)
{
- int i;
+ unsigned int i;
printf("Available commands:\n");
for(i = 0; regshell_cmds[i].name; i++) {
printf("%s - %s\n", regshell_cmds[i].name,
@@ -429,7 +429,8 @@ static char **reg_complete_command(const char *text, int start, int end)
{
/* Complete command */
char **matches;
- int i, len, samelen=0, count=1;
+ size_t len, samelen=0;
+ unsigned int i, count=1;
matches = malloc_array_p(char *, MAX_COMPLETIONS);
if (!matches) return NULL;
@@ -477,9 +478,8 @@ static char **reg_complete_key(const char *text, int start, int end)
{
struct registry_key *base;
const char *subkeyname;
- int i, j = 1;
- int samelen = 0;
- int len;
+ unsigned int i, j = 1;
+ size_t len, samelen = 0;
char **matches;
const char *base_n = "";
TALLOC_CTX *mem_ctx;
@@ -593,7 +593,7 @@ int main(int argc, char **argv)
return 1;
if (ctx->current == NULL) {
- int i;
+ unsigned int i;
for (i = 0; (reg_predefined_keys[i].handle != 0) &&
(ctx->current == NULL); i++) {
diff --git a/source4/lib/registry/tools/regtree.c b/source4/lib/registry/tools/regtree.c
index d266b604e3..72158283b3 100644
--- a/source4/lib/registry/tools/regtree.c
+++ b/source4/lib/registry/tools/regtree.c
@@ -43,7 +43,7 @@ static void print_tree(int level, struct registry_key *p,
DATA_BLOB valuedata;
struct security_descriptor *sec_desc;
WERROR error;
- int i;
+ unsigned int i;
TALLOC_CTX *mem_ctx;
for(i = 0; i < level; i++) putchar(' '); puts(name);
diff --git a/source4/lib/registry/util.c b/source4/lib/registry/util.c
index ba739c4921..8a4bc92fe1 100644
--- a/source4/lib/registry/util.c
+++ b/source4/lib/registry/util.c
@@ -41,7 +41,7 @@ static const struct {
/** Return string description of registry value type */
_PUBLIC_ const char *str_regtype(int type)
{
- int i;
+ unsigned int i;
for (i = 0; reg_value_types[i].name; i++) {
if (reg_value_types[i].id == type)
return reg_value_types[i].name;
@@ -115,7 +115,7 @@ _PUBLIC_ bool reg_string_to_val(TALLOC_CTX *mem_ctx,
const char *data_str, uint32_t *type,
DATA_BLOB *data)
{
- int i;
+ unsigned int i;
*type = -1;
/* Find the correct type */
@@ -171,7 +171,7 @@ WERROR reg_open_key_abs(TALLOC_CTX *mem_ctx, struct registry_context *handle,
{
struct registry_key *predef;
WERROR error;
- int predeflength;
+ size_t predeflength;
char *predefname;
if (strchr(name, '\\') != NULL)