Hi, all! This patch renames the strlcpy defined in strlcpy.c so that it no longer messes with tests by other programs for the presence of a strlcpy function. This patch also fixes compilation on mingw, and fixes a warning in regress_http.c.
cheers, -- Nick Mathewson
=== Makefile.am ================================================================== --- Makefile.am (revision 11673) +++ Makefile.am (local) @@ -40,8 +40,8 @@ endif libevent_la_SOURCES = event.c buffer.c evbuffer.c log.c event_tagging.c \ - http.c evhttp.h http-internal.h evdns.c evdns.h evrpc.c \ - evrpc.h evrpc-internal.h $(SYS_SRC) + http.c evhttp.h http-internal.h evdns.c evdns.h evrpc.c strlcpy.c \ + evrpc.h evrpc-internal.h strlcpy-internal.h $(SYS_SRC) libevent_la_LIBADD = @LTLIBOBJS@ $(SYS_LIBS) libevent_la_LDFLAGS = -release @VERSION@ -version-info 1:3:0 === configure.in ================================================================== --- configure.in (revision 11673) +++ configure.in (local) @@ -132,8 +132,7 @@ AC_HEADER_TIME dnl Checks for library functions. -AC_CHECK_FUNCS(gettimeofday vasprintf fcntl clock_gettime strtok_r strsep getaddrinfo getnameinfo) -AC_REPLACE_FUNCS(strlcpy) +AC_CHECK_FUNCS(gettimeofday vasprintf fcntl clock_gettime strtok_r strsep getaddrinfo getnameinfo strlcpy) if test "x$ac_cv_func_clock_gettime" = "xyes"; then AC_DEFINE(DNS_USE_CPU_CLOCK_FOR_ID, 1, [Define if clock_gettime is available in libc]) === http.c ================================================================== --- http.c (revision 11673) +++ http.c (local) @@ -73,6 +73,7 @@ #undef timeout_pending #undef timeout_initialized +#include "strlcpy-internal.h" #include "event.h" #include "evhttp.h" #include "log.h" === strlcpy.c ================================================================== --- strlcpy.c (revision 11673) +++ strlcpy.c (local) @@ -37,7 +37,8 @@ #include "config.h" #endif /* HAVE_CONFIG_H */ -#include <string.h> +#ifndef HAVE_STRLCPY +#include "strlcpy-internal.h" /* * Copy src to string dst of size siz. At most siz-1 characters @@ -45,7 +46,7 @@ * Returns strlen(src); if retval >= siz, truncation occurred. */ size_t -strlcpy(dst, src, siz) +_event_strlcpy(dst, src, siz) char *dst; const char *src; size_t siz; @@ -72,3 +73,4 @@ return(s - src - 1); /* count does not include NUL */ } +#endif === test/regress_http.c ================================================================== --- test/regress_http.c (revision 11673) +++ test/regress_http.c (local) @@ -128,7 +128,7 @@ event_debug(("%s: %s\n", __func__, EVBUFFER_DATA(bev->input))); - if (evbuffer_find(bev->input, what, strlen(what)) != NULL) { + if (evbuffer_find(bev->input, (const unsigned char*) what, strlen(what)) != NULL) { struct evhttp_request *req = evhttp_request_new(NULL, NULL); req->kind = EVHTTP_RESPONSE; int done = evhttp_parse_lines(req, bev->input); @@ -445,7 +445,7 @@ http_failure_readcb(struct bufferevent *bev, void *arg) { const char *what = "400 Bad Request"; - if (evbuffer_find(bev->input, what, strlen(what)) != NULL) { + if (evbuffer_find(bev->input, (const unsigned char*) what, strlen(what)) != NULL) { test_ok = 2; bufferevent_disable(bev, EV_READ); event_loopexit(NULL);
#ifndef _STRLCPY_INTERNAL_H_ #define _STRLCPY_INTERNAL_H_ #ifdef __cplusplus extern "C" { #endif #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #ifndef HAVE_STRLCPY #include <string.h> size_t _event_strlcpy(char *dst, const char *src, size_t siz); #define strlcpy _event_strlcpy #endif #ifdef __cplusplus } #endif #endif
pgp60WRhtvX37.pgp
Description: PGP signature
_______________________________________________ Libevent-users mailing list Libevent-users@monkey.org http://monkey.org/mailman/listinfo/libevent-users