ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/eplus_idf.c
(Generate patch)

Comparing ray/src/util/eplus_idf.c (file contents):
Revision 2.1 by greg, Sat Feb 1 01:28:43 2014 UTC vs.
Revision 2.2 by greg, Sat Feb 1 02:13:24 2014 UTC

# Line 163 | Line 163 | idf_read_argument(char *buf, FILE *fp, int trim)
163                  if (skipwhite && isspace(c))
164                          continue;
165                  skipwhite = 0;
166 <                if (cp-buf < IDF_MAXLINE-1)
166 >                if (cp-buf < IDF_MAXARGL-1)
167                          *cp++ = c;
168          }
169          if (trim)
# Line 203 | Line 203 | idf_read_comment(char *buf, int len, FILE *fp)
203   IDF_PARAMETER *
204   idf_readparam(IDF_LOADED *idf, FILE *fp)
205   {
206 <        char            abuf[IDF_MAXLINE], cbuf[IDF_MAXLINE];
206 >        char            abuf[IDF_MAXARGL], cbuf[IDF_MAXLINE];
207          int             delim;
208          IDF_PARAMETER   *pnew;
209          
# Line 221 | Line 221 | idf_readparam(IDF_LOADED *idf, FILE *fp)
221          return(pnew);
222   }
223  
224 + /* Upper-case string hashing function */
225 + static unsigned long
226 + strcasehash(const char *s)
227 + {
228 +        char            strup[IDF_MAXARGL];
229 +        char            *cdst = strup;
230 +
231 +        while ((*cdst++ = toupper(*s++)))
232 +                if (cdst >= strup+(sizeof(strup)-1)) {
233 +                        *cdst = '\0';
234 +                        break;
235 +                }
236 +        return(lu_shash(strup));
237 + }
238 +
239   /* Initialize an IDF struct */
240   IDF_LOADED *
241   idf_create(const char *hdrcomm)
# Line 229 | Line 244 | idf_create(const char *hdrcomm)
244  
245          if (idf == NULL)
246                  return(NULL);
247 <        idf->ptab.hashf = &lu_shash;
248 <        idf->ptab.keycmp = &strcmp;
247 >        idf->ptab.hashf = &strcasehash;
248 >        idf->ptab.keycmp = &strcasecmp;
249          idf->ptab.freek = &free;
250          lu_init(&idf->ptab, 200);
251          if (hdrcomm != NULL && *hdrcomm) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines