Commit 81e346a2 authored by Ge Jun's avatar Ge Jun

fix a warning in IOBuf::_pref_at()

parent 6ba83745
// Copyright (c) 2014 Baidu, Inc.G
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Authors: Lei He (helei@qiyi.com)
#include "brpc/concurrency_limiter.h"
namespace brpc {
ConcurrencyLimiter* ConcurrencyLimiter::CreateConcurrencyLimiterOrDie(
const AdaptiveMaxConcurrency& max_concurrency) {
const ConcurrencyLimiter* cl =
ConcurrencyLimiterExtension()->Find(max_concurrency.name().c_str());
CHECK(cl != NULL)
<< "Fail to find ConcurrencyLimiter by `"
<< max_concurrency.name() << "'";
ConcurrencyLimiter* cl_copy = cl->New();
CHECK(cl_copy != NULL) << "Fail to new ConcurrencyLimiter";
if (max_concurrency == "constant") {
cl_copy->_max_concurrency = max_concurrency;
}
return cl_copy;
}
} // namespace brpc
......@@ -158,7 +158,7 @@ inline const IOBuf::BlockRef& IOBuf::_ref_at(size_t i) const {
inline const IOBuf::BlockRef* IOBuf::_pref_at(size_t i) const {
if (_small()) {
return i < (!!_sv.refs[0].block + !!_sv.refs[1].block) ? &_sv.refs[i] : NULL;
return i < (size_t)(!!_sv.refs[0].block + !!_sv.refs[1].block) ? &_sv.refs[i] : NULL;
} else {
return i < _bv.nref ? &_bv.ref_at(i) : NULL;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment