Index: trunk/psLib/src/math/psPolynomialMetadata.c
===================================================================
--- trunk/psLib/src/math/psPolynomialMetadata.c	(revision 15254)
+++ trunk/psLib/src/math/psPolynomialMetadata.c	(revision 17515)
@@ -12,6 +12,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-10-09 19:25:45 $
+ *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2008-05-05 00:09:04 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -25,4 +25,5 @@
 #include <stdarg.h>
 #include <string.h>
+#include <ctype.h>
 
 #include "psType.h"
@@ -90,4 +91,6 @@
     PS_ASSERT_PTR_NON_NULL(md, false);
     PS_ASSERT_PTR_NON_NULL(poly, false);
+    PS_ASSERT_PTR_NON_NULL(format, false);
+
     //XXX:  Current implementation only supports ordinary polynomials.
     if (poly->type != PS_POLYNOMIAL_ORD)
@@ -99,15 +102,18 @@
     va_list argp;
 
-    va_start (argp, format);
-    Nbyte = vsnprintf (&tmp, 0, format, argp);
-    va_end (argp);
-
-    if (Nbyte <= 0)
-        return false;
+    // skip past whitespace (output name should not include whitespace)
+    char *fmt = (char *) format;
+    while (isspace(*fmt)) fmt++;
+
+    va_start (argp, format);
+    Nbyte = vsnprintf (&tmp, 0, fmt, argp);
+    va_end (argp);
+
+    if (Nbyte <= 0) return false;
 
     va_start (argp, format);
     root = (char *) psAlloc (Nbyte + 1);
     memset (root, 0, Nbyte + 1);
-    vsnprintf (root, Nbyte + 1, format, argp);
+    vsnprintf (root, Nbyte + 1, fmt, argp);
     va_end (argp);
 
@@ -203,4 +209,5 @@
     PS_ASSERT_PTR_NON_NULL(md, false);
     PS_ASSERT_PTR_NON_NULL(poly, false);
+    PS_ASSERT_PTR_NON_NULL(format, false);
 
     // XXX Current implementation only supports ordinary polynomials.
@@ -213,6 +220,10 @@
     va_list argp;
 
-    va_start (argp, format);
-    Nbyte = vsnprintf (&tmp, 0, format, argp);
+    // skip past whitespace (output name should not include whitespace)
+    char *fmt = (char *) format;
+    while (isspace(*fmt)) fmt++;
+
+    va_start (argp, format);
+    Nbyte = vsnprintf (&tmp, 0, fmt, argp);
     va_end (argp);
 
@@ -223,5 +234,5 @@
     root = (char *) psAlloc (Nbyte + 1);
     memset (root, 0, Nbyte + 1);
-    vsnprintf (root, Nbyte + 1, format, argp);
+    vsnprintf (root, Nbyte + 1, fmt, argp);
     va_end (argp);
 
@@ -327,4 +338,6 @@
     PS_ASSERT_PTR_NON_NULL(md, false);
     PS_ASSERT_PTR_NON_NULL(poly, false);
+    PS_ASSERT_PTR_NON_NULL(format, false);
+
     //XXX:  Current implementation only supports ordinary polynomials.
     if (poly->type != PS_POLYNOMIAL_ORD)
@@ -336,6 +349,10 @@
     va_list argp;
 
-    va_start (argp, format);
-    Nbyte = vsnprintf (&tmp, 0, format, argp);
+    // skip past whitespace (output name should not include whitespace)
+    char *fmt = (char *) format;
+    while (isspace(*fmt)) fmt++;
+
+    va_start (argp, format);
+    Nbyte = vsnprintf (&tmp, 0, fmt, argp);
     va_end (argp);
 
@@ -346,5 +363,5 @@
     root = (char *) psAlloc (Nbyte + 1);
     memset (root, 0, Nbyte + 1);
-    vsnprintf (root, Nbyte + 1, format, argp);
+    vsnprintf (root, Nbyte + 1, fmt, argp);
     va_end (argp);
 
@@ -461,4 +478,6 @@
     PS_ASSERT_PTR_NON_NULL(md, false);
     PS_ASSERT_PTR_NON_NULL(poly, false);
+    PS_ASSERT_PTR_NON_NULL(format, false);
+
     //XXX:  Current implementation only supports ordinary polynomials.
     if (poly->type != PS_POLYNOMIAL_ORD)
@@ -470,6 +489,10 @@
     va_list argp;
 
-    va_start (argp, format);
-    Nbyte = vsnprintf (&tmp, 0, format, argp);
+    // skip past whitespace (output name should not include whitespace)
+    char *fmt = (char *) format;
+    while (isspace(*fmt)) fmt++;
+
+    va_start (argp, format);
+    Nbyte = vsnprintf (&tmp, 0, fmt, argp);
     va_end (argp);
 
@@ -480,5 +503,5 @@
     root = (char *) psAlloc (Nbyte + 1);
     memset (root, 0, Nbyte + 1);
-    vsnprintf (root, Nbyte + 1, format, argp);
+    vsnprintf (root, Nbyte + 1, fmt, argp);
     va_end (argp);
 
