diff --git a/src/libopensc/asn1.c b/src/libopensc/asn1.c index 29b515b7..cad459b0 100644 --- a/src/libopensc/asn1.c +++ b/src/libopensc/asn1.c @@ -1001,7 +1001,7 @@ static int asn1_decode_se_info(sc_context_t *ctx, const u8 *obj, size_t objlen, ret = SC_SUCCESS; err: if (ret != SC_SUCCESS) { - int i; + size_t i; for (i = 0; i < idx; i++) if (ses[i]) free(ses[i]); diff --git a/src/libopensc/card-authentic.c b/src/libopensc/card-authentic.c index 123999aa..f5f0e001 100644 --- a/src/libopensc/card-authentic.c +++ b/src/libopensc/card-authentic.c @@ -1702,7 +1702,7 @@ static int authentic_pin_cmd(struct sc_card *card, struct sc_pin_cmd_data *data, int *tries_left) { struct sc_context *ctx = card->ctx; - int rv; + int rv = SC_ERROR_INTERNAL; LOG_FUNC_CALLED(ctx); sc_log(ctx, "PIN-CMD:%X,PIN(type:%X,ret:%i)", data->cmd, data->pin_type, data->pin_reference); @@ -2284,9 +2284,9 @@ authentic_sm_free_wrapped_apdu(struct sc_card *card, struct sc_apdu *plain, stru } if ((*sm_apdu)->data) - free((*sm_apdu)->data); + free((unsigned char *) (*sm_apdu)->data); if ((*sm_apdu)->resp) - free((*sm_apdu)->resp); + free((unsigned char *) (*sm_apdu)->resp); free(*sm_apdu); *sm_apdu = NULL; @@ -2337,7 +2337,7 @@ authentic_sm_get_wrapped_apdu(struct sc_card *card, struct sc_apdu *plain, struc if (!apdu->data) LOG_FUNC_RETURN(ctx, SC_ERROR_OUT_OF_MEMORY); if (plain->data && plain->datalen) - memcpy(apdu->data, plain->data, plain->datalen); + memcpy((unsigned char *) apdu->data, plain->data, plain->datalen); apdu->resp = calloc (1, plain->resplen + 32); if (!apdu->resp) diff --git a/src/libopensc/card-cardos.c b/src/libopensc/card-cardos.c index 24cb8590..52a90d94 100644 --- a/src/libopensc/card-cardos.c +++ b/src/libopensc/card-cardos.c @@ -874,7 +874,7 @@ cardos_compute_signature(sc_card_t *card, const u8 *data, size_t datalen, } else { /* check the the algorithmIDs from the AlgorithmInfo */ - int i; + size_t i; for(i=0; idata) - free((*sm_apdu)->data); + free((unsigned char *) (*sm_apdu)->data); if ((*sm_apdu)->resp) free((*sm_apdu)->resp); free(*sm_apdu); diff --git a/src/libopensc/card-flex.c b/src/libopensc/card-flex.c index ae5e11ce..64d9381a 100644 --- a/src/libopensc/card-flex.c +++ b/src/libopensc/card-flex.c @@ -856,9 +856,7 @@ cyberflex_construct_file_attrs(sc_card_t *card, const sc_file_t *file, u8 *buf, size_t *buflen) { u8 *p = buf; - int i; size_t size = file->size; - int ops[6]; /* cyberflex wants input parameters length added */ switch (file->type) { @@ -903,20 +901,6 @@ cyberflex_construct_file_attrs(sc_card_t *card, const sc_file_t *file, return -1; } p[5] = 0x01; /* status?? */ - for (i = 0; i < 6; i++) - ops[i] = -1; - if (file->type == SC_FILE_TYPE_DF) { - ops[0] = SC_AC_OP_LIST_FILES; - ops[2] = SC_AC_OP_DELETE; - ops[3] = SC_AC_OP_CREATE; - } else { - ops[0] = SC_AC_OP_READ; - ops[1] = SC_AC_OP_UPDATE; - ops[2] = SC_AC_OP_READ; - ops[3] = SC_AC_OP_UPDATE; - ops[4] = SC_AC_OP_REHABILITATE; - ops[5] = SC_AC_OP_INVALIDATE; - } p[6] = p[7] = 0; *buflen = 16; diff --git a/src/libopensc/card-jcop.c b/src/libopensc/card-jcop.c index 48602258..d01324c0 100644 --- a/src/libopensc/card-jcop.c +++ b/src/libopensc/card-jcop.c @@ -642,7 +642,7 @@ static int jcop_set_security_env(sc_card_t *card, if (tmp.algorithm_flags & SC_ALGORITHM_RSA_HASH_MD5) tmp.algorithm_ref |= 0x20; - memcpy(env, &tmp, sizeof(struct sc_security_env)); + memcpy((sc_security_env_t *) env, &tmp, sizeof(struct sc_security_env)); } sc_format_apdu(card, &apdu, SC_APDU_CASE_3_SHORT, 0x22, 0xC1, 0); diff --git a/src/libopensc/card-oberthur.c b/src/libopensc/card-oberthur.c index c93bdb79..25e1b7ef 100644 --- a/src/libopensc/card-oberthur.c +++ b/src/libopensc/card-oberthur.c @@ -1758,7 +1758,7 @@ auth_pin_change(struct sc_card *card, unsigned int type, struct sc_pin_cmd_data *data, int *tries_left) { struct sc_card_driver *iso_drv = sc_get_iso7816_driver(); - int rv; + int rv = SC_ERROR_INTERNAL; SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE); @@ -1905,7 +1905,7 @@ auth_pin_reset(struct sc_card *card, unsigned int type, static int auth_pin_cmd(struct sc_card *card, struct sc_pin_cmd_data *data, int *tries_left) { - int rv; + int rv = SC_ERROR_INTERNAL; SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE); if (data->pin_type != SC_AC_CHV) diff --git a/src/libopensc/card-openpgp.c b/src/libopensc/card-openpgp.c index e98f2ea2..6774fe17 100644 --- a/src/libopensc/card-openpgp.c +++ b/src/libopensc/card-openpgp.c @@ -651,7 +651,7 @@ pgp_new_blob(sc_card_t *card, struct blob *parent, unsigned int file_id, /* FIXME sc_format_path expects an hex string of an file * identifier. ushort2bebytes instead delivers a two bytes binary * string */ - sc_format_path(ushort2bebytes(id_str, file_id), &blob->file->path); + sc_format_path((char *) ushort2bebytes(id_str, file_id), &blob->file->path); } /* find matching DO info: set file type depending on it */ @@ -1687,7 +1687,7 @@ pgp_parse_and_set_pubkey_output(sc_card_t *card, u8* data, size_t data_len, LOG_TEST_RET(card->ctx, r, "Cannot store creation time"); /* Parse response. Ref: pgp_enumerate_blob() */ - while (data_len > (in - data)) { + while (data_len > (size_t) (in - data)) { unsigned int cla, tag, tmptag; size_t len; u8 *part = in; diff --git a/src/libopensc/card-piv.c b/src/libopensc/card-piv.c index 4238c0fe..f063c1b0 100644 --- a/src/libopensc/card-piv.c +++ b/src/libopensc/card-piv.c @@ -2012,7 +2012,7 @@ static int piv_compute_signature(sc_card_t *card, piv_private_data_t * priv = PIV_DATA(card); int r; int i; - int nLen; + size_t nLen; u8 rbuf[128]; /* For EC conversions 384 will fit */ size_t rbuflen = sizeof(rbuf); const u8 * body; diff --git a/src/libopensc/pkcs15-data.c b/src/libopensc/pkcs15-data.c index 04a3369e..e70d6684 100644 --- a/src/libopensc/pkcs15-data.c +++ b/src/libopensc/pkcs15-data.c @@ -55,7 +55,7 @@ sc_pkcs15_read_data_object(struct sc_pkcs15_card *p15card, LOG_FUNC_RETURN(ctx, SC_ERROR_INVALID_ARGUMENTS); if (!info->data.value) { - r = sc_pkcs15_read_file(p15card, &info->path, &info->data.value, &info->data.len); + r = sc_pkcs15_read_file(p15card, &info->path, (unsigned char **) &info->data.value, (size_t *) &info->data.len); LOG_TEST_RET(ctx, r, "Cannot get DATA object data"); } diff --git a/src/libopensc/pkcs15-piv.c b/src/libopensc/pkcs15-piv.c index 30f694aa..d082f81b 100644 --- a/src/libopensc/pkcs15-piv.c +++ b/src/libopensc/pkcs15-piv.c @@ -125,8 +125,8 @@ static int piv_get_guid(struct sc_pkcs15_card *p15card, const struct sc_pkcs15_o struct sc_serial_number serialnr; struct sc_pkcs15_id id; unsigned char guid_bin[SC_PKCS15_MAX_ID_SIZE + SC_MAX_SERIALNR]; - size_t bin_size, offs, tlen; - int r, i; + size_t bin_size, offs, tlen, i; + int r; unsigned char fbit, fbits, fbyte, fbyte2, fnibble; unsigned char *f5p, *f8p; @@ -219,7 +219,7 @@ static int piv_get_guid(struct sc_pkcs15_card *p15card, const struct sc_pkcs15_o offs = tlen - bin_size; for (i=0; icard->ctx; int r; - sc_algorithm_info_t *alg_info; + sc_algorithm_info_t *alg_info = NULL; sc_security_env_t senv; const struct sc_pkcs15_prkey_info *prkey = (const struct sc_pkcs15_prkey_info *) obj->data; unsigned long pad_flags = 0, sec_flags = 0; @@ -190,7 +190,7 @@ int sc_pkcs15_derive(struct sc_pkcs15_card *p15card, { sc_context_t *ctx = p15card->card->ctx; int r; - sc_algorithm_info_t *alg_info; + sc_algorithm_info_t *alg_info = NULL; sc_security_env_t senv; const struct sc_pkcs15_prkey_info *prkey = (const struct sc_pkcs15_prkey_info *) obj->data; unsigned long pad_flags = 0, sec_flags = 0; diff --git a/src/libopensc/pkcs15.c b/src/libopensc/pkcs15.c index 4bcd5d24..f296c94f 100644 --- a/src/libopensc/pkcs15.c +++ b/src/libopensc/pkcs15.c @@ -38,6 +38,10 @@ #include #endif +#ifdef HAVE_SYS_TIME_H +#include +#endif + static const struct sc_asn1_entry c_asn1_twlabel[] = { { "twlabel", SC_ASN1_UTF8STRING, SC_ASN1_TAG_UTF8STRING, 0, NULL, NULL }, { NULL, 0, 0, 0, NULL, NULL } @@ -1261,7 +1265,6 @@ __sc_pkcs15_search_objects(struct sc_pkcs15_card *p15card, unsigned int class_ma struct sc_pkcs15_df *df = NULL; unsigned int df_mask = 0; size_t match_count = 0; - int r = 0; if (type) class_mask |= SC_PKCS15_TYPE_TO_CLASS(type); @@ -1300,7 +1303,8 @@ __sc_pkcs15_search_objects(struct sc_pkcs15_card *p15card, unsigned int class_ma continue; /* Enumerate the DF's, so p15card->obj_list is * populated. */ - r = sc_pkcs15_parse_df(p15card, df); + /* FIXME dont ignore errors */ + sc_pkcs15_parse_df(p15card, df); } /* And now loop over all objects */ @@ -2533,7 +2537,6 @@ sc_pkcs15_get_supported_algo(struct sc_pkcs15_card *p15card, unsigned operation, return info; } - int sc_pkcs15_get_generalized_time(struct sc_context *ctx, char **out) { diff --git a/src/pkcs11/framework-pkcs15.c b/src/pkcs11/framework-pkcs15.c index e2d97ca4..a16c07f9 100644 --- a/src/pkcs11/framework-pkcs15.c +++ b/src/pkcs11/framework-pkcs15.c @@ -1939,7 +1939,6 @@ pkcs15_create_private_key(struct sc_pkcs11_slot *slot, struct sc_profile *profil struct sc_pkcs15_auth_info *pin = NULL; CK_KEY_TYPE key_type; struct sc_pkcs15_prkey_rsa *rsa = NULL; - struct sc_pkcs15_prkey_ec *ec = NULL; struct sc_pkcs15_prkey_gostr3410 *gost = NULL; int rc, rv; char label[SC_PKCS15_MAX_LABEL_SIZE]; @@ -1969,7 +1968,6 @@ pkcs15_create_private_key(struct sc_pkcs11_slot *slot, struct sc_profile *profil break; case CKK_EC: args.key.algorithm = SC_ALGORITHM_EC; - ec = &args.key.u.ec; /* TODO: -DEE Do not have PKCS15 card with EC to test this */ /* fall through */ default: diff --git a/src/pkcs11/pkcs11-session.c b/src/pkcs11/pkcs11-session.c index 0782bec1..e6edf25c 100644 --- a/src/pkcs11/pkcs11-session.c +++ b/src/pkcs11/pkcs11-session.c @@ -333,7 +333,7 @@ CK_RV C_InitPIN(CK_SESSION_HANDLE hSession, CK_CHAR_PTR pPin, CK_ULONG ulPinLen) struct sc_pkcs11_session *session; struct sc_pkcs11_slot *slot; - sc_log(context, "C_InitPIN() called, pin '%s'", pPin ? pPin : ""); + sc_log(context, "C_InitPIN() called, pin '%s'", pPin ? (char *) pPin : ""); if (pPin == NULL_PTR && ulPinLen > 0) return CKR_ARGUMENTS_BAD; diff --git a/src/pkcs11/slot.c b/src/pkcs11/slot.c index d37d615e..87b1e3dd 100644 --- a/src/pkcs11/slot.c +++ b/src/pkcs11/slot.c @@ -185,7 +185,8 @@ CK_RV card_detect(sc_reader_t *reader) struct sc_pkcs11_card *p11card = NULL; int rc; CK_RV rv; - unsigned int i, j; + unsigned int i; + int j; rv = CKR_OK; diff --git a/src/pkcs15init/pkcs15-cardos.c b/src/pkcs15init/pkcs15-cardos.c index 4576d700..a4e24528 100644 --- a/src/pkcs15init/pkcs15-cardos.c +++ b/src/pkcs15init/pkcs15-cardos.c @@ -172,10 +172,11 @@ cardos_select_pin_reference(sc_profile_t *profile, sc_pkcs15_card_t *p15card, preferred++; } - if (current > preferred || preferred > CARDOS_PIN_ID_MAX) + if (preferred > CARDOS_PIN_ID_MAX) return SC_ERROR_TOO_MANY_OBJECTS; auth_info->attrs.pin.reference = preferred; - return 0; + + return SC_SUCCESS; } /* diff --git a/src/pkcs15init/pkcs15-iasecc.c b/src/pkcs15init/pkcs15-iasecc.c index 534046f8..7df8103e 100644 --- a/src/pkcs15init/pkcs15-iasecc.c +++ b/src/pkcs15init/pkcs15-iasecc.c @@ -327,7 +327,7 @@ iasecc_file_convert_acls(struct sc_context *ctx, struct sc_profile *profile, str /* FIXME the acl object must not be modified, it is only defined in * sc_file_get_acl_entry. Accessing it here means we have a race * condition. */ - struct sc_acl_entry *acl = sc_file_get_acl_entry(file, ii); + struct sc_acl_entry *acl = (struct sc_acl_entry *) sc_file_get_acl_entry(file, ii); if (acl) { switch (acl->method) { diff --git a/src/pkcs15init/pkcs15-incrypto34.c b/src/pkcs15init/pkcs15-incrypto34.c index baafc2ec..f1715995 100644 --- a/src/pkcs15init/pkcs15-incrypto34.c +++ b/src/pkcs15init/pkcs15-incrypto34.c @@ -191,10 +191,11 @@ incrypto34_select_pin_reference(sc_profile_t *profile, sc_pkcs15_card_t *p15card preferred++; } - if (current > preferred || preferred > INCRYPTO34_PIN_ID_MAX) + if (preferred > INCRYPTO34_PIN_ID_MAX) return SC_ERROR_TOO_MANY_OBJECTS; auth_info->attrs.pin.reference = preferred; - return 0; + + return SC_SUCCESS; } /* diff --git a/src/pkcs15init/pkcs15-lib.c b/src/pkcs15init/pkcs15-lib.c index 440a9c37..be21bb12 100644 --- a/src/pkcs15init/pkcs15-lib.c +++ b/src/pkcs15init/pkcs15-lib.c @@ -114,8 +114,6 @@ static int check_key_compatibility(struct sc_pkcs15_card *, static int prkey_fixup(struct sc_pkcs15_card *, struct sc_pkcs15_prkey *); static int prkey_bits(struct sc_pkcs15_card *, struct sc_pkcs15_prkey *); static int prkey_pkcs15_algo(struct sc_pkcs15_card *, struct sc_pkcs15_prkey *); -static int select_intrinsic_id(struct sc_pkcs15_card *, struct sc_profile *, - int, struct sc_pkcs15_id *, void *); static int select_id(struct sc_pkcs15_card *, int, struct sc_pkcs15_id *); static int select_object_path(struct sc_pkcs15_card *, struct sc_profile *, struct sc_pkcs15_object *, struct sc_path *); @@ -1481,7 +1479,7 @@ sc_pkcs15init_store_public_key(struct sc_pkcs15_card *p15card, struct sc_profile struct sc_pkcs15_pubkey key; struct sc_path *path; const char *label; - unsigned int keybits, type, usage; + unsigned int keybits, type = 0, usage; int r; LOG_FUNC_CALLED(ctx); diff --git a/src/pkcs15init/pkcs15-oberthur-awp.c b/src/pkcs15init/pkcs15-oberthur-awp.c index 39abef05..18032fba 100644 --- a/src/pkcs15init/pkcs15-oberthur-awp.c +++ b/src/pkcs15init/pkcs15-oberthur-awp.c @@ -1565,7 +1565,7 @@ awp_update_df_create(struct sc_pkcs15_card *p15card, struct sc_profile *profile, struct sc_pkcs15_object *object) { struct sc_context *ctx = p15card->card->ctx; - int rv; + int rv = SC_ERROR_INTERNAL; SC_FUNC_CALLED(ctx, SC_LOG_DEBUG_NORMAL); if (!object) @@ -1891,7 +1891,7 @@ awp_update_df_delete(struct sc_pkcs15_card *p15card, struct sc_profile *profile, struct sc_pkcs15_object *object) { struct sc_context *ctx = p15card->card->ctx; - int rv; + int rv = SC_ERROR_INTERNAL; SC_FUNC_CALLED(ctx, SC_LOG_DEBUG_NORMAL); if (!object) diff --git a/src/smm/sm-cwa14890.c b/src/smm/sm-cwa14890.c index ea0ff8fa..df8bfee1 100644 --- a/src/smm/sm-cwa14890.c +++ b/src/smm/sm-cwa14890.c @@ -312,8 +312,8 @@ sm_cwa_securize_apdu(struct sc_context *ctx, struct sm_info *sm_info, struct sc_ unsigned char sbuf[0x400]; DES_cblock cblock, icv; unsigned char *encrypted = NULL, edfb_data[0x200], mac_data[0x200]; - size_t encrypted_len, edfb_len = 0, mac_len = 0; - int rv, offs; + size_t encrypted_len, edfb_len = 0, mac_len = 0, offs; + int rv; LOG_FUNC_CALLED(ctx); sc_log(ctx, "securize APDU (cla:%X,ins:%X,p1:%X,p2:%X,data(%i):%p)", diff --git a/src/tools/netkey-tool.c b/src/tools/netkey-tool.c index 7bc4153c..e03db690 100644 --- a/src/tools/netkey-tool.c +++ b/src/tools/netkey-tool.c @@ -41,9 +41,9 @@ static struct { {"DF01C100", 1, "Telesec Authentifizierungs Zertifikat"}, {"DF014371", 0, "User Authentifizierungs Zertifikat1"}, {"DF014372", 0, "User Authentifizierungs Zertifikat2"}, - {"DF01C200", 1, "Telesec Verschlüsselungs Zertifikat"}, - {"DF0143B1", 0, "User Verschlüsselungs Zertifikat1"}, - {"DF0143B2", 0, "User Verschlüsselungs Zertifikat2"}, + {"DF01C200", 1, "Telesec Verschluesselungs Zertifikat"}, + {"DF0143B1", 0, "User Verschluesselungs Zertifikat1"}, + {"DF0143B2", 0, "User Verschluesselungs Zertifikat2"}, }; static struct { diff --git a/src/tools/openpgp-tool.c b/src/tools/openpgp-tool.c index a5dcc8a4..31b46812 100644 --- a/src/tools/openpgp-tool.c +++ b/src/tools/openpgp-tool.c @@ -298,6 +298,7 @@ static int decode_options(int argc, char **argv) static int do_userinfo(sc_card_t *card) { int i; + /* FIXME there are no length checks on buf. */ unsigned char buf[2048]; for (i = 0; openpgp_data[i].ef != NULL; i++) { @@ -339,7 +340,7 @@ static int do_userinfo(sc_card_t *card) buf[file->size] = '\0'; if (file->size > 0) { - display_data(openpgp_data + i, buf); + display_data(openpgp_data + i, (char *) buf); } } @@ -402,7 +403,7 @@ int do_verify(sc_card_t *card, char *type, char *pin) data.cmd = SC_PIN_CMD_VERIFY; data.pin_type = SC_AC_CHV; data.pin_reference = type[3] - '0'; - data.pin1.data = pin; + data.pin1.data = (unsigned char *) pin; data.pin1.len = strlen(pin); r = sc_pin_cmd(card, &data, &tries_left); return r; diff --git a/src/tools/pkcs11-tool.c b/src/tools/pkcs11-tool.c index 43ffe316..8744c580 100644 --- a/src/tools/pkcs11-tool.c +++ b/src/tools/pkcs11-tool.c @@ -4154,7 +4154,7 @@ static void test_kpgen_certwrite(CK_SLOT_ID slot, CK_SESSION_HANDLE session) CK_OBJECT_HANDLE pub_key, priv_key; CK_ULONG i, num_mechs = 0; CK_RV rv; - CK_BYTE buf[20], *tmp, *mod; + CK_BYTE buf[20], *tmp; CK_BYTE md5_and_digestinfo[34] = "\x30\x20\x30\x0c\x06\x08\x2a\x86\x48\x86\xf7\x0d\x02\x05\x05\x00\x04\x10"; CK_BYTE *data, sig[512]; CK_ULONG data_len, sig_len; @@ -4203,7 +4203,7 @@ static void test_kpgen_certwrite(CK_SLOT_ID slot, CK_SESSION_HANDLE session) memcpy(opt_object_id, tmp, opt_object_id_len); /* This is done in NSS */ - mod = getMODULUS(session, priv_key, &mod_len); + getMODULUS(session, priv_key, &mod_len); if (mod_len < 5 || mod_len > 10000) { /* should be resonable limits */ printf("ERR: GetAttribute(privkey, CKA_MODULUS) doesn't seem to work\n"); return; @@ -4321,7 +4321,7 @@ static void test_ec(CK_SLOT_ID slot, CK_SESSION_HANDLE session) CK_OBJECT_HANDLE pub_key, priv_key; CK_ULONG i, num_mechs = 0; CK_RV rv; - CK_BYTE *tmp, *ec_params, *ec_point; + CK_BYTE *tmp; CK_BYTE *data_to_sign = (CK_BYTE *)"My Heart's in the Highland"; CK_BYTE *data, sig[512]; CK_ULONG data_len, sig_len; @@ -4358,12 +4358,12 @@ static void test_ec(CK_SLOT_ID slot, CK_SESSION_HANDLE session) memcpy(opt_object_id, tmp, opt_object_id_len); /* This is done in NSS */ - ec_params = getEC_PARAMS(session, priv_key, &ec_params_len); + getEC_PARAMS(session, priv_key, &ec_params_len); if (ec_params_len < 5 || ec_params_len > 10000) { printf("ERR: GetAttribute(privkey, CKA_EC_PARAMS) doesn't seem to work\n"); return; } - ec_point = getEC_POINT(session, pub_key, &ec_point_len); + getEC_POINT(session, pub_key, &ec_point_len); if (ec_point_len < 5 || ec_point_len > 10000) { printf("ERR: GetAttribute(pubkey, CKA_EC_POINT) doesn't seem to work\n"); return; diff --git a/src/tools/pkcs15-tool.c b/src/tools/pkcs15-tool.c index 2424335b..8aced169 100644 --- a/src/tools/pkcs15-tool.c +++ b/src/tools/pkcs15-tool.c @@ -1822,6 +1822,8 @@ int main(int argc, char * const argv[]) int action_count = 0; sc_context_param_t ctx_param; + c = OPT_PUK; + while (1) { c = getopt_long(argc, argv, "r:cuko:va:LR:CwDTU", options, &long_optind); if (c == -1)