├── .gitignore ├── lib ├── libcurl.a └── libcurl_a.lib ├── README_CN.md ├── LICENSE ├── README.md ├── include ├── stdcheaders.h ├── Makefile.am ├── options.h ├── mprintf.h ├── websockets.h ├── header.h ├── curlver.h ├── easy.h ├── urlapi.h ├── multi.h ├── system.h ├── Makefile.in └── typecheck-gcc.h ├── CMakeLists.txt └── SteamIconFix.cpp /.gitignore: -------------------------------------------------------------------------------- 1 | /cmake-build-debug/ 2 | /cmake-build-release/ 3 | /.idea 4 | /build/ -------------------------------------------------------------------------------- /lib/libcurl.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ez4y2f/SteamIconFix/HEAD/lib/libcurl.a -------------------------------------------------------------------------------- /lib/libcurl_a.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ez4y2f/SteamIconFix/HEAD/lib/libcurl_a.lib -------------------------------------------------------------------------------- /README_CN.md: -------------------------------------------------------------------------------- 1 | # Steam Icon Fix 2 | ##### 修复Steam空白的桌面图标 3 | ### 食用方法 4 | 直接运行,选择CDN时可以直接回车,自动修复桌面和开始菜单的快捷方式和你库里的游戏 5 | ### 常见问题 6 | - _Download Failed. Check your network! Error 23_ 图标文件可能被占用了,重启电脑试试 7 | - _E[GetDirFiles] Failed open dir._ 试试管理员方式运行? 8 | - _E Steam is not installed, exiting..._ 检查你的Steam安装目录,或者点击[下载链接](https://store.steampowered.com/about/)重新下载Steam 9 | - _E Cannot find Desktop, exiting..._ 打开注册表编辑器,找到如下目录:HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders,在其中添加名称为Desktop的字符串,数据为你的桌面路径 10 | - _W Cannot find steam icon dir, manual input>_ 把你Steam安装目录拖进来(Steam安装目录/steam/games) 11 | - _W Cannot find desktop dir, manual input>_ 把桌面目录拖进来 12 | - _E invalid shortcut_ 试试把这个快捷方式删掉,重新在库里创建个快捷方式 13 | - _E download failed. Check your network!_ 可以把错误码发给我,试着关掉vpn加速器反代,或者换个网络环境 14 | - _下载下来的图标还是0KB空白的_ 在选择CDN时候换个其他的,关掉反代,或者换个网络环境 15 | ### 警告 16 | 采用了第三方api获取clienticon,可能不安全 17 | ### 感谢 18 | - libcurl 19 | - winsock32 20 | - wldap32 21 | - winmm 22 | - crypt32 23 | - normaliz 24 | - bcrypt 25 | - jsoncpp 26 | - @inory121 Github 手动选择桌面路径 27 | - @Zinc-in Github 修复bug 28 | - @在下叶板 Bilibili 帮我找出好多bug(( -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 ez4y2f 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Steam Icon Fix 2 | ##### Fix the blank icon of steam apps 3 | [中文版本](README_CN.md) 4 | ### Requirements 5 | - libcurl 6 | - jsoncpp 7 | - winsock32 8 | - wldap32 9 | - winmm 10 | - crypt32 11 | - normaliz 12 | - bcrypt 13 | ### Usage 14 | Run it, and it will fix all icons found in Desktop&your library. 15 | ### Errors 16 | - _Download Failed. Check your network! Error 23_ icon file may in use, try to reboot your machine. 17 | - _E[GetDirFiles] Failed open dir._ No enough Premissions(it seems impossible). 18 | - _E Steam is not installed, exiting..._ Please check your steam installation,or click this [link](https://store.steampowered.com/about/) to download steam client. 19 | - _E Cannot find Desktop, exiting..._ Run regedit and find this location:HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders,right click the right window and create string value named Desktop,paste your desktop location in the data textbox. 20 | - _W Cannot find steam icon dir, manual input>_ Drag your steam icon dir in {SteamInstallPath}/steam/games. 21 | - _W Cannot find desktop dir, manual input>_ Drag your desktop dir into it 22 | - _E invalid shortcut_ It seems broken, try delete the shortcut and re-create it. 23 | - _E download failed. Check your network!_ Curl error code will display.(Maybe Turn off your vpn?) 24 | ### Warning 25 | It used a third-party API to get clientIcon from appId. 26 | -------------------------------------------------------------------------------- /include/stdcheaders.h: -------------------------------------------------------------------------------- 1 | #ifndef CURLINC_STDCHEADERS_H 2 | #define CURLINC_STDCHEADERS_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #include 28 | 29 | size_t fread(void *, size_t, size_t, FILE *); 30 | size_t fwrite(const void *, size_t, size_t, FILE *); 31 | 32 | int strcasecmp(const char *, const char *); 33 | int strncasecmp(const char *, const char *, size_t); 34 | 35 | #endif /* CURLINC_STDCHEADERS_H */ 36 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.27) 2 | 3 | if(NOT DEFINED CMAKE_TOOLCHAIN_FILE) 4 | if(DEFINED ENV{VCPKG_ROOT}) 5 | set(_VCPKG_CANDIDATE "$ENV{VCPKG_ROOT}") 6 | else() 7 | if(EXISTS "C:/vcpkg/scripts/buildsystems/vcpkg.cmake") 8 | set(_VCPKG_CANDIDATE "C:/vcpkg") 9 | elseif(DEFINED ENV{USERPROFILE}) 10 | set(_SCOOP_VCPKG_DIR "$ENV{USERPROFILE}/scoop/apps/vcpkg/current") 11 | if(EXISTS "${_SCOOP_VCPKG_DIR}/scripts/buildsystems/vcpkg.cmake") 12 | set(_VCPKG_CANDIDATE "${_SCOOP_VCPKG_DIR}") 13 | endif() 14 | endif() 15 | endif() 16 | 17 | if(DEFINED _VCPKG_CANDIDATE) 18 | set(CMAKE_TOOLCHAIN_FILE 19 | "${_VCPKG_CANDIDATE}/scripts/buildsystems/vcpkg.cmake" 20 | CACHE STRING "" FORCE) 21 | message(STATUS "Using vcpkg toolchain from: ${CMAKE_TOOLCHAIN_FILE}") 22 | else() 23 | message(STATUS "vcpkg not found automatically (no VCPKG_ROOT, C:/vcpkg 或 scoop vcpkg)") 24 | endif() 25 | endif() 26 | 27 | set(VCPKG_TARGET_TRIPLET "x64-mingw-static" CACHE STRING "") 28 | 29 | project(SteamIconFix) 30 | set(CMAKE_CXX_STANDARD 23) 31 | 32 | find_package(CURL REQUIRED) 33 | find_package(jsoncpp CONFIG REQUIRED) 34 | 35 | add_executable(SteamIconFix 36 | SteamIconFix.cpp) 37 | 38 | if (MINGW) 39 | set(CMAKE_EXE_LINKER_FLAGS 40 | "${CMAKE_EXE_LINKER_FLAGS} -static -static-libgcc -static-libstdc++") 41 | endif() 42 | 43 | target_link_libraries(SteamIconFix PRIVATE CURL::libcurl) 44 | target_link_libraries(SteamIconFix PRIVATE JsonCpp::JsonCpp) -------------------------------------------------------------------------------- /include/Makefile.am: -------------------------------------------------------------------------------- 1 | #*************************************************************************** 2 | # _ _ ____ _ 3 | # Project ___| | | | _ \| | 4 | # / __| | | | |_) | | 5 | # | (__| |_| | _ <| |___ 6 | # \___|\___/|_| \_\_____| 7 | # 8 | # Copyright (C) Daniel Stenberg, , et al. 9 | # 10 | # This software is licensed as described in the file COPYING, which 11 | # you should have received as part of this distribution. The terms 12 | # are also available at https://curl.se/docs/copyright.html. 13 | # 14 | # You may opt to use, copy, modify, merge, publish, distribute and/or sell 15 | # copies of the Software, and permit persons to whom the Software is 16 | # furnished to do so, under the terms of the COPYING file. 17 | # 18 | # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 19 | # KIND, either express or implied. 20 | # 21 | # SPDX-License-Identifier: curl 22 | # 23 | ########################################################################### 24 | pkginclude_HEADERS = \ 25 | curl.h curlver.h easy.h mprintf.h stdcheaders.h multi.h \ 26 | typecheck-gcc.h system.h urlapi.h options.h header.h websockets.h 27 | 28 | pkgincludedir= $(includedir)/curl 29 | 30 | CHECKSRC = $(CS_$(V)) 31 | CS_0 = @echo " RUN " $@; 32 | CS_1 = 33 | CS_ = $(CS_0) 34 | 35 | checksrc: 36 | $(CHECKSRC)@PERL@ $(top_srcdir)/scripts/checksrc.pl -D$(top_srcdir)/include/curl $(pkginclude_HEADERS) 37 | 38 | if CURLDEBUG 39 | # for debug builds, we scan the sources on all regular make invokes 40 | all-local: checksrc 41 | endif 42 | -------------------------------------------------------------------------------- /include/options.h: -------------------------------------------------------------------------------- 1 | #ifndef CURLINC_OPTIONS_H 2 | #define CURLINC_OPTIONS_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | typedef enum { 32 | CURLOT_LONG, /* long (a range of values) */ 33 | CURLOT_VALUES, /* (a defined set or bitmask) */ 34 | CURLOT_OFF_T, /* curl_off_t (a range of values) */ 35 | CURLOT_OBJECT, /* pointer (void *) */ 36 | CURLOT_STRING, /* (char * to null-terminated buffer) */ 37 | CURLOT_SLIST, /* (struct curl_slist *) */ 38 | CURLOT_CBPTR, /* (void * passed as-is to a callback) */ 39 | CURLOT_BLOB, /* blob (struct curl_blob *) */ 40 | CURLOT_FUNCTION /* function pointer */ 41 | } curl_easytype; 42 | 43 | /* Flag bits */ 44 | 45 | /* "alias" means it is provided for old programs to remain functional, 46 | we prefer another name */ 47 | #define CURLOT_FLAG_ALIAS (1<<0) 48 | 49 | /* The CURLOPTTYPE_* id ranges can still be used to figure out what type/size 50 | to use for curl_easy_setopt() for the given id */ 51 | struct curl_easyoption { 52 | const char *name; 53 | CURLoption id; 54 | curl_easytype type; 55 | unsigned int flags; 56 | }; 57 | 58 | CURL_EXTERN const struct curl_easyoption * 59 | curl_easy_option_by_name(const char *name); 60 | 61 | CURL_EXTERN const struct curl_easyoption * 62 | curl_easy_option_by_id(CURLoption id); 63 | 64 | CURL_EXTERN const struct curl_easyoption * 65 | curl_easy_option_next(const struct curl_easyoption *prev); 66 | 67 | #ifdef __cplusplus 68 | } /* end of extern "C" */ 69 | #endif 70 | #endif /* CURLINC_OPTIONS_H */ 71 | -------------------------------------------------------------------------------- /include/mprintf.h: -------------------------------------------------------------------------------- 1 | #ifndef CURLINC_MPRINTF_H 2 | #define CURLINC_MPRINTF_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #include 28 | #include /* needed for FILE */ 29 | #include "curl.h" /* for CURL_EXTERN */ 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif 34 | 35 | #if (defined(__GNUC__) || defined(__clang__)) && \ 36 | defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \ 37 | !defined(__MINGW32__) && !defined(CURL_NO_FMT_CHECKS) 38 | #define CURL_TEMP_PRINTF(a,b) __attribute__ ((format(printf, a, b))) 39 | #else 40 | #define CURL_TEMP_PRINTF(a,b) 41 | #endif 42 | 43 | CURL_EXTERN int curl_mprintf(const char *format, ...) CURL_TEMP_PRINTF(1, 2); 44 | CURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...) 45 | CURL_TEMP_PRINTF(2, 3); 46 | CURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...) 47 | CURL_TEMP_PRINTF(2, 3); 48 | CURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength, 49 | const char *format, ...) CURL_TEMP_PRINTF(3, 4); 50 | CURL_EXTERN int curl_mvprintf(const char *format, va_list args) 51 | CURL_TEMP_PRINTF(1, 0); 52 | CURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args) 53 | CURL_TEMP_PRINTF(2, 0); 54 | CURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args) 55 | CURL_TEMP_PRINTF(2, 0); 56 | CURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength, 57 | const char *format, va_list args) 58 | CURL_TEMP_PRINTF(3, 0); 59 | CURL_EXTERN char *curl_maprintf(const char *format, ...) 60 | CURL_TEMP_PRINTF(1, 2); 61 | CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args) 62 | CURL_TEMP_PRINTF(1, 0); 63 | 64 | #undef CURL_TEMP_PRINTF 65 | 66 | #ifdef __cplusplus 67 | } /* end of extern "C" */ 68 | #endif 69 | 70 | #endif /* CURLINC_MPRINTF_H */ 71 | -------------------------------------------------------------------------------- /include/websockets.h: -------------------------------------------------------------------------------- 1 | #ifndef CURLINC_WEBSOCKETS_H 2 | #define CURLINC_WEBSOCKETS_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | struct curl_ws_frame { 32 | int age; /* zero */ 33 | int flags; /* See the CURLWS_* defines */ 34 | curl_off_t offset; /* the offset of this data into the frame */ 35 | curl_off_t bytesleft; /* number of pending bytes left of the payload */ 36 | size_t len; /* size of the current data chunk */ 37 | }; 38 | 39 | /* flag bits */ 40 | #define CURLWS_TEXT (1<<0) 41 | #define CURLWS_BINARY (1<<1) 42 | #define CURLWS_CONT (1<<2) 43 | #define CURLWS_CLOSE (1<<3) 44 | #define CURLWS_PING (1<<4) 45 | #define CURLWS_OFFSET (1<<5) 46 | 47 | /* 48 | * NAME curl_ws_recv() 49 | * 50 | * DESCRIPTION 51 | * 52 | * Receives data from the websocket connection. Use after successful 53 | * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. 54 | */ 55 | CURL_EXTERN CURLcode curl_ws_recv(CURL *curl, void *buffer, size_t buflen, 56 | size_t *recv, 57 | const struct curl_ws_frame **metap); 58 | 59 | /* flags for curl_ws_send() */ 60 | #define CURLWS_PONG (1<<6) 61 | 62 | /* 63 | * NAME curl_ws_send() 64 | * 65 | * DESCRIPTION 66 | * 67 | * Sends data over the websocket connection. Use after successful 68 | * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. 69 | */ 70 | CURL_EXTERN CURLcode curl_ws_send(CURL *curl, const void *buffer, 71 | size_t buflen, size_t *sent, 72 | curl_off_t fragsize, 73 | unsigned int flags); 74 | 75 | /* bits for the CURLOPT_WS_OPTIONS bitmask: */ 76 | #define CURLWS_RAW_MODE (1<<0) 77 | 78 | CURL_EXTERN const struct curl_ws_frame *curl_ws_meta(CURL *curl); 79 | 80 | #ifdef __cplusplus 81 | } 82 | #endif 83 | 84 | #endif /* CURLINC_WEBSOCKETS_H */ 85 | -------------------------------------------------------------------------------- /include/header.h: -------------------------------------------------------------------------------- 1 | #ifndef CURLINC_HEADER_H 2 | #define CURLINC_HEADER_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | struct curl_header { 32 | char *name; /* this might not use the same case */ 33 | char *value; 34 | size_t amount; /* number of headers using this name */ 35 | size_t index; /* ... of this instance, 0 or higher */ 36 | unsigned int origin; /* see bits below */ 37 | void *anchor; /* handle privately used by libcurl */ 38 | }; 39 | 40 | /* 'origin' bits */ 41 | #define CURLH_HEADER (1<<0) /* plain server header */ 42 | #define CURLH_TRAILER (1<<1) /* trailers */ 43 | #define CURLH_CONNECT (1<<2) /* CONNECT headers */ 44 | #define CURLH_1XX (1<<3) /* 1xx headers */ 45 | #define CURLH_PSEUDO (1<<4) /* pseudo headers */ 46 | 47 | typedef enum { 48 | CURLHE_OK, 49 | CURLHE_BADINDEX, /* header exists but not with this index */ 50 | CURLHE_MISSING, /* no such header exists */ 51 | CURLHE_NOHEADERS, /* no headers at all exist (yet) */ 52 | CURLHE_NOREQUEST, /* no request with this number was used */ 53 | CURLHE_OUT_OF_MEMORY, /* out of memory while processing */ 54 | CURLHE_BAD_ARGUMENT, /* a function argument was not okay */ 55 | CURLHE_NOT_BUILT_IN /* if API was disabled in the build */ 56 | } CURLHcode; 57 | 58 | CURL_EXTERN CURLHcode curl_easy_header(CURL *easy, 59 | const char *name, 60 | size_t index, 61 | unsigned int origin, 62 | int request, 63 | struct curl_header **hout); 64 | 65 | CURL_EXTERN struct curl_header *curl_easy_nextheader(CURL *easy, 66 | unsigned int origin, 67 | int request, 68 | struct curl_header *prev); 69 | 70 | #ifdef __cplusplus 71 | } /* end of extern "C" */ 72 | #endif 73 | 74 | #endif /* CURLINC_HEADER_H */ 75 | -------------------------------------------------------------------------------- /include/curlver.h: -------------------------------------------------------------------------------- 1 | #ifndef CURLINC_CURLVER_H 2 | #define CURLINC_CURLVER_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | /* This header file contains nothing but libcurl version info, generated by 28 | a script at release-time. This was made its own header file in 7.11.2 */ 29 | 30 | /* This is the global package copyright */ 31 | #define LIBCURL_COPYRIGHT "Daniel Stenberg, ." 32 | 33 | /* This is the version number of the libcurl package from which this header 34 | file origins: */ 35 | #define LIBCURL_VERSION "8.5.0" 36 | 37 | /* The numeric version number is also available "in parts" by using these 38 | defines: */ 39 | #define LIBCURL_VERSION_MAJOR 8 40 | #define LIBCURL_VERSION_MINOR 5 41 | #define LIBCURL_VERSION_PATCH 0 42 | 43 | /* This is the numeric version of the libcurl version number, meant for easier 44 | parsing and comparisons by programs. The LIBCURL_VERSION_NUM define will 45 | always follow this syntax: 46 | 47 | 0xXXYYZZ 48 | 49 | Where XX, YY and ZZ are the main version, release and patch numbers in 50 | hexadecimal (using 8 bits each). All three numbers are always represented 51 | using two digits. 1.2 would appear as "0x010200" while version 9.11.7 52 | appears as "0x090b07". 53 | 54 | This 6-digit (24 bits) hexadecimal number does not show pre-release number, 55 | and it is always a greater number in a more recent release. It makes 56 | comparisons with greater than and less than work. 57 | 58 | Note: This define is the full hex number and _does not_ use the 59 | CURL_VERSION_BITS() macro since curl's own configure script greps for it 60 | and needs it to contain the full number. 61 | */ 62 | #define LIBCURL_VERSION_NUM 0x080500 63 | 64 | /* 65 | * This is the date and time when the full source package was created. The 66 | * timestamp is not stored in git, as the timestamp is properly set in the 67 | * tarballs by the maketgz script. 68 | * 69 | * The format of the date follows this template: 70 | * 71 | * "2007-11-23" 72 | */ 73 | #define LIBCURL_TIMESTAMP "2023-12-06" 74 | 75 | #define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|(z)) 76 | #define CURL_AT_LEAST_VERSION(x,y,z) \ 77 | (LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z)) 78 | 79 | #endif /* CURLINC_CURLVER_H */ 80 | -------------------------------------------------------------------------------- /include/easy.h: -------------------------------------------------------------------------------- 1 | #ifndef CURLINC_EASY_H 2 | #define CURLINC_EASY_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* Flag bits in the curl_blob struct: */ 31 | #define CURL_BLOB_COPY 1 /* tell libcurl to copy the data */ 32 | #define CURL_BLOB_NOCOPY 0 /* tell libcurl to NOT copy the data */ 33 | 34 | struct curl_blob { 35 | void *data; 36 | size_t len; 37 | unsigned int flags; /* bit 0 is defined, the rest are reserved and should be 38 | left zeroes */ 39 | }; 40 | 41 | CURL_EXTERN CURL *curl_easy_init(void); 42 | CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...); 43 | CURL_EXTERN CURLcode curl_easy_perform(CURL *curl); 44 | CURL_EXTERN void curl_easy_cleanup(CURL *curl); 45 | 46 | /* 47 | * NAME curl_easy_getinfo() 48 | * 49 | * DESCRIPTION 50 | * 51 | * Request internal information from the curl session with this function. 52 | * The third argument MUST be pointing to the specific type of the used option 53 | * which is documented in each man page of the option. The data pointed to 54 | * will be filled in accordingly and can be relied upon only if the function 55 | * returns CURLE_OK. This function is intended to get used *AFTER* a performed 56 | * transfer, all results from this function are undefined until the transfer 57 | * is completed. 58 | */ 59 | CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...); 60 | 61 | 62 | /* 63 | * NAME curl_easy_duphandle() 64 | * 65 | * DESCRIPTION 66 | * 67 | * Creates a new curl session handle with the same options set for the handle 68 | * passed in. Duplicating a handle could only be a matter of cloning data and 69 | * options, internal state info and things like persistent connections cannot 70 | * be transferred. It is useful in multithreaded applications when you can run 71 | * curl_easy_duphandle() for each new thread to avoid a series of identical 72 | * curl_easy_setopt() invokes in every thread. 73 | */ 74 | CURL_EXTERN CURL *curl_easy_duphandle(CURL *curl); 75 | 76 | /* 77 | * NAME curl_easy_reset() 78 | * 79 | * DESCRIPTION 80 | * 81 | * Re-initializes a CURL handle to the default values. This puts back the 82 | * handle to the same state as it was in when it was just created. 83 | * 84 | * It does keep: live connections, the Session ID cache, the DNS cache and the 85 | * cookies. 86 | */ 87 | CURL_EXTERN void curl_easy_reset(CURL *curl); 88 | 89 | /* 90 | * NAME curl_easy_recv() 91 | * 92 | * DESCRIPTION 93 | * 94 | * Receives data from the connected socket. Use after successful 95 | * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. 96 | */ 97 | CURL_EXTERN CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen, 98 | size_t *n); 99 | 100 | /* 101 | * NAME curl_easy_send() 102 | * 103 | * DESCRIPTION 104 | * 105 | * Sends data over the connected socket. Use after successful 106 | * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. 107 | */ 108 | CURL_EXTERN CURLcode curl_easy_send(CURL *curl, const void *buffer, 109 | size_t buflen, size_t *n); 110 | 111 | 112 | /* 113 | * NAME curl_easy_upkeep() 114 | * 115 | * DESCRIPTION 116 | * 117 | * Performs connection upkeep for the given session handle. 118 | */ 119 | CURL_EXTERN CURLcode curl_easy_upkeep(CURL *curl); 120 | 121 | #ifdef __cplusplus 122 | } /* end of extern "C" */ 123 | #endif 124 | 125 | #endif 126 | -------------------------------------------------------------------------------- /include/urlapi.h: -------------------------------------------------------------------------------- 1 | #ifndef CURLINC_URLAPI_H 2 | #define CURLINC_URLAPI_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #include "curl.h" 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | /* the error codes for the URL API */ 34 | typedef enum { 35 | CURLUE_OK, 36 | CURLUE_BAD_HANDLE, /* 1 */ 37 | CURLUE_BAD_PARTPOINTER, /* 2 */ 38 | CURLUE_MALFORMED_INPUT, /* 3 */ 39 | CURLUE_BAD_PORT_NUMBER, /* 4 */ 40 | CURLUE_UNSUPPORTED_SCHEME, /* 5 */ 41 | CURLUE_URLDECODE, /* 6 */ 42 | CURLUE_OUT_OF_MEMORY, /* 7 */ 43 | CURLUE_USER_NOT_ALLOWED, /* 8 */ 44 | CURLUE_UNKNOWN_PART, /* 9 */ 45 | CURLUE_NO_SCHEME, /* 10 */ 46 | CURLUE_NO_USER, /* 11 */ 47 | CURLUE_NO_PASSWORD, /* 12 */ 48 | CURLUE_NO_OPTIONS, /* 13 */ 49 | CURLUE_NO_HOST, /* 14 */ 50 | CURLUE_NO_PORT, /* 15 */ 51 | CURLUE_NO_QUERY, /* 16 */ 52 | CURLUE_NO_FRAGMENT, /* 17 */ 53 | CURLUE_NO_ZONEID, /* 18 */ 54 | CURLUE_BAD_FILE_URL, /* 19 */ 55 | CURLUE_BAD_FRAGMENT, /* 20 */ 56 | CURLUE_BAD_HOSTNAME, /* 21 */ 57 | CURLUE_BAD_IPV6, /* 22 */ 58 | CURLUE_BAD_LOGIN, /* 23 */ 59 | CURLUE_BAD_PASSWORD, /* 24 */ 60 | CURLUE_BAD_PATH, /* 25 */ 61 | CURLUE_BAD_QUERY, /* 26 */ 62 | CURLUE_BAD_SCHEME, /* 27 */ 63 | CURLUE_BAD_SLASHES, /* 28 */ 64 | CURLUE_BAD_USER, /* 29 */ 65 | CURLUE_LACKS_IDN, /* 30 */ 66 | CURLUE_LAST 67 | } CURLUcode; 68 | 69 | typedef enum { 70 | CURLUPART_URL, 71 | CURLUPART_SCHEME, 72 | CURLUPART_USER, 73 | CURLUPART_PASSWORD, 74 | CURLUPART_OPTIONS, 75 | CURLUPART_HOST, 76 | CURLUPART_PORT, 77 | CURLUPART_PATH, 78 | CURLUPART_QUERY, 79 | CURLUPART_FRAGMENT, 80 | CURLUPART_ZONEID /* added in 7.65.0 */ 81 | } CURLUPart; 82 | 83 | #define CURLU_DEFAULT_PORT (1<<0) /* return default port number */ 84 | #define CURLU_NO_DEFAULT_PORT (1<<1) /* act as if no port number was set, 85 | if the port number matches the 86 | default for the scheme */ 87 | #define CURLU_DEFAULT_SCHEME (1<<2) /* return default scheme if 88 | missing */ 89 | #define CURLU_NON_SUPPORT_SCHEME (1<<3) /* allow non-supported scheme */ 90 | #define CURLU_PATH_AS_IS (1<<4) /* leave dot sequences */ 91 | #define CURLU_DISALLOW_USER (1<<5) /* no user+password allowed */ 92 | #define CURLU_URLDECODE (1<<6) /* URL decode on get */ 93 | #define CURLU_URLENCODE (1<<7) /* URL encode on set */ 94 | #define CURLU_APPENDQUERY (1<<8) /* append a form style part */ 95 | #define CURLU_GUESS_SCHEME (1<<9) /* legacy curl-style guessing */ 96 | #define CURLU_NO_AUTHORITY (1<<10) /* Allow empty authority when the 97 | scheme is unknown. */ 98 | #define CURLU_ALLOW_SPACE (1<<11) /* Allow spaces in the URL */ 99 | #define CURLU_PUNYCODE (1<<12) /* get the host name in punycode */ 100 | #define CURLU_PUNY2IDN (1<<13) /* punycode => IDN conversion */ 101 | 102 | typedef struct Curl_URL CURLU; 103 | 104 | /* 105 | * curl_url() creates a new CURLU handle and returns a pointer to it. 106 | * Must be freed with curl_url_cleanup(). 107 | */ 108 | CURL_EXTERN CURLU *curl_url(void); 109 | 110 | /* 111 | * curl_url_cleanup() frees the CURLU handle and related resources used for 112 | * the URL parsing. It will not free strings previously returned with the URL 113 | * API. 114 | */ 115 | CURL_EXTERN void curl_url_cleanup(CURLU *handle); 116 | 117 | /* 118 | * curl_url_dup() duplicates a CURLU handle and returns a new copy. The new 119 | * handle must also be freed with curl_url_cleanup(). 120 | */ 121 | CURL_EXTERN CURLU *curl_url_dup(const CURLU *in); 122 | 123 | /* 124 | * curl_url_get() extracts a specific part of the URL from a CURLU 125 | * handle. Returns error code. The returned pointer MUST be freed with 126 | * curl_free() afterwards. 127 | */ 128 | CURL_EXTERN CURLUcode curl_url_get(const CURLU *handle, CURLUPart what, 129 | char **part, unsigned int flags); 130 | 131 | /* 132 | * curl_url_set() sets a specific part of the URL in a CURLU handle. Returns 133 | * error code. The passed in string will be copied. Passing a NULL instead of 134 | * a part string, clears that part. 135 | */ 136 | CURL_EXTERN CURLUcode curl_url_set(CURLU *handle, CURLUPart what, 137 | const char *part, unsigned int flags); 138 | 139 | /* 140 | * curl_url_strerror() turns a CURLUcode value into the equivalent human 141 | * readable error string. This is useful for printing meaningful error 142 | * messages. 143 | */ 144 | CURL_EXTERN const char *curl_url_strerror(CURLUcode); 145 | 146 | #ifdef __cplusplus 147 | } /* end of extern "C" */ 148 | #endif 149 | 150 | #endif /* CURLINC_URLAPI_H */ 151 | -------------------------------------------------------------------------------- /include/multi.h: -------------------------------------------------------------------------------- 1 | #ifndef CURLINC_MULTI_H 2 | #define CURLINC_MULTI_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | /* 27 | This is an "external" header file. Don't give away any internals here! 28 | 29 | GOALS 30 | 31 | o Enable a "pull" interface. The application that uses libcurl decides where 32 | and when to ask libcurl to get/send data. 33 | 34 | o Enable multiple simultaneous transfers in the same thread without making it 35 | complicated for the application. 36 | 37 | o Enable the application to select() on its own file descriptors and curl's 38 | file descriptors simultaneous easily. 39 | 40 | */ 41 | 42 | /* 43 | * This header file should not really need to include "curl.h" since curl.h 44 | * itself includes this file and we expect user applications to do #include 45 | * without the need for especially including multi.h. 46 | * 47 | * For some reason we added this include here at one point, and rather than to 48 | * break existing (wrongly written) libcurl applications, we leave it as-is 49 | * but with this warning attached. 50 | */ 51 | #include "curl.h" 52 | 53 | #ifdef __cplusplus 54 | extern "C" { 55 | #endif 56 | 57 | #if defined(BUILDING_LIBCURL) || defined(CURL_STRICTER) 58 | typedef struct Curl_multi CURLM; 59 | #else 60 | typedef void CURLM; 61 | #endif 62 | 63 | typedef enum { 64 | CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or 65 | curl_multi_socket*() soon */ 66 | CURLM_OK, 67 | CURLM_BAD_HANDLE, /* the passed-in handle is not a valid CURLM handle */ 68 | CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */ 69 | CURLM_OUT_OF_MEMORY, /* if you ever get this, you're in deep sh*t */ 70 | CURLM_INTERNAL_ERROR, /* this is a libcurl bug */ 71 | CURLM_BAD_SOCKET, /* the passed in socket argument did not match */ 72 | CURLM_UNKNOWN_OPTION, /* curl_multi_setopt() with unsupported option */ 73 | CURLM_ADDED_ALREADY, /* an easy handle already added to a multi handle was 74 | attempted to get added - again */ 75 | CURLM_RECURSIVE_API_CALL, /* an api function was called from inside a 76 | callback */ 77 | CURLM_WAKEUP_FAILURE, /* wakeup is unavailable or failed */ 78 | CURLM_BAD_FUNCTION_ARGUMENT, /* function called with a bad parameter */ 79 | CURLM_ABORTED_BY_CALLBACK, 80 | CURLM_UNRECOVERABLE_POLL, 81 | CURLM_LAST 82 | } CURLMcode; 83 | 84 | /* just to make code nicer when using curl_multi_socket() you can now check 85 | for CURLM_CALL_MULTI_SOCKET too in the same style it works for 86 | curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */ 87 | #define CURLM_CALL_MULTI_SOCKET CURLM_CALL_MULTI_PERFORM 88 | 89 | /* bitmask bits for CURLMOPT_PIPELINING */ 90 | #define CURLPIPE_NOTHING 0L 91 | #define CURLPIPE_HTTP1 1L 92 | #define CURLPIPE_MULTIPLEX 2L 93 | 94 | typedef enum { 95 | CURLMSG_NONE, /* first, not used */ 96 | CURLMSG_DONE, /* This easy handle has completed. 'result' contains 97 | the CURLcode of the transfer */ 98 | CURLMSG_LAST /* last, not used */ 99 | } CURLMSG; 100 | 101 | struct CURLMsg { 102 | CURLMSG msg; /* what this message means */ 103 | CURL *easy_handle; /* the handle it concerns */ 104 | union { 105 | void *whatever; /* message-specific data */ 106 | CURLcode result; /* return code for transfer */ 107 | } data; 108 | }; 109 | typedef struct CURLMsg CURLMsg; 110 | 111 | /* Based on poll(2) structure and values. 112 | * We don't use pollfd and POLL* constants explicitly 113 | * to cover platforms without poll(). */ 114 | #define CURL_WAIT_POLLIN 0x0001 115 | #define CURL_WAIT_POLLPRI 0x0002 116 | #define CURL_WAIT_POLLOUT 0x0004 117 | 118 | struct curl_waitfd { 119 | curl_socket_t fd; 120 | short events; 121 | short revents; 122 | }; 123 | 124 | /* 125 | * Name: curl_multi_init() 126 | * 127 | * Desc: initialize multi-style curl usage 128 | * 129 | * Returns: a new CURLM handle to use in all 'curl_multi' functions. 130 | */ 131 | CURL_EXTERN CURLM *curl_multi_init(void); 132 | 133 | /* 134 | * Name: curl_multi_add_handle() 135 | * 136 | * Desc: add a standard curl handle to the multi stack 137 | * 138 | * Returns: CURLMcode type, general multi error code. 139 | */ 140 | CURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle, 141 | CURL *curl_handle); 142 | 143 | /* 144 | * Name: curl_multi_remove_handle() 145 | * 146 | * Desc: removes a curl handle from the multi stack again 147 | * 148 | * Returns: CURLMcode type, general multi error code. 149 | */ 150 | CURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle, 151 | CURL *curl_handle); 152 | 153 | /* 154 | * Name: curl_multi_fdset() 155 | * 156 | * Desc: Ask curl for its fd_set sets. The app can use these to select() or 157 | * poll() on. We want curl_multi_perform() called as soon as one of 158 | * them are ready. 159 | * 160 | * Returns: CURLMcode type, general multi error code. 161 | */ 162 | CURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle, 163 | fd_set *read_fd_set, 164 | fd_set *write_fd_set, 165 | fd_set *exc_fd_set, 166 | int *max_fd); 167 | 168 | /* 169 | * Name: curl_multi_wait() 170 | * 171 | * Desc: Poll on all fds within a CURLM set as well as any 172 | * additional fds passed to the function. 173 | * 174 | * Returns: CURLMcode type, general multi error code. 175 | */ 176 | CURL_EXTERN CURLMcode curl_multi_wait(CURLM *multi_handle, 177 | struct curl_waitfd extra_fds[], 178 | unsigned int extra_nfds, 179 | int timeout_ms, 180 | int *ret); 181 | 182 | /* 183 | * Name: curl_multi_poll() 184 | * 185 | * Desc: Poll on all fds within a CURLM set as well as any 186 | * additional fds passed to the function. 187 | * 188 | * Returns: CURLMcode type, general multi error code. 189 | */ 190 | CURL_EXTERN CURLMcode curl_multi_poll(CURLM *multi_handle, 191 | struct curl_waitfd extra_fds[], 192 | unsigned int extra_nfds, 193 | int timeout_ms, 194 | int *ret); 195 | 196 | /* 197 | * Name: curl_multi_wakeup() 198 | * 199 | * Desc: wakes up a sleeping curl_multi_poll call. 200 | * 201 | * Returns: CURLMcode type, general multi error code. 202 | */ 203 | CURL_EXTERN CURLMcode curl_multi_wakeup(CURLM *multi_handle); 204 | 205 | /* 206 | * Name: curl_multi_perform() 207 | * 208 | * Desc: When the app thinks there's data available for curl it calls this 209 | * function to read/write whatever there is right now. This returns 210 | * as soon as the reads and writes are done. This function does not 211 | * require that there actually is data available for reading or that 212 | * data can be written, it can be called just in case. It returns 213 | * the number of handles that still transfer data in the second 214 | * argument's integer-pointer. 215 | * 216 | * Returns: CURLMcode type, general multi error code. *NOTE* that this only 217 | * returns errors etc regarding the whole multi stack. There might 218 | * still have occurred problems on individual transfers even when 219 | * this returns OK. 220 | */ 221 | CURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle, 222 | int *running_handles); 223 | 224 | /* 225 | * Name: curl_multi_cleanup() 226 | * 227 | * Desc: Cleans up and removes a whole multi stack. It does not free or 228 | * touch any individual easy handles in any way. We need to define 229 | * in what state those handles will be if this function is called 230 | * in the middle of a transfer. 231 | * 232 | * Returns: CURLMcode type, general multi error code. 233 | */ 234 | CURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle); 235 | 236 | /* 237 | * Name: curl_multi_info_read() 238 | * 239 | * Desc: Ask the multi handle if there's any messages/informationals from 240 | * the individual transfers. Messages include informationals such as 241 | * error code from the transfer or just the fact that a transfer is 242 | * completed. More details on these should be written down as well. 243 | * 244 | * Repeated calls to this function will return a new struct each 245 | * time, until a special "end of msgs" struct is returned as a signal 246 | * that there is no more to get at this point. 247 | * 248 | * The data the returned pointer points to will not survive calling 249 | * curl_multi_cleanup(). 250 | * 251 | * The 'CURLMsg' struct is meant to be very simple and only contain 252 | * very basic information. If more involved information is wanted, 253 | * we will provide the particular "transfer handle" in that struct 254 | * and that should/could/would be used in subsequent 255 | * curl_easy_getinfo() calls (or similar). The point being that we 256 | * must never expose complex structs to applications, as then we'll 257 | * undoubtably get backwards compatibility problems in the future. 258 | * 259 | * Returns: A pointer to a filled-in struct, or NULL if it failed or ran out 260 | * of structs. It also writes the number of messages left in the 261 | * queue (after this read) in the integer the second argument points 262 | * to. 263 | */ 264 | CURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle, 265 | int *msgs_in_queue); 266 | 267 | /* 268 | * Name: curl_multi_strerror() 269 | * 270 | * Desc: The curl_multi_strerror function may be used to turn a CURLMcode 271 | * value into the equivalent human readable error string. This is 272 | * useful for printing meaningful error messages. 273 | * 274 | * Returns: A pointer to a null-terminated error message. 275 | */ 276 | CURL_EXTERN const char *curl_multi_strerror(CURLMcode); 277 | 278 | /* 279 | * Name: curl_multi_socket() and 280 | * curl_multi_socket_all() 281 | * 282 | * Desc: An alternative version of curl_multi_perform() that allows the 283 | * application to pass in one of the file descriptors that have been 284 | * detected to have "action" on them and let libcurl perform. 285 | * See man page for details. 286 | */ 287 | #define CURL_POLL_NONE 0 288 | #define CURL_POLL_IN 1 289 | #define CURL_POLL_OUT 2 290 | #define CURL_POLL_INOUT 3 291 | #define CURL_POLL_REMOVE 4 292 | 293 | #define CURL_SOCKET_TIMEOUT CURL_SOCKET_BAD 294 | 295 | #define CURL_CSELECT_IN 0x01 296 | #define CURL_CSELECT_OUT 0x02 297 | #define CURL_CSELECT_ERR 0x04 298 | 299 | typedef int (*curl_socket_callback)(CURL *easy, /* easy handle */ 300 | curl_socket_t s, /* socket */ 301 | int what, /* see above */ 302 | void *userp, /* private callback 303 | pointer */ 304 | void *socketp); /* private socket 305 | pointer */ 306 | /* 307 | * Name: curl_multi_timer_callback 308 | * 309 | * Desc: Called by libcurl whenever the library detects a change in the 310 | * maximum number of milliseconds the app is allowed to wait before 311 | * curl_multi_socket() or curl_multi_perform() must be called 312 | * (to allow libcurl's timed events to take place). 313 | * 314 | * Returns: The callback should return zero. 315 | */ 316 | typedef int (*curl_multi_timer_callback)(CURLM *multi, /* multi handle */ 317 | long timeout_ms, /* see above */ 318 | void *userp); /* private callback 319 | pointer */ 320 | 321 | CURL_EXTERN CURLMcode CURL_DEPRECATED(7.19.5, "Use curl_multi_socket_action()") 322 | curl_multi_socket(CURLM *multi_handle, curl_socket_t s, int *running_handles); 323 | 324 | CURL_EXTERN CURLMcode curl_multi_socket_action(CURLM *multi_handle, 325 | curl_socket_t s, 326 | int ev_bitmask, 327 | int *running_handles); 328 | 329 | CURL_EXTERN CURLMcode CURL_DEPRECATED(7.19.5, "Use curl_multi_socket_action()") 330 | curl_multi_socket_all(CURLM *multi_handle, int *running_handles); 331 | 332 | #ifndef CURL_ALLOW_OLD_MULTI_SOCKET 333 | /* This macro below was added in 7.16.3 to push users who recompile to use 334 | the new curl_multi_socket_action() instead of the old curl_multi_socket() 335 | */ 336 | #define curl_multi_socket(x,y,z) curl_multi_socket_action(x,y,0,z) 337 | #endif 338 | 339 | /* 340 | * Name: curl_multi_timeout() 341 | * 342 | * Desc: Returns the maximum number of milliseconds the app is allowed to 343 | * wait before curl_multi_socket() or curl_multi_perform() must be 344 | * called (to allow libcurl's timed events to take place). 345 | * 346 | * Returns: CURLM error code. 347 | */ 348 | CURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle, 349 | long *milliseconds); 350 | 351 | typedef enum { 352 | /* This is the socket callback function pointer */ 353 | CURLOPT(CURLMOPT_SOCKETFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 1), 354 | 355 | /* This is the argument passed to the socket callback */ 356 | CURLOPT(CURLMOPT_SOCKETDATA, CURLOPTTYPE_OBJECTPOINT, 2), 357 | 358 | /* set to 1 to enable pipelining for this multi handle */ 359 | CURLOPT(CURLMOPT_PIPELINING, CURLOPTTYPE_LONG, 3), 360 | 361 | /* This is the timer callback function pointer */ 362 | CURLOPT(CURLMOPT_TIMERFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 4), 363 | 364 | /* This is the argument passed to the timer callback */ 365 | CURLOPT(CURLMOPT_TIMERDATA, CURLOPTTYPE_OBJECTPOINT, 5), 366 | 367 | /* maximum number of entries in the connection cache */ 368 | CURLOPT(CURLMOPT_MAXCONNECTS, CURLOPTTYPE_LONG, 6), 369 | 370 | /* maximum number of (pipelining) connections to one host */ 371 | CURLOPT(CURLMOPT_MAX_HOST_CONNECTIONS, CURLOPTTYPE_LONG, 7), 372 | 373 | /* maximum number of requests in a pipeline */ 374 | CURLOPT(CURLMOPT_MAX_PIPELINE_LENGTH, CURLOPTTYPE_LONG, 8), 375 | 376 | /* a connection with a content-length longer than this 377 | will not be considered for pipelining */ 378 | CURLOPT(CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE, CURLOPTTYPE_OFF_T, 9), 379 | 380 | /* a connection with a chunk length longer than this 381 | will not be considered for pipelining */ 382 | CURLOPT(CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE, CURLOPTTYPE_OFF_T, 10), 383 | 384 | /* a list of site names(+port) that are blocked from pipelining */ 385 | CURLOPT(CURLMOPT_PIPELINING_SITE_BL, CURLOPTTYPE_OBJECTPOINT, 11), 386 | 387 | /* a list of server types that are blocked from pipelining */ 388 | CURLOPT(CURLMOPT_PIPELINING_SERVER_BL, CURLOPTTYPE_OBJECTPOINT, 12), 389 | 390 | /* maximum number of open connections in total */ 391 | CURLOPT(CURLMOPT_MAX_TOTAL_CONNECTIONS, CURLOPTTYPE_LONG, 13), 392 | 393 | /* This is the server push callback function pointer */ 394 | CURLOPT(CURLMOPT_PUSHFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 14), 395 | 396 | /* This is the argument passed to the server push callback */ 397 | CURLOPT(CURLMOPT_PUSHDATA, CURLOPTTYPE_OBJECTPOINT, 15), 398 | 399 | /* maximum number of concurrent streams to support on a connection */ 400 | CURLOPT(CURLMOPT_MAX_CONCURRENT_STREAMS, CURLOPTTYPE_LONG, 16), 401 | 402 | CURLMOPT_LASTENTRY /* the last unused */ 403 | } CURLMoption; 404 | 405 | 406 | /* 407 | * Name: curl_multi_setopt() 408 | * 409 | * Desc: Sets options for the multi handle. 410 | * 411 | * Returns: CURLM error code. 412 | */ 413 | CURL_EXTERN CURLMcode curl_multi_setopt(CURLM *multi_handle, 414 | CURLMoption option, ...); 415 | 416 | 417 | /* 418 | * Name: curl_multi_assign() 419 | * 420 | * Desc: This function sets an association in the multi handle between the 421 | * given socket and a private pointer of the application. This is 422 | * (only) useful for curl_multi_socket uses. 423 | * 424 | * Returns: CURLM error code. 425 | */ 426 | CURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle, 427 | curl_socket_t sockfd, void *sockp); 428 | 429 | /* 430 | * Name: curl_multi_get_handles() 431 | * 432 | * Desc: Returns an allocated array holding all handles currently added to 433 | * the multi handle. Marks the final entry with a NULL pointer. If 434 | * there is no easy handle added to the multi handle, this function 435 | * returns an array with the first entry as a NULL pointer. 436 | * 437 | * Returns: NULL on failure, otherwise a CURL **array pointer 438 | */ 439 | CURL_EXTERN CURL **curl_multi_get_handles(CURLM *multi_handle); 440 | 441 | /* 442 | * Name: curl_push_callback 443 | * 444 | * Desc: This callback gets called when a new stream is being pushed by the 445 | * server. It approves or denies the new stream. It can also decide 446 | * to completely fail the connection. 447 | * 448 | * Returns: CURL_PUSH_OK, CURL_PUSH_DENY or CURL_PUSH_ERROROUT 449 | */ 450 | #define CURL_PUSH_OK 0 451 | #define CURL_PUSH_DENY 1 452 | #define CURL_PUSH_ERROROUT 2 /* added in 7.72.0 */ 453 | 454 | struct curl_pushheaders; /* forward declaration only */ 455 | 456 | CURL_EXTERN char *curl_pushheader_bynum(struct curl_pushheaders *h, 457 | size_t num); 458 | CURL_EXTERN char *curl_pushheader_byname(struct curl_pushheaders *h, 459 | const char *name); 460 | 461 | typedef int (*curl_push_callback)(CURL *parent, 462 | CURL *easy, 463 | size_t num_headers, 464 | struct curl_pushheaders *headers, 465 | void *userp); 466 | 467 | #ifdef __cplusplus 468 | } /* end of extern "C" */ 469 | #endif 470 | 471 | #endif 472 | -------------------------------------------------------------------------------- /SteamIconFix.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #include 15 | #include 16 | #include 17 | // for windows only :( 18 | 19 | using namespace std; 20 | 21 | BOOL isFileExists(const wstring &path) { 22 | DWORD dwAttr = GetFileAttributesW(path.c_str()); 23 | if (dwAttr == INVALID_FILE_ATTRIBUTES) return FALSE; 24 | return TRUE; 25 | } 26 | 27 | size_t curlWriteFunc(void *ptr, size_t size, size_t nmemb, FILE *stream) { 28 | return fwrite(ptr, size, nmemb, stream); 29 | } 30 | 31 | int downloadFile(const string &url, const wstring &path) { 32 | CURL *curl = curl_easy_init(); 33 | long responseCode = 0; 34 | if (curl) { 35 | FILE *ofile = _wfopen(path.c_str(), L"wb"); 36 | if (!ofile) { 37 | curl_easy_cleanup(curl); 38 | return -2; 39 | } 40 | curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); 41 | curl_easy_setopt(curl, CURLOPT_WRITEDATA, ofile); 42 | curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curlWriteFunc); 43 | CURLcode res = curl_easy_perform(curl); 44 | curl_easy_getinfo(curl, CURLINFO_HTTP_CODE, &responseCode); 45 | 46 | fclose(ofile); 47 | curl_easy_cleanup(curl); 48 | 49 | if (res != CURLE_OK) return res; 50 | if (responseCode >= 400) return (int)responseCode; 51 | return 0; 52 | } 53 | return -1; 54 | } 55 | 56 | void flushIcon() { 57 | system("taskkill /f /im explorer.exe"); 58 | system(R"(attrib -h -s -r "%userprofile%\AppData\Local\IconCache.db")"); 59 | system(R"(del /f "%userprofile%\AppData\Local\IconCache.db")"); 60 | system(R"(attrib /s /d -h -s -r "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\*")"); 61 | system(R"(del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_32.db")"); 62 | system(R"(del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_96.db")"); 63 | system(R"(del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_102.db")"); 64 | system(R"(del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_256.db")"); 65 | system(R"(del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_1024.db")"); 66 | system(R"(del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_idx.db")"); 67 | system(R"(del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_sr.db")"); 68 | system("echo y reg delete \"HKEY_CLASSES_ROOT\\Local Settings\\Software\\Microsoft\\Windows\\CurrentVersion\\TrayNotify\" /v IconStreams"); 69 | system("echo y reg delete \"HKEY_CLASSES_ROOT\\Local Settings\\Software\\Microsoft\\Windows\\CurrentVersion\\TrayNotify\" /v PastIconsStream"); 70 | system("start explorer"); 71 | } 72 | 73 | void setclr(unsigned short clr) { 74 | HANDLE hCon = GetStdHandle(STD_OUTPUT_HANDLE); 75 | SetConsoleTextAttribute(hCon, clr); 76 | } 77 | 78 | void logui(const char *str) { 79 | setclr(FOREGROUND_BLUE); 80 | cout << str << endl; 81 | setclr(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); 82 | } 83 | 84 | void logsuc(const char *str) { 85 | setclr(FOREGROUND_GREEN); 86 | cout << str << endl; 87 | setclr(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); 88 | } 89 | 90 | void logwrn(const char *str) { 91 | setclr(FOREGROUND_RED | FOREGROUND_GREEN); 92 | cout << str << endl; 93 | setclr(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); 94 | } 95 | 96 | void logerr(const char *str) { 97 | setclr(FOREGROUND_RED); 98 | cout << str << endl; 99 | setclr(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); 100 | } 101 | 102 | // thanks @Zinc-in 103 | string wstring2string(const wstring &wstr) { 104 | string result; 105 | int len = WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, 106 | wstr.c_str(), (int)wstr.size(), 107 | nullptr, 0, nullptr, nullptr); 108 | if (len <= 0) return {}; 109 | char *buffer = new char[len + 1]; 110 | WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, 111 | wstr.c_str(), (int)wstr.size(), 112 | buffer, len, nullptr, nullptr); 113 | buffer[len] = '\0'; 114 | result.append(buffer); 115 | delete[] buffer; 116 | return result; 117 | } 118 | 119 | bool getDirUrlFiles(const wstring &path, vector &files) { 120 | WIN32_FIND_DATAW ffd{}; 121 | wstring searchPath = path; 122 | if (!searchPath.empty() && searchPath.back() != L'\\') 123 | searchPath += L'\\'; 124 | searchPath += L"*.url"; 125 | 126 | HANDLE hFind = FindFirstFileW(searchPath.c_str(), &ffd); 127 | if (hFind == INVALID_HANDLE_VALUE) { 128 | cerr << "E[GetDirFiles] Failed open dir." << endl; 129 | return false; 130 | } 131 | 132 | do { 133 | if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; 134 | 135 | wstring fullPath = path; 136 | if (!fullPath.empty() && fullPath.back() != L'\\') 137 | fullPath += L'\\'; 138 | fullPath += ffd.cFileName; 139 | 140 | bool result = false; 141 | for (auto &file : files) { 142 | auto pos1 = fullPath.find_last_of(L'\\'); 143 | auto pos2 = file.find_last_of(L'\\'); 144 | wstring name1 = (pos1 == wstring::npos) ? fullPath : fullPath.substr(pos1 + 1); 145 | wstring name2 = (pos2 == wstring::npos) ? file : file.substr(pos2 + 1); 146 | if (name1 == name2) { 147 | result = true; 148 | break; 149 | } 150 | } 151 | if (!result) files.push_back(fullPath); 152 | 153 | } while (FindNextFileW(hFind, &ffd)); 154 | 155 | FindClose(hFind); 156 | return true; 157 | } 158 | 159 | static size_t WriteToStringCallback(char* ptr, size_t size, size_t nmemb, void* userdata) { 160 | auto* str = static_cast(userdata); 161 | auto realSize = size * nmemb; 162 | str->append(ptr, realSize); 163 | return realSize; 164 | } 165 | 166 | string getClientIconHash(const string& appid) { 167 | CURL* curl = curl_easy_init(); 168 | string url = "https://api.steamcmd.net/v1/info/" + appid; 169 | 170 | if (!curl) { 171 | logerr("E Curl init failed."); 172 | return ""; 173 | } 174 | 175 | string resp; 176 | 177 | curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); 178 | curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteToStringCallback); 179 | curl_easy_setopt(curl, CURLOPT_WRITEDATA, &resp); 180 | 181 | curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); 182 | 183 | CURLcode res = curl_easy_perform(curl); 184 | if (res != CURLE_OK) { 185 | string err = curl_easy_strerror(res); 186 | curl_easy_cleanup(curl); 187 | logerr(("E Curl failed err: " + err).c_str()); 188 | return ""; 189 | } 190 | 191 | long httpCode = 0; 192 | curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpCode); 193 | curl_easy_cleanup(curl); 194 | 195 | if (httpCode < 200 || httpCode >= 300) { 196 | logerr(("E Request clienticon failed: " + to_string(httpCode)).c_str()); 197 | return ""; 198 | } 199 | 200 | Json::CharReaderBuilder builder; 201 | builder["collectComments"] = false; 202 | 203 | Json::Value root; 204 | string errs; 205 | 206 | unique_ptr reader(builder.newCharReader()); 207 | const char* begin = resp.data(); 208 | const char* end = resp.data() + resp.size(); 209 | 210 | bool ok = reader->parse(begin, end, &root, &errs); 211 | if (!ok) { 212 | logerr(("E Json parse failed: " + errs).c_str()); 213 | return ""; 214 | } 215 | 216 | return root["data"][appid]["common"]["clienticon"].asString(); 217 | } 218 | 219 | wstring readFileToWstring(const wstring& path) { 220 | FILE* fp = _wfopen(path.c_str(), L"rb"); 221 | if (!fp) return L""; 222 | 223 | fseek(fp, 0, SEEK_END); 224 | long size = ftell(fp); 225 | fseek(fp, 0, SEEK_SET); 226 | 227 | string buffer; 228 | buffer.resize(size); 229 | 230 | fread(buffer.data(), 1, size, fp); 231 | fclose(fp); 232 | 233 | wstring_convert> conv; 234 | return conv.from_bytes(buffer); 235 | } 236 | 237 | std::vector getInstalledSteamAppIds(const std::wstring& steamRoot) { 238 | std::vector result; 239 | 240 | std::wstring steamappsRoot = steamRoot; 241 | if (!steamappsRoot.empty() && steamappsRoot.back() != L'\\') 242 | steamappsRoot += L'\\'; 243 | steamappsRoot += L"steamapps"; 244 | 245 | std::vector libraries; 246 | libraries.push_back(steamappsRoot); 247 | 248 | std::wstring vdfPath = steamappsRoot; 249 | if (!vdfPath.empty() && vdfPath.back() != L'\\') 250 | vdfPath += L'\\'; 251 | vdfPath += L"libraryfolders.vdf"; 252 | 253 | wstring vdfContent = readFileToWstring(vdfPath); 254 | if (!vdfContent.empty()) { 255 | wregex re(L"\"path\"\\s*\"([^\"]+)\""); 256 | for (wsregex_iterator it(vdfContent.begin(), vdfContent.end(), re), end; it != end; ++it) { 257 | wstring libPath = (*it)[1].str(); 258 | if (!libPath.empty() && libPath.back() != L'\\') 259 | libPath += L'\\'; 260 | libPath += L"steamapps"; 261 | libraries.push_back(libPath); 262 | } 263 | } 264 | 265 | 266 | std::sort(libraries.begin(), libraries.end()); 267 | libraries.erase(std::unique(libraries.begin(), libraries.end()), libraries.end()); 268 | 269 | for (const auto& lib : libraries) { 270 | WIN32_FIND_DATAW fd{}; 271 | std::wstring pattern = lib; 272 | if (!pattern.empty() && pattern.back() != L'\\') 273 | pattern += L'\\'; 274 | pattern += L"appmanifest_*.acf"; 275 | 276 | HANDLE hFind = FindFirstFileW(pattern.c_str(), &fd); 277 | if (hFind == INVALID_HANDLE_VALUE) continue; 278 | 279 | do { 280 | if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; 281 | 282 | std::wstring fullPath = lib; 283 | if (!fullPath.empty() && fullPath.back() != L'\\') 284 | fullPath += L'\\'; 285 | fullPath += fd.cFileName; 286 | 287 | wstring content = readFileToWstring(fullPath); 288 | if (content.empty()) continue; 289 | 290 | wregex appidRe(L"\"appid\"\\s*\"([0-9]+)\""); 291 | wsmatch m; 292 | if (regex_search(content, m, appidRe)) { 293 | int id = _wtoi(m[1].str().c_str()); 294 | if (id > 0) { 295 | result.push_back(to_string(id)); 296 | cout << "Found " << to_string(id) << endl; 297 | } 298 | } 299 | 300 | } while (FindNextFileW(hFind, &fd)); 301 | 302 | FindClose(hFind); 303 | } 304 | std::sort(result.begin(), result.end()); 305 | result.erase(std::unique(result.begin(), result.end()), result.end()); 306 | 307 | return result; 308 | } 309 | 310 | int main() { 311 | 312 | ios::sync_with_stdio(false); 313 | 314 | setclr(11); 315 | cout << "========Steam Icon Fix========" << endl; 316 | setclr(6); 317 | cout << ">_D3bug the w0r1d. Visit https://y2f.xyz for more information." << endl; 318 | setclr(15); 319 | 320 | wstring progFilesVar; 321 | DWORD size = MAX_PATH * sizeof(WCHAR); 322 | auto *buffer = new WCHAR[MAX_PATH]; 323 | if (!SUCCEEDED(RegGetValueW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\WOW6432Node\\Valve\\Steam", L"InstallPath", RRF_RT_ANY, 324 | nullptr, (PVOID) buffer, &size))) { 325 | logerr("E Steam is not installed, exiting..."); 326 | system("pause"); 327 | delete[] buffer; 328 | return 0; 329 | } 330 | 331 | progFilesVar = buffer; 332 | delete[] buffer; 333 | 334 | 335 | PWSTR desktopVar = nullptr; 336 | if (!SUCCEEDED(SHGetKnownFolderPath(FOLDERID_Desktop, 0, nullptr, &desktopVar))) { 337 | logerr("E Cannot find Desktop, exiting..."); 338 | system("pause"); 339 | return 0; 340 | } 341 | 342 | PWSTR startMenuVar = nullptr; 343 | HRESULT hrStart = SHGetKnownFolderPath(FOLDERID_Programs, 0, nullptr, &startMenuVar); 344 | if (!SUCCEEDED(hrStart)) { 345 | logwrn("W Cannot find Start menu, skipped"); 346 | } 347 | 348 | wstring desktopDir = desktopVar; 349 | CoTaskMemFree(desktopVar); 350 | 351 | wstring startMenuDir; 352 | if (SUCCEEDED(hrStart)) { 353 | startMenuDir = startMenuVar; 354 | CoTaskMemFree(startMenuVar); 355 | if (!startMenuDir.empty() && startMenuDir.back() != L'\\') 356 | startMenuDir += L'\\'; 357 | startMenuDir += L"Steam"; 358 | } 359 | 360 | wstring steamiconDir = progFilesVar; 361 | if (!steamiconDir.empty() && steamiconDir.back() != L'\\') 362 | steamiconDir += L'\\'; 363 | steamiconDir += L"steam\\games"; 364 | 365 | if (isFileExists(steamiconDir)) { 366 | cout << "Found Steam icon dir in " << wstring2string(steamiconDir) << endl; 367 | } else { 368 | logwrn("W Cannot find steam icon dir, manual input>_"); 369 | string input; 370 | getline(cin, input); 371 | if (input.empty()) { 372 | logerr("E Path not exist. Exiting..."); 373 | system("pause"); 374 | return 0; 375 | } 376 | steamiconDir = wstring(input.begin(), input.end()); 377 | if (!isFileExists(steamiconDir)) { 378 | logerr("E Path not exist. Exiting..."); 379 | system("pause"); 380 | return 0; 381 | } 382 | } 383 | 384 | if (isFileExists(desktopDir)) { 385 | cout << "Found Desktop in " << wstring2string(desktopDir) << endl; 386 | } else { 387 | logwrn("W Cannot find desktop dir, manual input>_"); 388 | string input; 389 | getline(cin, input); 390 | if (input.empty()) { 391 | logerr("E Path not exist. Exiting..."); 392 | system("pause"); 393 | return 0; 394 | } 395 | desktopDir = wstring(input.begin(), input.end()); 396 | if (!isFileExists(desktopDir)) { 397 | logerr("E Path not exist. Exiting..."); 398 | system("pause"); 399 | return 0; 400 | } 401 | } 402 | 403 | if (!startMenuDir.empty() && isFileExists(startMenuDir)) { 404 | cout << "Found Steam Start Menu Shortcut in " << wstring2string(startMenuDir) << endl; 405 | } else { 406 | logwrn("W Cannot find StartMenu Dir, skipping..."); 407 | } 408 | 409 | int cdnChoose = -1; 410 | 411 | cout << endl; 412 | logui("==Type what CDN u wanna use=="); 413 | logui("0 -> fastly"); 414 | logui("1 -> cloudflare"); 415 | 416 | while ((cdnChoose != 0) && (cdnChoose != 1)) { 417 | cout << "CDN[enter for 0]"; 418 | string cdnChooseStr; 419 | getline(cin, cdnChooseStr); 420 | if (cdnChooseStr.length() > 1) { 421 | cout << "Input Invalid" << endl; 422 | continue; 423 | } 424 | if (cdnChooseStr.empty()) cdnChooseStr = "0"; 425 | char cdnChooseChar = cdnChooseStr[0]; 426 | if (!(cdnChooseChar < '2' && cdnChooseChar >= '0')) { 427 | cout << "Input Invalid" << endl; 428 | continue; 429 | } 430 | cdnChoose = cdnChooseChar - '0'; 431 | } 432 | cout << endl; 433 | 434 | vector files; 435 | getDirUrlFiles(desktopDir, files); 436 | if (!startMenuDir.empty() && isFileExists(startMenuDir)) { 437 | getDirUrlFiles(startMenuDir, files); 438 | } 439 | 440 | wchar_t urlbuf[256]; // vars in ini(.url) 441 | wchar_t iconbuf[MAX_PATH]; 442 | 443 | string iconurl; 444 | if (cdnChoose == 0) iconurl = "https://shared.fastly.steamstatic.com/community_assets/images/apps/"; 445 | if (cdnChoose == 1) iconurl = "https://cdn.cloudflare.steamstatic.com/steamcommunity/public/images/apps/"; 446 | 447 | vector appIds = getInstalledSteamAppIds(progFilesVar); 448 | map ciHashs; 449 | for (const auto &file : files) { 450 | GetPrivateProfileStringW(L"InternetShortcut", L"URL", nullptr, urlbuf, sizeof(urlbuf), file.c_str()); 451 | 452 | GetPrivateProfileStringW(L"InternetShortcut", L"IconFile", nullptr, iconbuf, sizeof(iconbuf), 453 | 454 | file.c_str()); 455 | 456 | wstring urlW = urlbuf; 457 | wstring iconW = iconbuf; 458 | 459 | if (urlW.empty()) continue; 460 | 461 | auto colonPos = urlW.find(L':'); 462 | auto slashPos = urlW.find_last_of(L'/'); 463 | if (colonPos == wstring::npos || slashPos == wstring::npos) continue; 464 | 465 | if (urlW.substr(0, colonPos) != L"steam") continue; // not a steam shortcut 466 | 467 | if (iconW.find_last_of(L'\\') == wstring::npos) { 468 | logerr("E invalid shortcut"); 469 | continue; 470 | } 471 | 472 | wstring appIdW = urlW.substr(slashPos + 1); 473 | wstring iconFileNameW = iconW.substr(iconW.find_last_of(L'\\') + 1); 474 | 475 | string appId = wstring2string(appIdW); 476 | string iconFileName = wstring2string(iconFileNameW); 477 | 478 | cout << "Find Steam Shortcut " 479 | << wstring2string(file.substr(file.find_last_of(L'\\') + 1)) 480 | << " with appid " << appId << endl; 481 | appIds.push_back(appId); 482 | ciHashs[appId] = iconFileName; 483 | } 484 | sort(appIds.begin(), appIds.end()); 485 | appIds.erase(unique(appIds.begin(), appIds.end()), appIds.end()); 486 | std::wstring_convert> converter; 487 | for (const auto &appId : appIds) { 488 | string iconFileName = ciHashs.contains(appId) ? ciHashs[appId] : getClientIconHash(appId); 489 | if (iconFileName.empty()) { 490 | logwrn(("W iconFileName with appid " + appId + " is Empty, Skipped.").c_str()); 491 | continue; 492 | } 493 | string dwnurl = iconurl + appId + "/" + iconFileName; 494 | 495 | wstring dstPath = steamiconDir; 496 | if (!dstPath.empty() && dstPath.back() != L'\\') 497 | dstPath += L'\\'; 498 | dstPath += converter.from_bytes(iconFileName); 499 | 500 | cout << "- try to download icon from " << dwnurl << " to " << wstring2string(dstPath) << endl; 501 | int res = downloadFile(dwnurl, dstPath); 502 | 503 | bool terminateFlag = false; // terminate for error not-to-skip 504 | 505 | switch (res) { 506 | case 0: 507 | logsuc("- Successful Fixed."); 508 | break; 509 | case 3: 510 | logwrn("Skipped, error 3, URL error"); 511 | break; 512 | case 404: 513 | logwrn("Skipped, error 404, File Not Found"); 514 | break; 515 | case 500 ...599: 516 | logwrn(("Error" + to_string(res) + ", Server Error,please change cdn").c_str()); 517 | terminateFlag = true; 518 | break; 519 | default: 520 | logerr(("E download failed. Check your network! Error " + to_string(res)).c_str()); 521 | terminateFlag = true; 522 | } 523 | if (terminateFlag){ 524 | logerr("E deleting downloaded files..."); 525 | DeleteFileW(dstPath.c_str()); 526 | system("pause"); 527 | return 0; 528 | } 529 | } 530 | 531 | cout << "Finish Fixing, Flushing icon cache..." << endl; 532 | flushIcon(); 533 | logsuc("Success!"); 534 | system("pause"); 535 | return 0; 536 | } -------------------------------------------------------------------------------- /include/system.h: -------------------------------------------------------------------------------- 1 | #ifndef CURLINC_SYSTEM_H 2 | #define CURLINC_SYSTEM_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | /* 28 | * Try to keep one section per platform, compiler and architecture, otherwise, 29 | * if an existing section is reused for a different one and later on the 30 | * original is adjusted, probably the piggybacking one can be adversely 31 | * changed. 32 | * 33 | * In order to differentiate between platforms/compilers/architectures use 34 | * only compiler built in predefined preprocessor symbols. 35 | * 36 | * curl_off_t 37 | * ---------- 38 | * 39 | * For any given platform/compiler curl_off_t must be typedef'ed to a 64-bit 40 | * wide signed integral data type. The width of this data type must remain 41 | * constant and independent of any possible large file support settings. 42 | * 43 | * As an exception to the above, curl_off_t shall be typedef'ed to a 32-bit 44 | * wide signed integral data type if there is no 64-bit type. 45 | * 46 | * As a general rule, curl_off_t shall not be mapped to off_t. This rule shall 47 | * only be violated if off_t is the only 64-bit data type available and the 48 | * size of off_t is independent of large file support settings. Keep your 49 | * build on the safe side avoiding an off_t gating. If you have a 64-bit 50 | * off_t then take for sure that another 64-bit data type exists, dig deeper 51 | * and you will find it. 52 | * 53 | */ 54 | 55 | #if defined(__DJGPP__) || defined(__GO32__) 56 | # if defined(__DJGPP__) && (__DJGPP__ > 1) 57 | # define CURL_TYPEOF_CURL_OFF_T long long 58 | # define CURL_FORMAT_CURL_OFF_T "lld" 59 | # define CURL_FORMAT_CURL_OFF_TU "llu" 60 | # define CURL_SUFFIX_CURL_OFF_T LL 61 | # define CURL_SUFFIX_CURL_OFF_TU ULL 62 | # else 63 | # define CURL_TYPEOF_CURL_OFF_T long 64 | # define CURL_FORMAT_CURL_OFF_T "ld" 65 | # define CURL_FORMAT_CURL_OFF_TU "lu" 66 | # define CURL_SUFFIX_CURL_OFF_T L 67 | # define CURL_SUFFIX_CURL_OFF_TU UL 68 | # endif 69 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 70 | 71 | #elif defined(__SALFORDC__) 72 | # define CURL_TYPEOF_CURL_OFF_T long 73 | # define CURL_FORMAT_CURL_OFF_T "ld" 74 | # define CURL_FORMAT_CURL_OFF_TU "lu" 75 | # define CURL_SUFFIX_CURL_OFF_T L 76 | # define CURL_SUFFIX_CURL_OFF_TU UL 77 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 78 | 79 | #elif defined(__BORLANDC__) 80 | # if (__BORLANDC__ < 0x520) 81 | # define CURL_TYPEOF_CURL_OFF_T long 82 | # define CURL_FORMAT_CURL_OFF_T "ld" 83 | # define CURL_FORMAT_CURL_OFF_TU "lu" 84 | # define CURL_SUFFIX_CURL_OFF_T L 85 | # define CURL_SUFFIX_CURL_OFF_TU UL 86 | # else 87 | # define CURL_TYPEOF_CURL_OFF_T __int64 88 | # define CURL_FORMAT_CURL_OFF_T "I64d" 89 | # define CURL_FORMAT_CURL_OFF_TU "I64u" 90 | # define CURL_SUFFIX_CURL_OFF_T i64 91 | # define CURL_SUFFIX_CURL_OFF_TU ui64 92 | # endif 93 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 94 | 95 | #elif defined(__TURBOC__) 96 | # define CURL_TYPEOF_CURL_OFF_T long 97 | # define CURL_FORMAT_CURL_OFF_T "ld" 98 | # define CURL_FORMAT_CURL_OFF_TU "lu" 99 | # define CURL_SUFFIX_CURL_OFF_T L 100 | # define CURL_SUFFIX_CURL_OFF_TU UL 101 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 102 | 103 | #elif defined(__POCC__) 104 | # if (__POCC__ < 280) 105 | # define CURL_TYPEOF_CURL_OFF_T long 106 | # define CURL_FORMAT_CURL_OFF_T "ld" 107 | # define CURL_FORMAT_CURL_OFF_TU "lu" 108 | # define CURL_SUFFIX_CURL_OFF_T L 109 | # define CURL_SUFFIX_CURL_OFF_TU UL 110 | # elif defined(_MSC_VER) 111 | # define CURL_TYPEOF_CURL_OFF_T __int64 112 | # define CURL_FORMAT_CURL_OFF_T "I64d" 113 | # define CURL_FORMAT_CURL_OFF_TU "I64u" 114 | # define CURL_SUFFIX_CURL_OFF_T i64 115 | # define CURL_SUFFIX_CURL_OFF_TU ui64 116 | # else 117 | # define CURL_TYPEOF_CURL_OFF_T long long 118 | # define CURL_FORMAT_CURL_OFF_T "lld" 119 | # define CURL_FORMAT_CURL_OFF_TU "llu" 120 | # define CURL_SUFFIX_CURL_OFF_T LL 121 | # define CURL_SUFFIX_CURL_OFF_TU ULL 122 | # endif 123 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 124 | 125 | #elif defined(__LCC__) 126 | # if defined(__MCST__) /* MCST eLbrus Compiler Collection */ 127 | # define CURL_TYPEOF_CURL_OFF_T long 128 | # define CURL_FORMAT_CURL_OFF_T "ld" 129 | # define CURL_FORMAT_CURL_OFF_TU "lu" 130 | # define CURL_SUFFIX_CURL_OFF_T L 131 | # define CURL_SUFFIX_CURL_OFF_TU UL 132 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 133 | # define CURL_PULL_SYS_TYPES_H 1 134 | # define CURL_PULL_SYS_SOCKET_H 1 135 | # else /* Local (or Little) C Compiler */ 136 | # define CURL_TYPEOF_CURL_OFF_T long 137 | # define CURL_FORMAT_CURL_OFF_T "ld" 138 | # define CURL_FORMAT_CURL_OFF_TU "lu" 139 | # define CURL_SUFFIX_CURL_OFF_T L 140 | # define CURL_SUFFIX_CURL_OFF_TU UL 141 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 142 | # endif 143 | 144 | #elif defined(macintosh) 145 | # include 146 | # if TYPE_LONGLONG 147 | # define CURL_TYPEOF_CURL_OFF_T long long 148 | # define CURL_FORMAT_CURL_OFF_T "lld" 149 | # define CURL_FORMAT_CURL_OFF_TU "llu" 150 | # define CURL_SUFFIX_CURL_OFF_T LL 151 | # define CURL_SUFFIX_CURL_OFF_TU ULL 152 | # else 153 | # define CURL_TYPEOF_CURL_OFF_T long 154 | # define CURL_FORMAT_CURL_OFF_T "ld" 155 | # define CURL_FORMAT_CURL_OFF_TU "lu" 156 | # define CURL_SUFFIX_CURL_OFF_T L 157 | # define CURL_SUFFIX_CURL_OFF_TU UL 158 | # endif 159 | # define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int 160 | 161 | #elif defined(__TANDEM) 162 | # if ! defined(__LP64) 163 | /* Required for 32-bit NonStop builds only. */ 164 | # define CURL_TYPEOF_CURL_OFF_T long long 165 | # define CURL_FORMAT_CURL_OFF_T "lld" 166 | # define CURL_FORMAT_CURL_OFF_TU "llu" 167 | # define CURL_SUFFIX_CURL_OFF_T LL 168 | # define CURL_SUFFIX_CURL_OFF_TU ULL 169 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 170 | # endif 171 | 172 | #elif defined(_WIN32_WCE) 173 | # define CURL_TYPEOF_CURL_OFF_T __int64 174 | # define CURL_FORMAT_CURL_OFF_T "I64d" 175 | # define CURL_FORMAT_CURL_OFF_TU "I64u" 176 | # define CURL_SUFFIX_CURL_OFF_T i64 177 | # define CURL_SUFFIX_CURL_OFF_TU ui64 178 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 179 | 180 | #elif defined(__MINGW32__) 181 | # include 182 | # define CURL_TYPEOF_CURL_OFF_T long long 183 | # define CURL_FORMAT_CURL_OFF_T PRId64 184 | # define CURL_FORMAT_CURL_OFF_TU PRIu64 185 | # define CURL_SUFFIX_CURL_OFF_T LL 186 | # define CURL_SUFFIX_CURL_OFF_TU ULL 187 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 188 | # define CURL_PULL_SYS_TYPES_H 1 189 | # define CURL_PULL_WS2TCPIP_H 1 190 | 191 | #elif defined(__VMS) 192 | # if defined(__VAX) 193 | # define CURL_TYPEOF_CURL_OFF_T long 194 | # define CURL_FORMAT_CURL_OFF_T "ld" 195 | # define CURL_FORMAT_CURL_OFF_TU "lu" 196 | # define CURL_SUFFIX_CURL_OFF_T L 197 | # define CURL_SUFFIX_CURL_OFF_TU UL 198 | # else 199 | # define CURL_TYPEOF_CURL_OFF_T long long 200 | # define CURL_FORMAT_CURL_OFF_T "lld" 201 | # define CURL_FORMAT_CURL_OFF_TU "llu" 202 | # define CURL_SUFFIX_CURL_OFF_T LL 203 | # define CURL_SUFFIX_CURL_OFF_TU ULL 204 | # endif 205 | # define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int 206 | 207 | #elif defined(__OS400__) 208 | # define CURL_TYPEOF_CURL_OFF_T long long 209 | # define CURL_FORMAT_CURL_OFF_T "lld" 210 | # define CURL_FORMAT_CURL_OFF_TU "llu" 211 | # define CURL_SUFFIX_CURL_OFF_T LL 212 | # define CURL_SUFFIX_CURL_OFF_TU ULL 213 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 214 | # define CURL_PULL_SYS_TYPES_H 1 215 | # define CURL_PULL_SYS_SOCKET_H 1 216 | 217 | #elif defined(__MVS__) 218 | # if defined(_LONG_LONG) 219 | # define CURL_TYPEOF_CURL_OFF_T long long 220 | # define CURL_FORMAT_CURL_OFF_T "lld" 221 | # define CURL_FORMAT_CURL_OFF_TU "llu" 222 | # define CURL_SUFFIX_CURL_OFF_T LL 223 | # define CURL_SUFFIX_CURL_OFF_TU ULL 224 | # elif defined(_LP64) 225 | # define CURL_TYPEOF_CURL_OFF_T long 226 | # define CURL_FORMAT_CURL_OFF_T "ld" 227 | # define CURL_FORMAT_CURL_OFF_TU "lu" 228 | # define CURL_SUFFIX_CURL_OFF_T L 229 | # define CURL_SUFFIX_CURL_OFF_TU UL 230 | # else 231 | # define CURL_TYPEOF_CURL_OFF_T long 232 | # define CURL_FORMAT_CURL_OFF_T "ld" 233 | # define CURL_FORMAT_CURL_OFF_TU "lu" 234 | # define CURL_SUFFIX_CURL_OFF_T L 235 | # define CURL_SUFFIX_CURL_OFF_TU UL 236 | # endif 237 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 238 | # define CURL_PULL_SYS_TYPES_H 1 239 | # define CURL_PULL_SYS_SOCKET_H 1 240 | 241 | #elif defined(__370__) 242 | # if defined(__IBMC__) || defined(__IBMCPP__) 243 | # if defined(_ILP32) 244 | # elif defined(_LP64) 245 | # endif 246 | # if defined(_LONG_LONG) 247 | # define CURL_TYPEOF_CURL_OFF_T long long 248 | # define CURL_FORMAT_CURL_OFF_T "lld" 249 | # define CURL_FORMAT_CURL_OFF_TU "llu" 250 | # define CURL_SUFFIX_CURL_OFF_T LL 251 | # define CURL_SUFFIX_CURL_OFF_TU ULL 252 | # elif defined(_LP64) 253 | # define CURL_TYPEOF_CURL_OFF_T long 254 | # define CURL_FORMAT_CURL_OFF_T "ld" 255 | # define CURL_FORMAT_CURL_OFF_TU "lu" 256 | # define CURL_SUFFIX_CURL_OFF_T L 257 | # define CURL_SUFFIX_CURL_OFF_TU UL 258 | # else 259 | # define CURL_TYPEOF_CURL_OFF_T long 260 | # define CURL_FORMAT_CURL_OFF_T "ld" 261 | # define CURL_FORMAT_CURL_OFF_TU "lu" 262 | # define CURL_SUFFIX_CURL_OFF_T L 263 | # define CURL_SUFFIX_CURL_OFF_TU UL 264 | # endif 265 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 266 | # define CURL_PULL_SYS_TYPES_H 1 267 | # define CURL_PULL_SYS_SOCKET_H 1 268 | # endif 269 | 270 | #elif defined(TPF) 271 | # define CURL_TYPEOF_CURL_OFF_T long 272 | # define CURL_FORMAT_CURL_OFF_T "ld" 273 | # define CURL_FORMAT_CURL_OFF_TU "lu" 274 | # define CURL_SUFFIX_CURL_OFF_T L 275 | # define CURL_SUFFIX_CURL_OFF_TU UL 276 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 277 | 278 | #elif defined(__TINYC__) /* also known as tcc */ 279 | # define CURL_TYPEOF_CURL_OFF_T long long 280 | # define CURL_FORMAT_CURL_OFF_T "lld" 281 | # define CURL_FORMAT_CURL_OFF_TU "llu" 282 | # define CURL_SUFFIX_CURL_OFF_T LL 283 | # define CURL_SUFFIX_CURL_OFF_TU ULL 284 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 285 | # define CURL_PULL_SYS_TYPES_H 1 286 | # define CURL_PULL_SYS_SOCKET_H 1 287 | 288 | #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) /* Oracle Solaris Studio */ 289 | # if !defined(__LP64) && (defined(__ILP32) || \ 290 | defined(__i386) || \ 291 | defined(__sparcv8) || \ 292 | defined(__sparcv8plus)) 293 | # define CURL_TYPEOF_CURL_OFF_T long long 294 | # define CURL_FORMAT_CURL_OFF_T "lld" 295 | # define CURL_FORMAT_CURL_OFF_TU "llu" 296 | # define CURL_SUFFIX_CURL_OFF_T LL 297 | # define CURL_SUFFIX_CURL_OFF_TU ULL 298 | # elif defined(__LP64) || \ 299 | defined(__amd64) || defined(__sparcv9) 300 | # define CURL_TYPEOF_CURL_OFF_T long 301 | # define CURL_FORMAT_CURL_OFF_T "ld" 302 | # define CURL_FORMAT_CURL_OFF_TU "lu" 303 | # define CURL_SUFFIX_CURL_OFF_T L 304 | # define CURL_SUFFIX_CURL_OFF_TU UL 305 | # endif 306 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 307 | # define CURL_PULL_SYS_TYPES_H 1 308 | # define CURL_PULL_SYS_SOCKET_H 1 309 | 310 | #elif defined(__xlc__) /* IBM xlc compiler */ 311 | # if !defined(_LP64) 312 | # define CURL_TYPEOF_CURL_OFF_T long long 313 | # define CURL_FORMAT_CURL_OFF_T "lld" 314 | # define CURL_FORMAT_CURL_OFF_TU "llu" 315 | # define CURL_SUFFIX_CURL_OFF_T LL 316 | # define CURL_SUFFIX_CURL_OFF_TU ULL 317 | # else 318 | # define CURL_TYPEOF_CURL_OFF_T long 319 | # define CURL_FORMAT_CURL_OFF_T "ld" 320 | # define CURL_FORMAT_CURL_OFF_TU "lu" 321 | # define CURL_SUFFIX_CURL_OFF_T L 322 | # define CURL_SUFFIX_CURL_OFF_TU UL 323 | # endif 324 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 325 | # define CURL_PULL_SYS_TYPES_H 1 326 | # define CURL_PULL_SYS_SOCKET_H 1 327 | 328 | #elif defined(__hpux) /* HP aCC compiler */ 329 | # if !defined(_LP64) 330 | # define CURL_TYPEOF_CURL_OFF_T long long 331 | # define CURL_FORMAT_CURL_OFF_T "lld" 332 | # define CURL_FORMAT_CURL_OFF_TU "llu" 333 | # define CURL_SUFFIX_CURL_OFF_T LL 334 | # define CURL_SUFFIX_CURL_OFF_TU ULL 335 | # else 336 | # define CURL_TYPEOF_CURL_OFF_T long 337 | # define CURL_FORMAT_CURL_OFF_T "ld" 338 | # define CURL_FORMAT_CURL_OFF_TU "lu" 339 | # define CURL_SUFFIX_CURL_OFF_T L 340 | # define CURL_SUFFIX_CURL_OFF_TU UL 341 | # endif 342 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 343 | # define CURL_PULL_SYS_TYPES_H 1 344 | # define CURL_PULL_SYS_SOCKET_H 1 345 | 346 | /* ===================================== */ 347 | /* KEEP MSVC THE PENULTIMATE ENTRY */ 348 | /* ===================================== */ 349 | 350 | #elif defined(_MSC_VER) 351 | # if (_MSC_VER >= 1800) 352 | # include 353 | # define CURL_TYPEOF_CURL_OFF_T __int64 354 | # define CURL_FORMAT_CURL_OFF_T PRId64 355 | # define CURL_FORMAT_CURL_OFF_TU PRIu64 356 | # define CURL_SUFFIX_CURL_OFF_T i64 357 | # define CURL_SUFFIX_CURL_OFF_TU ui64 358 | # elif (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64) 359 | # define CURL_TYPEOF_CURL_OFF_T __int64 360 | # define CURL_FORMAT_CURL_OFF_T "I64d" 361 | # define CURL_FORMAT_CURL_OFF_TU "I64u" 362 | # define CURL_SUFFIX_CURL_OFF_T i64 363 | # define CURL_SUFFIX_CURL_OFF_TU ui64 364 | # else 365 | # define CURL_TYPEOF_CURL_OFF_T long 366 | # define CURL_FORMAT_CURL_OFF_T "ld" 367 | # define CURL_FORMAT_CURL_OFF_TU "lu" 368 | # define CURL_SUFFIX_CURL_OFF_T L 369 | # define CURL_SUFFIX_CURL_OFF_TU UL 370 | # endif 371 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 372 | 373 | /* ===================================== */ 374 | /* KEEP GENERIC GCC THE LAST ENTRY */ 375 | /* ===================================== */ 376 | 377 | #elif defined(__GNUC__) && !defined(_SCO_DS) 378 | # if !defined(__LP64__) && \ 379 | (defined(__ILP32__) || defined(__i386__) || defined(__hppa__) || \ 380 | defined(__ppc__) || defined(__powerpc__) || defined(__arm__) || \ 381 | defined(__sparc__) || defined(__mips__) || defined(__sh__) || \ 382 | defined(__XTENSA__) || \ 383 | (defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 4) || \ 384 | (defined(__LONG_MAX__) && __LONG_MAX__ == 2147483647L)) 385 | # define CURL_TYPEOF_CURL_OFF_T long long 386 | # define CURL_FORMAT_CURL_OFF_T "lld" 387 | # define CURL_FORMAT_CURL_OFF_TU "llu" 388 | # define CURL_SUFFIX_CURL_OFF_T LL 389 | # define CURL_SUFFIX_CURL_OFF_TU ULL 390 | # elif defined(__LP64__) || \ 391 | defined(__x86_64__) || defined(__ppc64__) || defined(__sparc64__) || \ 392 | defined(__e2k__) || \ 393 | (defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 8) || \ 394 | (defined(__LONG_MAX__) && __LONG_MAX__ == 9223372036854775807L) 395 | # define CURL_TYPEOF_CURL_OFF_T long 396 | # define CURL_FORMAT_CURL_OFF_T "ld" 397 | # define CURL_FORMAT_CURL_OFF_TU "lu" 398 | # define CURL_SUFFIX_CURL_OFF_T L 399 | # define CURL_SUFFIX_CURL_OFF_TU UL 400 | # endif 401 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 402 | # define CURL_PULL_SYS_TYPES_H 1 403 | # define CURL_PULL_SYS_SOCKET_H 1 404 | 405 | #else 406 | /* generic "safe guess" on old 32 bit style */ 407 | # define CURL_TYPEOF_CURL_OFF_T long 408 | # define CURL_FORMAT_CURL_OFF_T "ld" 409 | # define CURL_FORMAT_CURL_OFF_TU "lu" 410 | # define CURL_SUFFIX_CURL_OFF_T L 411 | # define CURL_SUFFIX_CURL_OFF_TU UL 412 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 413 | #endif 414 | 415 | #ifdef _AIX 416 | /* AIX needs */ 417 | #define CURL_PULL_SYS_POLL_H 418 | #endif 419 | 420 | 421 | /* CURL_PULL_WS2TCPIP_H is defined above when inclusion of header file */ 422 | /* ws2tcpip.h is required here to properly make type definitions below. */ 423 | #ifdef CURL_PULL_WS2TCPIP_H 424 | # include 425 | # include 426 | # include 427 | #endif 428 | 429 | /* CURL_PULL_SYS_TYPES_H is defined above when inclusion of header file */ 430 | /* sys/types.h is required here to properly make type definitions below. */ 431 | #ifdef CURL_PULL_SYS_TYPES_H 432 | # include 433 | #endif 434 | 435 | /* CURL_PULL_SYS_SOCKET_H is defined above when inclusion of header file */ 436 | /* sys/socket.h is required here to properly make type definitions below. */ 437 | #ifdef CURL_PULL_SYS_SOCKET_H 438 | # include 439 | #endif 440 | 441 | /* CURL_PULL_SYS_POLL_H is defined above when inclusion of header file */ 442 | /* sys/poll.h is required here to properly make type definitions below. */ 443 | #ifdef CURL_PULL_SYS_POLL_H 444 | # include 445 | #endif 446 | 447 | /* Data type definition of curl_socklen_t. */ 448 | #ifdef CURL_TYPEOF_CURL_SOCKLEN_T 449 | typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t; 450 | #endif 451 | 452 | /* Data type definition of curl_off_t. */ 453 | 454 | #ifdef CURL_TYPEOF_CURL_OFF_T 455 | typedef CURL_TYPEOF_CURL_OFF_T curl_off_t; 456 | #endif 457 | 458 | /* 459 | * CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow 460 | * these to be visible and exported by the external libcurl interface API, 461 | * while also making them visible to the library internals, simply including 462 | * curl_setup.h, without actually needing to include curl.h internally. 463 | * If some day this section would grow big enough, all this should be moved 464 | * to its own header file. 465 | */ 466 | 467 | /* 468 | * Figure out if we can use the ## preprocessor operator, which is supported 469 | * by ISO/ANSI C and C++. Some compilers support it without setting __STDC__ 470 | * or __cplusplus so we need to carefully check for them too. 471 | */ 472 | 473 | #if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \ 474 | defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \ 475 | defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \ 476 | defined(__ILEC400__) 477 | /* This compiler is believed to have an ISO compatible preprocessor */ 478 | #define CURL_ISOCPP 479 | #else 480 | /* This compiler is believed NOT to have an ISO compatible preprocessor */ 481 | #undef CURL_ISOCPP 482 | #endif 483 | 484 | /* 485 | * Macros for minimum-width signed and unsigned curl_off_t integer constants. 486 | */ 487 | 488 | #if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551) 489 | # define CURLINC_OFF_T_C_HLPR2(x) x 490 | # define CURLINC_OFF_T_C_HLPR1(x) CURLINC_OFF_T_C_HLPR2(x) 491 | # define CURL_OFF_T_C(Val) CURLINC_OFF_T_C_HLPR1(Val) ## \ 492 | CURLINC_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T) 493 | # define CURL_OFF_TU_C(Val) CURLINC_OFF_T_C_HLPR1(Val) ## \ 494 | CURLINC_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU) 495 | #else 496 | # ifdef CURL_ISOCPP 497 | # define CURLINC_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix 498 | # else 499 | # define CURLINC_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix 500 | # endif 501 | # define CURLINC_OFF_T_C_HLPR1(Val,Suffix) CURLINC_OFF_T_C_HLPR2(Val,Suffix) 502 | # define CURL_OFF_T_C(Val) CURLINC_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T) 503 | # define CURL_OFF_TU_C(Val) CURLINC_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU) 504 | #endif 505 | 506 | #endif /* CURLINC_SYSTEM_H */ 507 | -------------------------------------------------------------------------------- /include/Makefile.in: -------------------------------------------------------------------------------- 1 | # Makefile.in generated by automake 1.16.5 from Makefile.am. 2 | # @configure_input@ 3 | 4 | # Copyright (C) 1994-2021 Free Software Foundation, Inc. 5 | 6 | # This Makefile.in is free software; the Free Software Foundation 7 | # gives unlimited permission to copy and/or distribute it, 8 | # with or without modifications, as long as this notice is preserved. 9 | 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without 12 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A 13 | # PARTICULAR PURPOSE. 14 | 15 | @SET_MAKE@ 16 | 17 | VPATH = @srcdir@ 18 | am__is_gnu_make = { \ 19 | if test -z '$(MAKELEVEL)'; then \ 20 | false; \ 21 | elif test -n '$(MAKE_HOST)'; then \ 22 | true; \ 23 | elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ 24 | true; \ 25 | else \ 26 | false; \ 27 | fi; \ 28 | } 29 | am__make_running_with_option = \ 30 | case $${target_option-} in \ 31 | ?) ;; \ 32 | *) echo "am__make_running_with_option: internal error: invalid" \ 33 | "target option '$${target_option-}' specified" >&2; \ 34 | exit 1;; \ 35 | esac; \ 36 | has_opt=no; \ 37 | sane_makeflags=$$MAKEFLAGS; \ 38 | if $(am__is_gnu_make); then \ 39 | sane_makeflags=$$MFLAGS; \ 40 | else \ 41 | case $$MAKEFLAGS in \ 42 | *\\[\ \ ]*) \ 43 | bs=\\; \ 44 | sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ 45 | | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ 46 | esac; \ 47 | fi; \ 48 | skip_next=no; \ 49 | strip_trailopt () \ 50 | { \ 51 | flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ 52 | }; \ 53 | for flg in $$sane_makeflags; do \ 54 | test $$skip_next = yes && { skip_next=no; continue; }; \ 55 | case $$flg in \ 56 | *=*|--*) continue;; \ 57 | -*I) strip_trailopt 'I'; skip_next=yes;; \ 58 | -*I?*) strip_trailopt 'I';; \ 59 | -*O) strip_trailopt 'O'; skip_next=yes;; \ 60 | -*O?*) strip_trailopt 'O';; \ 61 | -*l) strip_trailopt 'l'; skip_next=yes;; \ 62 | -*l?*) strip_trailopt 'l';; \ 63 | -[dEDm]) skip_next=yes;; \ 64 | -[JT]) skip_next=yes;; \ 65 | esac; \ 66 | case $$flg in \ 67 | *$$target_option*) has_opt=yes; break;; \ 68 | esac; \ 69 | done; \ 70 | test $$has_opt = yes 71 | am__make_dryrun = (target_option=n; $(am__make_running_with_option)) 72 | am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 73 | pkgdatadir = $(datadir)/@PACKAGE@ 74 | pkglibdir = $(libdir)/@PACKAGE@ 75 | pkglibexecdir = $(libexecdir)/@PACKAGE@ 76 | am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd 77 | install_sh_DATA = $(install_sh) -c -m 644 78 | install_sh_PROGRAM = $(install_sh) -c 79 | install_sh_SCRIPT = $(install_sh) -c 80 | INSTALL_HEADER = $(INSTALL_DATA) 81 | transform = $(program_transform_name) 82 | NORMAL_INSTALL = : 83 | PRE_INSTALL = : 84 | POST_INSTALL = : 85 | NORMAL_UNINSTALL = : 86 | PRE_UNINSTALL = : 87 | POST_UNINSTALL = : 88 | build_triplet = @build@ 89 | host_triplet = @host@ 90 | subdir = include/curl 91 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 92 | am__aclocal_m4_deps = $(top_srcdir)/m4/curl-amissl.m4 \ 93 | $(top_srcdir)/m4/curl-bearssl.m4 \ 94 | $(top_srcdir)/m4/curl-compilers.m4 \ 95 | $(top_srcdir)/m4/curl-confopts.m4 \ 96 | $(top_srcdir)/m4/curl-functions.m4 \ 97 | $(top_srcdir)/m4/curl-gnutls.m4 \ 98 | $(top_srcdir)/m4/curl-mbedtls.m4 \ 99 | $(top_srcdir)/m4/curl-openssl.m4 \ 100 | $(top_srcdir)/m4/curl-override.m4 \ 101 | $(top_srcdir)/m4/curl-reentrant.m4 \ 102 | $(top_srcdir)/m4/curl-rustls.m4 \ 103 | $(top_srcdir)/m4/curl-schannel.m4 \ 104 | $(top_srcdir)/m4/curl-sectransp.m4 \ 105 | $(top_srcdir)/m4/curl-sysconfig.m4 \ 106 | $(top_srcdir)/m4/curl-wolfssl.m4 $(top_srcdir)/m4/libtool.m4 \ 107 | $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ 108 | $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ 109 | $(top_srcdir)/m4/xc-am-iface.m4 \ 110 | $(top_srcdir)/m4/xc-cc-check.m4 \ 111 | $(top_srcdir)/m4/xc-lt-iface.m4 \ 112 | $(top_srcdir)/m4/xc-translit.m4 \ 113 | $(top_srcdir)/m4/xc-val-flgs.m4 \ 114 | $(top_srcdir)/m4/zz40-xc-ovr.m4 \ 115 | $(top_srcdir)/m4/zz50-xc-ovr.m4 \ 116 | $(top_srcdir)/m4/zz60-xc-ovr.m4 $(top_srcdir)/acinclude.m4 \ 117 | $(top_srcdir)/configure.ac 118 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 119 | $(ACLOCAL_M4) 120 | DIST_COMMON = $(srcdir)/Makefile.am $(pkginclude_HEADERS) \ 121 | $(am__DIST_COMMON) 122 | mkinstalldirs = $(install_sh) -d 123 | CONFIG_HEADER = $(top_builddir)/lib/curl_config.h 124 | CONFIG_CLEAN_FILES = 125 | CONFIG_CLEAN_VPATH_FILES = 126 | AM_V_P = $(am__v_P_@AM_V@) 127 | am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) 128 | am__v_P_0 = false 129 | am__v_P_1 = : 130 | AM_V_GEN = $(am__v_GEN_@AM_V@) 131 | am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) 132 | am__v_GEN_0 = @echo " GEN " $@; 133 | am__v_GEN_1 = 134 | AM_V_at = $(am__v_at_@AM_V@) 135 | am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) 136 | am__v_at_0 = @ 137 | am__v_at_1 = 138 | SOURCES = 139 | DIST_SOURCES = 140 | am__can_run_installinfo = \ 141 | case $$AM_UPDATE_INFO_DIR in \ 142 | n|no|NO) false;; \ 143 | *) (install-info --version) >/dev/null 2>&1;; \ 144 | esac 145 | am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; 146 | am__vpath_adj = case $$p in \ 147 | $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ 148 | *) f=$$p;; \ 149 | esac; 150 | am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; 151 | am__install_max = 40 152 | am__nobase_strip_setup = \ 153 | srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` 154 | am__nobase_strip = \ 155 | for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" 156 | am__nobase_list = $(am__nobase_strip_setup); \ 157 | for p in $$list; do echo "$$p $$p"; done | \ 158 | sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ 159 | $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ 160 | if (++n[$$2] == $(am__install_max)) \ 161 | { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ 162 | END { for (dir in files) print dir, files[dir] }' 163 | am__base_list = \ 164 | sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ 165 | sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' 166 | am__uninstall_files_from_dir = { \ 167 | test -z "$$files" \ 168 | || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ 169 | || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ 170 | $(am__cd) "$$dir" && rm -f $$files; }; \ 171 | } 172 | am__installdirs = "$(DESTDIR)$(pkgincludedir)" 173 | HEADERS = $(pkginclude_HEADERS) 174 | am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) 175 | # Read a list of newline-separated strings from the standard input, 176 | # and print each of them once, without duplicates. Input order is 177 | # *not* preserved. 178 | am__uniquify_input = $(AWK) '\ 179 | BEGIN { nonempty = 0; } \ 180 | { items[$$0] = 1; nonempty = 1; } \ 181 | END { if (nonempty) { for (i in items) print i; }; } \ 182 | ' 183 | # Make sure the list of sources is unique. This is necessary because, 184 | # e.g., the same source file might be shared among _SOURCES variables 185 | # for different programs/libraries. 186 | am__define_uniq_tagged_files = \ 187 | list='$(am__tagged_files)'; \ 188 | unique=`for i in $$list; do \ 189 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 190 | done | $(am__uniquify_input)` 191 | am__DIST_COMMON = $(srcdir)/Makefile.in 192 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 193 | pkgincludedir = $(includedir)/curl 194 | ACLOCAL = @ACLOCAL@ 195 | AMTAR = @AMTAR@ 196 | AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ 197 | APACHECTL = @APACHECTL@ 198 | APXS = @APXS@ 199 | AR = @AR@ 200 | AR_FLAGS = @AR_FLAGS@ 201 | AS = @AS@ 202 | AUTOCONF = @AUTOCONF@ 203 | AUTOHEADER = @AUTOHEADER@ 204 | AUTOMAKE = @AUTOMAKE@ 205 | AWK = @AWK@ 206 | BLANK_AT_MAKETIME = @BLANK_AT_MAKETIME@ 207 | CADDY = @CADDY@ 208 | CC = @CC@ 209 | CCDEPMODE = @CCDEPMODE@ 210 | CFLAGS = @CFLAGS@ 211 | CFLAG_CURL_SYMBOL_HIDING = @CFLAG_CURL_SYMBOL_HIDING@ 212 | CONFIGURE_OPTIONS = @CONFIGURE_OPTIONS@ 213 | CPP = @CPP@ 214 | CPPFLAGS = @CPPFLAGS@ 215 | CPPFLAG_CURL_STATICLIB = @CPPFLAG_CURL_STATICLIB@ 216 | CSCOPE = @CSCOPE@ 217 | CTAGS = @CTAGS@ 218 | CURLVERSION = @CURLVERSION@ 219 | CURL_CA_BUNDLE = @CURL_CA_BUNDLE@ 220 | CURL_CFLAG_EXTRAS = @CURL_CFLAG_EXTRAS@ 221 | CURL_DISABLE_DICT = @CURL_DISABLE_DICT@ 222 | CURL_DISABLE_FILE = @CURL_DISABLE_FILE@ 223 | CURL_DISABLE_FTP = @CURL_DISABLE_FTP@ 224 | CURL_DISABLE_GOPHER = @CURL_DISABLE_GOPHER@ 225 | CURL_DISABLE_HTTP = @CURL_DISABLE_HTTP@ 226 | CURL_DISABLE_IMAP = @CURL_DISABLE_IMAP@ 227 | CURL_DISABLE_LDAP = @CURL_DISABLE_LDAP@ 228 | CURL_DISABLE_LDAPS = @CURL_DISABLE_LDAPS@ 229 | CURL_DISABLE_MQTT = @CURL_DISABLE_MQTT@ 230 | CURL_DISABLE_POP3 = @CURL_DISABLE_POP3@ 231 | CURL_DISABLE_PROXY = @CURL_DISABLE_PROXY@ 232 | CURL_DISABLE_RTSP = @CURL_DISABLE_RTSP@ 233 | CURL_DISABLE_SMB = @CURL_DISABLE_SMB@ 234 | CURL_DISABLE_SMTP = @CURL_DISABLE_SMTP@ 235 | CURL_DISABLE_TELNET = @CURL_DISABLE_TELNET@ 236 | CURL_DISABLE_TFTP = @CURL_DISABLE_TFTP@ 237 | CURL_LT_SHLIB_VERSIONED_FLAVOUR = @CURL_LT_SHLIB_VERSIONED_FLAVOUR@ 238 | CURL_NETWORK_AND_TIME_LIBS = @CURL_NETWORK_AND_TIME_LIBS@ 239 | CURL_NETWORK_LIBS = @CURL_NETWORK_LIBS@ 240 | CURL_PLIST_VERSION = @CURL_PLIST_VERSION@ 241 | CURL_WITH_MULTI_SSL = @CURL_WITH_MULTI_SSL@ 242 | CYGPATH_W = @CYGPATH_W@ 243 | DEFAULT_SSL_BACKEND = @DEFAULT_SSL_BACKEND@ 244 | DEFS = @DEFS@ 245 | DEPDIR = @DEPDIR@ 246 | DLLTOOL = @DLLTOOL@ 247 | DSYMUTIL = @DSYMUTIL@ 248 | DUMPBIN = @DUMPBIN@ 249 | ECHO_C = @ECHO_C@ 250 | ECHO_N = @ECHO_N@ 251 | ECHO_T = @ECHO_T@ 252 | EGREP = @EGREP@ 253 | ENABLE_SHARED = @ENABLE_SHARED@ 254 | ENABLE_STATIC = @ENABLE_STATIC@ 255 | ETAGS = @ETAGS@ 256 | EXEEXT = @EXEEXT@ 257 | FGREP = @FGREP@ 258 | FILECMD = @FILECMD@ 259 | FISH_FUNCTIONS_DIR = @FISH_FUNCTIONS_DIR@ 260 | GCOV = @GCOV@ 261 | GREP = @GREP@ 262 | HAVE_BROTLI = @HAVE_BROTLI@ 263 | HAVE_GNUTLS_SRP = @HAVE_GNUTLS_SRP@ 264 | HAVE_LDAP_SSL = @HAVE_LDAP_SSL@ 265 | HAVE_LIBZ = @HAVE_LIBZ@ 266 | HAVE_OPENSSL_SRP = @HAVE_OPENSSL_SRP@ 267 | HAVE_PROTO_BSDSOCKET_H = @HAVE_PROTO_BSDSOCKET_H@ 268 | HAVE_ZSTD = @HAVE_ZSTD@ 269 | HTTPD = @HTTPD@ 270 | HTTPD_NGHTTPX = @HTTPD_NGHTTPX@ 271 | IDN_ENABLED = @IDN_ENABLED@ 272 | INSTALL = @INSTALL@ 273 | INSTALL_DATA = @INSTALL_DATA@ 274 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ 275 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ 276 | INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ 277 | IPV6_ENABLED = @IPV6_ENABLED@ 278 | LCOV = @LCOV@ 279 | LD = @LD@ 280 | LDFLAGS = @LDFLAGS@ 281 | LIBCURL_LIBS = @LIBCURL_LIBS@ 282 | LIBCURL_NO_SHARED = @LIBCURL_NO_SHARED@ 283 | LIBOBJS = @LIBOBJS@ 284 | LIBS = @LIBS@ 285 | LIBTOOL = @LIBTOOL@ 286 | LIPO = @LIPO@ 287 | LN_S = @LN_S@ 288 | LTLIBOBJS = @LTLIBOBJS@ 289 | LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 290 | MAINT = @MAINT@ 291 | MAKEINFO = @MAKEINFO@ 292 | MANIFEST_TOOL = @MANIFEST_TOOL@ 293 | MANOPT = @MANOPT@ 294 | MKDIR_P = @MKDIR_P@ 295 | NM = @NM@ 296 | NMEDIT = @NMEDIT@ 297 | NROFF = @NROFF@ 298 | OBJDUMP = @OBJDUMP@ 299 | OBJEXT = @OBJEXT@ 300 | OTOOL = @OTOOL@ 301 | OTOOL64 = @OTOOL64@ 302 | PACKAGE = @PACKAGE@ 303 | PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ 304 | PACKAGE_NAME = @PACKAGE_NAME@ 305 | PACKAGE_STRING = @PACKAGE_STRING@ 306 | PACKAGE_TARNAME = @PACKAGE_TARNAME@ 307 | PACKAGE_URL = @PACKAGE_URL@ 308 | PACKAGE_VERSION = @PACKAGE_VERSION@ 309 | PATH_SEPARATOR = @PATH_SEPARATOR@ 310 | PERL = @PERL@ 311 | PKGADD_NAME = @PKGADD_NAME@ 312 | PKGADD_PKG = @PKGADD_PKG@ 313 | PKGADD_VENDOR = @PKGADD_VENDOR@ 314 | PKGCONFIG = @PKGCONFIG@ 315 | RANDOM_FILE = @RANDOM_FILE@ 316 | RANLIB = @RANLIB@ 317 | RC = @RC@ 318 | REQUIRE_LIB_DEPS = @REQUIRE_LIB_DEPS@ 319 | SED = @SED@ 320 | SET_MAKE = @SET_MAKE@ 321 | SHELL = @SHELL@ 322 | SSL_BACKENDS = @SSL_BACKENDS@ 323 | SSL_ENABLED = @SSL_ENABLED@ 324 | SSL_LIBS = @SSL_LIBS@ 325 | STRIP = @STRIP@ 326 | SUPPORT_FEATURES = @SUPPORT_FEATURES@ 327 | SUPPORT_PROTOCOLS = @SUPPORT_PROTOCOLS@ 328 | TEST_NGHTTPX = @TEST_NGHTTPX@ 329 | USE_ARES = @USE_ARES@ 330 | USE_BEARSSL = @USE_BEARSSL@ 331 | USE_GNUTLS = @USE_GNUTLS@ 332 | USE_HYPER = @USE_HYPER@ 333 | USE_LIBRTMP = @USE_LIBRTMP@ 334 | USE_LIBSSH = @USE_LIBSSH@ 335 | USE_LIBSSH2 = @USE_LIBSSH2@ 336 | USE_MBEDTLS = @USE_MBEDTLS@ 337 | USE_MSH3 = @USE_MSH3@ 338 | USE_NGHTTP2 = @USE_NGHTTP2@ 339 | USE_NGHTTP3 = @USE_NGHTTP3@ 340 | USE_NGTCP2 = @USE_NGTCP2@ 341 | USE_NGTCP2_CRYPTO_GNUTLS = @USE_NGTCP2_CRYPTO_GNUTLS@ 342 | USE_NGTCP2_CRYPTO_QUICTLS = @USE_NGTCP2_CRYPTO_QUICTLS@ 343 | USE_NGTCP2_CRYPTO_WOLFSSL = @USE_NGTCP2_CRYPTO_WOLFSSL@ 344 | USE_OPENLDAP = @USE_OPENLDAP@ 345 | USE_QUICHE = @USE_QUICHE@ 346 | USE_RUSTLS = @USE_RUSTLS@ 347 | USE_SCHANNEL = @USE_SCHANNEL@ 348 | USE_SECTRANSP = @USE_SECTRANSP@ 349 | USE_UNIX_SOCKETS = @USE_UNIX_SOCKETS@ 350 | USE_WIN32_CRYPTO = @USE_WIN32_CRYPTO@ 351 | USE_WIN32_LARGE_FILES = @USE_WIN32_LARGE_FILES@ 352 | USE_WIN32_SMALL_FILES = @USE_WIN32_SMALL_FILES@ 353 | USE_WINDOWS_SSPI = @USE_WINDOWS_SSPI@ 354 | USE_WOLFSSH = @USE_WOLFSSH@ 355 | USE_WOLFSSL = @USE_WOLFSSL@ 356 | VERSION = @VERSION@ 357 | VERSIONNUM = @VERSIONNUM@ 358 | ZLIB_LIBS = @ZLIB_LIBS@ 359 | ZSH_FUNCTIONS_DIR = @ZSH_FUNCTIONS_DIR@ 360 | abs_builddir = @abs_builddir@ 361 | abs_srcdir = @abs_srcdir@ 362 | abs_top_builddir = @abs_top_builddir@ 363 | abs_top_srcdir = @abs_top_srcdir@ 364 | ac_ct_AR = @ac_ct_AR@ 365 | ac_ct_CC = @ac_ct_CC@ 366 | ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ 367 | am__include = @am__include@ 368 | am__leading_dot = @am__leading_dot@ 369 | am__quote = @am__quote@ 370 | am__tar = @am__tar@ 371 | am__untar = @am__untar@ 372 | bindir = @bindir@ 373 | build = @build@ 374 | build_alias = @build_alias@ 375 | build_cpu = @build_cpu@ 376 | build_os = @build_os@ 377 | build_vendor = @build_vendor@ 378 | builddir = @builddir@ 379 | datadir = @datadir@ 380 | datarootdir = @datarootdir@ 381 | docdir = @docdir@ 382 | dvidir = @dvidir@ 383 | exec_prefix = @exec_prefix@ 384 | host = @host@ 385 | host_alias = @host_alias@ 386 | host_cpu = @host_cpu@ 387 | host_os = @host_os@ 388 | host_vendor = @host_vendor@ 389 | htmldir = @htmldir@ 390 | includedir = @includedir@ 391 | infodir = @infodir@ 392 | install_sh = @install_sh@ 393 | libdir = @libdir@ 394 | libexecdir = @libexecdir@ 395 | libext = @libext@ 396 | localedir = @localedir@ 397 | localstatedir = @localstatedir@ 398 | mandir = @mandir@ 399 | mkdir_p = @mkdir_p@ 400 | oldincludedir = @oldincludedir@ 401 | pdfdir = @pdfdir@ 402 | prefix = @prefix@ 403 | program_transform_name = @program_transform_name@ 404 | psdir = @psdir@ 405 | runstatedir = @runstatedir@ 406 | sbindir = @sbindir@ 407 | sharedstatedir = @sharedstatedir@ 408 | srcdir = @srcdir@ 409 | sysconfdir = @sysconfdir@ 410 | target_alias = @target_alias@ 411 | top_build_prefix = @top_build_prefix@ 412 | top_builddir = @top_builddir@ 413 | top_srcdir = @top_srcdir@ 414 | 415 | #*************************************************************************** 416 | # _ _ ____ _ 417 | # Project ___| | | | _ \| | 418 | # / __| | | | |_) | | 419 | # | (__| |_| | _ <| |___ 420 | # \___|\___/|_| \_\_____| 421 | # 422 | # Copyright (C) Daniel Stenberg, , et al. 423 | # 424 | # This software is licensed as described in the file COPYING, which 425 | # you should have received as part of this distribution. The terms 426 | # are also available at https://curl.se/docs/copyright.html. 427 | # 428 | # You may opt to use, copy, modify, merge, publish, distribute and/or sell 429 | # copies of the Software, and permit persons to whom the Software is 430 | # furnished to do so, under the terms of the COPYING file. 431 | # 432 | # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 433 | # KIND, either express or implied. 434 | # 435 | # SPDX-License-Identifier: curl 436 | # 437 | ########################################################################### 438 | pkginclude_HEADERS = \ 439 | curl.h curlver.h easy.h mprintf.h stdcheaders.h multi.h \ 440 | typecheck-gcc.h system.h urlapi.h options.h header.h websockets.h 441 | 442 | CHECKSRC = $(CS_$(V)) 443 | CS_0 = @echo " RUN " $@; 444 | CS_1 = 445 | CS_ = $(CS_0) 446 | all: all-am 447 | 448 | .SUFFIXES: 449 | $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) 450 | @for dep in $?; do \ 451 | case '$(am__configure_deps)' in \ 452 | *$$dep*) \ 453 | ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ 454 | && { if test -f $@; then exit 0; else break; fi; }; \ 455 | exit 1;; \ 456 | esac; \ 457 | done; \ 458 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/curl/Makefile'; \ 459 | $(am__cd) $(top_srcdir) && \ 460 | $(AUTOMAKE) --foreign include/curl/Makefile 461 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 462 | @case '$?' in \ 463 | *config.status*) \ 464 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ 465 | *) \ 466 | echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ 467 | cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ 468 | esac; 469 | 470 | $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) 471 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 472 | 473 | $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) 474 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 475 | $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) 476 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 477 | $(am__aclocal_m4_deps): 478 | 479 | mostlyclean-libtool: 480 | -rm -f *.lo 481 | 482 | clean-libtool: 483 | -rm -rf .libs _libs 484 | install-pkgincludeHEADERS: $(pkginclude_HEADERS) 485 | @$(NORMAL_INSTALL) 486 | @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ 487 | if test -n "$$list"; then \ 488 | echo " $(MKDIR_P) '$(DESTDIR)$(pkgincludedir)'"; \ 489 | $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" || exit 1; \ 490 | fi; \ 491 | for p in $$list; do \ 492 | if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ 493 | echo "$$d$$p"; \ 494 | done | $(am__base_list) | \ 495 | while read files; do \ 496 | echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \ 497 | $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \ 498 | done 499 | 500 | uninstall-pkgincludeHEADERS: 501 | @$(NORMAL_UNINSTALL) 502 | @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ 503 | files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ 504 | dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir) 505 | 506 | ID: $(am__tagged_files) 507 | $(am__define_uniq_tagged_files); mkid -fID $$unique 508 | tags: tags-am 509 | TAGS: tags 510 | 511 | tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 512 | set x; \ 513 | here=`pwd`; \ 514 | $(am__define_uniq_tagged_files); \ 515 | shift; \ 516 | if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ 517 | test -n "$$unique" || unique=$$empty_fix; \ 518 | if test $$# -gt 0; then \ 519 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 520 | "$$@" $$unique; \ 521 | else \ 522 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 523 | $$unique; \ 524 | fi; \ 525 | fi 526 | ctags: ctags-am 527 | 528 | CTAGS: ctags 529 | ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 530 | $(am__define_uniq_tagged_files); \ 531 | test -z "$(CTAGS_ARGS)$$unique" \ 532 | || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ 533 | $$unique 534 | 535 | GTAGS: 536 | here=`$(am__cd) $(top_builddir) && pwd` \ 537 | && $(am__cd) $(top_srcdir) \ 538 | && gtags -i $(GTAGS_ARGS) "$$here" 539 | cscopelist: cscopelist-am 540 | 541 | cscopelist-am: $(am__tagged_files) 542 | list='$(am__tagged_files)'; \ 543 | case "$(srcdir)" in \ 544 | [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ 545 | *) sdir=$(subdir)/$(srcdir) ;; \ 546 | esac; \ 547 | for i in $$list; do \ 548 | if test -f "$$i"; then \ 549 | echo "$(subdir)/$$i"; \ 550 | else \ 551 | echo "$$sdir/$$i"; \ 552 | fi; \ 553 | done >> $(top_builddir)/cscope.files 554 | 555 | distclean-tags: 556 | -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags 557 | distdir: $(BUILT_SOURCES) 558 | $(MAKE) $(AM_MAKEFLAGS) distdir-am 559 | 560 | distdir-am: $(DISTFILES) 561 | @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ 562 | topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ 563 | list='$(DISTFILES)'; \ 564 | dist_files=`for file in $$list; do echo $$file; done | \ 565 | sed -e "s|^$$srcdirstrip/||;t" \ 566 | -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ 567 | case $$dist_files in \ 568 | */*) $(MKDIR_P) `echo "$$dist_files" | \ 569 | sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ 570 | sort -u` ;; \ 571 | esac; \ 572 | for file in $$dist_files; do \ 573 | if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ 574 | if test -d $$d/$$file; then \ 575 | dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ 576 | if test -d "$(distdir)/$$file"; then \ 577 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ 578 | fi; \ 579 | if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ 580 | cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ 581 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ 582 | fi; \ 583 | cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ 584 | else \ 585 | test -f "$(distdir)/$$file" \ 586 | || cp -p $$d/$$file "$(distdir)/$$file" \ 587 | || exit 1; \ 588 | fi; \ 589 | done 590 | check-am: all-am 591 | check: check-am 592 | @CURLDEBUG_FALSE@all-local: 593 | all-am: Makefile $(HEADERS) all-local 594 | installdirs: 595 | for dir in "$(DESTDIR)$(pkgincludedir)"; do \ 596 | test -z "$$dir" || $(MKDIR_P) "$$dir"; \ 597 | done 598 | install: install-am 599 | install-exec: install-exec-am 600 | install-data: install-data-am 601 | uninstall: uninstall-am 602 | 603 | install-am: all-am 604 | @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am 605 | 606 | installcheck: installcheck-am 607 | install-strip: 608 | if test -z '$(STRIP)'; then \ 609 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ 610 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ 611 | install; \ 612 | else \ 613 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ 614 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ 615 | "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ 616 | fi 617 | mostlyclean-generic: 618 | 619 | clean-generic: 620 | 621 | distclean-generic: 622 | -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) 623 | -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) 624 | 625 | maintainer-clean-generic: 626 | @echo "This command is intended for maintainers to use" 627 | @echo "it deletes files that may require special tools to rebuild." 628 | clean: clean-am 629 | 630 | clean-am: clean-generic clean-libtool mostlyclean-am 631 | 632 | distclean: distclean-am 633 | -rm -f Makefile 634 | distclean-am: clean-am distclean-generic distclean-tags 635 | 636 | dvi: dvi-am 637 | 638 | dvi-am: 639 | 640 | html: html-am 641 | 642 | html-am: 643 | 644 | info: info-am 645 | 646 | info-am: 647 | 648 | install-data-am: install-pkgincludeHEADERS 649 | 650 | install-dvi: install-dvi-am 651 | 652 | install-dvi-am: 653 | 654 | install-exec-am: 655 | 656 | install-html: install-html-am 657 | 658 | install-html-am: 659 | 660 | install-info: install-info-am 661 | 662 | install-info-am: 663 | 664 | install-man: 665 | 666 | install-pdf: install-pdf-am 667 | 668 | install-pdf-am: 669 | 670 | install-ps: install-ps-am 671 | 672 | install-ps-am: 673 | 674 | installcheck-am: 675 | 676 | maintainer-clean: maintainer-clean-am 677 | -rm -f Makefile 678 | maintainer-clean-am: distclean-am maintainer-clean-generic 679 | 680 | mostlyclean: mostlyclean-am 681 | 682 | mostlyclean-am: mostlyclean-generic mostlyclean-libtool 683 | 684 | pdf: pdf-am 685 | 686 | pdf-am: 687 | 688 | ps: ps-am 689 | 690 | ps-am: 691 | 692 | uninstall-am: uninstall-pkgincludeHEADERS 693 | 694 | .MAKE: install-am install-strip 695 | 696 | .PHONY: CTAGS GTAGS TAGS all all-am all-local check check-am clean \ 697 | clean-generic clean-libtool cscopelist-am ctags ctags-am \ 698 | distclean distclean-generic distclean-libtool distclean-tags \ 699 | distdir dvi dvi-am html html-am info info-am install \ 700 | install-am install-data install-data-am install-dvi \ 701 | install-dvi-am install-exec install-exec-am install-html \ 702 | install-html-am install-info install-info-am install-man \ 703 | install-pdf install-pdf-am install-pkgincludeHEADERS \ 704 | install-ps install-ps-am install-strip installcheck \ 705 | installcheck-am installdirs maintainer-clean \ 706 | maintainer-clean-generic mostlyclean mostlyclean-generic \ 707 | mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ 708 | uninstall-am uninstall-pkgincludeHEADERS 709 | 710 | .PRECIOUS: Makefile 711 | 712 | 713 | checksrc: 714 | $(CHECKSRC)@PERL@ $(top_srcdir)/scripts/checksrc.pl -D$(top_srcdir)/include/curl $(pkginclude_HEADERS) 715 | 716 | # for debug builds, we scan the sources on all regular make invokes 717 | @CURLDEBUG_TRUE@all-local: checksrc 718 | 719 | # Tell versions [3.59,3.63) of GNU make to not export all variables. 720 | # Otherwise a system limit (for SysV at least) may be exceeded. 721 | .NOEXPORT: 722 | -------------------------------------------------------------------------------- /include/typecheck-gcc.h: -------------------------------------------------------------------------------- 1 | #ifndef CURLINC_TYPECHECK_GCC_H 2 | #define CURLINC_TYPECHECK_GCC_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | /* wraps curl_easy_setopt() with typechecking */ 28 | 29 | /* To add a new kind of warning, add an 30 | * if(curlcheck_sometype_option(_curl_opt)) 31 | * if(!curlcheck_sometype(value)) 32 | * _curl_easy_setopt_err_sometype(); 33 | * block and define curlcheck_sometype_option, curlcheck_sometype and 34 | * _curl_easy_setopt_err_sometype below 35 | * 36 | * NOTE: We use two nested 'if' statements here instead of the && operator, in 37 | * order to work around gcc bug #32061. It affects only gcc 4.3.x/4.4.x 38 | * when compiling with -Wlogical-op. 39 | * 40 | * To add an option that uses the same type as an existing option, you'll just 41 | * need to extend the appropriate _curl_*_option macro 42 | */ 43 | #define curl_easy_setopt(handle, option, value) \ 44 | __extension__({ \ 45 | CURLoption _curl_opt = (option); \ 46 | if(__builtin_constant_p(_curl_opt)) { \ 47 | CURL_IGNORE_DEPRECATION( \ 48 | if(curlcheck_long_option(_curl_opt)) \ 49 | if(!curlcheck_long(value)) \ 50 | _curl_easy_setopt_err_long(); \ 51 | if(curlcheck_off_t_option(_curl_opt)) \ 52 | if(!curlcheck_off_t(value)) \ 53 | _curl_easy_setopt_err_curl_off_t(); \ 54 | if(curlcheck_string_option(_curl_opt)) \ 55 | if(!curlcheck_string(value)) \ 56 | _curl_easy_setopt_err_string(); \ 57 | if(curlcheck_write_cb_option(_curl_opt)) \ 58 | if(!curlcheck_write_cb(value)) \ 59 | _curl_easy_setopt_err_write_callback(); \ 60 | if((_curl_opt) == CURLOPT_RESOLVER_START_FUNCTION) \ 61 | if(!curlcheck_resolver_start_callback(value)) \ 62 | _curl_easy_setopt_err_resolver_start_callback(); \ 63 | if((_curl_opt) == CURLOPT_READFUNCTION) \ 64 | if(!curlcheck_read_cb(value)) \ 65 | _curl_easy_setopt_err_read_cb(); \ 66 | if((_curl_opt) == CURLOPT_IOCTLFUNCTION) \ 67 | if(!curlcheck_ioctl_cb(value)) \ 68 | _curl_easy_setopt_err_ioctl_cb(); \ 69 | if((_curl_opt) == CURLOPT_SOCKOPTFUNCTION) \ 70 | if(!curlcheck_sockopt_cb(value)) \ 71 | _curl_easy_setopt_err_sockopt_cb(); \ 72 | if((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION) \ 73 | if(!curlcheck_opensocket_cb(value)) \ 74 | _curl_easy_setopt_err_opensocket_cb(); \ 75 | if((_curl_opt) == CURLOPT_PROGRESSFUNCTION) \ 76 | if(!curlcheck_progress_cb(value)) \ 77 | _curl_easy_setopt_err_progress_cb(); \ 78 | if((_curl_opt) == CURLOPT_DEBUGFUNCTION) \ 79 | if(!curlcheck_debug_cb(value)) \ 80 | _curl_easy_setopt_err_debug_cb(); \ 81 | if((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION) \ 82 | if(!curlcheck_ssl_ctx_cb(value)) \ 83 | _curl_easy_setopt_err_ssl_ctx_cb(); \ 84 | if(curlcheck_conv_cb_option(_curl_opt)) \ 85 | if(!curlcheck_conv_cb(value)) \ 86 | _curl_easy_setopt_err_conv_cb(); \ 87 | if((_curl_opt) == CURLOPT_SEEKFUNCTION) \ 88 | if(!curlcheck_seek_cb(value)) \ 89 | _curl_easy_setopt_err_seek_cb(); \ 90 | if(curlcheck_cb_data_option(_curl_opt)) \ 91 | if(!curlcheck_cb_data(value)) \ 92 | _curl_easy_setopt_err_cb_data(); \ 93 | if((_curl_opt) == CURLOPT_ERRORBUFFER) \ 94 | if(!curlcheck_error_buffer(value)) \ 95 | _curl_easy_setopt_err_error_buffer(); \ 96 | if((_curl_opt) == CURLOPT_STDERR) \ 97 | if(!curlcheck_FILE(value)) \ 98 | _curl_easy_setopt_err_FILE(); \ 99 | if(curlcheck_postfields_option(_curl_opt)) \ 100 | if(!curlcheck_postfields(value)) \ 101 | _curl_easy_setopt_err_postfields(); \ 102 | if((_curl_opt) == CURLOPT_HTTPPOST) \ 103 | if(!curlcheck_arr((value), struct curl_httppost)) \ 104 | _curl_easy_setopt_err_curl_httpost(); \ 105 | if((_curl_opt) == CURLOPT_MIMEPOST) \ 106 | if(!curlcheck_ptr((value), curl_mime)) \ 107 | _curl_easy_setopt_err_curl_mimepost(); \ 108 | if(curlcheck_slist_option(_curl_opt)) \ 109 | if(!curlcheck_arr((value), struct curl_slist)) \ 110 | _curl_easy_setopt_err_curl_slist(); \ 111 | if((_curl_opt) == CURLOPT_SHARE) \ 112 | if(!curlcheck_ptr((value), CURLSH)) \ 113 | _curl_easy_setopt_err_CURLSH(); \ 114 | ) \ 115 | } \ 116 | curl_easy_setopt(handle, _curl_opt, value); \ 117 | }) 118 | 119 | /* wraps curl_easy_getinfo() with typechecking */ 120 | #define curl_easy_getinfo(handle, info, arg) \ 121 | __extension__({ \ 122 | CURLINFO _curl_info = (info); \ 123 | if(__builtin_constant_p(_curl_info)) { \ 124 | CURL_IGNORE_DEPRECATION( \ 125 | if(curlcheck_string_info(_curl_info)) \ 126 | if(!curlcheck_arr((arg), char *)) \ 127 | _curl_easy_getinfo_err_string(); \ 128 | if(curlcheck_long_info(_curl_info)) \ 129 | if(!curlcheck_arr((arg), long)) \ 130 | _curl_easy_getinfo_err_long(); \ 131 | if(curlcheck_double_info(_curl_info)) \ 132 | if(!curlcheck_arr((arg), double)) \ 133 | _curl_easy_getinfo_err_double(); \ 134 | if(curlcheck_slist_info(_curl_info)) \ 135 | if(!curlcheck_arr((arg), struct curl_slist *)) \ 136 | _curl_easy_getinfo_err_curl_slist(); \ 137 | if(curlcheck_tlssessioninfo_info(_curl_info)) \ 138 | if(!curlcheck_arr((arg), struct curl_tlssessioninfo *)) \ 139 | _curl_easy_getinfo_err_curl_tlssesssioninfo(); \ 140 | if(curlcheck_certinfo_info(_curl_info)) \ 141 | if(!curlcheck_arr((arg), struct curl_certinfo *)) \ 142 | _curl_easy_getinfo_err_curl_certinfo(); \ 143 | if(curlcheck_socket_info(_curl_info)) \ 144 | if(!curlcheck_arr((arg), curl_socket_t)) \ 145 | _curl_easy_getinfo_err_curl_socket(); \ 146 | if(curlcheck_off_t_info(_curl_info)) \ 147 | if(!curlcheck_arr((arg), curl_off_t)) \ 148 | _curl_easy_getinfo_err_curl_off_t(); \ 149 | ) \ 150 | } \ 151 | curl_easy_getinfo(handle, _curl_info, arg); \ 152 | }) 153 | 154 | /* 155 | * For now, just make sure that the functions are called with three arguments 156 | */ 157 | #define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param) 158 | #define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param) 159 | 160 | 161 | /* the actual warnings, triggered by calling the _curl_easy_setopt_err* 162 | * functions */ 163 | 164 | /* To define a new warning, use _CURL_WARNING(identifier, "message") */ 165 | #define CURLWARNING(id, message) \ 166 | static void __attribute__((__warning__(message))) \ 167 | __attribute__((__unused__)) __attribute__((__noinline__)) \ 168 | id(void) { __asm__(""); } 169 | 170 | CURLWARNING(_curl_easy_setopt_err_long, 171 | "curl_easy_setopt expects a long argument for this option") 172 | CURLWARNING(_curl_easy_setopt_err_curl_off_t, 173 | "curl_easy_setopt expects a curl_off_t argument for this option") 174 | CURLWARNING(_curl_easy_setopt_err_string, 175 | "curl_easy_setopt expects a " 176 | "string ('char *' or char[]) argument for this option" 177 | ) 178 | CURLWARNING(_curl_easy_setopt_err_write_callback, 179 | "curl_easy_setopt expects a curl_write_callback argument for this option") 180 | CURLWARNING(_curl_easy_setopt_err_resolver_start_callback, 181 | "curl_easy_setopt expects a " 182 | "curl_resolver_start_callback argument for this option" 183 | ) 184 | CURLWARNING(_curl_easy_setopt_err_read_cb, 185 | "curl_easy_setopt expects a curl_read_callback argument for this option") 186 | CURLWARNING(_curl_easy_setopt_err_ioctl_cb, 187 | "curl_easy_setopt expects a curl_ioctl_callback argument for this option") 188 | CURLWARNING(_curl_easy_setopt_err_sockopt_cb, 189 | "curl_easy_setopt expects a curl_sockopt_callback argument for this option") 190 | CURLWARNING(_curl_easy_setopt_err_opensocket_cb, 191 | "curl_easy_setopt expects a " 192 | "curl_opensocket_callback argument for this option" 193 | ) 194 | CURLWARNING(_curl_easy_setopt_err_progress_cb, 195 | "curl_easy_setopt expects a curl_progress_callback argument for this option") 196 | CURLWARNING(_curl_easy_setopt_err_debug_cb, 197 | "curl_easy_setopt expects a curl_debug_callback argument for this option") 198 | CURLWARNING(_curl_easy_setopt_err_ssl_ctx_cb, 199 | "curl_easy_setopt expects a curl_ssl_ctx_callback argument for this option") 200 | CURLWARNING(_curl_easy_setopt_err_conv_cb, 201 | "curl_easy_setopt expects a curl_conv_callback argument for this option") 202 | CURLWARNING(_curl_easy_setopt_err_seek_cb, 203 | "curl_easy_setopt expects a curl_seek_callback argument for this option") 204 | CURLWARNING(_curl_easy_setopt_err_cb_data, 205 | "curl_easy_setopt expects a " 206 | "private data pointer as argument for this option") 207 | CURLWARNING(_curl_easy_setopt_err_error_buffer, 208 | "curl_easy_setopt expects a " 209 | "char buffer of CURL_ERROR_SIZE as argument for this option") 210 | CURLWARNING(_curl_easy_setopt_err_FILE, 211 | "curl_easy_setopt expects a 'FILE *' argument for this option") 212 | CURLWARNING(_curl_easy_setopt_err_postfields, 213 | "curl_easy_setopt expects a 'void *' or 'char *' argument for this option") 214 | CURLWARNING(_curl_easy_setopt_err_curl_httpost, 215 | "curl_easy_setopt expects a 'struct curl_httppost *' " 216 | "argument for this option") 217 | CURLWARNING(_curl_easy_setopt_err_curl_mimepost, 218 | "curl_easy_setopt expects a 'curl_mime *' " 219 | "argument for this option") 220 | CURLWARNING(_curl_easy_setopt_err_curl_slist, 221 | "curl_easy_setopt expects a 'struct curl_slist *' argument for this option") 222 | CURLWARNING(_curl_easy_setopt_err_CURLSH, 223 | "curl_easy_setopt expects a CURLSH* argument for this option") 224 | 225 | CURLWARNING(_curl_easy_getinfo_err_string, 226 | "curl_easy_getinfo expects a pointer to 'char *' for this info") 227 | CURLWARNING(_curl_easy_getinfo_err_long, 228 | "curl_easy_getinfo expects a pointer to long for this info") 229 | CURLWARNING(_curl_easy_getinfo_err_double, 230 | "curl_easy_getinfo expects a pointer to double for this info") 231 | CURLWARNING(_curl_easy_getinfo_err_curl_slist, 232 | "curl_easy_getinfo expects a pointer to 'struct curl_slist *' for this info") 233 | CURLWARNING(_curl_easy_getinfo_err_curl_tlssesssioninfo, 234 | "curl_easy_getinfo expects a pointer to " 235 | "'struct curl_tlssessioninfo *' for this info") 236 | CURLWARNING(_curl_easy_getinfo_err_curl_certinfo, 237 | "curl_easy_getinfo expects a pointer to " 238 | "'struct curl_certinfo *' for this info") 239 | CURLWARNING(_curl_easy_getinfo_err_curl_socket, 240 | "curl_easy_getinfo expects a pointer to curl_socket_t for this info") 241 | CURLWARNING(_curl_easy_getinfo_err_curl_off_t, 242 | "curl_easy_getinfo expects a pointer to curl_off_t for this info") 243 | 244 | /* groups of curl_easy_setops options that take the same type of argument */ 245 | 246 | /* To add a new option to one of the groups, just add 247 | * (option) == CURLOPT_SOMETHING 248 | * to the or-expression. If the option takes a long or curl_off_t, you don't 249 | * have to do anything 250 | */ 251 | 252 | /* evaluates to true if option takes a long argument */ 253 | #define curlcheck_long_option(option) \ 254 | (0 < (option) && (option) < CURLOPTTYPE_OBJECTPOINT) 255 | 256 | #define curlcheck_off_t_option(option) \ 257 | (((option) > CURLOPTTYPE_OFF_T) && ((option) < CURLOPTTYPE_BLOB)) 258 | 259 | /* evaluates to true if option takes a char* argument */ 260 | #define curlcheck_string_option(option) \ 261 | ((option) == CURLOPT_ABSTRACT_UNIX_SOCKET || \ 262 | (option) == CURLOPT_ACCEPT_ENCODING || \ 263 | (option) == CURLOPT_ALTSVC || \ 264 | (option) == CURLOPT_CAINFO || \ 265 | (option) == CURLOPT_CAPATH || \ 266 | (option) == CURLOPT_COOKIE || \ 267 | (option) == CURLOPT_COOKIEFILE || \ 268 | (option) == CURLOPT_COOKIEJAR || \ 269 | (option) == CURLOPT_COOKIELIST || \ 270 | (option) == CURLOPT_CRLFILE || \ 271 | (option) == CURLOPT_CUSTOMREQUEST || \ 272 | (option) == CURLOPT_DEFAULT_PROTOCOL || \ 273 | (option) == CURLOPT_DNS_INTERFACE || \ 274 | (option) == CURLOPT_DNS_LOCAL_IP4 || \ 275 | (option) == CURLOPT_DNS_LOCAL_IP6 || \ 276 | (option) == CURLOPT_DNS_SERVERS || \ 277 | (option) == CURLOPT_DOH_URL || \ 278 | (option) == CURLOPT_EGDSOCKET || \ 279 | (option) == CURLOPT_FTP_ACCOUNT || \ 280 | (option) == CURLOPT_FTP_ALTERNATIVE_TO_USER || \ 281 | (option) == CURLOPT_FTPPORT || \ 282 | (option) == CURLOPT_HSTS || \ 283 | (option) == CURLOPT_HAPROXY_CLIENT_IP || \ 284 | (option) == CURLOPT_INTERFACE || \ 285 | (option) == CURLOPT_ISSUERCERT || \ 286 | (option) == CURLOPT_KEYPASSWD || \ 287 | (option) == CURLOPT_KRBLEVEL || \ 288 | (option) == CURLOPT_LOGIN_OPTIONS || \ 289 | (option) == CURLOPT_MAIL_AUTH || \ 290 | (option) == CURLOPT_MAIL_FROM || \ 291 | (option) == CURLOPT_NETRC_FILE || \ 292 | (option) == CURLOPT_NOPROXY || \ 293 | (option) == CURLOPT_PASSWORD || \ 294 | (option) == CURLOPT_PINNEDPUBLICKEY || \ 295 | (option) == CURLOPT_PRE_PROXY || \ 296 | (option) == CURLOPT_PROTOCOLS_STR || \ 297 | (option) == CURLOPT_PROXY || \ 298 | (option) == CURLOPT_PROXY_CAINFO || \ 299 | (option) == CURLOPT_PROXY_CAPATH || \ 300 | (option) == CURLOPT_PROXY_CRLFILE || \ 301 | (option) == CURLOPT_PROXY_ISSUERCERT || \ 302 | (option) == CURLOPT_PROXY_KEYPASSWD || \ 303 | (option) == CURLOPT_PROXY_PINNEDPUBLICKEY || \ 304 | (option) == CURLOPT_PROXY_SERVICE_NAME || \ 305 | (option) == CURLOPT_PROXY_SSL_CIPHER_LIST || \ 306 | (option) == CURLOPT_PROXY_SSLCERT || \ 307 | (option) == CURLOPT_PROXY_SSLCERTTYPE || \ 308 | (option) == CURLOPT_PROXY_SSLKEY || \ 309 | (option) == CURLOPT_PROXY_SSLKEYTYPE || \ 310 | (option) == CURLOPT_PROXY_TLS13_CIPHERS || \ 311 | (option) == CURLOPT_PROXY_TLSAUTH_PASSWORD || \ 312 | (option) == CURLOPT_PROXY_TLSAUTH_TYPE || \ 313 | (option) == CURLOPT_PROXY_TLSAUTH_USERNAME || \ 314 | (option) == CURLOPT_PROXYPASSWORD || \ 315 | (option) == CURLOPT_PROXYUSERNAME || \ 316 | (option) == CURLOPT_PROXYUSERPWD || \ 317 | (option) == CURLOPT_RANDOM_FILE || \ 318 | (option) == CURLOPT_RANGE || \ 319 | (option) == CURLOPT_REDIR_PROTOCOLS_STR || \ 320 | (option) == CURLOPT_REFERER || \ 321 | (option) == CURLOPT_REQUEST_TARGET || \ 322 | (option) == CURLOPT_RTSP_SESSION_ID || \ 323 | (option) == CURLOPT_RTSP_STREAM_URI || \ 324 | (option) == CURLOPT_RTSP_TRANSPORT || \ 325 | (option) == CURLOPT_SASL_AUTHZID || \ 326 | (option) == CURLOPT_SERVICE_NAME || \ 327 | (option) == CURLOPT_SOCKS5_GSSAPI_SERVICE || \ 328 | (option) == CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 || \ 329 | (option) == CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256 || \ 330 | (option) == CURLOPT_SSH_KNOWNHOSTS || \ 331 | (option) == CURLOPT_SSH_PRIVATE_KEYFILE || \ 332 | (option) == CURLOPT_SSH_PUBLIC_KEYFILE || \ 333 | (option) == CURLOPT_SSLCERT || \ 334 | (option) == CURLOPT_SSLCERTTYPE || \ 335 | (option) == CURLOPT_SSLENGINE || \ 336 | (option) == CURLOPT_SSLKEY || \ 337 | (option) == CURLOPT_SSLKEYTYPE || \ 338 | (option) == CURLOPT_SSL_CIPHER_LIST || \ 339 | (option) == CURLOPT_TLS13_CIPHERS || \ 340 | (option) == CURLOPT_TLSAUTH_PASSWORD || \ 341 | (option) == CURLOPT_TLSAUTH_TYPE || \ 342 | (option) == CURLOPT_TLSAUTH_USERNAME || \ 343 | (option) == CURLOPT_UNIX_SOCKET_PATH || \ 344 | (option) == CURLOPT_URL || \ 345 | (option) == CURLOPT_USERAGENT || \ 346 | (option) == CURLOPT_USERNAME || \ 347 | (option) == CURLOPT_AWS_SIGV4 || \ 348 | (option) == CURLOPT_USERPWD || \ 349 | (option) == CURLOPT_XOAUTH2_BEARER || \ 350 | (option) == CURLOPT_SSL_EC_CURVES || \ 351 | 0) 352 | 353 | /* evaluates to true if option takes a curl_write_callback argument */ 354 | #define curlcheck_write_cb_option(option) \ 355 | ((option) == CURLOPT_HEADERFUNCTION || \ 356 | (option) == CURLOPT_WRITEFUNCTION) 357 | 358 | /* evaluates to true if option takes a curl_conv_callback argument */ 359 | #define curlcheck_conv_cb_option(option) \ 360 | ((option) == CURLOPT_CONV_TO_NETWORK_FUNCTION || \ 361 | (option) == CURLOPT_CONV_FROM_NETWORK_FUNCTION || \ 362 | (option) == CURLOPT_CONV_FROM_UTF8_FUNCTION) 363 | 364 | /* evaluates to true if option takes a data argument to pass to a callback */ 365 | #define curlcheck_cb_data_option(option) \ 366 | ((option) == CURLOPT_CHUNK_DATA || \ 367 | (option) == CURLOPT_CLOSESOCKETDATA || \ 368 | (option) == CURLOPT_DEBUGDATA || \ 369 | (option) == CURLOPT_FNMATCH_DATA || \ 370 | (option) == CURLOPT_HEADERDATA || \ 371 | (option) == CURLOPT_HSTSREADDATA || \ 372 | (option) == CURLOPT_HSTSWRITEDATA || \ 373 | (option) == CURLOPT_INTERLEAVEDATA || \ 374 | (option) == CURLOPT_IOCTLDATA || \ 375 | (option) == CURLOPT_OPENSOCKETDATA || \ 376 | (option) == CURLOPT_PREREQDATA || \ 377 | (option) == CURLOPT_PROGRESSDATA || \ 378 | (option) == CURLOPT_READDATA || \ 379 | (option) == CURLOPT_SEEKDATA || \ 380 | (option) == CURLOPT_SOCKOPTDATA || \ 381 | (option) == CURLOPT_SSH_KEYDATA || \ 382 | (option) == CURLOPT_SSL_CTX_DATA || \ 383 | (option) == CURLOPT_WRITEDATA || \ 384 | (option) == CURLOPT_RESOLVER_START_DATA || \ 385 | (option) == CURLOPT_TRAILERDATA || \ 386 | (option) == CURLOPT_SSH_HOSTKEYDATA || \ 387 | 0) 388 | 389 | /* evaluates to true if option takes a POST data argument (void* or char*) */ 390 | #define curlcheck_postfields_option(option) \ 391 | ((option) == CURLOPT_POSTFIELDS || \ 392 | (option) == CURLOPT_COPYPOSTFIELDS || \ 393 | 0) 394 | 395 | /* evaluates to true if option takes a struct curl_slist * argument */ 396 | #define curlcheck_slist_option(option) \ 397 | ((option) == CURLOPT_HTTP200ALIASES || \ 398 | (option) == CURLOPT_HTTPHEADER || \ 399 | (option) == CURLOPT_MAIL_RCPT || \ 400 | (option) == CURLOPT_POSTQUOTE || \ 401 | (option) == CURLOPT_PREQUOTE || \ 402 | (option) == CURLOPT_PROXYHEADER || \ 403 | (option) == CURLOPT_QUOTE || \ 404 | (option) == CURLOPT_RESOLVE || \ 405 | (option) == CURLOPT_TELNETOPTIONS || \ 406 | (option) == CURLOPT_CONNECT_TO || \ 407 | 0) 408 | 409 | /* groups of curl_easy_getinfo infos that take the same type of argument */ 410 | 411 | /* evaluates to true if info expects a pointer to char * argument */ 412 | #define curlcheck_string_info(info) \ 413 | (CURLINFO_STRING < (info) && (info) < CURLINFO_LONG && \ 414 | (info) != CURLINFO_PRIVATE) 415 | 416 | /* evaluates to true if info expects a pointer to long argument */ 417 | #define curlcheck_long_info(info) \ 418 | (CURLINFO_LONG < (info) && (info) < CURLINFO_DOUBLE) 419 | 420 | /* evaluates to true if info expects a pointer to double argument */ 421 | #define curlcheck_double_info(info) \ 422 | (CURLINFO_DOUBLE < (info) && (info) < CURLINFO_SLIST) 423 | 424 | /* true if info expects a pointer to struct curl_slist * argument */ 425 | #define curlcheck_slist_info(info) \ 426 | (((info) == CURLINFO_SSL_ENGINES) || ((info) == CURLINFO_COOKIELIST)) 427 | 428 | /* true if info expects a pointer to struct curl_tlssessioninfo * argument */ 429 | #define curlcheck_tlssessioninfo_info(info) \ 430 | (((info) == CURLINFO_TLS_SSL_PTR) || ((info) == CURLINFO_TLS_SESSION)) 431 | 432 | /* true if info expects a pointer to struct curl_certinfo * argument */ 433 | #define curlcheck_certinfo_info(info) ((info) == CURLINFO_CERTINFO) 434 | 435 | /* true if info expects a pointer to struct curl_socket_t argument */ 436 | #define curlcheck_socket_info(info) \ 437 | (CURLINFO_SOCKET < (info) && (info) < CURLINFO_OFF_T) 438 | 439 | /* true if info expects a pointer to curl_off_t argument */ 440 | #define curlcheck_off_t_info(info) \ 441 | (CURLINFO_OFF_T < (info)) 442 | 443 | 444 | /* typecheck helpers -- check whether given expression has requested type */ 445 | 446 | /* For pointers, you can use the curlcheck_ptr/curlcheck_arr macros, 447 | * otherwise define a new macro. Search for __builtin_types_compatible_p 448 | * in the GCC manual. 449 | * NOTE: these macros MUST NOT EVALUATE their arguments! The argument is 450 | * the actual expression passed to the curl_easy_setopt macro. This 451 | * means that you can only apply the sizeof and __typeof__ operators, no 452 | * == or whatsoever. 453 | */ 454 | 455 | /* XXX: should evaluate to true if expr is a pointer */ 456 | #define curlcheck_any_ptr(expr) \ 457 | (sizeof(expr) == sizeof(void *)) 458 | 459 | /* evaluates to true if expr is NULL */ 460 | /* XXX: must not evaluate expr, so this check is not accurate */ 461 | #define curlcheck_NULL(expr) \ 462 | (__builtin_types_compatible_p(__typeof__(expr), __typeof__(NULL))) 463 | 464 | /* evaluates to true if expr is type*, const type* or NULL */ 465 | #define curlcheck_ptr(expr, type) \ 466 | (curlcheck_NULL(expr) || \ 467 | __builtin_types_compatible_p(__typeof__(expr), type *) || \ 468 | __builtin_types_compatible_p(__typeof__(expr), const type *)) 469 | 470 | /* evaluates to true if expr is one of type[], type*, NULL or const type* */ 471 | #define curlcheck_arr(expr, type) \ 472 | (curlcheck_ptr((expr), type) || \ 473 | __builtin_types_compatible_p(__typeof__(expr), type [])) 474 | 475 | /* evaluates to true if expr is a string */ 476 | #define curlcheck_string(expr) \ 477 | (curlcheck_arr((expr), char) || \ 478 | curlcheck_arr((expr), signed char) || \ 479 | curlcheck_arr((expr), unsigned char)) 480 | 481 | /* evaluates to true if expr is a long (no matter the signedness) 482 | * XXX: for now, int is also accepted (and therefore short and char, which 483 | * are promoted to int when passed to a variadic function) */ 484 | #define curlcheck_long(expr) \ 485 | (__builtin_types_compatible_p(__typeof__(expr), long) || \ 486 | __builtin_types_compatible_p(__typeof__(expr), signed long) || \ 487 | __builtin_types_compatible_p(__typeof__(expr), unsigned long) || \ 488 | __builtin_types_compatible_p(__typeof__(expr), int) || \ 489 | __builtin_types_compatible_p(__typeof__(expr), signed int) || \ 490 | __builtin_types_compatible_p(__typeof__(expr), unsigned int) || \ 491 | __builtin_types_compatible_p(__typeof__(expr), short) || \ 492 | __builtin_types_compatible_p(__typeof__(expr), signed short) || \ 493 | __builtin_types_compatible_p(__typeof__(expr), unsigned short) || \ 494 | __builtin_types_compatible_p(__typeof__(expr), char) || \ 495 | __builtin_types_compatible_p(__typeof__(expr), signed char) || \ 496 | __builtin_types_compatible_p(__typeof__(expr), unsigned char)) 497 | 498 | /* evaluates to true if expr is of type curl_off_t */ 499 | #define curlcheck_off_t(expr) \ 500 | (__builtin_types_compatible_p(__typeof__(expr), curl_off_t)) 501 | 502 | /* evaluates to true if expr is abuffer suitable for CURLOPT_ERRORBUFFER */ 503 | /* XXX: also check size of an char[] array? */ 504 | #define curlcheck_error_buffer(expr) \ 505 | (curlcheck_NULL(expr) || \ 506 | __builtin_types_compatible_p(__typeof__(expr), char *) || \ 507 | __builtin_types_compatible_p(__typeof__(expr), char[])) 508 | 509 | /* evaluates to true if expr is of type (const) void* or (const) FILE* */ 510 | #if 0 511 | #define curlcheck_cb_data(expr) \ 512 | (curlcheck_ptr((expr), void) || \ 513 | curlcheck_ptr((expr), FILE)) 514 | #else /* be less strict */ 515 | #define curlcheck_cb_data(expr) \ 516 | curlcheck_any_ptr(expr) 517 | #endif 518 | 519 | /* evaluates to true if expr is of type FILE* */ 520 | #define curlcheck_FILE(expr) \ 521 | (curlcheck_NULL(expr) || \ 522 | (__builtin_types_compatible_p(__typeof__(expr), FILE *))) 523 | 524 | /* evaluates to true if expr can be passed as POST data (void* or char*) */ 525 | #define curlcheck_postfields(expr) \ 526 | (curlcheck_ptr((expr), void) || \ 527 | curlcheck_arr((expr), char) || \ 528 | curlcheck_arr((expr), unsigned char)) 529 | 530 | /* helper: __builtin_types_compatible_p distinguishes between functions and 531 | * function pointers, hide it */ 532 | #define curlcheck_cb_compatible(func, type) \ 533 | (__builtin_types_compatible_p(__typeof__(func), type) || \ 534 | __builtin_types_compatible_p(__typeof__(func) *, type)) 535 | 536 | /* evaluates to true if expr is of type curl_resolver_start_callback */ 537 | #define curlcheck_resolver_start_callback(expr) \ 538 | (curlcheck_NULL(expr) || \ 539 | curlcheck_cb_compatible((expr), curl_resolver_start_callback)) 540 | 541 | /* evaluates to true if expr is of type curl_read_callback or "similar" */ 542 | #define curlcheck_read_cb(expr) \ 543 | (curlcheck_NULL(expr) || \ 544 | curlcheck_cb_compatible((expr), __typeof__(fread) *) || \ 545 | curlcheck_cb_compatible((expr), curl_read_callback) || \ 546 | curlcheck_cb_compatible((expr), _curl_read_callback1) || \ 547 | curlcheck_cb_compatible((expr), _curl_read_callback2) || \ 548 | curlcheck_cb_compatible((expr), _curl_read_callback3) || \ 549 | curlcheck_cb_compatible((expr), _curl_read_callback4) || \ 550 | curlcheck_cb_compatible((expr), _curl_read_callback5) || \ 551 | curlcheck_cb_compatible((expr), _curl_read_callback6)) 552 | typedef size_t (*_curl_read_callback1)(char *, size_t, size_t, void *); 553 | typedef size_t (*_curl_read_callback2)(char *, size_t, size_t, const void *); 554 | typedef size_t (*_curl_read_callback3)(char *, size_t, size_t, FILE *); 555 | typedef size_t (*_curl_read_callback4)(void *, size_t, size_t, void *); 556 | typedef size_t (*_curl_read_callback5)(void *, size_t, size_t, const void *); 557 | typedef size_t (*_curl_read_callback6)(void *, size_t, size_t, FILE *); 558 | 559 | /* evaluates to true if expr is of type curl_write_callback or "similar" */ 560 | #define curlcheck_write_cb(expr) \ 561 | (curlcheck_read_cb(expr) || \ 562 | curlcheck_cb_compatible((expr), __typeof__(fwrite) *) || \ 563 | curlcheck_cb_compatible((expr), curl_write_callback) || \ 564 | curlcheck_cb_compatible((expr), _curl_write_callback1) || \ 565 | curlcheck_cb_compatible((expr), _curl_write_callback2) || \ 566 | curlcheck_cb_compatible((expr), _curl_write_callback3) || \ 567 | curlcheck_cb_compatible((expr), _curl_write_callback4) || \ 568 | curlcheck_cb_compatible((expr), _curl_write_callback5) || \ 569 | curlcheck_cb_compatible((expr), _curl_write_callback6)) 570 | typedef size_t (*_curl_write_callback1)(const char *, size_t, size_t, void *); 571 | typedef size_t (*_curl_write_callback2)(const char *, size_t, size_t, 572 | const void *); 573 | typedef size_t (*_curl_write_callback3)(const char *, size_t, size_t, FILE *); 574 | typedef size_t (*_curl_write_callback4)(const void *, size_t, size_t, void *); 575 | typedef size_t (*_curl_write_callback5)(const void *, size_t, size_t, 576 | const void *); 577 | typedef size_t (*_curl_write_callback6)(const void *, size_t, size_t, FILE *); 578 | 579 | /* evaluates to true if expr is of type curl_ioctl_callback or "similar" */ 580 | #define curlcheck_ioctl_cb(expr) \ 581 | (curlcheck_NULL(expr) || \ 582 | curlcheck_cb_compatible((expr), curl_ioctl_callback) || \ 583 | curlcheck_cb_compatible((expr), _curl_ioctl_callback1) || \ 584 | curlcheck_cb_compatible((expr), _curl_ioctl_callback2) || \ 585 | curlcheck_cb_compatible((expr), _curl_ioctl_callback3) || \ 586 | curlcheck_cb_compatible((expr), _curl_ioctl_callback4)) 587 | typedef curlioerr (*_curl_ioctl_callback1)(CURL *, int, void *); 588 | typedef curlioerr (*_curl_ioctl_callback2)(CURL *, int, const void *); 589 | typedef curlioerr (*_curl_ioctl_callback3)(CURL *, curliocmd, void *); 590 | typedef curlioerr (*_curl_ioctl_callback4)(CURL *, curliocmd, const void *); 591 | 592 | /* evaluates to true if expr is of type curl_sockopt_callback or "similar" */ 593 | #define curlcheck_sockopt_cb(expr) \ 594 | (curlcheck_NULL(expr) || \ 595 | curlcheck_cb_compatible((expr), curl_sockopt_callback) || \ 596 | curlcheck_cb_compatible((expr), _curl_sockopt_callback1) || \ 597 | curlcheck_cb_compatible((expr), _curl_sockopt_callback2)) 598 | typedef int (*_curl_sockopt_callback1)(void *, curl_socket_t, curlsocktype); 599 | typedef int (*_curl_sockopt_callback2)(const void *, curl_socket_t, 600 | curlsocktype); 601 | 602 | /* evaluates to true if expr is of type curl_opensocket_callback or 603 | "similar" */ 604 | #define curlcheck_opensocket_cb(expr) \ 605 | (curlcheck_NULL(expr) || \ 606 | curlcheck_cb_compatible((expr), curl_opensocket_callback) || \ 607 | curlcheck_cb_compatible((expr), _curl_opensocket_callback1) || \ 608 | curlcheck_cb_compatible((expr), _curl_opensocket_callback2) || \ 609 | curlcheck_cb_compatible((expr), _curl_opensocket_callback3) || \ 610 | curlcheck_cb_compatible((expr), _curl_opensocket_callback4)) 611 | typedef curl_socket_t (*_curl_opensocket_callback1) 612 | (void *, curlsocktype, struct curl_sockaddr *); 613 | typedef curl_socket_t (*_curl_opensocket_callback2) 614 | (void *, curlsocktype, const struct curl_sockaddr *); 615 | typedef curl_socket_t (*_curl_opensocket_callback3) 616 | (const void *, curlsocktype, struct curl_sockaddr *); 617 | typedef curl_socket_t (*_curl_opensocket_callback4) 618 | (const void *, curlsocktype, const struct curl_sockaddr *); 619 | 620 | /* evaluates to true if expr is of type curl_progress_callback or "similar" */ 621 | #define curlcheck_progress_cb(expr) \ 622 | (curlcheck_NULL(expr) || \ 623 | curlcheck_cb_compatible((expr), curl_progress_callback) || \ 624 | curlcheck_cb_compatible((expr), _curl_progress_callback1) || \ 625 | curlcheck_cb_compatible((expr), _curl_progress_callback2)) 626 | typedef int (*_curl_progress_callback1)(void *, 627 | double, double, double, double); 628 | typedef int (*_curl_progress_callback2)(const void *, 629 | double, double, double, double); 630 | 631 | /* evaluates to true if expr is of type curl_debug_callback or "similar" */ 632 | #define curlcheck_debug_cb(expr) \ 633 | (curlcheck_NULL(expr) || \ 634 | curlcheck_cb_compatible((expr), curl_debug_callback) || \ 635 | curlcheck_cb_compatible((expr), _curl_debug_callback1) || \ 636 | curlcheck_cb_compatible((expr), _curl_debug_callback2) || \ 637 | curlcheck_cb_compatible((expr), _curl_debug_callback3) || \ 638 | curlcheck_cb_compatible((expr), _curl_debug_callback4) || \ 639 | curlcheck_cb_compatible((expr), _curl_debug_callback5) || \ 640 | curlcheck_cb_compatible((expr), _curl_debug_callback6) || \ 641 | curlcheck_cb_compatible((expr), _curl_debug_callback7) || \ 642 | curlcheck_cb_compatible((expr), _curl_debug_callback8)) 643 | typedef int (*_curl_debug_callback1) (CURL *, 644 | curl_infotype, char *, size_t, void *); 645 | typedef int (*_curl_debug_callback2) (CURL *, 646 | curl_infotype, char *, size_t, const void *); 647 | typedef int (*_curl_debug_callback3) (CURL *, 648 | curl_infotype, const char *, size_t, void *); 649 | typedef int (*_curl_debug_callback4) (CURL *, 650 | curl_infotype, const char *, size_t, const void *); 651 | typedef int (*_curl_debug_callback5) (CURL *, 652 | curl_infotype, unsigned char *, size_t, void *); 653 | typedef int (*_curl_debug_callback6) (CURL *, 654 | curl_infotype, unsigned char *, size_t, const void *); 655 | typedef int (*_curl_debug_callback7) (CURL *, 656 | curl_infotype, const unsigned char *, size_t, void *); 657 | typedef int (*_curl_debug_callback8) (CURL *, 658 | curl_infotype, const unsigned char *, size_t, const void *); 659 | 660 | /* evaluates to true if expr is of type curl_ssl_ctx_callback or "similar" */ 661 | /* this is getting even messier... */ 662 | #define curlcheck_ssl_ctx_cb(expr) \ 663 | (curlcheck_NULL(expr) || \ 664 | curlcheck_cb_compatible((expr), curl_ssl_ctx_callback) || \ 665 | curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback1) || \ 666 | curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback2) || \ 667 | curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback3) || \ 668 | curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback4) || \ 669 | curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback5) || \ 670 | curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback6) || \ 671 | curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback7) || \ 672 | curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback8)) 673 | typedef CURLcode (*_curl_ssl_ctx_callback1)(CURL *, void *, void *); 674 | typedef CURLcode (*_curl_ssl_ctx_callback2)(CURL *, void *, const void *); 675 | typedef CURLcode (*_curl_ssl_ctx_callback3)(CURL *, const void *, void *); 676 | typedef CURLcode (*_curl_ssl_ctx_callback4)(CURL *, const void *, 677 | const void *); 678 | #ifdef HEADER_SSL_H 679 | /* hack: if we included OpenSSL's ssl.h, we know about SSL_CTX 680 | * this will of course break if we're included before OpenSSL headers... 681 | */ 682 | typedef CURLcode (*_curl_ssl_ctx_callback5)(CURL *, SSL_CTX *, void *); 683 | typedef CURLcode (*_curl_ssl_ctx_callback6)(CURL *, SSL_CTX *, const void *); 684 | typedef CURLcode (*_curl_ssl_ctx_callback7)(CURL *, const SSL_CTX *, void *); 685 | typedef CURLcode (*_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX *, 686 | const void *); 687 | #else 688 | typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback5; 689 | typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback6; 690 | typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback7; 691 | typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback8; 692 | #endif 693 | 694 | /* evaluates to true if expr is of type curl_conv_callback or "similar" */ 695 | #define curlcheck_conv_cb(expr) \ 696 | (curlcheck_NULL(expr) || \ 697 | curlcheck_cb_compatible((expr), curl_conv_callback) || \ 698 | curlcheck_cb_compatible((expr), _curl_conv_callback1) || \ 699 | curlcheck_cb_compatible((expr), _curl_conv_callback2) || \ 700 | curlcheck_cb_compatible((expr), _curl_conv_callback3) || \ 701 | curlcheck_cb_compatible((expr), _curl_conv_callback4)) 702 | typedef CURLcode (*_curl_conv_callback1)(char *, size_t length); 703 | typedef CURLcode (*_curl_conv_callback2)(const char *, size_t length); 704 | typedef CURLcode (*_curl_conv_callback3)(void *, size_t length); 705 | typedef CURLcode (*_curl_conv_callback4)(const void *, size_t length); 706 | 707 | /* evaluates to true if expr is of type curl_seek_callback or "similar" */ 708 | #define curlcheck_seek_cb(expr) \ 709 | (curlcheck_NULL(expr) || \ 710 | curlcheck_cb_compatible((expr), curl_seek_callback) || \ 711 | curlcheck_cb_compatible((expr), _curl_seek_callback1) || \ 712 | curlcheck_cb_compatible((expr), _curl_seek_callback2)) 713 | typedef CURLcode (*_curl_seek_callback1)(void *, curl_off_t, int); 714 | typedef CURLcode (*_curl_seek_callback2)(const void *, curl_off_t, int); 715 | 716 | 717 | #endif /* CURLINC_TYPECHECK_GCC_H */ 718 | --------------------------------------------------------------------------------