Replace ctype usage

The ctype functions are error prone. The argument is an int which must
be in the range of an unsigned char and is interpreted based on the
locale:

    These functions check whether c, which must have the value of
    an unsigned char or EOF, falls into a certain character class
    according to the  specified  locale. The  functions without the
    "_l" suffix perform the check based on the current locale.
master 0.14.9
Michael Santos 11 months ago
parent ff574f6412
commit 24b5a81456

@ -12,7 +12,6 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <ctype.h>
#include <err.h>
#include <limits.h>
#include <stdio.h>
@ -27,7 +26,7 @@
#include "strtonum.h"
#endif
#define XMPPIPE_VERSION "0.14.8"
#define XMPPIPE_VERSION "0.14.9"
#define XMPPIPE_RESOURCE "xmppipe"
#define XMPPIPE_STREQ(a, b) (strcmp((a), (b)) == 0)

@ -21,8 +21,9 @@ int xmppipe_fmt_init(void) {
int i = 0;
for (i = 0; i < 256; i++)
rfc3986[i] = isalnum(i) || i == '~' || i == '-' || i == '.' || i == '_' ||
i == '@' || i == '/'
rfc3986[i] = (i >= '0' && i <= '9') || (i >= 'a' && i <= 'z') ||
(i >= 'A' && i <= 'Z') || i == '~' || i == '-' ||
i == '.' || i == '_' || i == '@' || i == '/'
? i
: 0;

Loading…
Cancel
Save