summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2004-09-08 15:15:27 +0000
committerOliver Bolte <obo@openoffice.org>2004-09-08 15:15:27 +0000
commit38de65ab69bebba8c88f2e70bfa2ddae454c9f1e (patch)
tree5a120b45bad7cc1dd35397eaf7204b079b0b83f8 /sal
parent13e27de604845e124899831fa7fe7d63c0119014 (diff)
INTEGRATION: CWS getfilesize1 (1.5.28); FILE MERGED
2004/08/24 13:08:32 cmc 1.5.28.1: #i33340# as discussed with MHU add an explicit osl_getFileSize function to mirror osl_setFileSize as an alternative to seeking to end of files and back to get their length
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/unx/file.cxx22
1 files changed, 20 insertions, 2 deletions
diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx
index edb4e9193..8a8e938e0 100644
--- a/sal/osl/unx/file.cxx
+++ b/sal/osl/unx/file.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: file.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: rt $ $Date: 2004-06-17 13:26:55 $
+ * last change: $Author: obo $ $Date: 2004-09-08 16:15:27 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1182,6 +1182,24 @@ oslFileError osl_getFilePos( oslFileHandle Handle, sal_uInt64* pPos )
return osl_File_E_None;
}
+/****************************************************************************
+ * osl_getFileSize
+ ****************************************************************************/
+
+oslFileError osl_getFileSize( oslFileHandle Handle, sal_uInt64* pSize )
+{
+ oslFileHandleImpl* pHandleImpl=(oslFileHandleImpl*) Handle;
+ if (pHandleImpl == 0)
+ return osl_File_E_INVAL;
+
+ struct stat file_stat;
+ if (fstat(pHandleImpl->fd, &file_stat) == -1)
+ return oslTranslateFileError(OSL_FET_ERROR, errno);
+
+ *pSize = file_stat.st_size;
+ return osl_File_E_None;
+}
+
/************************************************
* osl_setFileSize
***********************************************/