summaryrefslogtreecommitdiff
path: root/ACE/ace/OS_NS_sys_stat.inl
diff options
context:
space:
mode:
authorOssama Othman <ossama-othman@users.noreply.github.com>2006-10-26 23:07:24 +0000
committerOssama Othman <ossama-othman@users.noreply.github.com>2006-10-26 23:07:24 +0000
commitec9496bea543bd5ebb9214880c056b95446b6b13 (patch)
treef13a58e9814886bf7627a4f566caa7425bd61a25 /ACE/ace/OS_NS_sys_stat.inl
parentd4ce64ef75457044ad7a9334f787d24fbb4c0a23 (diff)
downloadATCD-ec9496bea543bd5ebb9214880c056b95446b6b13.tar.gz
ChangeLogTag:Thu Oct 27 01:59:19 UTC 2006 Ossama Othman <ossama_othman at symantec dot com>
Diffstat (limited to 'ACE/ace/OS_NS_sys_stat.inl')
-rw-r--r--ACE/ace/OS_NS_sys_stat.inl24
1 files changed, 20 insertions, 4 deletions
diff --git a/ACE/ace/OS_NS_sys_stat.inl b/ACE/ace/OS_NS_sys_stat.inl
index 88085ddb84e..63cab76ce22 100644
--- a/ACE/ace/OS_NS_sys_stat.inl
+++ b/ACE/ace/OS_NS_sys_stat.inl
@@ -95,23 +95,39 @@ namespace ACE_OS
// This function returns the number of bytes in the file referenced by
// FD.
- ACE_INLINE ACE_LOFF_T
+ ACE_INLINE ACE_OFF_T
filesize (ACE_HANDLE handle)
{
ACE_OS_TRACE ("ACE_OS::filesize");
+#if defined (ACE_WIN32)
+# if defined (_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64
+ LARGE_INTEGER size;
+ return
+ (::GetFileSizeEx (handle, &size)
+ ? size.QuadPart
+ : (ACE_OS::set_errno_to_last_error (), -1));
+# else
+ ACE_OFF_T const size = ::GetFileSize (handle, 0);
+ return
+ (size != INVALID_FILE_SIZE
+ ? size
+ : (ACE_OS::set_errno_to_last_error (), -1));
+# endif /* _FILE_OFFSET_BITS == 64 */
+#else /* !ACE_WIN32 */
ACE_stat sb;
return ACE_OS::fstat (handle, &sb) == -1 ? -1 : sb.st_size;
+#endif
}
- ACE_INLINE ACE_LOFF_T
+ ACE_INLINE ACE_OFF_T
filesize (const ACE_TCHAR *filename)
{
ACE_OS_TRACE ("ACE_OS::filesize");
- ACE_HANDLE h = ACE_OS::open (filename, O_RDONLY);
+ ACE_HANDLE const h = ACE_OS::open (filename, O_RDONLY);
if (h != ACE_INVALID_HANDLE)
{
- ACE_LOFF_T size = ACE_OS::filesize (h);
+ ACE_OFF_T size = ACE_OS::filesize (h);
ACE_OS::close (h);
return size;
}