|
From: <br...@us...> - 2009-10-19 02:04:29
|
Revision: 3999
http://openvrml.svn.sourceforge.net/openvrml/?rev=3999&view=rev
Author: braden
Date: 2009-10-19 02:04:21 +0000 (Mon, 19 Oct 2009)
Log Message:
-----------
Make throw_runtime_error_from_win32_system_error available to other translation units.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/Makefile.am
trunk/src/libopenvrml/openvrml/local/conf.cpp
Added Paths:
-----------
trunk/src/libopenvrml/openvrml/local/error.cpp
trunk/src/libopenvrml/openvrml/local/error.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-10-05 07:21:09 UTC (rev 3998)
+++ trunk/ChangeLog 2009-10-19 02:04:21 UTC (rev 3999)
@@ -1,3 +1,13 @@
+2009-10-18 Braden McDaniel <br...@en...>
+
+ Make throw_runtime_error_from_win32_system_error available to
+ other translation units.
+
+ * src/Makefile.am
+ * src/libopenvrml/openvrml/local/conf.cpp
+ * src/libopenvrml/openvrml/local/error.cpp
+ * src/libopenvrml/openvrml/local/error.h
+
2009-10-05 Braden McDaniel <br...@en...>
* Makefile.am (VISUALC9_0_FILES): Added openvrml-dl.vcproj to the
Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am 2009-10-05 07:21:09 UTC (rev 3998)
+++ trunk/src/Makefile.am 2009-10-19 02:04:21 UTC (rev 3999)
@@ -96,6 +96,8 @@
libopenvrml/openvrml/node_impl_util.cpp \
libopenvrml/openvrml/local/conf.cpp \
libopenvrml/openvrml/local/conf.h \
+ libopenvrml/openvrml/local/error.cpp \
+ libopenvrml/openvrml/local/error.h \
libopenvrml/openvrml/local/uri.cpp \
libopenvrml/openvrml/local/uri.h \
libopenvrml/openvrml/local/xml_reader.cpp \
Modified: trunk/src/libopenvrml/openvrml/local/conf.cpp
===================================================================
--- trunk/src/libopenvrml/openvrml/local/conf.cpp 2009-10-05 07:21:09 UTC (rev 3998)
+++ trunk/src/libopenvrml/openvrml/local/conf.cpp 2009-10-19 02:04:21 UTC (rev 3999)
@@ -19,6 +19,7 @@
//
# include "conf.h"
+# include "error.h"
# include <boost/multi_index/detail/scope_guard.hpp>
# include <boost/ref.hpp>
# include <boost/tokenizer.hpp>
@@ -64,25 +65,6 @@
}
# ifdef _WIN32
- void throw_runtime_error(LONG result) OPENVRML_THROW1(std::runtime_error)
- {
- using boost::ref;
-
- static const LPCVOID source;
- LPTSTR buf = 0;
- scope_guard buf_guard = make_guard(LocalFree, ref(buf));
- FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM
- | FORMAT_MESSAGE_ALLOCATE_BUFFER,
- source,
- result,
- LANG_USER_DEFAULT,
- reinterpret_cast< LPTSTR >(&buf),
- 0,
- 0);
-
- throw std::runtime_error(buf);
- }
-
const std::string query_registry_value(HKEY key, const std::string & name)
OPENVRML_THROW2(std::runtime_error, std::bad_alloc)
{
@@ -101,7 +83,9 @@
data.resize(data.size() * 2);
}
- if (result != 0) { throw_runtime_error(result); }
+ if (result != 0) {
+ throw_runtime_error_from_win32_system_error(result);
+ }
_ASSERTE(type == REG_SZ);
@@ -125,7 +109,7 @@
&key);
if (result != ERROR_SUCCESS) {
if (result == ERROR_FILE_NOT_FOUND) { throw no_registry_key(); }
- throw_runtime_error(result);
+ throw_runtime_error_from_win32_system_error(result);
}
return query_registry_value(key, name);
Added: trunk/src/libopenvrml/openvrml/local/error.cpp
===================================================================
--- trunk/src/libopenvrml/openvrml/local/error.cpp (rev 0)
+++ trunk/src/libopenvrml/openvrml/local/error.cpp 2009-10-19 02:04:21 UTC (rev 3999)
@@ -0,0 +1,43 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 78 -*-
+//
+// OpenVRML
+//
+// Copyright 2009 Braden McDaniel
+//
+// This library is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or (at
+// your option) any later version.
+//
+// This library is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+// License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, see <http://www.gnu.org/licenses/>.
+//
+
+# include "error.h"
+
+# ifdef _WIN32
+void openvrml::local::throw_runtime_error_from_win32_system_error(LONG result)
+ OPENVRML_THROW1(std::runtime_error)
+{
+ using boost::ref;
+
+ static const LPCVOID source;
+ LPTSTR buf = 0;
+ scope_guard buf_guard = make_guard(LocalFree, ref(buf));
+ FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM
+ | FORMAT_MESSAGE_ALLOCATE_BUFFER,
+ source,
+ result,
+ LANG_USER_DEFAULT,
+ reinterpret_cast< LPTSTR >(&buf),
+ 0,
+ 0);
+
+ throw std::runtime_error(buf);
+}
+# endif
Property changes on: trunk/src/libopenvrml/openvrml/local/error.cpp
___________________________________________________________________
Added: svn:eol-style
+ native
Added: trunk/src/libopenvrml/openvrml/local/error.h
===================================================================
--- trunk/src/libopenvrml/openvrml/local/error.h (rev 0)
+++ trunk/src/libopenvrml/openvrml/local/error.h 2009-10-19 02:04:21 UTC (rev 3999)
@@ -0,0 +1,42 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 78 -*-
+//
+// OpenVRML
+//
+// Copyright 2009 Braden McDaniel
+//
+// This library is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or (at
+// your option) any later version.
+//
+// This library is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+// License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, see <http://www.gnu.org/licenses/>.
+//
+
+# ifndef OPENVRML_LOCAL_ERROR_H
+# define OPENVRML_LOCAL_ERROR_H
+
+# include <openvrml-common.h>
+# include <stdexcept>
+# ifdef _WIN32
+# include <windows.h>
+# endif
+
+namespace openvrml {
+
+ namespace local {
+
+# ifdef _WIN32
+ OPENVRML_LOCAL
+ void throw_runtime_error_from_win32_system_error(LONG error)
+ OPENVRML_THROW1(std::runtime_error);
+# endif
+ }
+}
+
+# endif // ifndef OPENVRML_LOCAL_ERROR_H
Property changes on: trunk/src/libopenvrml/openvrml/local/error.h
___________________________________________________________________
Added: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|