dnn: fix failed Torch tests

"Torch invalid argument 2: position must be smaller than LLONG_MAX"

These conditions are always true for "long position" argument.
This commit is contained in:
Alexander Alekhin 2017-06-26 19:27:05 +03:00
parent 93091ba203
commit 986d27e49c

View File

@ -175,13 +175,10 @@ static void THDiskFile_seek(THFile *self, long position)
THArgCheck(dfself->handle != NULL, 1, "attempt to use a closed file");
#if defined(_WIN64)
THArgCheck(position <= (_int64)INT64_MAX, 2, "position must be smaller than INT64_MAX");
if(_fseeki64(dfself->handle, (__int64)position, SEEK_SET) < 0)
#elif defined(_WIN32)
THArgCheck(position <= (long)LONG_MAX, 2, "position must be smaller than LONG_MAX");
if(fseek(dfself->handle, (long)position, SEEK_SET) < 0)
#else
THArgCheck(position <= (long)LLONG_MAX, 2, "position must be smaller than LLONG_MAX");
if(fseeko(dfself->handle, (off_t)position, SEEK_SET) < 0)
#endif
{