Skip to content

Commit f530a36

Browse files
bnoordhuisMyles Borins
authored and
Myles Borins
committed
src: fix runtime/int cpplint warnings
PR-URL: #7462 Reviewed-By: Trevor Norris <[email protected]>
1 parent d6595ad commit f530a36

File tree

4 files changed

+27
-22
lines changed

4 files changed

+27
-22
lines changed

src/node_crypto.cc

+21-18
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ static int CryptoPemCallback(char *buf, int size, int rwflag, void *u) {
208208

209209

210210
void ThrowCryptoError(Environment* env,
211-
unsigned long err,
211+
unsigned long err, // NOLINT(runtime/int)
212212
const char* default_message = nullptr) {
213213
HandleScope scope(env->isolate());
214214
if (err != 0 || default_message == nullptr) {
@@ -467,7 +467,7 @@ void SecureContext::SetKey(const FunctionCallbackInfo<Value>& args) {
467467

468468
if (!key) {
469469
BIO_free_all(bio);
470-
unsigned long err = ERR_get_error();
470+
unsigned long err = ERR_get_error(); // NOLINT(runtime/int)
471471
if (!err) {
472472
return env->ThrowError("PEM_read_bio_PrivateKey");
473473
}
@@ -479,7 +479,7 @@ void SecureContext::SetKey(const FunctionCallbackInfo<Value>& args) {
479479
BIO_free_all(bio);
480480

481481
if (!rv) {
482-
unsigned long err = ERR_get_error();
482+
unsigned long err = ERR_get_error(); // NOLINT(runtime/int)
483483
if (!err)
484484
return env->ThrowError("SSL_CTX_use_PrivateKey");
485485
return ThrowCryptoError(env, err);
@@ -597,7 +597,7 @@ int SSL_CTX_use_certificate_chain(SSL_CTX* ctx,
597597

598598
X509* extra = nullptr;
599599
int ret = 0;
600-
unsigned long err = 0;
600+
unsigned long err = 0; // NOLINT(runtime/int)
601601

602602
// Read extra certs
603603
STACK_OF(X509)* extra_certs = sk_X509_new_null();
@@ -672,7 +672,7 @@ void SecureContext::SetCert(const FunctionCallbackInfo<Value>& args) {
672672
BIO_free_all(bio);
673673

674674
if (!rv) {
675-
unsigned long err = ERR_get_error();
675+
unsigned long err = ERR_get_error(); // NOLINT(runtime/int)
676676
if (!err) {
677677
return env->ThrowError("SSL_CTX_use_certificate_chain");
678678
}
@@ -866,7 +866,9 @@ void SecureContext::SetOptions(const FunctionCallbackInfo<Value>& args) {
866866
return sc->env()->ThrowTypeError("Bad parameter");
867867
}
868868

869-
SSL_CTX_set_options(sc->ctx_, static_cast<long>(args[0]->IntegerValue()));
869+
SSL_CTX_set_options(
870+
sc->ctx_,
871+
static_cast<long>(args[0]->IntegerValue())); // NOLINT(runtime/int)
870872
}
871873

872874

@@ -1001,7 +1003,7 @@ void SecureContext::LoadPKCS12(const FunctionCallbackInfo<Value>& args) {
10011003
delete[] pass;
10021004

10031005
if (!ret) {
1004-
unsigned long err = ERR_get_error();
1006+
unsigned long err = ERR_get_error(); // NOLINT(runtime/int)
10051007
const char* str = ERR_reason_error_string(err);
10061008
return env->ThrowError(str);
10071009
}
@@ -1427,7 +1429,7 @@ static Local<Object> X509ToObject(Environment* env, X509* cert) {
14271429
String::kNormalString, mem->length));
14281430
(void) BIO_reset(bio);
14291431

1430-
unsigned long exponent_word = BN_get_word(rsa->e);
1432+
BN_ULONG exponent_word = BN_get_word(rsa->e);
14311433
BIO_printf(bio, "0x%lx", exponent_word);
14321434

14331435
BIO_get_mem_ptr(bio, &mem);
@@ -1834,7 +1836,8 @@ void SSLWrap<Base>::VerifyError(const FunctionCallbackInfo<Value>& args) {
18341836
// XXX(bnoordhuis) The UNABLE_TO_GET_ISSUER_CERT error when there is no
18351837
// peer certificate is questionable but it's compatible with what was
18361838
// here before.
1837-
long x509_verify_error = X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT;
1839+
long x509_verify_error = // NOLINT(runtime/int)
1840+
X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT;
18381841
if (X509* peer_cert = SSL_get_peer_certificate(w->ssl_)) {
18391842
X509_free(peer_cert);
18401843
x509_verify_error = SSL_get_verify_result(w->ssl_);
@@ -2171,7 +2174,7 @@ void SSLWrap<Base>::CertCbDone(const FunctionCallbackInfo<Value>& args) {
21712174
if (rv)
21722175
rv = w->SetCACerts(sc);
21732176
if (!rv) {
2174-
unsigned long err = ERR_get_error();
2177+
unsigned long err = ERR_get_error(); // NOLINT(runtime/int)
21752178
if (!err)
21762179
return env->ThrowError("CertCbDone");
21772180
return ThrowCryptoError(env, err);
@@ -2605,7 +2608,7 @@ void Connection::New(const FunctionCallbackInfo<Value>& args) {
26052608
SSL_set_bio(conn->ssl_, conn->bio_read_, conn->bio_write_);
26062609

26072610
#ifdef SSL_MODE_RELEASE_BUFFERS
2608-
long mode = SSL_get_mode(conn->ssl_);
2611+
long mode = SSL_get_mode(conn->ssl_); // NOLINT(runtime/int)
26092612
SSL_set_mode(conn->ssl_, mode | SSL_MODE_RELEASE_BUFFERS);
26102613
#endif
26112614

@@ -3551,7 +3554,7 @@ void SignBase::CheckThrow(SignBase::Error error) {
35513554
case kSignPrivateKey:
35523555
case kSignPublicKey:
35533556
{
3554-
unsigned long err = ERR_get_error();
3557+
unsigned long err = ERR_get_error(); // NOLINT(runtime/int)
35553558
if (err)
35563559
return ThrowCryptoError(env(), err);
35573560
switch (error) {
@@ -5049,11 +5052,11 @@ class RandomBytesRequest : public AsyncWrap {
50495052
size_ = 0;
50505053
}
50515054

5052-
inline unsigned long error() const {
5055+
inline unsigned long error() const { // NOLINT(runtime/int)
50535056
return error_;
50545057
}
50555058

5056-
inline void set_error(unsigned long err) {
5059+
inline void set_error(unsigned long err) { // NOLINT(runtime/int)
50575060
error_ = err;
50585061
}
50595062

@@ -5062,7 +5065,7 @@ class RandomBytesRequest : public AsyncWrap {
50625065
uv_work_t work_req_;
50635066

50645067
private:
5065-
unsigned long error_;
5068+
unsigned long error_; // NOLINT(runtime/int)
50665069
size_t size_;
50675070
char* data_;
50685071
};
@@ -5080,9 +5083,9 @@ void RandomBytesWork(uv_work_t* work_req) {
50805083

50815084
// RAND_bytes() returns 0 on error.
50825085
if (r == 0) {
5083-
req->set_error(ERR_get_error());
5086+
req->set_error(ERR_get_error()); // NOLINT(runtime/int)
50845087
} else if (r == -1) {
5085-
req->set_error(static_cast<unsigned long>(-1));
5088+
req->set_error(static_cast<unsigned long>(-1)); // NOLINT(runtime/int)
50865089
}
50875090
}
50885091

@@ -5092,7 +5095,7 @@ void RandomBytesCheck(RandomBytesRequest* req, Local<Value> argv[2]) {
50925095
if (req->error()) {
50935096
char errmsg[256] = "Operation not supported";
50945097

5095-
if (req->error() != static_cast<unsigned long>(-1))
5098+
if (req->error() != static_cast<unsigned long>(-1)) // NOLINT(runtime/int)
50965099
ERR_error_string_n(req->error(), errmsg, sizeof errmsg);
50975100

50985101
argv[0] = Exception::Error(OneByteString(req->env()->isolate(), errmsg));

src/node_crypto_bio.cc

+3-2
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,10 @@ int NodeBIO::Gets(BIO* bio, char* out, int size) {
164164
}
165165

166166

167-
long NodeBIO::Ctrl(BIO* bio, int cmd, long num, void* ptr) {
167+
long NodeBIO::Ctrl(BIO* bio, int cmd, long num, // NOLINT(runtime/int)
168+
void* ptr) {
168169
NodeBIO* nbio;
169-
long ret;
170+
long ret; // NOLINT(runtime/int)
170171

171172
nbio = FromBIO(bio);
172173
ret = 1;

src/node_crypto_bio.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ class NodeBIO {
8989
static int Write(BIO* bio, const char* data, int len);
9090
static int Puts(BIO* bio, const char* str);
9191
static int Gets(BIO* bio, char* out, int size);
92-
static long Ctrl(BIO* bio, int cmd, long num, void* ptr);
92+
static long Ctrl(BIO* bio, int cmd, long num, // NOLINT(runtime/int)
93+
void* ptr);
9394

9495
// Enough to handle the most of the client hellos
9596
static const size_t kInitialBufferLength = 1024;

src/tls_wrap.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ void TLSWrap::InitSSL() {
126126
SSL_set_verify(ssl_, SSL_VERIFY_NONE, crypto::VerifyCallback);
127127

128128
#ifdef SSL_MODE_RELEASE_BUFFERS
129-
long mode = SSL_get_mode(ssl_);
129+
long mode = SSL_get_mode(ssl_); // NOLINT(runtime/int)
130130
SSL_set_mode(ssl_, mode | SSL_MODE_RELEASE_BUFFERS);
131131
#endif // SSL_MODE_RELEASE_BUFFERS
132132

0 commit comments

Comments
 (0)