From: tomo Date: Fri, 14 Apr 2006 17:08:33 +0000 (+0000) Subject: (concord_ds_open_genre): Use instead of for X-Git-Tag: libconcord-0_0_0~1 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=a83396cc89153d0fb93b7025a0b8f21bdfa47f37;p=chise%2Fconcord.git (concord_ds_open_genre): Use instead of for genre-name. (concord_genre_open_feature): Likewise. (concord_genre_open_index): Use instead of for index-name. (concord_genre_get_feature_0): Use instead of for feature-name. (struct CONCORD_DS_Table): Use instead of for member `location'. (concord_default_read_object): Cast to avoid warning. (concord_open_ds): Use instead of for ds->location. (concord_ds_foreach_genre_name): Use instead of for ds->location; cast to avoid warning. (struct CONCORD_Genre_Table): Use instead of for member `name'. (concord_ds_open_genre): Use instead of for genre-name. (concord_genre_foreach_feature_name): Use instead of for ds->location. (concord_genre_get_feature_0): Use instead of for genre-name. (concord_genre_get_feature): Use instead of for t_name. (struct CONCORD_Feature_Table): Use instead of for member `name'. (concord_genre_open_feature): Use instead of for feature-name. (concord_obj_gets_feature_value): Cast to avoid warning. (struct CONCORD_INDEX_Table): Use instead of for member `name'. (concord_genre_open_index): Use instead of for index-name. (concord_index_strid_put_obj): Cast to avoid warning. --- diff --git a/concord.c b/concord.c index 1c42ebc..f115960 100644 --- a/concord.c +++ b/concord.c @@ -42,23 +42,22 @@ CONCORD_String_data (const CONCORD_String s) return s->data; } -CONCORD_Genre -concord_ds_open_genre (CONCORD_DS ds, const unsigned char* name); +CONCORD_Genre concord_ds_open_genre (CONCORD_DS ds, const char* name); int concord_close_genre (CONCORD_Genre genre); CONCORD_Feature -concord_genre_open_feature (CONCORD_Genre genre, const unsigned char* name); +concord_genre_open_feature (CONCORD_Genre genre, const char* name); int concord_close_feature (CONCORD_Feature feature); CONCORD_INDEX -concord_genre_open_index (CONCORD_Genre genre, const unsigned char* index); +concord_genre_open_index (CONCORD_Genre genre, const char* index); CONCORD_Feature -concord_genre_get_feature_0 (CONCORD_Genre genre, const unsigned char* name); +concord_genre_get_feature_0 (CONCORD_Genre genre, const char* name); int concord_close_index (CONCORD_INDEX table); @@ -70,7 +69,7 @@ concord_default_read_object (const unsigned char* string, size_t length); struct CONCORD_DS_Table { CONCORD_Backend_Type type; - unsigned char *location; + char *location; CONCORD_NAME_TABLE* genre_names; DBTYPE subtype; int modemask; @@ -86,7 +85,7 @@ concord_default_read_object (const unsigned char* str, size_t length) if (buf == NULL) return NULL; - strncpy (buf, str, length); + strncpy ((char*)buf, (char*)str, length); buf[length] = '\0'; return buf; } @@ -104,7 +103,7 @@ concord_open_ds (CONCORD_Backend_Type type, const char* location, ds->type = type; ds->subtype = ( (subtype != 0) ? subtype : DB_HASH ); ds->modemask = modemask; - ds->location = (unsigned char*)malloc (len + 1); + ds->location = (char*)malloc (len + 1); if (ds->location == NULL) goto location_failure; @@ -184,7 +183,7 @@ int concord_ds_foreach_genre_name (CONCORD_DS ds, int (*func) (CONCORD_DS ds, char* name)) { - unsigned char* dname = ds->location; + char* dname = ds->location; DIR *dir; struct dirent *de; @@ -198,10 +197,10 @@ concord_ds_foreach_genre_name (CONCORD_DS ds, { int i, need_to_decode = 0; unsigned char *cp; - unsigned char *name; + char *name; unsigned char *np; - for (cp = de->d_name, i = 0; *cp != '\0'; i++) + for (cp = (unsigned char*)de->d_name, i = 0; *cp != '\0'; i++) { if (*cp++ == '%') need_to_decode = 1; @@ -212,9 +211,9 @@ concord_ds_foreach_genre_name (CONCORD_DS ds, int ch, c[2]; int hex[2]; - name = (unsigned char *) alloca (i); - cp = de->d_name; - np = name; + name = (char*) alloca (i); + cp = (unsigned char*)de->d_name; + np = (unsigned char*)name; while ( (ch = *cp++) != '\0') { @@ -273,13 +272,13 @@ concord_ds_foreach_genre_name (CONCORD_DS ds, struct CONCORD_Genre_Table { CONCORD_DS ds; - unsigned char *name; + char *name; CONCORD_NAME_TABLE* feature_names; CONCORD_NAME_TABLE* index_names; }; CONCORD_Genre -concord_ds_open_genre (CONCORD_DS ds, const unsigned char* name) +concord_ds_open_genre (CONCORD_DS ds, const char* name) { CONCORD_Genre genre; size_t len = strlen (name); @@ -292,7 +291,7 @@ concord_ds_open_genre (CONCORD_DS ds, const unsigned char* name) return NULL; genre->ds = ds; - genre->name = (unsigned char*)malloc (len + 1); + genre->name = (char*)malloc (len + 1); if (genre->name == NULL) { free (genre); @@ -362,7 +361,7 @@ concord_genre_foreach_feature_name (CONCORD_Genre genre, int (*func) (CONCORD_Genre genre, char* name)) { - unsigned char *dname + char *dname = alloca (strlen (genre->ds->location) + 1 + strlen (genre->name) + sizeof ("/feature") + 1); DIR *dir; @@ -383,10 +382,10 @@ concord_genre_foreach_feature_name (CONCORD_Genre genre, { int i, need_to_decode = 0; unsigned char *cp; - unsigned char *name; + char *name; unsigned char *np; - for (cp = de->d_name, i = 0; *cp != '\0'; i++) + for (cp = (unsigned char*)de->d_name, i = 0; *cp != '\0'; i++) { if (*cp++ == '%') need_to_decode = 1; @@ -397,9 +396,9 @@ concord_genre_foreach_feature_name (CONCORD_Genre genre, int ch, c[2]; int hex[2]; - name = (unsigned char *) alloca (i); - cp = de->d_name; - np = name; + name = (char*) alloca (i); + cp = (unsigned char*)de->d_name; + np = (unsigned char*)name; while ( (ch = *cp++) != '\0') { @@ -455,7 +454,7 @@ concord_genre_foreach_feature_name (CONCORD_Genre genre, } CONCORD_Feature -concord_genre_get_feature_0 (CONCORD_Genre genre, const unsigned char* name) +concord_genre_get_feature_0 (CONCORD_Genre genre, const char* name) { CONCORD_Feature feature; @@ -495,7 +494,7 @@ concord_genre_get_feature (CONCORD_Genre genre, const char* name) &s_true_name); if (status == 0) { - unsigned char* t_name = alloca (s_true_name.size + 1); + char* t_name = alloca (s_true_name.size + 1); strncpy (t_name, s_true_name.data, s_true_name.size); t_name[s_true_name.size] = '\0'; @@ -531,13 +530,13 @@ concord_genre_get_index (CONCORD_Genre genre, const char* name) struct CONCORD_Feature_Table { CONCORD_Genre genre; - unsigned char* name; + char* name; DB* db; u_int32_t access; }; CONCORD_Feature -concord_genre_open_feature (CONCORD_Genre genre, const unsigned char* feature) +concord_genre_open_feature (CONCORD_Genre genre, const char* feature) { CONCORD_Feature table; size_t len = strlen (feature); @@ -552,7 +551,7 @@ concord_genre_open_feature (CONCORD_Genre genre, const unsigned char* feature) table->genre = genre; table->db = NULL; table->access = 0; - table->name = (unsigned char*)malloc (len + 1); + table->name = (char*)malloc (len + 1); if (table->name == NULL) { free (table); @@ -707,7 +706,7 @@ concord_obj_gets_feature_value (const char* object_id, return NULL; if (size < valdatum.size) return NULL; - strncpy (dst, valdatum.data, valdatum.size); + strncpy ((char*)dst, valdatum.data, valdatum.size); dst[valdatum.size] = '\0'; return dst; } @@ -745,13 +744,13 @@ concord_feature_foreach_obj_string (CONCORD_Feature feature, struct CONCORD_INDEX_Table { CONCORD_Genre genre; - unsigned char *name; + char *name; DB* db; u_int32_t access; }; CONCORD_INDEX -concord_genre_open_index (CONCORD_Genre genre, const unsigned char* index) +concord_genre_open_index (CONCORD_Genre genre, const char* index) { CONCORD_INDEX table; size_t len = strlen (index); @@ -766,7 +765,7 @@ concord_genre_open_index (CONCORD_Genre genre, const unsigned char* index) table->genre = genre; table->db = NULL; table->access = 0; - table->name = (unsigned char*)malloc (len + 1); + table->name = (char*)malloc (len + 1); if (table->name == NULL) { free (table); @@ -864,7 +863,7 @@ concord_index_strid_put_obj (CONCORD_INDEX index, if (concord_index_setup_db (index, 1)) return -1; - return CONCORD_BDB_put (index->db, strid, object_id); + return CONCORD_BDB_put (index->db, strid, (unsigned char*)object_id); } int