mirror of
https://gitee.com/fasiondog/hikyuu.git
synced 2024-12-01 11:28:32 +08:00
消除CppCheck检测的两个漏洞
This commit is contained in:
parent
012aae0abb
commit
8b49ab0406
@ -131,7 +131,7 @@ void KDataBufferImp::_recoverForUpDay() {
|
||||
}
|
||||
KRecord record = day_list[day_pos];
|
||||
int pre_day_pos = day_pos;
|
||||
while (day_list[day_pos].datetime <= phase_end_date && day_pos < day_total) {
|
||||
while (day_pos < day_total && day_list[day_pos].datetime <= phase_end_date) {
|
||||
if (day_list[day_pos].lowPrice < record.lowPrice) {
|
||||
record.lowPrice = day_list[day_pos].lowPrice;
|
||||
} else if (day_list[day_pos].highPrice > record.highPrice) {
|
||||
|
@ -350,11 +350,9 @@ Indicator IndicatorImp::calculate() {
|
||||
//Python中继承的实现会出现bad_weak_ptr错误,通过此方式避免
|
||||
result = clone();
|
||||
}
|
||||
return Indicator(result);
|
||||
|
||||
} else {
|
||||
return Indicator();
|
||||
}
|
||||
|
||||
return Indicator(result);
|
||||
}
|
||||
|
||||
if (!m_need_calculate) {
|
||||
@ -443,8 +441,10 @@ Indicator IndicatorImp::calculate() {
|
||||
try {
|
||||
result = shared_from_this();
|
||||
} catch (...) {
|
||||
//Python中继承的实现会出现bad_weak_ptr错误,通过此方式避免
|
||||
result = clone();
|
||||
}
|
||||
|
||||
return Indicator(result);
|
||||
}
|
||||
|
||||
|
@ -1825,7 +1825,7 @@ PriceList TradeManager
|
||||
return result;
|
||||
|
||||
size_t i = 0;
|
||||
while (dates[i] < m_init_datetime && i < total) {
|
||||
while (i < total && dates[i] < m_init_datetime) {
|
||||
result[i] = 0;
|
||||
i++;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user