mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
0026171: Coding rules - eliminate -Wshorten-64-to-32 CLang warnings
This commit is contained in:
@@ -187,11 +187,11 @@ Standard_Integer OSD_Disk::DiskSize()
|
||||
ULONGLONG aSize = aNbTotalBytes.QuadPart / 512;
|
||||
return (Standard_Integer )aSize; // may be an overflow
|
||||
#else
|
||||
struct statvfs buffer;
|
||||
if (statvfs (myDiskName.ToCString(), &buffer) == 0)
|
||||
struct statvfs aBuffer;
|
||||
if (statvfs (myDiskName.ToCString(), &aBuffer) == 0)
|
||||
{
|
||||
int BSize512 = buffer.f_frsize / 512;
|
||||
return buffer.f_blocks * BSize512;
|
||||
unsigned long aBSize512 = aBuffer.f_frsize / 512;
|
||||
return Standard_Integer(aBuffer.f_blocks * aBSize512);
|
||||
}
|
||||
myError.SetValue (errno, Iam, "OSD_Disk: statvfs failed.");
|
||||
return 0;
|
||||
@@ -219,11 +219,11 @@ Standard_Integer OSD_Disk::DiskFree()
|
||||
ULONGLONG aSize = aNbFreeAvailableBytes.QuadPart / 512;
|
||||
return (Standard_Integer )aSize; // may be an overflow
|
||||
#else
|
||||
struct statvfs buffer;
|
||||
if (statvfs (myDiskName.ToCString(), &buffer) == 0)
|
||||
struct statvfs aBuffer;
|
||||
if (statvfs (myDiskName.ToCString(), &aBuffer) == 0)
|
||||
{
|
||||
int BSize512 = buffer.f_frsize / 512;
|
||||
return buffer.f_bavail * BSize512;
|
||||
unsigned long aBSize512 = aBuffer.f_frsize / 512;
|
||||
return Standard_Integer(aBuffer.f_bavail * aBSize512);
|
||||
}
|
||||
myError.SetValue (errno, Iam, "OSD_Disk: statvfs failed.");
|
||||
return 0;
|
||||
|
@@ -782,7 +782,7 @@ void OSD_File::Read (TCollection_AsciiString& theBuffer,
|
||||
#ifdef _WIN32
|
||||
Read (&aBuffer.ChangeFirst(), theNbBytes, aNbBytesRead);
|
||||
#else
|
||||
aNbBytesRead = read (myFileChannel, &aBuffer.ChangeFirst(), theNbBytes);
|
||||
aNbBytesRead = (Standard_Integer )read (myFileChannel, &aBuffer.ChangeFirst(), theNbBytes);
|
||||
if (aNbBytesRead == -1)
|
||||
{
|
||||
aNbBytesRead = 0;
|
||||
@@ -1078,7 +1078,7 @@ void OSD_File::Read (const Standard_Address theBuffer,
|
||||
theNbReadBytes = (Standard_Integer )aNbReadBytes;
|
||||
#else
|
||||
theNbReadBytes = 0;
|
||||
int aNbReadBytes = read (myFileChannel, (char* )theBuffer, theNbBytes);
|
||||
int aNbReadBytes = (Standard_Integer )read (myFileChannel, (char* )theBuffer, theNbBytes);
|
||||
if (aNbReadBytes == -1)
|
||||
{
|
||||
myError.SetValue (errno, Iam, "Read");
|
||||
@@ -1131,7 +1131,7 @@ void OSD_File::Write (const Standard_Address theBuffer,
|
||||
_osd_wnt_set_error (myError, OSD_WFile);
|
||||
}
|
||||
#else
|
||||
const int aNbWritten = write (myFileChannel, (const char* )theBuffer, theNbBytes);
|
||||
const int aNbWritten = (Standard_Integer )write (myFileChannel, (const char* )theBuffer, theNbBytes);
|
||||
if (aNbWritten == -1)
|
||||
{
|
||||
myError.SetValue (errno, Iam, "Write");
|
||||
|
@@ -183,11 +183,15 @@ int static copy_file( const char* src, const char* trg )
|
||||
const int BUFSIZE=4096;
|
||||
char buf[BUFSIZE];
|
||||
int n=0;
|
||||
while ( ( n = read ( fds, buf, BUFSIZE )) >0 )
|
||||
while ((n = (int )read (fds, buf, BUFSIZE)) > 0)
|
||||
{
|
||||
if ( write ( fdo, buf, n ) != n ) { // writing error
|
||||
if ( ! errno )
|
||||
if ( write ( fdo, buf, n ) != n )
|
||||
{
|
||||
// writing error
|
||||
if (!errno)
|
||||
{
|
||||
errno = ENOSPC;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user