https://github.com/git/git
Revision 3c7896e36202c09a5f124730b40f243ae94ffa62 authored by Junio C Hamano on 20 January 2023, 23:36:21 UTC, committed by Johannes Schindelin on 22 March 2023, 17:00:36 UTC
Deal with a few deprecation warning from cURL library.

* jk/curl-avoid-deprecated-api:
  http: support CURLOPT_PROTOCOLS_STR
  http: prefer CURLOPT_SEEKFUNCTION to CURLOPT_IOCTLFUNCTION
  http-push: prefer CURLOPT_UPLOAD to CURLOPT_PUT
2 parent s 6f5ff3a + 07f91e5
Raw File
Tip revision: 3c7896e36202c09a5f124730b40f243ae94ffa62 authored by Junio C Hamano on 20 January 2023, 23:36:21 UTC
Merge branch 'backport/jk/curl-avoid-deprecated-api' into maint-2.30
Tip revision: 3c7896e
varint.c
#include "git-compat-util.h"
#include "varint.h"

uintmax_t decode_varint(const unsigned char **bufp)
{
	const unsigned char *buf = *bufp;
	unsigned char c = *buf++;
	uintmax_t val = c & 127;
	while (c & 128) {
		val += 1;
		if (!val || MSB(val, 7))
			return 0; /* overflow */
		c = *buf++;
		val = (val << 7) + (c & 127);
	}
	*bufp = buf;
	return val;
}

int encode_varint(uintmax_t value, unsigned char *buf)
{
	unsigned char varint[16];
	unsigned pos = sizeof(varint) - 1;
	varint[pos] = value & 127;
	while (value >>= 7)
		varint[--pos] = 128 | (--value & 127);
	if (buf)
		memcpy(buf, varint + pos, sizeof(varint) - pos);
	return sizeof(varint) - pos;
}
back to top