Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

Commit 1122e3a

Browse files
committed
crypto: Style. Prefer 'char*' over 'char *'
1 parent f2fa97f commit 1122e3a

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

src/node_crypto.cc

+29-29
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ static BIO* LoadBIO (Handle<Value> v) {
286286
String::Utf8Value s(v);
287287
r = BIO_write(bio, *s, s.length());
288288
} else if (Buffer::HasInstance(v)) {
289-
char *buffer_data = Buffer::Data(v);
289+
char* buffer_data = Buffer::Data(v);
290290
size_t buffer_length = Buffer::Length(v);
291291
r = BIO_write(bio, buffer_data, buffer_length);
292292
}
@@ -700,7 +700,7 @@ Handle<Value> SecureContext::LoadPKCS12(const Arguments& args) {
700700

701701
if (!ret) {
702702
unsigned long err = ERR_get_error();
703-
const char *str = ERR_reason_error_string(err);
703+
const char* str = ERR_reason_error_string(err);
704704
return ThrowException(Exception::Error(String::New(str)));
705705
}
706706

@@ -1047,7 +1047,7 @@ static int VerifyCallback(int preverify_ok, X509_STORE_CTX *ctx) {
10471047
#ifdef OPENSSL_NPN_NEGOTIATED
10481048

10491049
int Connection::AdvertiseNextProtoCallback_(SSL *s,
1050-
const unsigned char **data,
1050+
const unsigned char** data,
10511051
unsigned int *len,
10521052
void *arg) {
10531053

@@ -1066,7 +1066,7 @@ int Connection::AdvertiseNextProtoCallback_(SSL *s,
10661066
}
10671067

10681068
int Connection::SelectNextProtoCallback_(SSL *s,
1069-
unsigned char **out, unsigned char *outlen,
1069+
unsigned char** out, unsigned char* outlen,
10701070
const unsigned char* in,
10711071
unsigned int inlen, void *arg) {
10721072
Connection *p = static_cast<Connection*> SSL_get_app_data(s);
@@ -1282,7 +1282,7 @@ Handle<Value> Connection::EncIn(const Arguments& args) {
12821282
String::New("Second argument should be a buffer")));
12831283
}
12841284

1285-
char *buffer_data = Buffer::Data(args[0]);
1285+
char* buffer_data = Buffer::Data(args[0]);
12861286
size_t buffer_length = Buffer::Length(args[0]);
12871287

12881288
size_t off = args[1]->Int32Value();
@@ -1328,7 +1328,7 @@ Handle<Value> Connection::ClearOut(const Arguments& args) {
13281328
String::New("Second argument should be a buffer")));
13291329
}
13301330

1331-
char *buffer_data = Buffer::Data(args[0]);
1331+
char* buffer_data = Buffer::Data(args[0]);
13321332
size_t buffer_length = Buffer::Length(args[0]);
13331333

13341334
size_t off = args[1]->Int32Value();
@@ -1400,7 +1400,7 @@ Handle<Value> Connection::EncOut(const Arguments& args) {
14001400
String::New("Second argument should be a buffer")));
14011401
}
14021402

1403-
char *buffer_data = Buffer::Data(args[0]);
1403+
char* buffer_data = Buffer::Data(args[0]);
14041404
size_t buffer_length = Buffer::Length(args[0]);
14051405

14061406
size_t off = args[1]->Int32Value();
@@ -1439,7 +1439,7 @@ Handle<Value> Connection::ClearIn(const Arguments& args) {
14391439
String::New("Second argument should be a buffer")));
14401440
}
14411441

1442-
char *buffer_data = Buffer::Data(args[0]);
1442+
char* buffer_data = Buffer::Data(args[0]);
14431443
size_t buffer_length = Buffer::Length(args[0]);
14441444

14451445
size_t off = args[1]->Int32Value();
@@ -1905,9 +1905,9 @@ Handle<Value> Connection::GetCurrentCipher(const Arguments& args) {
19051905
c = SSL_get_current_cipher(ss->ssl_);
19061906
if ( c == NULL ) return Undefined();
19071907
Local<Object> info = Object::New();
1908-
const char *cipher_name = SSL_CIPHER_get_name(c);
1908+
const char* cipher_name = SSL_CIPHER_get_name(c);
19091909
info->Set(name_symbol, String::New(cipher_name));
1910-
const char *cipher_version = SSL_CIPHER_get_version(c);
1910+
const char* cipher_version = SSL_CIPHER_get_version(c);
19111911
info->Set(version_symbol, String::New(cipher_version));
19121912
return scope.Close(info);
19131913
}
@@ -1931,7 +1931,7 @@ Handle<Value> Connection::GetNegotiatedProto(const Arguments& args) {
19311931
Connection *ss = Connection::Unwrap(args);
19321932

19331933
if (ss->is_server_) {
1934-
const unsigned char *npn_proto;
1934+
const unsigned char* npn_proto;
19351935
unsigned int npn_proto_len;
19361936

19371937
SSL_get0_next_proto_negotiated(ss->ssl_, &npn_proto, &npn_proto_len);
@@ -2039,8 +2039,8 @@ class Cipher : public ObjectWrap {
20392039
return false;
20402040
}
20412041
EVP_CipherInit_ex(&ctx, NULL, NULL,
2042-
(unsigned char *)key,
2043-
(unsigned char *)iv, true);
2042+
(unsigned char*)key,
2043+
(unsigned char*)iv, true);
20442044
initialised_ = true;
20452045
return true;
20462046
}
@@ -2049,7 +2049,7 @@ class Cipher : public ObjectWrap {
20492049
bool CipherInitIv(char* cipherType,
20502050
char* key,
20512051
int key_len,
2052-
char *iv,
2052+
char* iv,
20532053
int iv_len) {
20542054
cipher = EVP_get_cipherbyname(cipherType);
20552055
if(!cipher) {
@@ -2071,8 +2071,8 @@ class Cipher : public ObjectWrap {
20712071
return false;
20722072
}
20732073
EVP_CipherInit_ex(&ctx, NULL, NULL,
2074-
(unsigned char *)key,
2075-
(unsigned char *)iv, true);
2074+
(unsigned char*)key,
2075+
(unsigned char*)iv, true);
20762076
initialised_ = true;
20772077
return true;
20782078
}
@@ -2210,7 +2210,7 @@ class Cipher : public ObjectWrap {
22102210

22112211
ASSERT_IS_BUFFER(args[0]);
22122212

2213-
unsigned char *out=0;
2213+
unsigned char* out=0;
22142214
int out_len=0, r;
22152215
char* buffer_data = Buffer::Data(args[0]);
22162216
size_t buffer_length = Buffer::Length(args[0]);
@@ -2338,8 +2338,8 @@ class Decipher : public ObjectWrap {
23382338
return false;
23392339
}
23402340
EVP_CipherInit_ex(&ctx, NULL, NULL,
2341-
(unsigned char *)key,
2342-
(unsigned char *)iv, false);
2341+
(unsigned char*)key,
2342+
(unsigned char*)iv, false);
23432343
initialised_ = true;
23442344
return true;
23452345
}
@@ -2348,7 +2348,7 @@ class Decipher : public ObjectWrap {
23482348
bool DecipherInitIv(char* cipherType,
23492349
char* key,
23502350
int key_len,
2351-
char *iv,
2351+
char* iv,
23522352
int iv_len) {
23532353
cipher_ = EVP_get_cipherbyname(cipherType);
23542354
if(!cipher_) {
@@ -2370,8 +2370,8 @@ class Decipher : public ObjectWrap {
23702370
return false;
23712371
}
23722372
EVP_CipherInit_ex(&ctx, NULL, NULL,
2373-
(unsigned char *)key,
2374-
(unsigned char *)iv, false);
2373+
(unsigned char*)key,
2374+
(unsigned char*)iv, false);
23752375
initialised_ = true;
23762376
return true;
23772377
}
@@ -2525,13 +2525,13 @@ class Decipher : public ObjectWrap {
25252525
char* buf;
25262526
// if alloc_buf then buf must be deleted later
25272527
bool alloc_buf = false;
2528-
char *buffer_data = Buffer::Data(args[0]);
2528+
char* buffer_data = Buffer::Data(args[0]);
25292529
size_t buffer_length = Buffer::Length(args[0]);
25302530

25312531
buf = buffer_data;
25322532
len = buffer_length;
25332533

2534-
unsigned char *out=0;
2534+
unsigned char* out=0;
25352535
int out_len=0;
25362536
int r = cipher->DecipherUpdate(buf, len, &out, &out_len);
25372537

@@ -2717,7 +2717,7 @@ class Hmac : public ObjectWrap {
27172717

27182718
int r;
27192719

2720-
char *buffer_data = Buffer::Data(args[0]);
2720+
char* buffer_data = Buffer::Data(args[0]);
27212721
size_t buffer_length = Buffer::Length(args[0]);
27222722

27232723
r = hmac->HmacUpdate(buffer_data, buffer_length);
@@ -2832,7 +2832,7 @@ class Hash : public ObjectWrap {
28322832

28332833
int r;
28342834

2835-
char *buffer_data = Buffer::Data(args[0]);
2835+
char* buffer_data = Buffer::Data(args[0]);
28362836
size_t buffer_length = Buffer::Length(args[0]);
28372837
r = hash->HashUpdate(buffer_data, buffer_length);
28382838

@@ -2984,7 +2984,7 @@ class Sign : public ObjectWrap {
29842984

29852985
int r;
29862986

2987-
char *buffer_data = Buffer::Data(args[0]);
2987+
char* buffer_data = Buffer::Data(args[0]);
29882988
size_t buffer_length = Buffer::Length(args[0]);
29892989

29902990
r = sign->SignUpdate(buffer_data, buffer_length);
@@ -3195,7 +3195,7 @@ class Verify : public ObjectWrap {
31953195

31963196
int r;
31973197

3198-
char *buffer_data = Buffer::Data(args[0]);
3198+
char* buffer_data = Buffer::Data(args[0]);
31993199
size_t buffer_length = Buffer::Length(args[0]);
32003200

32013201
r = verify->VerifyUpdate(buffer_data, buffer_length);
@@ -3236,7 +3236,7 @@ class Verify : public ObjectWrap {
32363236
}
32373237

32383238
unsigned char* hbuf = new unsigned char[hlen];
3239-
ssize_t hwritten = DecodeWrite((char *)hbuf, hlen, args[1], BINARY);
3239+
ssize_t hwritten = DecodeWrite((char*)hbuf, hlen, args[1], BINARY);
32403240
assert(hwritten == hlen);
32413241

32423242
int r=-1;

0 commit comments

Comments
 (0)