]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/getfilter.c
Cast char* argument to hh_to_c() to Byte*
[openldap] / libraries / libldap / getfilter.c
index e466adc243cd70df73960a0ae09591ace8992777..d69ff0e9e881f17e3c1443a87c2105dbe9d6c583 100644 (file)
@@ -1,4 +1,8 @@
 /*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/*  Portions
  *  Copyright (c) 1993 Regents of the University of Michigan.
  *  All rights reserved.
  *
@@ -7,10 +11,6 @@
 
 #include "portable.h"
 
-#ifndef lint 
-static char copyright[] = "@(#) Copyright (c) 1993 Regents of the University of Michigan.\nAll rights reserved.\n";
-#endif
-
 #include <stdio.h>
 #include <stdlib.h>
 
@@ -115,14 +115,14 @@ ldap_init_getfilter_buf( char *buf, long buflen )
                ldap_getfilter_free( lfdp );
                return( NULL );
            }
-           nextflp->lfl_tag = ldap_strdup( tag );
+           nextflp->lfl_tag = strdup( tag );
            nextflp->lfl_pattern = tok[ 0 ];
            if ( (rc = regcomp( &re, nextflp->lfl_pattern, 0 )) != 0 ) {
 #ifdef LDAP_LIBUI
                char error[512];
                regerror(rc, &re, error, sizeof(error));
                ldap_getfilter_free( lfdp );
-               fprintf( stderr, "bad regular expresssion %s, %s\n",
+               fprintf( stderr, "bad regular expression %s, %s\n",
                        nextflp->lfl_pattern, error );
                errno = EINVAL;
 #endif /* LDAP_LIBUI */
@@ -210,12 +210,12 @@ ldap_setfilteraffixes( LDAPFiltDesc *lfdp, char *prefix, char *suffix )
     if ( lfdp->lfd_filtprefix != NULL ) {
        free( lfdp->lfd_filtprefix );
     }
-    lfdp->lfd_filtprefix = ( prefix == NULL ) ? NULL : ldap_strdup( prefix );
+    lfdp->lfd_filtprefix = ( prefix == NULL ) ? NULL : strdup( prefix );
 
     if ( lfdp->lfd_filtsuffix != NULL ) {
        free( lfdp->lfd_filtsuffix );
     }
-    lfdp->lfd_filtsuffix = ( suffix == NULL ) ? NULL : ldap_strdup( suffix );
+    lfdp->lfd_filtsuffix = ( suffix == NULL ) ? NULL : strdup( suffix );
 }
 
 
@@ -264,7 +264,7 @@ ldap_getfirstfilter( LDAPFiltDesc *lfdp, char *tagpat, char *value )
        return( NULL );
     }
 
-    if (( lfdp->lfd_curvalcopy = ldap_strdup( value )) == NULL ) {
+    if (( lfdp->lfd_curvalcopy = strdup( value )) == NULL ) {
        return( NULL );
     }
 
@@ -331,12 +331,12 @@ ldap_build_filter( char *filtbuf, unsigned long buflen, char *pattern,
            if ( *p == '%' ) {
                ++p;
                if ( *p == 'v' ) {
-                   if ( isdigit( *(p+1))) {
+                   if ( isdigit( (unsigned char) p[1] )) {
                        ++p;
                        wordnum = *p - '1';
                        if ( *(p+1) == '-' ) {
                            ++p;
-                           if ( isdigit( *(p+1))) {
+                           if ( isdigit( (unsigned char) p[1] )) {
                                ++p;
                                endwordnum = *p - '1';  /* e.g., "%v2-4" */
                                if ( endwordnum > wordcount - 1 ) {
@@ -405,14 +405,15 @@ break_into_words( char *str, char *delims, char ***wordsp )
 {
     char       *word, **words;
     int                count;
-       
+    char        *tok_r;        
+
     if (( words = (char **)calloc( 1, sizeof( char * ))) == NULL ) {
        return( -1 );
     }
     count = 0;
     words[ count ] = NULL;
 
-    word = strtok( str, delims );
+    word = ldap_pvt_strtok( str, delims, &tok_r );
     while ( word != NULL ) {
        if (( words = (char **)realloc( words,
                ( count + 2 ) * sizeof( char * ))) == NULL ) {
@@ -421,7 +422,7 @@ break_into_words( char *str, char *delims, char ***wordsp )
 
        words[ count ] = word;
        words[ ++count ] = NULL;
-       word = strtok( NULL, delims );
+       word = ldap_pvt_strtok( NULL, delims, &tok_r );
     }
        
     *wordsp = words;