Unverified Commit d1bdf2a8 by Edward Thomson Committed by GitHub

Merge pull request #6678 from libgit2/ethomson/compat_fixes

Several compatibility fixes
parents 82d44145 839b2495
...@@ -59,11 +59,12 @@ bool ntlm_des_encrypt( ...@@ -59,11 +59,12 @@ bool ntlm_des_encrypt(
ntlm_des_block *plaintext, ntlm_des_block *plaintext,
ntlm_des_block *key) ntlm_des_block *key)
{ {
CCCryptorStatus result;
size_t written; size_t written;
NTLM_UNUSED(ntlm); NTLM_UNUSED(ntlm);
CCCryptorStatus result = CCCrypt(kCCEncrypt, result = CCCrypt(kCCEncrypt,
kCCAlgorithmDES, kCCOptionECBMode, kCCAlgorithmDES, kCCOptionECBMode,
key, sizeof(ntlm_des_block), NULL, key, sizeof(ntlm_des_block), NULL,
plaintext, sizeof(ntlm_des_block), plaintext, sizeof(ntlm_des_block),
......
...@@ -29,8 +29,8 @@ GIT_BEGIN_DECL ...@@ -29,8 +29,8 @@ GIT_BEGIN_DECL
typedef struct git_stream { typedef struct git_stream {
int version; int version;
int encrypted : 1, unsigned int encrypted : 1,
proxy_support : 1; proxy_support : 1;
/** /**
* Timeout for read and write operations; can be set to `0` to * Timeout for read and write operations; can be set to `0` to
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* This file was produced by using the `rename.pl` script included with * This file was produced by using the `rename.pl` script included with
* adopt. The command-line specified was: * adopt. The command-line specified was:
* *
* ./rename.pl cli_opt --filename=opt --include=cli.h --inline=GIT_INLINE --header-guard=CLI_opt_h__ --lowercase-status --without-usage * ./rename.pl cli_opt --filename=opt --include=common.h --inline=GIT_INLINE --header-guard=CLI_opt_h__ --lowercase-status --without-usage
*/ */
#include <stdlib.h> #include <stdlib.h>
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* This file was produced by using the `rename.pl` script included with * This file was produced by using the `rename.pl` script included with
* adopt. The command-line specified was: * adopt. The command-line specified was:
* *
* ./rename.pl cli_opt --filename=opt --include=cli.h --inline=GIT_INLINE --header-guard=CLI_opt_h__ --lowercase-status --without-usage * ./rename.pl cli_opt --filename=opt --include=common.h --inline=GIT_INLINE --header-guard=CLI_opt_h__ --lowercase-status --without-usage
*/ */
#ifndef CLI_opt_h__ #ifndef CLI_opt_h__
...@@ -275,8 +275,8 @@ typedef struct cli_opt_parser { ...@@ -275,8 +275,8 @@ typedef struct cli_opt_parser {
size_t arg_idx; size_t arg_idx;
size_t in_args; size_t in_args;
size_t in_short; size_t in_short;
int needs_sort : 1, unsigned int needs_sort : 1,
in_literal : 1; in_literal : 1;
} cli_opt_parser; } cli_opt_parser;
/** /**
...@@ -300,6 +300,16 @@ cli_opt_status_t cli_opt_parse( ...@@ -300,6 +300,16 @@ cli_opt_status_t cli_opt_parse(
size_t args_len, size_t args_len,
unsigned int flags); unsigned int flags);
/**
* Quickly executes the given callback for each argument.
*
* @param specs A NULL-terminated array of `cli_opt_spec`s that can be parsed
* @param args The arguments that will be parsed
* @param args_len The length of arguments to be parsed
* @param flags The `cli_opt_flag_t flags for parsing
* @param callback The callback to invoke for each specified option
* @param callback_data Data to be provided to the callback
*/
int cli_opt_foreach( int cli_opt_foreach(
const cli_opt_spec specs[], const cli_opt_spec specs[],
char **args, char **args,
......
...@@ -279,8 +279,7 @@ static int skip_bom(git_parse_ctx *parser) ...@@ -279,8 +279,7 @@ static int skip_bom(git_parse_ctx *parser)
*/ */
/* '\"' -> '"' etc */ /* '\"' -> '"' etc */
static int unescape_line( static int unescape_line(char **out, bool *is_multi, const char *ptr, int *quote_count)
char **out, bool *is_multi, const char *ptr, int quote_count)
{ {
char *str, *fixed, *esc; char *str, *fixed, *esc;
size_t ptr_len = strlen(ptr), alloc_len; size_t ptr_len = strlen(ptr), alloc_len;
...@@ -296,7 +295,8 @@ static int unescape_line( ...@@ -296,7 +295,8 @@ static int unescape_line(
while (*ptr != '\0') { while (*ptr != '\0') {
if (*ptr == '"') { if (*ptr == '"') {
quote_count++; if (quote_count)
(*quote_count)++;
} else if (*ptr != '\\') { } else if (*ptr != '\\') {
*fixed++ = *ptr; *fixed++ = *ptr;
} else { } else {
...@@ -358,7 +358,7 @@ static int parse_multiline_variable(git_config_parser *reader, git_str *value, i ...@@ -358,7 +358,7 @@ static int parse_multiline_variable(git_config_parser *reader, git_str *value, i
goto next; goto next;
if ((error = unescape_line(&proc_line, &multiline, if ((error = unescape_line(&proc_line, &multiline,
line, in_quotes)) < 0) line, &in_quotes)) < 0)
goto out; goto out;
/* Add this line to the multiline var */ /* Add this line to the multiline var */
...@@ -445,7 +445,7 @@ static int parse_variable(git_config_parser *reader, char **var_name, char **var ...@@ -445,7 +445,7 @@ static int parse_variable(git_config_parser *reader, char **var_name, char **var
while (git__isspace(value_start[0])) while (git__isspace(value_start[0]))
value_start++; value_start++;
if ((error = unescape_line(&value, &multiline, value_start, 0)) < 0) if ((error = unescape_line(&value, &multiline, value_start, NULL)) < 0)
goto out; goto out;
if (multiline) { if (multiline) {
......
...@@ -62,8 +62,8 @@ typedef struct refdb_fs_backend { ...@@ -62,8 +62,8 @@ typedef struct refdb_fs_backend {
git_oid_t oid_type; git_oid_t oid_type;
int fsync : 1, unsigned int fsync : 1,
sorted : 1; sorted : 1;
int peeling_mode; int peeling_mode;
git_iterator_flag_t iterator_flags; git_iterator_flag_t iterator_flags;
uint32_t direach_flags; uint32_t direach_flags;
......
...@@ -203,7 +203,7 @@ int git_smart__update_heads(transport_smart *t, git_vector *symrefs); ...@@ -203,7 +203,7 @@ int git_smart__update_heads(transport_smart *t, git_vector *symrefs);
/* smart_pkt.c */ /* smart_pkt.c */
typedef struct { typedef struct {
git_oid_t oid_type; git_oid_t oid_type;
int seen_capabilities: 1; unsigned int seen_capabilities: 1;
} git_pkt_parse_data; } git_pkt_parse_data;
int git_pkt_parse_line(git_pkt **head, const char **endptr, const char *line, size_t linelen, git_pkt_parse_data *data); int git_pkt_parse_line(git_pkt **head, const char **endptr, const char *line, size_t linelen, git_pkt_parse_data *data);
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#define GIT_NET_URL_PARSER_INIT { 0 } #define GIT_NET_URL_PARSER_INIT { 0 }
typedef struct { typedef struct {
int hierarchical : 1; unsigned int hierarchical : 1;
const char *scheme; const char *scheme;
const char *user; const char *user;
......
...@@ -11,10 +11,10 @@ ...@@ -11,10 +11,10 @@
typedef struct git_process git_process; typedef struct git_process git_process;
typedef struct { typedef struct {
int capture_in : 1, unsigned int capture_in : 1,
capture_out : 1, capture_out : 1,
capture_err : 1, capture_err : 1,
exclude_env : 1; exclude_env : 1;
char *cwd; char *cwd;
} git_process_options; } git_process_options;
......
...@@ -94,8 +94,10 @@ ...@@ -94,8 +94,10 @@
static void fs_rm(const char *_source); static void fs_rm(const char *_source);
static void fs_copy(const char *_source, const char *dest); static void fs_copy(const char *_source, const char *dest);
#ifdef CLAR_FIXTURE_PATH
static const char * static const char *
fixture_path(const char *base, const char *fixture_name); fixture_path(const char *base, const char *fixture_name);
#endif
struct clar_error { struct clar_error {
const char *file; const char *file;
......
#ifdef CLAR_FIXTURE_PATH
static const char * static const char *
fixture_path(const char *base, const char *fixture_name) fixture_path(const char *base, const char *fixture_name)
{ {
...@@ -20,7 +21,6 @@ fixture_path(const char *base, const char *fixture_name) ...@@ -20,7 +21,6 @@ fixture_path(const char *base, const char *fixture_name)
return _path; return _path;
} }
#ifdef CLAR_FIXTURE_PATH
const char *cl_fixture(const char *fixture_name) const char *cl_fixture(const char *fixture_name)
{ {
return fixture_path(CLAR_FIXTURE_PATH, fixture_name); return fixture_path(CLAR_FIXTURE_PATH, fixture_name);
......
...@@ -295,7 +295,9 @@ fs_copy(const char *_source, const char *_dest) ...@@ -295,7 +295,9 @@ fs_copy(const char *_source, const char *_dest)
void void
cl_fs_cleanup(void) cl_fs_cleanup(void)
{ {
#ifdef CLAR_FIXTURE_PATH
fs_rm(fixture_path(_clar_path, "*")); fs_rm(fixture_path(_clar_path, "*"));
#endif
} }
#else #else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment