pread
pwrite
statvfs
+ strcasestr
strlcpy
strsep
syslog
"-DHAVE_ASPRINTF",
"-DHAVE_LIBGEN",
"-DHAVE_STRCASECMP",
+ "-DHAVE_STRCASESTR",
"-DHAVE_ZLIB",
"-DHAVE_ICONV",
);
"-DHAVE_ASPRINTF",
"-DHAVE_LIBGEN",
"-DHAVE_STRCASECMP",
+ "-DHAVE_STRCASESTR",
"-DHAVE_ZLIB",
"-DHAVE_ICONV",
);
"-DHAVE_ASPRINTF",
"-DHAVE_LIBGEN",
"-DHAVE_STRCASECMP",
+ "-DHAVE_STRCASESTR",
"-DHAVE_ZLIB",
"-DHAVE_ICONV",
);
AC_HEADER_TIME
AC_CHECK_HEADERS([xlocale.h])
-AC_CHECK_FUNCS([iconv pread pwrite lrintf strlcpy daemon dirname basename canonicalize_file_name strcasecmp localtime_r fallocate64 posix_fallocate memmem strsep strtold syslog valloc getpagesize posix_memalign statvfs htonll ntohll mkdtemp uselocale _configthreadlocale])
+AC_CHECK_FUNCS([iconv pread pwrite lrintf strlcpy daemon dirname basename canonicalize_file_name strcasecmp localtime_r fallocate64 posix_fallocate memmem strsep strtold syslog valloc getpagesize posix_memalign statvfs htonll ntohll mkdtemp uselocale _configthreadlocale strcasestr])
AC_PROG_INSTALL
AC_PROG_MAKE_SET
ACX_PTHREAD
target_link_libraries(${TR_NAME} ${ICONV_LIBRARIES})
endif()
+if(WIN32)
+ target_link_libraries(${TR_NAME} shlwapi)
+endif()
+
if(ENABLE_TESTS)
add_library(${TR_NAME}-test STATIC
libtransmission-test.c
{
struct tr_mimepart* p = tr_ptrArrayNth(&parts, i);
- if (tr_memmem(p->headers, p->headers_len, TR_RPC_SESSION_ID_HEADER, strlen(TR_RPC_SESSION_ID_HEADER)) != NULL)
+ if (tr_strcasestr(p->headers, TR_RPC_SESSION_ID_HEADER) != NULL)
{
char const* ours = get_current_session_id(server);
size_t const ourlen = strlen(ours);
#include <ws2tcpip.h> /* WSAStartup() */
#include <windows.h> /* Sleep(), GetSystemTimeAsFileTime(), GetEnvironmentVariable() */
#include <shellapi.h> /* CommandLineToArgv() */
+#include <shlwapi.h> /* StrStrIA() */
#else
#include <sys/time.h>
#include <unistd.h> /* getpagesize() */
#endif
}
+char const* tr_strcasestr(char const* haystack, char const* needle)
+{
+#ifdef HAVE_STRCASESTR
+
+ return strcasestr(haystack, needle);
+
+#elif defined(_WIN32)
+
+ return StrStrIA(haystack, needle);
+
+#else
+
+#error please open a PR to implement tr_strcasestr() for your platform
+
+#endif
+}
+
char* tr_strdup_printf(char const* fmt, ...)
{
va_list ap;
#include <string.h> /* strcmp */
#include <event2/buffer.h>
+#include <event2/util.h>
#define CURL_DISABLE_TYPECHECK /* otherwise -Wunreachable-code goes insane */
#include <curl/curl.h>
char const* key = TR_RPC_SESSION_ID_HEADER ": ";
size_t const key_len = strlen(key);
- if (line_len >= key_len && memcmp(line, key, key_len) == 0)
+ if (line_len >= key_len && evutil_ascii_strncasecmp(line, key, key_len) == 0)
{
char const* begin = line + key_len;
char const* end = begin;