Author: sebor
Date: Fri Aug  8 16:14:30 2008
New Revision: 684138

URL: http://svn.apache.org/viewvc?rev=684138&view=rev
Log:
2008-08-08  Martin Sebor  <[EMAIL PROTECTED]>

        STDCXX-998
        * include/rw/_file.h (__rw_fopen, __rw_fdopen, __rw_fclose,
        __rw_fileno, __rw_fdmode, __rw_fmode, __rw_fread, __rw_fwrite,
        __rw_fseek, __rw_fflush): Declared with attribute nothrow.
        * include/ostream (__rw_fflush): Same.
        * src/mman.h (__rw_mmap, __rw_munmap): Same.
        * src/mman.cpp (__rw_mmap): Used malloc() instead of operator
        new to avoid exceptions.

Modified:
    stdcxx/branches/4.2.x/include/ostream
    stdcxx/branches/4.2.x/include/rw/_file.h
    stdcxx/branches/4.2.x/src/mman.cpp
    stdcxx/branches/4.2.x/src/mman.h

Modified: stdcxx/branches/4.2.x/include/ostream
URL: 
http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/ostream?rev=684138&r1=684137&r2=684138&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/include/ostream (original)
+++ stdcxx/branches/4.2.x/include/ostream Fri Aug  8 16:14:30 2008
@@ -49,7 +49,7 @@
 
 _RWSTD_NAMESPACE (__rw) { 
 
-_RWSTD_EXPORT int __rw_fflush (void*, int);
+_RWSTD_EXPORT int __rw_fflush (void*, int) _RWSTD_ATTRIBUTE_NOTHROW;
 
 }   // namespace __rw
 

Modified: stdcxx/branches/4.2.x/include/rw/_file.h
URL: 
http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/rw/_file.h?rev=684138&r1=684137&r2=684138&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/include/rw/_file.h (original)
+++ stdcxx/branches/4.2.x/include/rw/_file.h Fri Aug  8 16:14:30 2008
@@ -25,7 +25,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 1994-2006 Rogue Wave Software.
+ * Copyright 1994-2006 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -39,21 +39,35 @@
 
 _RWSTD_NAMESPACE (__rw) {
 
-_RWSTD_EXPORT void* __rw_fopen (const char*, int, long);
-_RWSTD_EXPORT void* __rw_fdopen (int);
-_RWSTD_EXPORT int __rw_fclose (void*, int);
-_RWSTD_EXPORT int __rw_fileno (void*, int);
-_RWSTD_EXPORT int __rw_fdmode (int);
-_RWSTD_EXPORT int __rw_fmode (void*, int);
+_RWSTD_EXPORT void*
+__rw_fopen (const char*, int, long) _RWSTD_ATTRIBUTE_NOTHROW;
+
+_RWSTD_EXPORT void*
+__rw_fdopen (int) _RWSTD_ATTRIBUTE_NOTHROW;
+
+_RWSTD_EXPORT int
+__rw_fclose (void*, int) _RWSTD_ATTRIBUTE_NOTHROW;
+
+_RWSTD_EXPORT int
+__rw_fileno (void*, int) _RWSTD_ATTRIBUTE_NOTHROW;
+
+_RWSTD_EXPORT int
+__rw_fdmode (int) _RWSTD_ATTRIBUTE_NOTHROW;
+
+_RWSTD_EXPORT int
+__rw_fmode (void*, int) _RWSTD_ATTRIBUTE_NOTHROW;
 
 _RWSTD_EXPORT _RWSTD_SIZE_T
-__rw_fread (void*, int, void*, _RWSTD_SIZE_T);
+__rw_fread (void*, int, void*, _RWSTD_SIZE_T) _RWSTD_ATTRIBUTE_NOTHROW;
 
 _RWSTD_EXPORT _RWSTD_PTRDIFF_T
-__rw_fwrite (void*, int, const void*, _RWSTD_SIZE_T);
+__rw_fwrite (void*, int, const void*, _RWSTD_SIZE_T) _RWSTD_ATTRIBUTE_NOTHROW;
+
+_RWSTD_EXPORT long
+__rw_fseek (void*, int, _RWSTD_PTRDIFF_T, int) _RWSTD_ATTRIBUTE_NOTHROW;
 
-_RWSTD_EXPORT long __rw_fseek (void*, int, _RWSTD_PTRDIFF_T, int);
-_RWSTD_EXPORT int __rw_fflush (void*, int);
+_RWSTD_EXPORT int
+__rw_fflush (void*, int) _RWSTD_ATTRIBUTE_NOTHROW;
 
 }   // namespace __rw
 

Modified: stdcxx/branches/4.2.x/src/mman.cpp
URL: 
http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/mman.cpp?rev=684138&r1=684137&r2=684138&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/src/mman.cpp (original)
+++ stdcxx/branches/4.2.x/src/mman.cpp Fri Aug  8 16:14:30 2008
@@ -45,6 +45,7 @@
 
 #include <sys/types.h>
 #include <fcntl.h>
+#include <stdlib.h>
 
 
 _RWSTD_NAMESPACE (__rw) {
@@ -53,7 +54,7 @@
 // maps a named file into memory as shared, read-only, returns
 // the beginning address on success and fills `size' with the
 // size of the file; returns 0 on failure
-void* __rw_mmap (const char* fname, _RWSTD_SIZE_T *size)
+void* __rw_mmap (const char* fname, _RWSTD_SIZE_T *size)   // nothrow
 {
     _RWSTD_ASSERT (0 != fname);
     _RWSTD_ASSERT (0 != size);
@@ -130,12 +131,14 @@
     // read() takes a size_t argument, convert off_t to it
     const size_t mapsize = size_t (sb.st_size);
 
-    void* data = operator new (mapsize);
-    const ssize_t nread = read (fd, data, mapsize);
-
-    if (size_t (nread) != mapsize) {
-        operator delete (data);
-        data = 0;
+    void* data = malloc (mapsize);
+    if (data) {
+        const ssize_t nread = read (fd, data, mapsize);
+
+        if (size_t (nread) != mapsize) {
+            free (data);
+            data = 0;
+        }
     }
 
 #endif  // _MSC_VER
@@ -144,7 +147,7 @@
 }
 
 
-void __rw_munmap (const void* pcv, _RWSTD_SIZE_T size)
+void __rw_munmap (const void* pcv, _RWSTD_SIZE_T size)   // nothrow
 {
     _RWSTD_ASSERT (pcv && size);
 

Modified: stdcxx/branches/4.2.x/src/mman.h
URL: 
http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/mman.h?rev=684138&r1=684137&r2=684138&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/src/mman.h (original)
+++ stdcxx/branches/4.2.x/src/mman.h Fri Aug  8 16:14:30 2008
@@ -22,7 +22,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 2001-2006 Rogue Wave Software.
+ * Copyright 2001-2006 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -39,10 +39,10 @@
 // maps a named file into memory as shared, read-only, returns
 // the beginning address on success and fills 'size' with the
 // size of the file; returns 0 on failure
-void* __rw_mmap (const char*, _RWSTD_SIZE_T*);
+void* __rw_mmap (const char*, _RWSTD_SIZE_T*) _RWSTD_ATTRIBUTE_NOTHROW;
 
 // unmaps a memory region
-void __rw_munmap (const void*, _RWSTD_SIZE_T);
+void __rw_munmap (const void*, _RWSTD_SIZE_T) _RWSTD_ATTRIBUTE_NOTHROW;
 
 
 }   // namespace __rw


Reply via email to