Skip to content

Conversation

@aqrln
Copy link
Contributor

@aqrlnaqrln commented Mar 31, 2017

Make parameters as const since it's both better at its own and consistent with base64_decode_fast() and base64_decode().

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

src

@nodejs-github-botnodejs-github-bot added buffer Issues and PRs related to the buffer subsystem. c++ Issues and PRs that require attention from people who are familiar with C++. labels Mar 31, 2017
Make parameters as const since it's both better at its own and consistent with base64_decode_fast() and base64_decode().
@aqrlnaqrlnforce-pushed the base64-const-parameters branch from a5e8045 to 008bbbcCompareMarch 31, 2017 08:43
Copy link
Member

@bnoordhuisbnoordhuis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

size_tbase64_decode_slow(char* dst, size_t dstlen,
const TypeName* src, size_t srclen){
size_tbase64_decode_slow(char* constdst,constsize_t dstlen,
const TypeName* constsrc,constsize_t srclen){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the second const for src necessary?

Copy link
ContributorAuthor

@aqrlnaqrlnMar 31, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not strictly necessary, but why not add it if we don't mutate the pointer? And that would be consistent with base64_decode_slow() (line 90) and base64_decode() (line 122).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@richardlau The first const declares the pointed-to memory immutable, the second one declares the pointer itself immutable (i.e., not reassignable.)

@aqrln
Copy link
ContributorAuthor

Well, I've just tried to do something more interesting, so this PR will be a bit obsolete if everything's okay with #12146.

@addaleaxaddaleax added the blocked PRs that are blocked by other issues or PRs. label Apr 3, 2017
@aqrln
Copy link
ContributorAuthor

aqrln commented Apr 4, 2017

Closing this as #12146 has landed.

@aqrlnaqrln closed this Apr 4, 2017
@aqrlnaqrln deleted the base64-const-parameters branch July 31, 2017 22:35
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blockedPRs that are blocked by other issues or PRs.bufferIssues and PRs related to the buffer subsystem.c++Issues and PRs that require attention from people who are familiar with C++.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@aqrln@bnoordhuis@jasnell@addaleax@TimothyGu@cjihrig@richardlau@nodejs-github-bot