diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/cc-compat.h | 18 | ||||
| -rw-r--r-- | src/odb.c | 2 | ||||
| -rw-r--r-- | src/streams/socket.c | 2 | ||||
| -rw-r--r-- | src/transports/winhttp.c | 36 | ||||
| -rw-r--r-- | src/win32/posix_w32.c | 1 |
5 files changed, 21 insertions, 38 deletions
diff --git a/src/cc-compat.h b/src/cc-compat.h index 0f05cd2d9..8aaa8bb5a 100644 --- a/src/cc-compat.h +++ b/src/cc-compat.h @@ -47,12 +47,24 @@ /* Define the printf format specifer to use for size_t output */ #if defined(_MSC_VER) || defined(__MINGW32__) -# define PRIuZ "Iu" -# define PRIxZ "Ix" -# define PRIdZ "Id" + +/* The first block is needed to avoid warnings on MingW amd64 */ +# if (SIZE_MAX == ULLONG_MAX) +# define PRIuZ "I64u" +# define PRIxZ "I64x" +# define PRIXZ "I64X" +# define PRIdZ "I64d" +# else +# define PRIuZ "Iu" +# define PRIxZ "Ix" +# define PRIXZ "IX" +# define PRIdZ "Id" +# endif + #else # define PRIuZ "zu" # define PRIxZ "zx" +# define PRIXZ "zX" # define PRIdZ "zd" #endif @@ -95,7 +95,7 @@ int git_odb__format_object_header( int hdr_max = (hdr_size > INT_MAX-2) ? (INT_MAX-2) : (int)hdr_size; int len; - len = p_snprintf(hdr, hdr_max, "%s %lld", type_str, (long long)obj_len); + len = p_snprintf(hdr, hdr_max, "%s %"PRId64, type_str, (int64_t)obj_len); if (len < 0 || len >= hdr_max) { giterr_set(GITERR_OS, "object header creation failed"); diff --git a/src/streams/socket.c b/src/streams/socket.c index 732b45940..998e2fe87 100644 --- a/src/streams/socket.c +++ b/src/streams/socket.c @@ -38,7 +38,7 @@ static void net_set_error(const char *str) giterr_set(GITERR_NET, "%s: %s", str, win32_error); git__free(win32_error); } else { - giterr_set(GITERR_NET, str); + giterr_set(GITERR_NET, "%s", str); } } #else diff --git a/src/transports/winhttp.c b/src/transports/winhttp.c index 30e2ecb73..11b4298f4 100644 --- a/src/transports/winhttp.c +++ b/src/transports/winhttp.c @@ -329,34 +329,6 @@ static void winhttp_stream_close(winhttp_stream *s) s->sent_request = 0; } -/** - * Extract the url and password from a URL. The outputs are pointers - * into the input. - */ -static int userpass_from_url(wchar_t **user, int *user_len, - wchar_t **pass, int *pass_len, - const wchar_t *url, int url_len) -{ - URL_COMPONENTS components = { 0 }; - - components.dwStructSize = sizeof(components); - /* These tell WinHttpCrackUrl that we're interested in the fields */ - components.dwUserNameLength = 1; - components.dwPasswordLength = 1; - - if (!WinHttpCrackUrl(url, url_len, 0, &components)) { - giterr_set(GITERR_OS, "failed to extract user/pass from url"); - return -1; - } - - *user = components.lpszUserName; - *user_len = components.dwUserNameLength; - *pass = components.lpszPassword; - *pass_len = components.dwPasswordLength; - - return 0; -} - #define SCHEME_HTTP "http://" #define SCHEME_HTTPS "https://" @@ -659,7 +631,7 @@ static int write_chunk(HINTERNET request, const char *buffer, size_t len) git_buf buf = GIT_BUF_INIT; /* Chunk header */ - git_buf_printf(&buf, "%X\r\n", len); + git_buf_printf(&buf, "%"PRIXZ"\r\n", len); if (git_buf_oom(&buf)) return -1; @@ -747,7 +719,7 @@ static void CALLBACK winhttp_status( else if ((status & WINHTTP_CALLBACK_STATUS_FLAG_SECURITY_CHANNEL_ERROR)) giterr_set(GITERR_NET, "security libraries could not be loaded"); else - giterr_set(GITERR_NET, "unknown security error %d", status); + giterr_set(GITERR_NET, "unknown security error %lu", status); } static int winhttp_connect( @@ -870,7 +842,7 @@ static int do_send_request(winhttp_stream *s, size_t len, int ignore_length) len, 0); } - if (success || GetLastError() != SEC_E_BUFFER_TOO_SMALL) + if (success || GetLastError() != (DWORD)SEC_E_BUFFER_TOO_SMALL) break; } @@ -1170,7 +1142,7 @@ replay: } if (HTTP_STATUS_OK != status_code) { - giterr_set(GITERR_NET, "request failed with status code: %d", status_code); + giterr_set(GITERR_NET, "request failed with status code: %lu", status_code); return -1; } diff --git a/src/win32/posix_w32.c b/src/win32/posix_w32.c index 5d144936b..aa9e61877 100644 --- a/src/win32/posix_w32.c +++ b/src/win32/posix_w32.c @@ -397,7 +397,6 @@ int p_readlink(const char *path, char *buf, size_t bufsiz) int p_symlink(const char *target, const char *path) { git_win32_path target_w, path_w; - wchar_t *target_p; if (git_win32_path_from_utf8(path_w, path) < 0 || git__utf8_to_16(target_w, MAX_PATH, target) < 0) |
