Fix compilation error due to 64-bit integer narrowing to size_t (#5250)
This commit is contained in:
parent
472ded549d
commit
adc795929a
@ -311,7 +311,7 @@ XGB_DLL int XGDMatrixSliceDMatrixEx(DMatrixHandle handle,
|
||||
DMatrix* dmat = static_cast<std::shared_ptr<DMatrix>*>(handle)->get();
|
||||
CHECK(dynamic_cast<data::SimpleDMatrix*>(dmat))
|
||||
<< "Slice only supported for SimpleDMatrix currently.";
|
||||
data::DMatrixSliceAdapter adapter(dmat, {idxset, len});
|
||||
data::DMatrixSliceAdapter adapter(dmat, {idxset, static_cast<size_t>(len)});
|
||||
*out = new std::shared_ptr<DMatrix>(
|
||||
DMatrix::Create(&adapter, std::numeric_limits<float>::quiet_NaN(), 1));
|
||||
API_END();
|
||||
|
||||
@ -670,9 +670,10 @@ class LearnerImpl : public Learner {
|
||||
for more details about differences between saving model and serializing.
|
||||
|
||||
)doc";
|
||||
int64_t json_offset {-1};
|
||||
CHECK_EQ(fp.Read(&json_offset, sizeof(json_offset)), sizeof(json_offset));
|
||||
CHECK_GT(json_offset, 0);
|
||||
int64_t sz {-1};
|
||||
CHECK_EQ(fp.Read(&sz, sizeof(sz)), sizeof(sz));
|
||||
CHECK_GT(sz, 0);
|
||||
size_t json_offset = static_cast<size_t>(sz);
|
||||
std::string buffer;
|
||||
common::FixedSizeStream{&fp}.Take(&buffer);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user