[PATCH 4 of 6 A2 series] pathencode: add function _dotauxencode

Adrian Buehlmann adrian at cadifra.com
Sat Oct 6 04:52:25 CDT 2012


# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1349469383 -7200
# Node ID 9ed1aa45af277af8e47d8e96811f4f210643d8f2
# Parent  e93c452610bcd7e5ba0e5ed835d3fa2f1712d93e
pathencode: add function _dotauxencode

Derived from a patch originally published by Bryan

diff --git a/mercurial/pathencode.c b/mercurial/pathencode.c
--- a/mercurial/pathencode.c
+++ b/mercurial/pathencode.c
@@ -529,6 +529,20 @@
 		       src, len, 1);
 }
 
+static Py_ssize_t _dotauxencode(char *dest, size_t destsize,
+                                const char *src, Py_ssize_t len)
+{
+	static const uint32_t twobytes[8];
+
+	static const uint32_t onebyte[8] = {
+		~0, 0xffff3ffe, ~0, ~0, ~0, ~0, ~0, ~0,
+	};
+
+	Py_ssize_t destlen = 0;
+
+	return _encode(twobytes, onebyte, dest, destlen, destsize, src, len, 0);
+}
+
 static const Py_ssize_t maxstorepathlen = 120;
 
 /*


More information about the Mercurial-devel mailing list