Browse Source

Remove redundant casts to same type

ppa-0.6.1
practicalswift 7 years ago
committed by Christian Decker
parent
commit
3dbace3421
  1. 2
      gossipd/routing.c
  2. 4
      lightningd/bitcoind.c
  3. 2
      lightningd/chaintopology.c
  4. 6
      lightningd/dev_ping.c
  5. 4
      lightningd/gossip_control.c
  6. 6
      lightningd/jsonrpc.c
  7. 8
      lightningd/pay.c
  8. 6
      lightningd/payalgo.c

2
gossipd/routing.c

@ -815,7 +815,7 @@ bool handle_pending_cannouncement(struct routing_state *rstate,
if (replace_broadcast(rstate->broadcasts,
&chan->msg_indexes[MSG_INDEX_CANNOUNCE],
WIRE_CHANNEL_ANNOUNCEMENT,
(u8*)tag, pending->announce))
tag, pending->announce))
status_failed(STATUS_FAIL_INTERNAL_ERROR,
"Announcement %s was replaced?",
tal_hex(trc, pending->announce));

4
lightningd/bitcoind.c

@ -358,7 +358,7 @@ static void process_sendrawtx(struct bitcoin_cli *bcli)
{
void (*cb)(struct bitcoind *bitcoind,
int, const char *msg, void *) = bcli->cb;
const char *msg = tal_strndup(bcli, (char *)bcli->output,
const char *msg = tal_strndup(bcli, bcli->output,
bcli->output_bytes);
log_debug(bcli->bitcoind->log, "sendrawtx exit %u, gave %s",
@ -390,7 +390,7 @@ static void process_rawblock(struct bitcoin_cli *bcli)
if (!blk)
fatal("%s: bad block '%.*s'?",
bcli_args(bcli),
(int)bcli->output_bytes, (char *)bcli->output);
(int)bcli->output_bytes, bcli->output);
cb(bcli->bitcoind, blk, bcli->cb_arg);
}

2
lightningd/chaintopology.c

@ -631,7 +631,7 @@ static void json_dev_setfees(struct command *cmd,
if (!json_tok_number(buffer, ratetok[i],
&topo->override_fee_rate[i])) {
command_fail(cmd, "Invalid feerate %.*s",
(int)(ratetok[i]->end - ratetok[i]->start),
ratetok[i]->end - ratetok[i]->start,
buffer + ratetok[i]->start);
return;
}

6
lightningd/dev_ping.c

@ -57,21 +57,21 @@ static void json_dev_ping(struct command *cmd,
* ready to forward! */
if (!json_tok_number(buffer, lentok, &len)) {
command_fail(cmd, "'%.*s' is not a valid number",
(int)(lentok->end - lentok->start),
lentok->end - lentok->start,
buffer + lentok->start);
return;
}
if (!json_tok_number(buffer, pongbytestok, &pongbytes)) {
command_fail(cmd, "'%.*s' is not a valid number",
(int)(pongbytestok->end - pongbytestok->start),
pongbytestok->end - pongbytestok->start,
buffer + pongbytestok->start);
return;
}
if (!json_tok_pubkey(buffer, idtok, &id)) {
command_fail(cmd, "'%.*s' is not a valid pubkey",
(int)(idtok->end - idtok->start),
idtok->end - idtok->start,
buffer + idtok->start);
return;
}

4
lightningd/gossip_control.c

@ -325,14 +325,14 @@ static void json_getroute(struct command *cmd, const char *buffer, const jsmntok
if (!json_tok_u64(buffer, msatoshitok, &msatoshi)) {
command_fail(cmd, "'%.*s' is not a valid number",
(int)(msatoshitok->end - msatoshitok->start),
msatoshitok->end - msatoshitok->start,
buffer + msatoshitok->start);
return;
}
if (!json_tok_double(buffer, riskfactortok, &riskfactor)) {
command_fail(cmd, "'%.*s' is not a valid double",
(int)(riskfactortok->end - riskfactortok->start),
riskfactortok->end - riskfactortok->start,
buffer + riskfactortok->start);
return;
}

6
lightningd/jsonrpc.c

@ -102,7 +102,7 @@ static void json_rhash(struct command *cmd,
secrettok->end - secrettok->start,
&secret, sizeof(secret))) {
command_fail(cmd, "'%.*s' is not a valid 32-byte hex value",
(int)(secrettok->end - secrettok->start),
secrettok->end - secrettok->start,
buffer + secrettok->start);
return;
}
@ -511,7 +511,7 @@ static void parse_request(struct json_connection *jcon, const jsmntok_t tok[])
command_fail_detailed(c,
JSONRPC2_METHOD_NOT_FOUND, NULL,
"Unknown command '%.*s'",
(int)(method->end - method->start),
method->end - method->start,
jcon->buffer + method->start);
return;
}
@ -519,7 +519,7 @@ static void parse_request(struct json_connection *jcon, const jsmntok_t tok[])
command_fail_detailed(c,
JSONRPC2_METHOD_NOT_FOUND, NULL,
"Command '%.*s' is deprecated",
(int)(method->end - method->start),
method->end - method->start,
jcon->buffer + method->start);
return;
}

8
lightningd/pay.c

@ -733,14 +733,14 @@ static void json_sendpay(struct command *cmd,
rhashtok->end - rhashtok->start,
&rhash, sizeof(rhash))) {
command_fail(cmd, "'%.*s' is not a valid sha256 hash",
(int)(rhashtok->end - rhashtok->start),
rhashtok->end - rhashtok->start,
buffer + rhashtok->start);
return;
}
if (routetok->type != JSMN_ARRAY) {
command_fail(cmd, "'%.*s' is not an array",
(int)(routetok->end - routetok->start),
routetok->end - routetok->start,
buffer + routetok->start);
return;
}
@ -755,7 +755,7 @@ static void json_sendpay(struct command *cmd,
if (t->type != JSMN_OBJECT) {
command_fail(cmd, "Route %zu '%.*s' is not an object",
n_hops,
(int)(t->end - t->start),
t->end - t->start,
buffer + t->start);
return;
}
@ -851,7 +851,7 @@ static void json_listpayments(struct command *cmd, const char *buffer,
rhashtok->end - rhashtok->start,
rhash, sizeof(*rhash))) {
command_fail(cmd, "'%.*s' is not a valid sha256 hash",
(int)(rhashtok->end - rhashtok->start),
rhashtok->end - rhashtok->start,
buffer + rhashtok->start);
return;
}

6
lightningd/payalgo.c

@ -286,7 +286,7 @@ static void json_pay(struct command *cmd,
if (!json_tok_u64(buffer, msatoshitok, &msatoshi)) {
command_fail(cmd,
"msatoshi '%.*s' is not a valid number",
(int)(msatoshitok->end-msatoshitok->start),
msatoshitok->end-msatoshitok->start,
buffer + msatoshitok->start);
return;
}
@ -296,7 +296,7 @@ static void json_pay(struct command *cmd,
if (riskfactortok
&& !json_tok_double(buffer, riskfactortok, &riskfactor)) {
command_fail(cmd, "'%.*s' is not a valid double",
(int)(riskfactortok->end - riskfactortok->start),
riskfactortok->end - riskfactortok->start,
buffer + riskfactortok->start);
return;
}
@ -305,7 +305,7 @@ static void json_pay(struct command *cmd,
if (maxfeetok
&& !json_tok_double(buffer, maxfeetok, &maxfeepercent)) {
command_fail(cmd, "'%.*s' is not a valid double",
(int)(maxfeetok->end - maxfeetok->start),
maxfeetok->end - maxfeetok->start,
buffer + maxfeetok->start);
return;
}

Loading…
Cancel
Save