mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Fix clang-tidy readability-isolate-declaration warnings
I missed one of these in review so a machine is probably better at catching them. I fixed the existing instances which where largely in code which look dated. Where possible I slightly reorganized the code so we do not have to leave values uninitialized, but did not touch up anything else.
This commit is contained in:
parent
c725311d07
commit
627c3ad726
32 changed files with 142 additions and 81 deletions
|
@ -217,17 +217,19 @@ String* decode_base64(const String* s, const String* a, Connection* conn) {
|
|||
}
|
||||
|
||||
int buf_len = int((s->Len() + 3) / 4) * 3 + 1;
|
||||
int rlen2, rlen = buf_len;
|
||||
char *rbuf2, *rbuf = new char[rlen];
|
||||
int rlen = buf_len;
|
||||
char* rbuf = new char[rlen];
|
||||
|
||||
Base64Converter dec(conn, a ? a->CheckString() : "");
|
||||
dec.Decode(s->Len(), (const char*)s->Bytes(), &rlen, &rbuf);
|
||||
|
||||
if ( dec.Errored() )
|
||||
goto err;
|
||||
if ( dec.Errored() ) {
|
||||
delete[] rbuf;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
rlen2 = buf_len - rlen;
|
||||
rbuf2 = rbuf + rlen;
|
||||
int rlen2 = buf_len - rlen;
|
||||
char* rbuf2 = rbuf + rlen;
|
||||
// Done() returns -1 if there isn't enough padding, but we just ignore
|
||||
// it.
|
||||
dec.Done(&rlen2, &rbuf2);
|
||||
|
@ -235,10 +237,6 @@ String* decode_base64(const String* s, const String* a, Connection* conn) {
|
|||
|
||||
rbuf[rlen] = '\0';
|
||||
return new String(true, (u_char*)rbuf, rlen);
|
||||
|
||||
err:
|
||||
delete[] rbuf;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
String* encode_base64(const String* s, const String* a, Connection* conn) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue