1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-19 03:52:17 +00:00
freebsd-ports/net-im/jabber/files/patch-jabberd_log.cc
Jan Beich 9f60a6df34 net-im/jabber: unbreak with libc++ 3.9
log.cc:89:8: error: assigning to 'char *' from incompatible type 'const char *'
        pos = strchr(zone,'.');
              ^~~~~~~~~~~~~~~~
xmlnode.cc:913:21: error: assigning to 'char *' from incompatible type 'const char *'
    start_predicate = strchr(path, '[');
                    ^ ~~~~~~~~~~~~~~~~~
xmlnode.cc:914:15: error: assigning to 'char *' from incompatible type 'const char *'
    next_step = strchr(path, '/');
              ^ ~~~~~~~~~~~~~~~~~
xmlnode.cc:1836:27: error: read-only variable is not assignable
            strchr(lang, '-')[0] = 0;
            ~~~~~~~~~~~~~~~~~~~~ ^

Reported by:	pkg-fallout
2017-02-01 12:30:08 +00:00

33 lines
850 B
C++

--- jabberd/log.cc.orig 2007-07-20 13:56:59 UTC
+++ jabberd/log.cc
@@ -83,21 +83,22 @@ static char *debug_log_timestamp(void) {
* @return 1 if it should be logged, 0 if not
*/
static inline int _debug_log_zonefilter(char const* zone) {
- char *pos, c = '\0';
+ const char *pos;
+ char *tmp;
+ int ret = 1;
if(zone != NULL && debug__zones != NULL)
{
pos = strchr(zone,'.');
if(pos != NULL)
{
- c = *pos;
- *pos = '\0'; /* chop */
+ tmp = strndup(zone, pos - zone);
}
- if(xhash_get(debug__zones,zone) == NULL)
- return 0;
+ if(xhash_get(debug__zones, (pos ? tmp : zone)) == NULL)
+ ret = 0;
if(pos != NULL)
- *pos = c; /* restore */
+ free(tmp);
}
- return 1;
+ return ret;
}
/**