1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-11-20 02:42:09 +03:00

src: address fopen() warnings, add missing copyright headers

Ref: https://github.com/libssh2/libssh2/pull/235
This commit is contained in:
Viktor Szakats
2018-03-12 11:09:36 +00:00
parent c274a3fdd4
commit ef6eaadba5
7 changed files with 103 additions and 6 deletions

View File

@@ -1076,4 +1076,27 @@ void _libssh2_init_if_needed(void);
#define LIBSSH2_INT64_T_FORMAT "lld"
#endif
/* In Windows the default file mode is text but an application can override it.
Therefore we specify it explicitly. https://github.com/curl/curl/pull/258
*/
#if defined(WIN32) || defined(MSDOS)
#define FOPEN_READTEXT "rt"
#define FOPEN_WRITETEXT "wt"
#define FOPEN_APPENDTEXT "at"
#elif defined(__CYGWIN__)
/* Cygwin has specific behavior we need to address when WIN32 is not defined.
https://cygwin.com/cygwin-ug-net/using-textbinary.html
For write we want our output to have line endings of LF and be compatible with
other Cygwin utilities. For read we want to handle input that may have line
endings either CRLF or LF so 't' is appropriate.
*/
#define FOPEN_READTEXT "rt"
#define FOPEN_WRITETEXT "w"
#define FOPEN_APPENDTEXT "a"
#else
#define FOPEN_READTEXT "r"
#define FOPEN_WRITETEXT "w"
#define FOPEN_APPENDTEXT "a"
#endif
#endif /* LIBSSH2_H */