changeset 166:ea6936b82915

Defensive treatment of SOAP input Ensure that things that are assumed to be supplied are actually supplied, so that we will fail gracefully rather than trip over broken assumptions...
author mas01cr
date Tue, 06 Nov 2007 16:29:56 +0000
parents 324699d56429
children ecfa25f72b7e
files audioDB.cpp audioDB.h
diffstat 2 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/audioDB.cpp	Tue Nov 06 10:52:32 2007 +0000
+++ b/audioDB.cpp	Tue Nov 06 16:29:56 2007 +0000
@@ -2629,13 +2629,13 @@
     COM_QUERY, 
     queryType, // Need to pass a parameter
     COM_DATABASE,
-    dbName, 
+    ENSURE_STRING(dbName),
     COM_FEATURES,
-    qKey, 
+    ENSURE_STRING(qKey),
     COM_KEYLIST,
-    keyList==0?"":keyList,
+    ENSURE_STRING(keyList),
     COM_TIMES,
-    timesFileName==0?"":timesFileName,
+    ENSURE_STRING(timesFileName),
     COM_QPOINT, 
     qPosStr,
     COM_POINTNN,
--- a/audioDB.h	Tue Nov 06 10:52:32 2007 +0000
+++ b/audioDB.h	Tue Nov 06 16:29:56 2007 +0000
@@ -83,6 +83,8 @@
 #define ALIGN_UP(x,w) ((x) + ((1<<w)-1) & ~((1<<w)-1))
 #define ALIGN_DOWN(x,w) ((x) & ~((1<<w)-1))
 
+#define ENSURE_STRING(x) ((x) ? (x) : "")
+
 using namespace std;
 
 typedef struct dbTableHeader{