;;
esac
+have_mingw='no'
+case $host_os in
+ mingw*)
+ have_mingw='yes'
+ ;;
+esac
+
+AM_CONDITIONAL([HAVE_MINGW],
+ [test "$curl_cv_native_windows" = 'yes' -a "$have_mingw" = 'yes'])
+
AM_CONDITIONAL([HAVE_WINDRES],
[test "$curl_cv_native_windows" = "yes" && test -n "${RC}"])
if(LIB_SELECTED STREQUAL LIB_STATIC AND WIN32)
set_property(TARGET ${_example_target} APPEND PROPERTY COMPILE_DEFINITIONS "CURL_STATICLIB")
endif()
+ if(MINGW)
+ # For mingw-w64 7.0.0 and earlier to avoid '-Wformat='
+ set_property(TARGET ${_example_target} APPEND PROPERTY COMPILE_DEFINITIONS "__USE_MINGW_ANSI_STDIO=1")
+ endif()
set_target_properties(${_example_target} PROPERTIES
OUTPUT_NAME "${_example}" UNITY_BUILD OFF)
endforeach()
AM_CPPFLAGS += -DCURL_STATICLIB
endif
+if HAVE_MINGW
+# For mingw-w64 7.0.0 and earlier to avoid '-Wformat='
+AM_CPPFLAGS += -D__USE_MINGW_ANSI_STDIO=1
+endif
+
# Prevent LIBS from being used for all link targets
LIBS = $(BLANK_AT_MAKETIME)
res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T,
&filesize);
if((CURLE_OK == res) && (filesize>0))
- printf("filesize %s: %" CURL_FORMAT_CURL_OFF_T " bytes\n",
- filename, filesize);
+ curl_mprintf("filesize %s: %" CURL_FORMAT_CURL_OFF_T " bytes\n",
+ filename, filesize);
}
else {
/* we failed */
if(LIB_SELECTED STREQUAL LIB_STATIC AND WIN32)
set_property(TARGET ${_test_target} APPEND PROPERTY COMPILE_DEFINITIONS "CURL_STATICLIB")
endif()
+ if(MINGW)
+ # For mingw-w64 7.0.0 and earlier to avoid '-Wformat='
+ set_property(TARGET ${_test_target} APPEND PROPERTY COMPILE_DEFINITIONS "__USE_MINGW_ANSI_STDIO=1")
+ endif()
set_target_properties(${_test_target} PROPERTIES
OUTPUT_NAME "${_test_name}" UNITY_BUILD OFF
PROJECT_LABEL "Test client ${_test_target}")
AM_CPPFLAGS += -DCURL_STATICLIB
endif
+if HAVE_MINGW
+# For mingw-w64 7.0.0 and earlier to avoid '-Wformat='
+AM_CPPFLAGS += -D__USE_MINGW_ANSI_STDIO=1
+endif
+
# Prevent LIBS from being used for all link targets
LIBS = $(BLANK_AT_MAKETIME)
#include <unistd.h> /* getopt() */
#endif
-#ifdef _MSC_VER
-#define snprintf _snprintf
-#endif
-
#ifndef CURLPIPE_MULTIPLEX
#error "too old libcurl, cannot do HTTP/2 server push!"
#endif
if(!curl_easy_getinfo(handle, CURLINFO_XFER_ID, &xfer_id) && xfer_id >= 0) {
if(!curl_easy_getinfo(handle, CURLINFO_CONN_ID, &conn_id) &&
- conn_id >= 0) {
- snprintf(idsbuf, sizeof(idsbuf), TRC_IDS_FORMAT_IDS_2, xfer_id, conn_id);
+ conn_id >= 0) {
+ curl_msnprintf(idsbuf, sizeof(idsbuf), TRC_IDS_FORMAT_IDS_2, xfer_id,
+ conn_id);
}
else {
- snprintf(idsbuf, sizeof(idsbuf), TRC_IDS_FORMAT_IDS_1, xfer_id);
+ curl_msnprintf(idsbuf, sizeof(idsbuf), TRC_IDS_FORMAT_IDS_1, xfer_id);
}
}
else
fprintf(stderr, "[t-%d] RECV %ld bytes, total=%ld, pause_at=%ld\n",
t->idx, (long)blen, (long)t->recv_size, (long)t->pause_at);
if(!t->out) {
- snprintf(t->filename, sizeof(t->filename)-1, "download_%u.data", t->idx);
+ curl_msnprintf(t->filename, sizeof(t->filename)-1, "download_%u.data",
+ t->idx);
t->out = fopen(t->filename, "wb");
if(!t->out)
return 0;
#include <unistd.h> /* getopt() */
#endif
-#ifdef _MSC_VER
-#define snprintf _snprintf
-#endif
-
#ifndef _MSC_VER
#define HANDLECOUNT 2
if(!curl_easy_getinfo(handle, CURLINFO_XFER_ID, &xfer_id) && xfer_id >= 0) {
if(!curl_easy_getinfo(handle, CURLINFO_CONN_ID, &conn_id) &&
conn_id >= 0) {
- snprintf(idsbuf, sizeof(idsbuf), TRC_IDS_FORMAT_IDS_2, xfer_id, conn_id);
+ curl_msnprintf(idsbuf, sizeof(idsbuf), TRC_IDS_FORMAT_IDS_2, xfer_id,
+ conn_id);
}
else {
- snprintf(idsbuf, sizeof(idsbuf), TRC_IDS_FORMAT_IDS_1, xfer_id);
+ curl_msnprintf(idsbuf, sizeof(idsbuf), TRC_IDS_FORMAT_IDS_1, xfer_id);
}
}
else
exit(1);
}
memset(&resolve, 0, sizeof(resolve));
- snprintf(resolve_buf, sizeof(resolve_buf)-1, "%s:%s:127.0.0.1", host, port);
+ curl_msnprintf(resolve_buf, sizeof(resolve_buf)-1, "%s:%s:127.0.0.1",
+ host, port);
resolve = curl_slist_append(resolve, resolve_buf);
for(i = 0; i<HANDLECOUNT; i++) {
#error "too old libcurl, cannot do HTTP/2 server push!"
#endif
-#ifdef _MSC_VER
-#define snprintf _snprintf
-#endif
-
static
void dump(const char *text, unsigned char *ptr, size_t size,
char nohex)
int rv;
(void)parent; /* we have no use for this */
- snprintf(filename, sizeof(filename)-1, "push%u", count++);
+ curl_msnprintf(filename, sizeof(filename)-1, "push%u", count++);
/* here's a new stream, save it in a new file for each new push */
out = fopen(filename, "wb");
/* #include <error.h> */
#include <errno.h>
-#ifdef _MSC_VER
-#define snprintf _snprintf
-#endif
-
static void log_line_start(FILE *log, const char *idsbuf, curl_infotype type)
{
/*
if(!curl_easy_getinfo(handle, CURLINFO_XFER_ID, &xfer_id) && xfer_id >= 0) {
if(!curl_easy_getinfo(handle, CURLINFO_CONN_ID, &conn_id) &&
conn_id >= 0) {
- snprintf(idsbuf, sizeof(idsbuf), TRC_IDS_FORMAT_IDS_2, xfer_id, conn_id);
+ curl_msnprintf(idsbuf, sizeof(idsbuf), TRC_IDS_FORMAT_IDS_2, xfer_id,
+ conn_id);
}
else {
- snprintf(idsbuf, sizeof(idsbuf), TRC_IDS_FORMAT_IDS_1, xfer_id);
+ curl_msnprintf(idsbuf, sizeof(idsbuf), TRC_IDS_FORMAT_IDS_1, xfer_id);
}
}
else
curl_easy_setopt(easy, CURLOPT_WRITEFUNCTION, write_cb);
curl_easy_setopt(easy, CURLOPT_WRITEDATA, NULL);
curl_easy_setopt(easy, CURLOPT_HTTPGET, 1L);
- snprintf(range, sizeof(range), "%d-%d", 0, 16384);
+ curl_msnprintf(range, sizeof(range),
+ "%" CURL_FORMAT_CURL_OFF_TU "-"
+ "%" CURL_FORMAT_CURL_OFF_TU,
+ (curl_off_t)0,
+ (curl_off_t)16384);
curl_easy_setopt(easy, CURLOPT_RANGE, range);
mc = curl_multi_add_handle(multi, easy);
/* #include <error.h> */
#include <errno.h>
-#ifdef _MSC_VER
-#define snprintf _snprintf
-#endif
-
static void log_line_start(FILE *log, const char *idsbuf, curl_infotype type)
{
/*
if(!curl_easy_getinfo(handle, CURLINFO_XFER_ID, &xfer_id) && xfer_id >= 0) {
if(!curl_easy_getinfo(handle, CURLINFO_CONN_ID, &conn_id) &&
conn_id >= 0) {
- snprintf(idsbuf, sizeof(idsbuf), TRC_IDS_FORMAT_IDS_2, xfer_id, conn_id);
+ curl_msnprintf(idsbuf, sizeof(idsbuf), TRC_IDS_FORMAT_IDS_2, xfer_id,
+ conn_id);
}
else {
- snprintf(idsbuf, sizeof(idsbuf), TRC_IDS_FORMAT_IDS_1, xfer_id);
+ curl_msnprintf(idsbuf, sizeof(idsbuf), TRC_IDS_FORMAT_IDS_1, xfer_id);
}
}
else
}
memset(&resolve, 0, sizeof(resolve));
- snprintf(resolve_buf, sizeof(resolve_buf)-1, "%s:%s:127.0.0.1", host, port);
+ curl_msnprintf(resolve_buf, sizeof(resolve_buf)-1, "%s:%s:127.0.0.1",
+ host, port);
curl_slist_append(&resolve, resolve_buf);
multi = curl_multi_init();
#include <unistd.h> /* getopt() */
#endif
-#ifdef _MSC_VER
-#define snprintf _snprintf
-#endif
-
#ifndef _MSC_VER
static void log_line_start(FILE *log, const char *idsbuf, curl_infotype type)
{
if(!curl_easy_getinfo(handle, CURLINFO_XFER_ID, &xfer_id) && xfer_id >= 0) {
if(!curl_easy_getinfo(handle, CURLINFO_CONN_ID, &conn_id) &&
conn_id >= 0) {
- snprintf(idsbuf, sizeof(idsbuf), TRC_IDS_FORMAT_IDS_2, xfer_id, conn_id);
+ curl_msnprintf(idsbuf, sizeof(idsbuf), TRC_IDS_FORMAT_IDS_2, xfer_id,
+ conn_id);
}
else {
- snprintf(idsbuf, sizeof(idsbuf), TRC_IDS_FORMAT_IDS_1, xfer_id);
+ curl_msnprintf(idsbuf, sizeof(idsbuf), TRC_IDS_FORMAT_IDS_1, xfer_id);
}
}
else
exit(1);
}
memset(&resolve, 0, sizeof(resolve));
- snprintf(resolve_buf, sizeof(resolve_buf)-1, "%s:%s:127.0.0.1", host, port);
+ curl_msnprintf(resolve_buf, sizeof(resolve_buf)-1, "%s:%s:127.0.0.1",
+ host, port);
resolve = curl_slist_append(resolve, resolve_buf);
curl = curl_easy_init();