|
Packit |
3f21c4 |
/* Copyright (C) 2001-2012 Artifex Software, Inc.
|
|
Packit |
3f21c4 |
All Rights Reserved.
|
|
Packit |
3f21c4 |
|
|
Packit |
3f21c4 |
This software is provided AS-IS with no warranty, either express or
|
|
Packit |
3f21c4 |
implied.
|
|
Packit |
3f21c4 |
|
|
Packit |
3f21c4 |
This software is distributed under license and may not be copied,
|
|
Packit |
3f21c4 |
modified or distributed except as expressly authorized under the terms
|
|
Packit |
3f21c4 |
of the license contained in the file LICENSE in this distribution.
|
|
Packit |
3f21c4 |
|
|
Packit |
3f21c4 |
Refer to licensing information at http://www.artifex.com or contact
|
|
Packit |
3f21c4 |
Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael,
|
|
Packit |
3f21c4 |
CA 94903, U.S.A., +1(415)492-9861, for further information.
|
|
Packit |
3f21c4 |
*/
|
|
Packit |
3f21c4 |
|
|
Packit |
3f21c4 |
/*
|
|
Packit |
3f21c4 |
jbig2dec
|
|
Packit |
3f21c4 |
*/
|
|
Packit |
3f21c4 |
|
|
Packit |
3f21c4 |
#ifdef HAVE_CONFIG_H
|
|
Packit |
3f21c4 |
#include "config.h"
|
|
Packit |
3f21c4 |
#endif
|
|
Packit |
3f21c4 |
|
|
Packit |
3f21c4 |
#include <stddef.h>
|
|
Packit |
3f21c4 |
|
|
Packit |
3f21c4 |
/* replacement for broken memcmp() */
|
|
Packit |
3f21c4 |
|
|
Packit |
3f21c4 |
/*
|
|
Packit |
3f21c4 |
* compares two byte strings 'a' and 'b', both assumed to be 'len' bytes long
|
|
Packit |
3f21c4 |
* returns zero if the two strings are identical, otherwise returns -1 or 1
|
|
Packit |
3f21c4 |
* depending on the relative magnitude of the first differing elements,
|
|
Packit |
3f21c4 |
* considered as unsigned chars
|
|
Packit |
3f21c4 |
*/
|
|
Packit |
3f21c4 |
|
|
Packit |
3f21c4 |
int
|
|
Packit |
3f21c4 |
memcmp(const void *b1, const void *b2, size_t len)
|
|
Packit |
3f21c4 |
{
|
|
Packit |
3f21c4 |
unsigned char *a, *b;
|
|
Packit |
3f21c4 |
size_t i;
|
|
Packit |
3f21c4 |
|
|
Packit |
3f21c4 |
a = (unsigned char *)b1;
|
|
Packit |
3f21c4 |
b = (unsigned char *)b2;
|
|
Packit |
3f21c4 |
for (i = 0; i < len; i++) {
|
|
Packit |
3f21c4 |
if (*a != *b) {
|
|
Packit |
3f21c4 |
/* strings differ */
|
|
Packit |
3f21c4 |
return (*a < *b) ? -1 : 1;
|
|
Packit |
3f21c4 |
}
|
|
Packit |
3f21c4 |
a++;
|
|
Packit |
3f21c4 |
b++;
|
|
Packit |
3f21c4 |
}
|
|
Packit |
3f21c4 |
|
|
Packit |
3f21c4 |
/* strings match */
|
|
Packit |
3f21c4 |
return 0;
|
|
Packit |
3f21c4 |
}
|