Mercurial > pidgin.yaz
view libpurple/protocols/zephyr/et_name.c @ 23367:ef4dbd2bb696
Allow a 'Z' (UTC) TZ in strings passed to purple_str_to_time. Used for
parsing (some) MSN SOAP timestamps.
Plucked from im.pidgin.cpw.qulogic.msn, approved by rlaager,
applied changes from 738e1d83d6a690135e101c9612aee628c1b65601
through cc1fdbd7d5ce3915a5d7ad6920066f5951a29e23
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sat, 14 Jun 2008 04:50:35 +0000 |
parents | 5fe8042783c1 |
children |
line wrap: on
line source
/* * Copyright 1987 by MIT Student Information Processing Board * * For copyright info, see mit-sipb-copyright.h. */ #include <sysdep.h> #define ERRCODE_RANGE 8 /* # of bits to shift table number */ #define BITS_PER_CHAR 6 /* # bits to shift per character in name */ static const char char_set[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_"; /* Prototypes for -Wmissing-prototypes */ const char * error_table_name(int num); const char * error_table_name_r(int num, char *buf); const char * error_table_name_r(int num, char *buf) { int ch; int i; char *p; /* num = aa aaa abb bbb bcc ccc cdd ddd d?? ??? ??? */ p = buf; num >>= ERRCODE_RANGE; /* num = ?? ??? ??? aaa aaa bbb bbb ccc ccc ddd ddd */ num &= 077777777; /* num = 00 000 000 aaa aaa bbb bbb ccc ccc ddd ddd */ for (i = 4; i >= 0; i--) { ch = (num >> BITS_PER_CHAR * i) & ((1 << BITS_PER_CHAR) - 1); if (ch != 0) *p++ = char_set[ch-1]; } *p = '\0'; return(buf); } const char * error_table_name(int num) { static char buf[6]; return(error_table_name_r(num, buf)); }