diff options
Diffstat (limited to 'src/node_crypto_bio.cc')
-rw-r--r-- | src/node_crypto_bio.cc | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/node_crypto_bio.cc b/src/node_crypto_bio.cc index 16ec515de9..e6ccb33f8f 100644 --- a/src/node_crypto_bio.cc +++ b/src/node_crypto_bio.cc @@ -37,7 +37,7 @@ const BIO_METHOD NodeBIO::method = { NodeBIO::Ctrl, NodeBIO::New, NodeBIO::Free, - NULL + nullptr }; @@ -61,13 +61,13 @@ int NodeBIO::New(BIO* bio) { int NodeBIO::Free(BIO* bio) { - if (bio == NULL) + if (bio == nullptr) return 0; if (bio->shutdown) { - if (bio->init && bio->ptr != NULL) { + if (bio->init && bio->ptr != nullptr) { delete FromBIO(bio); - bio->ptr = NULL; + bio->ptr = nullptr; } } @@ -151,7 +151,7 @@ int NodeBIO::Gets(BIO* bio, char* out, int size) { if (i < size && i >= 0 && static_cast<size_t>(i) < nbio->Length()) i++; - // Shift `i` a bit to NULL-terminate string later + // Shift `i` a bit to nullptr-terminate string later if (size == i) i--; @@ -183,8 +183,8 @@ long NodeBIO::Ctrl(BIO* bio, int cmd, long num, void* ptr) { break; case BIO_CTRL_INFO: ret = nbio->Length(); - if (ptr != NULL) - *reinterpret_cast<void**>(ptr) = NULL; + if (ptr != nullptr) + *reinterpret_cast<void**>(ptr) = nullptr; break; case BIO_C_SET_BUF_MEM: CHECK(0 && "Can't use SET_BUF_MEM_PTR with NodeBIO"); @@ -252,7 +252,7 @@ size_t NodeBIO::Read(char* out, size_t size) { avail = left; // Copy data - if (out != NULL) + if (out != nullptr) memcpy(out + offset, read_head_->data_ + read_head_->read_pos_, avail); read_head_->read_pos_ += avail; @@ -274,7 +274,7 @@ size_t NodeBIO::Read(char* out, size_t size) { void NodeBIO::FreeEmpty() { - if (write_head_ == NULL) + if (write_head_ == nullptr) return; Buffer* child = write_head_->next_; if (child == write_head_ || child == read_head_) @@ -413,16 +413,16 @@ void NodeBIO::TryAllocateForWrite(size_t hint) { Buffer* w = write_head_; Buffer* r = read_head_; // If write head is full, next buffer is either read head or not empty. - if (w == NULL || + if (w == nullptr || (w->write_pos_ == w->len_ && (w->next_ == r || w->next_->write_pos_ != 0))) { - size_t len = w == NULL ? initial_ : + size_t len = w == nullptr ? initial_ : kThroughputBufferLength; if (len < hint) len = hint; Buffer* next = new Buffer(len); - if (w == NULL) { + if (w == nullptr) { next->next_ = next; write_head_ = next; read_head_ = next; @@ -435,7 +435,7 @@ void NodeBIO::TryAllocateForWrite(size_t hint) { void NodeBIO::Reset() { - if (read_head_ == NULL) + if (read_head_ == nullptr) return; while (read_head_->read_pos_ != read_head_->write_pos_) { @@ -453,7 +453,7 @@ void NodeBIO::Reset() { NodeBIO::~NodeBIO() { - if (read_head_ == NULL) + if (read_head_ == nullptr) return; Buffer* current = read_head_; @@ -463,8 +463,8 @@ NodeBIO::~NodeBIO() { current = next; } while (current != read_head_); - read_head_ = NULL; - write_head_ = NULL; + read_head_ = nullptr; + write_head_ = nullptr; } } // namespace node |