projects
/
oweals
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix argument processing.
[oweals/openssl.git]
/
crypto
/
o_str.c
diff --git
a/crypto/o_str.c
b/crypto/o_str.c
index 0bdfb40076baed71f89bffe05dec677da0c7f94b..60c01c10a40667c29e35395ce65bef12523400d6 100644
(file)
--- a/
crypto/o_str.c
+++ b/
crypto/o_str.c
@@
-57,13
+57,18
@@
*/
#include <ctype.h>
*/
#include <ctype.h>
-#include <
string
s.h>
+#include <
e_o
s.h>
#include "o_str.h"
#include "o_str.h"
-#include <openssl/e_os2.h>
+
+#if !defined(OPENSSL_IMPLEMENTS_strncasecmp) && \
+ !defined(OPENSSL_SYSNAME_WIN32) && !defined(OPENSSL_SYSNAME_WINCE) && \
+ !defined(NETWARE_CLIB)
+# include <strings.h>
+#endif
int OPENSSL_strncasecmp(const char *str1, const char *str2, size_t n)
{
int OPENSSL_strncasecmp(const char *str1, const char *str2, size_t n)
{
-#if defined(OPENSSL_
SYS_VMS
)
+#if defined(OPENSSL_
IMPLEMENTS_strncasecmp
)
while (*str1 && *str2 && n)
{
int res = toupper(*str1) - toupper(*str2);
while (*str1 && *str2 && n)
{
int res = toupper(*str1) - toupper(*str2);
@@
-79,20
+84,28
@@
int OPENSSL_strncasecmp(const char *str1, const char *str2, size_t n)
if (*str2)
return -1;
return 0;
if (*str2)
return -1;
return 0;
-#elif defined(OPENSSL_SYS_WINDOWS)
- return _strnicmp(str1, str2, n);
#else
#else
+ /* Recursion hazard warning! Whenever strncasecmp is #defined as
+ * OPENSSL_strncasecmp, OPENSSL_IMPLEMENTS_strncasecmp must be
+ * defined as well. */
return strncasecmp(str1, str2, n);
#endif
}
int OPENSSL_strcasecmp(const char *str1, const char *str2)
{
return strncasecmp(str1, str2, n);
#endif
}
int OPENSSL_strcasecmp(const char *str1, const char *str2)
{
-#if defined(OPENSSL_
SYS_VMS
)
+#if defined(OPENSSL_
IMPLEMENTS_strncasecmp
)
return OPENSSL_strncasecmp(str1, str2, (size_t)-1);
return OPENSSL_strncasecmp(str1, str2, (size_t)-1);
-#elif defined(OPENSSL_SYS_WINDOWS)
- return _stricmp(str1, str2);
#else
return strcasecmp(str1, str2);
#endif
}
#else
return strcasecmp(str1, str2);
#endif
}
+int OPENSSL_memcmp(const void *v1,const void *v2,size_t n)
+ {
+ const unsigned char *c1=v1,*c2=v2;
+ int ret=0;
+
+ while(n && (ret=*c1-*c2)==0) n--,c1++,c2++;
+
+ return ret;
+ }