Kaydet (Commit) e5f0aceb authored tarafından Stephan Bergmann's avatar Stephan Bergmann

readwrite_helper.h -> readwrite_helper.hxx

Change-Id: If0d71f0660d60e3bcea4db3906ffe600e00f69f2
üst 93d550d9
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include "file_path_helper.hxx" #include "file_path_helper.hxx"
#include "file_url.hxx" #include "file_url.hxx"
#include "uunxapi.hxx" #include "uunxapi.hxx"
#include "readwrite_helper.h" #include "readwrite_helper.hxx"
#include <sys/types.h> #include <sys/types.h>
#include <errno.h> #include <errno.h>
......
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
#include "createfilehandlefromfd.hxx" #include "createfilehandlefromfd.hxx"
#include "file_url.hxx" #include "file_url.hxx"
#include "readwrite_helper.h" #include "readwrite_helper.hxx"
#include "sockimpl.h" #include "sockimpl.h"
#include "secimpl.h" #include "secimpl.h"
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
*/ */
#include "system.h" #include "system.h"
#include "readwrite_helper.h" #include "readwrite_helper.hxx"
#include "file_url.hxx" #include "file_url.hxx"
#include <osl/diagnose.h> #include <osl/diagnose.h>
......
...@@ -7,12 +7,12 @@ ...@@ -7,12 +7,12 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/ */
#include "readwrite_helper.h" #include "readwrite_helper.hxx"
#include <osl/diagnose.h> #include <osl/diagnose.h>
#include <system.h> #include <system.h>
sal_Bool safeWrite(int fd, void* data, sal_uInt32 dataSize) bool safeWrite(int fd, void* data, sal_uInt32 dataSize)
{ {
sal_Int32 nToWrite = dataSize; sal_Int32 nToWrite = dataSize;
unsigned char* dataToWrite = static_cast<unsigned char *>(data); unsigned char* dataToWrite = static_cast<unsigned char *>(data);
...@@ -25,7 +25,7 @@ sal_Bool safeWrite(int fd, void* data, sal_uInt32 dataSize) ...@@ -25,7 +25,7 @@ sal_Bool safeWrite(int fd, void* data, sal_uInt32 dataSize)
if ( errno == EINTR ) if ( errno == EINTR )
continue; continue;
return sal_False; return false;
} }
...@@ -34,10 +34,10 @@ sal_Bool safeWrite(int fd, void* data, sal_uInt32 dataSize) ...@@ -34,10 +34,10 @@ sal_Bool safeWrite(int fd, void* data, sal_uInt32 dataSize)
dataToWrite += nWritten; dataToWrite += nWritten;
} }
return sal_True; return true;
} }
sal_Bool safeRead( int fd, void* buffer, sal_uInt32 count ) bool safeRead( int fd, void* buffer, sal_uInt32 count )
{ {
sal_Int32 nToRead = count; sal_Int32 nToRead = count;
unsigned char* bufferForReading = static_cast<unsigned char *>(buffer); unsigned char* bufferForReading = static_cast<unsigned char *>(buffer);
...@@ -51,19 +51,19 @@ sal_Bool safeRead( int fd, void* buffer, sal_uInt32 count ) ...@@ -51,19 +51,19 @@ sal_Bool safeRead( int fd, void* buffer, sal_uInt32 count )
if (errno == EINTR) if (errno == EINTR)
continue; continue;
return sal_False; return false;
} }
// If we reach the EOF, we consider this a partial transfer and thus // If we reach the EOF, we consider this a partial transfer and thus
// an error. // an error.
if ( nRead == 0 ) if ( nRead == 0 )
return sal_False; return false;
nToRead -= nRead; nToRead -= nRead;
bufferForReading += nRead; bufferForReading += nRead;
} }
return sal_True; return true;
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -7,26 +7,17 @@ ...@@ -7,26 +7,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/ */
#ifndef INCLUDED_SAL_OSL_UNX_READWRITE_HELPER_H #ifndef INCLUDED_SAL_OSL_UNX_READWRITE_HELPER_HXX
#define INCLUDED_SAL_OSL_UNX_READWRITE_HELPER_H #define INCLUDED_SAL_OSL_UNX_READWRITE_HELPER_HXX
#include <sal/types.h> #include <sal/types.h>
#ifdef __cplusplus bool safeWrite( int fd, void* data, sal_uInt32 dataSize );
extern "C"
{
#endif
sal_Bool safeWrite( int fd, void* data, sal_uInt32 dataSize );
// This function *will* read |count| bytes from |fd|, busy looping // This function *will* read |count| bytes from |fd|, busy looping
// if needed. Don't use it when you don't know if you can request enough // if needed. Don't use it when you don't know if you can request enough
// data. It will return sal_False for any partial transfer or error. // data. It will return sal_False for any partial transfer or error.
sal_Bool safeRead( int fd, void* buffer, sal_uInt32 count ); bool safeRead( int fd, void* buffer, sal_uInt32 count );
#ifdef __cplusplus
}
#endif
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment