diff options
author | kiyomizumia <melissa@stroly.jp> | 2018-11-14 03:53:12 +0300 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2018-12-24 12:41:15 +0300 |
commit | 71bc7e1ce6881b4e6fe50459cc9866d47f96e4a4 (patch) | |
tree | f72b9a7fa2d414a7ce4ea6857b44700822af664c /src/stream_base.cc | |
parent | 65d8179b0d10b4a53564d360c21d0260ec4b1686 (diff) |
src: add DCHECK macros
This adds check statements for debugging and refactors the code
accordingly.
PR-URL: https://github.com/nodejs/node/pull/24359
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'src/stream_base.cc')
-rw-r--r-- | src/stream_base.cc | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/stream_base.cc b/src/stream_base.cc index 26efa46ba02..739964eb85a 100644 --- a/src/stream_base.cc +++ b/src/stream_base.cc @@ -292,17 +292,16 @@ void StreamBase::CallJSOnreadMethod(ssize_t nread, size_t offset) { Environment* env = env_; -#ifdef DEBUG - CHECK_EQ(static_cast<int32_t>(nread), nread); - CHECK_LE(offset, INT32_MAX); + DCHECK_EQ(static_cast<int32_t>(nread), nread); + DCHECK_LE(offset, INT32_MAX); if (ab.IsEmpty()) { - CHECK_EQ(offset, 0); - CHECK_LE(nread, 0); + DCHECK_EQ(offset, 0); + DCHECK_LE(nread, 0); } else { - CHECK_GE(nread, 0); + DCHECK_GE(nread, 0); } -#endif + env->stream_base_state()[kReadBytesOrError] = nread; env->stream_base_state()[kArrayBufferOffset] = offset; |