Index: /trunk/gsdl/src/colservr/browsefilter.cpp
===================================================================
--- /trunk/gsdl/src/colservr/browsefilter.cpp	(revision 11258)
+++ /trunk/gsdl/src/colservr/browsefilter.cpp	(revision 11259)
@@ -57,5 +57,5 @@
   filtopt.type = FilterOption_t::stringt;
   filtopt.repeatable = FilterOption_t::onePerQuery;
-  filtopt.defaultValue = "";
+  filtopt.defaultValue = g_EmptyText;
   filterOptions["ParentNode"] = filtopt;
 }
Index: /trunk/gsdl/src/mgpp/text/GSDLQueryLex.cpp
===================================================================
--- /trunk/gsdl/src/mgpp/text/GSDLQueryLex.cpp	(revision 11258)
+++ /trunk/gsdl/src/mgpp/text/GSDLQueryLex.cpp	(revision 11259)
@@ -43,5 +43,5 @@
   // this version of end is used in unitool
   //  UCArray::const_iterator endMinus1 = end-1;
-  const unsigned char* endMinus1 = &(*end)-1;
+  const unsigned char* endMinus1 = &*(end - 1);
 
   int charLen;
@@ -83,5 +83,5 @@
   // this version of end is used in unitool
   //UCArray::const_iterator endMinus1 = end-1;
-  const unsigned char* endMinus1 = &(*end)-1;
+  const unsigned char* endMinus1 = &*(end - 1);
 
   int charLen=0;
@@ -123,6 +123,9 @@
 		       UCArray::const_iterator end,
 		       UCArray &text) {
+  if (here == end)
+    return false;
+
   //UCArray::const_iterator endMinus1 = end-1;
-  const unsigned char* endMinus1 = &(*end)-1;
+  const unsigned char* endMinus1 = &*(end - 1);
   const unsigned char* new_here = ParseIndexWord (&*here, endMinus1, text);
   here += (new_here - &*here); // advance iterator by number of chars advanced
@@ -137,9 +140,10 @@
 
   // strange things can happen if here == end == 0
-  if (here == end) return false;
+  if (here == end)
+    return false;
   
   // this version of end is used in unitool
   //UCArray::const_iterator endMinus1 = end-1;
-  const unsigned char* endMinus1 = &(*end)-1;
+  const unsigned char* endMinus1 = &*(end - 1);
 
   // ignore all white space
Index: /trunk/gsdl/src/recpt/OIDtools.cpp
===================================================================
--- /trunk/gsdl/src/recpt/OIDtools.cpp	(revision 11258)
+++ /trunk/gsdl/src/recpt/OIDtools.cpp	(revision 11259)
@@ -229,7 +229,7 @@
 // get_parent returns the parent of the document or classification
 // specified by OID
-text_t get_parent (text_t OID) {
-
-  if (OID.empty() || is_top (OID)) return "";
+text_t get_parent (const text_t& OID)
+{
+  if (OID.empty() || is_top (OID)) return g_EmptyText;
 
   text_t::const_iterator begin = OID.begin();
@@ -237,9 +237,18 @@
 
   while (here >= begin) {
-    OID.pop_back();
-    if (*here == '.') break;
+    if (*here == '.')
+      break;
+    if (here == begin)
+      break;
     --here;
   }
-  return OID;
+
+  if (here != begin) {
+    text_t parentOID;
+    parentOID.appendrange(begin, here);
+    return parentOID;
+  }
+
+  return g_EmptyText;
 }
 
Index: /trunk/gsdl/src/recpt/OIDtools.h
===================================================================
--- /trunk/gsdl/src/recpt/OIDtools.h	(revision 11258)
+++ /trunk/gsdl/src/recpt/OIDtools.h	(revision 11259)
@@ -93,5 +93,5 @@
 // get_parent returns the parent of the document or classification
 // specified by OID
-text_t get_parent (text_t OID);
+text_t get_parent (const text_t& OID);
 
 // takes an OID like ".2.3 and replaces the " with parent
Index: /trunk/gsdl/src/recpt/cgiutils.cpp
===================================================================
--- /trunk/gsdl/src/recpt/cgiutils.cpp	(revision 11258)
+++ /trunk/gsdl/src/recpt/cgiutils.cpp	(revision 11259)
@@ -374,6 +374,7 @@
   text_t::const_iterator saveconfend = saveconf.end();
   
-  text_t::iterator arg_ehere = arg_e->begin();
+  text_t::iterator arg_ebegin = arg_e->begin();
   text_t::iterator arg_eend = arg_e->end();
+  text_t::iterator arg_ehere = arg_ebegin;
   while (saveconfhere != saveconfend && arg_ehere != arg_eend) {
     saveconfhere = get_next_save_arg (saveconfhere, saveconfend, argname);
@@ -399,17 +400,18 @@
 	  text_t::const_iterator sav = arg_ehere;
 	  arg_ehere = getdelimitstr (arg_ehere, arg_eend, '-', argvalue);
-	  // replace any '-' chars escaped with 'Zz'
-	  bool first = true;
-	  while ((*(arg_ehere-3) == 'Z') && (*(arg_ehere-2) == 'z')) {
-	    if (first) argvalue.clear();
-	    arg_ehere = (findchar (arg_ehere, arg_eend, '-')) + 1;
-	    while (sav != (arg_ehere-1)) {
-	      if (!((*sav == 'Z') && (*(sav+1) == 'z') && (*(sav+2) == '-')) &&
-		  !((*(sav-1) == 'Z') && (*sav == 'z') && (*(sav+1) == '-'))) argvalue.push_back (*sav);
-	      ++sav;
+	  if (distance(arg_ebegin, arg_ehere) > 2) {
+	    // replace any '-' chars escaped with 'Zz'
+	    bool first = true;
+	    while ((*(arg_ehere-3) == 'Z') && (*(arg_ehere-2) == 'z')) {
+	      if (first) argvalue.clear();
+	      arg_ehere = (findchar (arg_ehere, arg_eend, '-')) + 1;
+	      while (sav != (arg_ehere-1)) {
+		if (!((*sav == 'Z') && (*(sav+1) == 'z') && (*(sav+2) == '-')) &&
+		    !((*(sav-1) == 'Z') && (*sav == 'z') && (*(sav+1) == '-'))) argvalue.push_back (*sav);
+		++sav;
+	      }
+	      first = false;
 	    }
-	    first = false;
 	  }
-
 	  argvalue.setencoding(1); // other encoding
 	  if (!argvalue.empty()) args.setdefaultarg (argname, argvalue, cgiarg_t::compressed_arg);
Index: /trunk/gsdl/src/recpt/comtypes.cpp
===================================================================
--- /trunk/gsdl/src/recpt/comtypes.cpp	(revision 11258)
+++ /trunk/gsdl/src/recpt/comtypes.cpp	(revision 11259)
@@ -65,5 +65,5 @@
   numBytes=0;
   format.erase(format.begin(), format.end());
-  building.erase(format.begin(), format.end());
+  building.erase(building.begin(), building.end());
   httpdomain.clear();
   httpprefix.clear();
Index: /trunk/gsdl/src/recpt/infodbclass.cpp
===================================================================
--- /trunk/gsdl/src/recpt/infodbclass.cpp	(revision 11258)
+++ /trunk/gsdl/src/recpt/infodbclass.cpp	(revision 11259)
@@ -384,5 +384,5 @@
   }
 
-  if (!tailarray.size()) return inOID;
+  if (tailarray.empty()) return inOID;
   text_tarray::const_iterator begin = tailarray.begin();
   text_tarray::const_iterator here = tailarray.end() - 1;
@@ -401,4 +401,6 @@
       get_previous_sibling (OID, info);
     
+    if (here == begin)
+      break;
     --here;
   }
Index: /trunk/gsdl/src/w32server/httpreq.cpp
===================================================================
--- /trunk/gsdl/src/w32server/httpreq.cpp	(revision 11258)
+++ /trunk/gsdl/src/w32server/httpreq.cpp	(revision 11259)
@@ -299,4 +299,6 @@
 		  RequestInfo.ThreadNum) != 0)
 	return GH_ERROR;
+      if (NextLine.empty())
+	break;
       if ((*(NextLine.begin()) == ' ') || (*(NextLine.begin()) == '\t')) {
 	CurLine += NextLine;
