--- trunk/Src/wptKeylist.cpp 2005/10/31 21:14:11 48 +++ trunk/Src/wptKeylist.cpp 2005/11/08 07:15:13 73 @@ -297,6 +297,7 @@ case GPGME_PK_ELG: case GPGME_PK_ELG_E: return "ELG"; case GPGME_PK_RSA: return "RSA"; + default: return "???"; } return "???"; } @@ -368,13 +369,12 @@ } +/* Return the status of the key @key. */ char* get_key_status (gpgme_key_t key, int uididx, int listmode) { gpgme_user_id_t u; - char * p; - const char * attr; - int i = 0; + const char *attr; u32 key_attr =0; if (uididx < 0 || count_userids (key) > uididx) @@ -399,15 +399,8 @@ u = get_nth_userid (key, uididx); key_attr = u->validity; attr = get_key_trust2 (NULL, key_attr, 0, 0); - /* FIXME: Why not just strdup and why does this function either - * return a new allocated or an m_strdup allocated string? This - * is very dangerous!!! */ - p = new char[strlen( attr ) + 2]; - if (!p) - BUG (NULL); - strcpy (p, attr); - return p; -} /* get_key_status */ + return m_strdup (attr); +} /* Integer comparsion of @a and @b. @@ -502,7 +495,7 @@ static const char* calc_validity (gpg_group_t grp) { - int level = 0, valid; + int valid=0; gpg_member_t mbr; gpgme_key_t key; @@ -555,7 +548,7 @@ listview_ctrl_t lv; listview_column_t col; int j, n = 0; - int kl_nolist = 0, rc = 0; + int rc = 0; rc = listview_new (&lv); if( rc ) @@ -819,7 +812,7 @@ int keylist_add_key (listview_ctrl_t lv, int mode, gpgme_key_t key) { - int uids, rc = 0, i, n = 0; + int uids, rc = 0, i; gpgme_subkey_t k; /* if the entire key is disabled, just return. */