summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/llapr.cpp25
-rw-r--r--indra/llcommon/llapr.h9
-rw-r--r--indra/llcommon/llsdutil.cpp11
-rw-r--r--indra/llcommon/llsdutil.h2
4 files changed, 21 insertions, 26 deletions
diff --git a/indra/llcommon/llapr.cpp b/indra/llcommon/llapr.cpp
index a548c96002..61929e184b 100644
--- a/indra/llcommon/llapr.cpp
+++ b/indra/llcommon/llapr.cpp
@@ -291,35 +291,18 @@ void LLScopedLock::unlock()
//---------------------------------------------------------------------
-bool ll_apr_warn_status(apr_status_t status)
+bool _ll_apr_warn_status(apr_status_t status, const char* file, int line)
{
if(APR_SUCCESS == status) return false;
char buf[MAX_STRING]; /* Flawfinder: ignore */
apr_strerror(status, buf, sizeof(buf));
- LL_WARNS("APR") << "APR: " << buf << LL_ENDL;
+ LL_WARNS("APR") << "APR: " << file << ":" << line << " " << buf << LL_ENDL;
return true;
}
-bool ll_apr_warn_status(apr_status_t status, apr_dso_handle_t *handle)
+void _ll_apr_assert_status(apr_status_t status, const char* file, int line)
{
- bool result = ll_apr_warn_status(status);
- // Despite observed truncation of actual Mac dylib load errors, increasing
- // this buffer to more than MAX_STRING doesn't help: it appears that APR
- // stores the output in a fixed 255-character internal buffer. (*sigh*)
- char buf[MAX_STRING]; /* Flawfinder: ignore */
- apr_dso_error(handle, buf, sizeof(buf));
- LL_WARNS("APR") << "APR: " << buf << LL_ENDL;
- return result;
-}
-
-void ll_apr_assert_status(apr_status_t status)
-{
- llassert(! ll_apr_warn_status(status));
-}
-
-void ll_apr_assert_status(apr_status_t status, apr_dso_handle_t *handle)
-{
- llassert(! ll_apr_warn_status(status, handle));
+ llassert(! _ll_apr_warn_status(status, file, line));
}
//---------------------------------------------------------------------
diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h
index b1b0fc4718..1ac5c4e9b2 100644
--- a/indra/llcommon/llapr.h
+++ b/indra/llcommon/llapr.h
@@ -52,12 +52,11 @@ struct apr_dso_handle_t;
* APR_SUCCESS.
* @return Returns <code>true</code> if status is an error condition.
*/
-bool LL_COMMON_API ll_apr_warn_status(apr_status_t status);
-/// There's a whole other APR error-message function if you pass a DSO handle.
-bool LL_COMMON_API ll_apr_warn_status(apr_status_t status, apr_dso_handle_t* handle);
+#define ll_apr_warn_status(status) _ll_apr_warn_status(status, __FILE__, __LINE__)
+bool LL_COMMON_API _ll_apr_warn_status(apr_status_t status, const char* file, int line);
-void LL_COMMON_API ll_apr_assert_status(apr_status_t status);
-void LL_COMMON_API ll_apr_assert_status(apr_status_t status, apr_dso_handle_t* handle);
+#define ll_apr_assert_status(status) _ll_apr_assert_status(status, __FILE__, __LINE__)
+void LL_COMMON_API _ll_apr_assert_status(apr_status_t status, const char* file, int line);
extern "C" LL_COMMON_API apr_pool_t* gAPRPoolp; // Global APR memory pool
diff --git a/indra/llcommon/llsdutil.cpp b/indra/llcommon/llsdutil.cpp
index 6ad4a97149..8ccd915e6d 100644
--- a/indra/llcommon/llsdutil.cpp
+++ b/indra/llcommon/llsdutil.cpp
@@ -193,6 +193,17 @@ char* ll_pretty_print_sd(const LLSD& sd)
return buffer;
}
+std::string ll_stream_notation_sd(const LLSD& sd)
+{
+ std::ostringstream stream;
+ //stream.rdbuf()->pubsetbuf(buffer, bufferSize);
+ stream << LLSDOStreamer<LLSDNotationFormatter>(sd);
+ stream << std::ends;
+
+ return stream.str();
+}
+
+
//compares the structure of an LLSD to a template LLSD and stores the
//"valid" values in a 3rd LLSD. Default values pulled from the template
//if the tested LLSD does not contain the key/value pair.
diff --git a/indra/llcommon/llsdutil.h b/indra/llcommon/llsdutil.h
index 99cb79aa54..01ab6bcb8d 100644
--- a/indra/llcommon/llsdutil.h
+++ b/indra/llcommon/llsdutil.h
@@ -56,6 +56,8 @@ LL_COMMON_API char* ll_print_sd(const LLSD& sd);
LL_COMMON_API char* ll_pretty_print_sd_ptr(const LLSD* sd);
LL_COMMON_API char* ll_pretty_print_sd(const LLSD& sd);
+LL_COMMON_API std::string ll_stream_notation_sd(const LLSD& sd);
+
//compares the structure of an LLSD to a template LLSD and stores the
//"valid" values in a 3rd LLSD. Default values
//are pulled from the template. Extra keys/values in the test