From dac70ad4c5a6d679d65a118ee29cd8dbcb6ca3e6 Mon Sep 17 00:00:00 2001 From: xjqbest <173596896@qq.com> Date: Tue, 16 Apr 2019 14:08:17 +0800 Subject: [PATCH] fix bug of num > INT_MAX --- paddle/fluid/framework/data_feed.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/paddle/fluid/framework/data_feed.cc b/paddle/fluid/framework/data_feed.cc index ec1d9ba845b..6b0404134d0 100644 --- a/paddle/fluid/framework/data_feed.cc +++ b/paddle/fluid/framework/data_feed.cc @@ -531,7 +531,7 @@ bool MultiSlotDataFeed::CheckFile(const char* filename) { char* endptr = const_cast(str); int len = line.length(); for (size_t i = 0; i < all_slots_.size(); ++i) { - int num = strtol(endptr, &endptr, 10); + long num = strtol(endptr, &endptr, 10); if (num < 0) { VLOG(0) << "error: the number of ids is a negative number: " << num; VLOG(0) << "please check line<" << instance_cout << "> in file<" @@ -546,7 +546,7 @@ bool MultiSlotDataFeed::CheckFile(const char* filename) { VLOG(0) << "please check line<" << instance_cout << "> in file<" << filename << ">"; return false; - } else if (errno == ERANGE || (unsigned int)num > INT_MAX) { + } else if (errno == ERANGE) { VLOG(0) << "error: the number of ids greater than INT_MAX"; VLOG(0) << "please check line<" << instance_cout << "> in file<" << filename << ">"; -- GitLab