Path: blob/master/Utilities/cmcurl/include/curl/mprintf.h
3158 views
#ifndef CURLINC_MPRINTF_H1#define CURLINC_MPRINTF_H2/***************************************************************************3* _ _ ____ _4* Project ___| | | | _ \| |5* / __| | | | |_) | |6* | (__| |_| | _ <| |___7* \___|\___/|_| \_\_____|8*9* Copyright (C) Daniel Stenberg, <[email protected]>, et al.10*11* This software is licensed as described in the file COPYING, which12* you should have received as part of this distribution. The terms13* are also available at https://curl.se/docs/copyright.html.14*15* You may opt to use, copy, modify, merge, publish, distribute and/or sell16* copies of the Software, and permit persons to whom the Software is17* furnished to do so, under the terms of the COPYING file.18*19* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY20* KIND, either express or implied.21*22* SPDX-License-Identifier: curl23*24***************************************************************************/2526#include <stdarg.h>27#include <stdio.h> /* needed for FILE */28#include "curl.h" /* for CURL_EXTERN */2930#ifdef __cplusplus31extern "C" {32#endif3334#ifndef CURL_TEMP_PRINTF35#if (defined(__GNUC__) || defined(__clang__) || \36defined(__IAR_SYSTEMS_ICC__)) && \37defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \38!defined(CURL_NO_FMT_CHECKS)39#if defined(__MINGW32__) && !defined(__clang__)40#if defined(__MINGW_PRINTF_FORMAT) /* mingw-w64 3.0.0+. Needs stdio.h. */41#define CURL_TEMP_PRINTF(fmt, arg) \42__attribute__((format(__MINGW_PRINTF_FORMAT, fmt, arg)))43#else44#define CURL_TEMP_PRINTF(fmt, arg)45#endif46#else47#define CURL_TEMP_PRINTF(fmt, arg) \48__attribute__((format(printf, fmt, arg)))49#endif50#else51#define CURL_TEMP_PRINTF(fmt, arg)52#endif53#endif5455CURL_EXTERN int curl_mprintf(const char *format, ...)56CURL_TEMP_PRINTF(1, 2);57CURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...)58CURL_TEMP_PRINTF(2, 3);59CURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...)60CURL_TEMP_PRINTF(2, 3);61CURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength,62const char *format, ...)63CURL_TEMP_PRINTF(3, 4);64CURL_EXTERN int curl_mvprintf(const char *format, va_list args)65CURL_TEMP_PRINTF(1, 0);66CURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args)67CURL_TEMP_PRINTF(2, 0);68CURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args)69CURL_TEMP_PRINTF(2, 0);70CURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength,71const char *format, va_list args)72CURL_TEMP_PRINTF(3, 0);73CURL_EXTERN char *curl_maprintf(const char *format, ...)74CURL_TEMP_PRINTF(1, 2);75CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args)76CURL_TEMP_PRINTF(1, 0);7778#undef CURL_TEMP_PRINTF7980#ifdef __cplusplus81} /* end of extern "C" */82#endif8384#endif /* CURLINC_MPRINTF_H */858687