Kaydet (Commit) 27f3b885 authored tarafından Bahadır Kandemir's avatar Bahadır Kandemir

* pass unsigned char to hash_string

* load_file returns char
üst cb476900
...@@ -13,7 +13,7 @@ char *strsub(const char *str, int start, int end); ...@@ -13,7 +13,7 @@ char *strsub(const char *str, int start, int end);
char *strrep(const char *str, char old, char new); char *strrep(const char *str, char old, char new);
int check_file(const char *fname); int check_file(const char *fname);
unsigned char *load_file(const char *fname, int *sizeptr); char *load_file(const char *fname, int *sizeptr);
int save_file(const char *fname, const char *buffer, size_t size); int save_file(const char *fname, const char *buffer, size_t size);
unsigned long time_diff(struct timeval *start, struct timeval *end); unsigned long time_diff(struct timeval *start, struct timeval *end);
...@@ -134,7 +134,7 @@ model_lookup_interface(const char *iface) ...@@ -134,7 +134,7 @@ model_lookup_interface(const char *iface)
struct node *n; struct node *n;
int val; int val;
val = hash_string(iface, strlen(iface)) % TABLE_SIZE; val = hash_string((unsigned char*) iface, strlen(iface)) % TABLE_SIZE;
for (n = node_table[val]; n; n = n->next) { for (n = node_table[val]; n; n = n->next) {
if (N_INTERFACE == n->type && strcmp(n->path, iface) == 0) { if (N_INTERFACE == n->type && strcmp(n->path, iface) == 0) {
return n->no; return n->no;
...@@ -163,7 +163,7 @@ model_lookup_method(const char *iface, const char *method) ...@@ -163,7 +163,7 @@ model_lookup_method(const char *iface, const char *method)
snprintf(path, size, "%s.%s", iface, method); snprintf(path, size, "%s.%s", iface, method);
path[size - 1] = '\0'; path[size - 1] = '\0';
val = hash_string(path, strlen(path)) % TABLE_SIZE; val = hash_string((unsigned char*) path, strlen(path)) % TABLE_SIZE;
for (n = node_table[val]; n; n = n->next) { for (n = node_table[val]; n; n = n->next) {
if (N_METHOD == n->type && strcmp(n->path, path) == 0) { if (N_METHOD == n->type && strcmp(n->path, path) == 0) {
free(path); free(path);
...@@ -204,7 +204,7 @@ model_lookup_signal(const char *iface, const char *signal) ...@@ -204,7 +204,7 @@ model_lookup_signal(const char *iface, const char *signal)
snprintf(path, size, "%s.%s", iface, signal); snprintf(path, size, "%s.%s", iface, signal);
path[size - 1] = '\0'; path[size - 1] = '\0';
val = hash_string(path, strlen(path)) % TABLE_SIZE; val = hash_string((unsigned char*) path, strlen(path)) % TABLE_SIZE;
for (n = node_table[val]; n; n = n->next) { for (n = node_table[val]; n; n = n->next) {
if (N_SIGNAL == n->type && strcmp(n->path, path) == 0) { if (N_SIGNAL == n->type && strcmp(n->path, path) == 0) {
free(path); free(path);
...@@ -239,7 +239,7 @@ add_node(int parent_no, const char *path, char *label, int type) ...@@ -239,7 +239,7 @@ add_node(int parent_no, const char *path, char *label, int type)
n->no = model_nr_nodes++; n->no = model_nr_nodes++;
n->access_label = label; n->access_label = label;
val = hash_string(path, len) % TABLE_SIZE; val = hash_string((unsigned char*) path, len) % TABLE_SIZE;
n->next = node_table[val]; n->next = node_table[val];
node_table[val] = n; node_table[val] = n;
......
...@@ -96,7 +96,7 @@ check_file(const char *fname) ...@@ -96,7 +96,7 @@ check_file(const char *fname)
} }
//! Returns content of a file //! Returns content of a file
unsigned char * char *
load_file(const char *fname, int *sizeptr) load_file(const char *fname, int *sizeptr)
{ {
/*! /*!
...@@ -110,7 +110,7 @@ load_file(const char *fname, int *sizeptr) ...@@ -110,7 +110,7 @@ load_file(const char *fname, int *sizeptr)
FILE *f; FILE *f;
struct stat fs; struct stat fs;
size_t size; size_t size;
unsigned char *data; char *data;
if (stat(fname, &fs) != 0) return NULL; if (stat(fname, &fs) != 0) return NULL;
size = fs.st_size; size = fs.st_size;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment