src: use unique_ptr for requests in crypto#17000
Closed
fhinkel wants to merge 1 commit intonodejs:masterfrom
Closed
src: use unique_ptr for requests in crypto#17000fhinkel wants to merge 1 commit intonodejs:masterfrom
fhinkel wants to merge 1 commit intonodejs:masterfrom
Conversation
jasnell
approved these changes
Nov 14, 2017
bnoordhuis
approved these changes
Nov 14, 2017
src/node_crypto.cc
Outdated
Member
There was a problem hiding this comment.
4 space indent. (Line continuation.)
Member
Author
There was a problem hiding this comment.
Thanks! I think I have a few of these wrong. Let me check my other PRs.
src/node_crypto.cc
Outdated
Member
There was a problem hiding this comment.
Since you're here, I'd be okay with writing this as:
std::unique_ptr<PBKDF2Request> req(
new PBKDF2Request(env, obj, digest, passlen, pass, saltlen, iter, keylen));
cjihrig
approved these changes
Nov 14, 2017
Instead of raw pointerns, use std::unique_ptr for PBKDF2Request and RandomBytesRequest. This makes ownership more clear.
701d89c to
e86545e
Compare
Member
Author
2 tasks
Member
Author
|
CI failures are unrelated. Landed in 1b093cb. |
fhinkel
added a commit
that referenced
this pull request
Nov 15, 2017
Instead of raw pointerns, use std::unique_ptr for PBKDF2Request and RandomBytesRequest. This makes ownership more clear. PR-URL: #17000 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
fhinkel
added a commit
that referenced
this pull request
Nov 17, 2017
Add rule for smart pointers, i.e., std::unique_ptr and std::shared_ptr, to the Cpp style guide. Mostly copied from the Google style guide. PR-URL: #17055 Ref: #16970 Ref: #16974 Ref: #17000 Ref: #17012 Ref: #17020 Ref: #17030 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
MylesBorins
pushed a commit
that referenced
this pull request
Dec 11, 2017
Instead of raw pointerns, use std::unique_ptr for PBKDF2Request and RandomBytesRequest. This makes ownership more clear. PR-URL: #17000 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
MylesBorins
pushed a commit
that referenced
this pull request
Dec 12, 2017
Add rule for smart pointers, i.e., std::unique_ptr and std::shared_ptr, to the Cpp style guide. Mostly copied from the Google style guide. PR-URL: #17055 Ref: #16970 Ref: #16974 Ref: #17000 Ref: #17012 Ref: #17020 Ref: #17030 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Merged
Contributor
|
This needs to be manually backported to v6.x and v8.x. 6.x does not have pbkdf2, but we might want to backport it in the next minor. Please leave the label on right now and we will revisit the 6.x backport in January |
Member
|
Compile failure on 8.x: g++ '-DNODE_ARCH="x64"' '-DNODE_PLATFORM="linux"' '-DNODE_WANT_INTERNALS=1' '-DV8_DEPRECATION_WARNINGS=1' '-DHAVE_INSPECTOR=1' '-D__POSIX__' '-DHAVE_OPENSSL=1' '-DNODE_USE_V8_PLATFORM=1' '-DNODE_HAVE_I18N_SUPPORT=1' '-DNODE_HAVE_SMALL_ICU=1' '-DNGHTTP2_STATICLIB' '-DUCONFIG_NO_SERVICE=1' '-DUCONFIG_NO_REGULAR_EXPRESSIONS=1' '-DU_ENABLE_DYLOAD=0' '-DU_STATIC_IMPLEMENTATION=1' '-DU_HAVE_STD_STRING=0' '-DUCONFIG_NO_BREAK_ITERATION=0' '-DHTTP_PARSER_STRICT=0' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D_POSIX_C_SOURCE=200112' -I../src -I../tools/msvs/genfiles -I/build/gib/node/out/Release/obj/gen -I../deps/nghttp2/lib/includes -I/build/gib/node/out/Release/obj/gen/include -I../deps/openssl/openssl/include -I../deps/v8/include -I../deps/icu-small/source/i18n -I../deps/icu-small/source/common -I../deps/zlib -I../deps/http_parser -I../deps/cares/include -I../deps/uv/include -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++0x -MMD -MF /build/gib/node/out/Release/.deps//build/gib/node/out/Release/obj.target/node/src/tls_wrap.o.d.raw -c -o /build/gib/node/out/Release/obj.target/node/src/tls_wrap.o ../src/tls_wrap.cc
../src/node_contextify.cc: In static member function ‘static void node::{anonymous}::ContextifyContext::RunInDebugContext(const v8::FunctionCallbackInfo<v8::Value>&)’:
../src/node_contextify.cc:278:76: warning: ‘static v8::Local<v8::Context> v8::Debug::GetDebugContext(v8::Isolate*)’ is deprecated (declared at ../deps/v8/include/v8-debug.h:208): Use v8-inspector [-Wdeprecated-declarations]
Local<Context> debug_context = Debug::GetDebugContext(args.GetIsolate());
^
../src/node_contextify.cc:283:75: warning: ‘static bool v8::Debug::SetDebugEventListener(v8::Isolate*, v8::Debug::EventCallback, v8::Local<v8::Value>)’ is deprecated (declared at ../deps/v8/include/v8-debug.h:145): No longer supported [-Wdeprecated-declarations]
Debug::SetDebugEventListener(args.GetIsolate(), dummy_event_listener);
^
../src/node_contextify.cc:284:63: warning: ‘static v8::Local<v8::Context> v8::Debug::GetDebugContext(v8::Isolate*)’ is deprecated (declared at ../deps/v8/include/v8-debug.h:208): Use v8-inspector [-Wdeprecated-declarations]
debug_context = Debug::GetDebugContext(args.GetIsolate());
^
../src/node_crypto.cc: In function ‘void node::crypto::PBKDF2(const v8::FunctionCallbackInfo<v8::Value>&)’:
../src/node_crypto.cc:5478:2: error: jump to label ‘err’ [-fpermissive]
err:
^
../src/node_crypto.cc:5437:12: error: from here [-fpermissive]
goto err;
^
../src/node_crypto.cc:5447:34: error: crosses initialization of ‘std::unique_ptr<node::crypto::PBKDF2Request> req’
std::unique_ptr<PBKDF2Request> req(
^
../src/node_crypto.cc:5478:2: error: jump to label ‘err’ [-fpermissive]
err:
^
../src/node_crypto.cc:5427:10: error: from here [-fpermissive]
goto err;
^
../src/node_crypto.cc:5447:34: error: crosses initialization of ‘std::unique_ptr<node::crypto::PBKDF2Request> req’
std::unique_ptr<PBKDF2Request> req(
^
../src/node_crypto.cc:5478:2: error: jump to label ‘err’ [-fpermissive]
err:
^
../src/node_crypto.cc:5420:10: error: from here [-fpermissive]
goto err;
^
../src/node_crypto.cc:5447:34: error: crosses initialization of ‘std::unique_ptr<node::crypto::PBKDF2Request> req’
std::unique_ptr<PBKDF2Request> req(
^
../src/node_crypto.cc:5478:2: error: jump to label ‘err’ [-fpermissive]
err:
^
../src/node_crypto.cc:5415:10: error: from here [-fpermissive]
goto err;
^
../src/node_crypto.cc:5447:34: error: crosses initialization of ‘std::unique_ptr<node::crypto::PBKDF2Request> req’
std::unique_ptr<PBKDF2Request> req(
^
../src/node_crypto.cc:5478:2: error: jump to label ‘err’ [-fpermissive]
err:
^
../src/node_crypto.cc:5409:10: error: from here [-fpermissive]
goto err;
^
../src/node_crypto.cc:5447:34: error: crosses initialization of ‘std::unique_ptr<node::crypto::PBKDF2Request> req’
std::unique_ptr<PBKDF2Request> req(
^
../src/node_crypto.cc:5478:2: error: jump to label ‘err’ [-fpermissive]
err:
^
../src/node_crypto.cc:5401:10: error: from here [-fpermissive]
goto err;
^
../src/node_crypto.cc:5447:34: error: crosses initialization of ‘std::unique_ptr<node::crypto::PBKDF2Request> req’
std::unique_ptr<PBKDF2Request> req(
^
../src/node_crypto.cc:5478:2: error: jump to label ‘err’ [-fpermissive]
err:
^
../src/node_crypto.cc:5390:10: error: from here [-fpermissive]
goto err;
^
../src/node_crypto.cc:5447:34: error: crosses initialization of ‘std::unique_ptr<node::crypto::PBKDF2Request> req’
std::unique_ptr<PBKDF2Request> req(
^
../src/node_crypto.cc:5478:2: error: jump to label ‘err’ [-fpermissive]
err:
^
../src/node_crypto.cc:5383:10: error: from here [-fpermissive]
goto err;
^
../src/node_crypto.cc:5447:34: error: crosses initialization of ‘std::unique_ptr<node::crypto::PBKDF2Request> req’
std::unique_ptr<PBKDF2Request> req(
^
../src/node.cc: In function ‘void node::DebugPause(const v8::FunctionCallbackInfo<v8::Value>&)’:
../src/node.cc:4422:42: warning: ‘static void v8::Debug::DebugBreak(v8::Isolate*)’ is deprecated (declared at ../deps/v8/include/v8-debug.h:151): No longer supported [-Wdeprecated-declarations]
v8::Debug::DebugBreak(args.GetIsolate());
^ |
gibfahn
pushed a commit
that referenced
this pull request
Dec 19, 2017
Add rule for smart pointers, i.e., std::unique_ptr and std::shared_ptr, to the Cpp style guide. Mostly copied from the Google style guide. PR-URL: #17055 Ref: #16970 Ref: #16974 Ref: #17000 Ref: #17012 Ref: #17020 Ref: #17030 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
gibfahn
pushed a commit
that referenced
this pull request
Dec 20, 2017
Add rule for smart pointers, i.e., std::unique_ptr and std::shared_ptr, to the Cpp style guide. Mostly copied from the Google style guide. PR-URL: #17055 Ref: #16970 Ref: #16974 Ref: #17000 Ref: #17012 Ref: #17020 Ref: #17030 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Member
|
i'm not convinced this is worth backporting to 8.x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Instead of raw pointerns, use std::unique_ptr for PBKDF2Request and
RandomBytesRequest. This makes ownership more clear.
Checklist
make -j4 test(UNIX) passesAffected core subsystem(s)
src