git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: David Michael Barr <davidbarr@google.com>,
	Florian Achleitner <florian.achleitner2.6.31@gmail.com>,
	git@vger.kernel.org
Subject: [PATCH 9/9] vcs-svn: allow 64-bit Prop-Content-Length
Date: Fri, 6 Jul 2012 12:27:50 -0500	[thread overview]
Message-ID: <20120706172750.GJ31001@burratino> (raw)
In-Reply-To: <20120706171040.GA31001@burratino>

Date: Thu, 5 Jul 2012 22:47:47 -0500

Currently the vcs-svn/ library only pays attention to the presence of
the Prop-Content-Length field and doesn't care about its value, but
some day we might care about the value.  Parse it as an off_t instead
of arbitrarily limiting to 32 bits for intuitiveness.

So now you can import from a dump with more than 2 GiB of properties
for a node.  In practice that isn't likely to happen often, and this
is mostly meant as a cleanup.

Based-on-patch-by: David Barr <davidbarr@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Another change that was mixed into v2's signedness warnings patch.
In v2 it changed the type of propLength without changing its name.
This version of the patch is more thorough about consistently using
the intuitive type (off_t instead of a 32-bit integer).

That's the end of the series.  Thanks for your patience.

 vcs-svn/svndump.c |   33 ++++++++++++++++++---------------
 1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c
index c5d07a66..a7f3ea64 100644
--- a/vcs-svn/svndump.c
+++ b/vcs-svn/svndump.c
@@ -34,14 +34,13 @@
 #define NODE_CTX 2	/* node metadata */
 #define INTERNODE_CTX 3	/* between nodes */
 
-#define LENGTH_UNKNOWN (~0)
 #define DATE_RFC2822_LEN 31
 
 static struct line_buffer input = LINE_BUFFER_INIT;
 
 static struct {
-	uint32_t action, propLength, srcRev, type;
-	off_t text_length;
+	uint32_t action, srcRev, type;
+	off_t prop_length, text_length;
 	struct strbuf src, dst;
 	uint32_t text_delta, prop_delta;
 } node_ctx;
@@ -61,7 +60,7 @@ static void reset_node_ctx(char *fname)
 {
 	node_ctx.type = 0;
 	node_ctx.action = NODEACT_UNKNOWN;
-	node_ctx.propLength = LENGTH_UNKNOWN;
+	node_ctx.prop_length = -1;
 	node_ctx.text_length = -1;
 	strbuf_reset(&node_ctx.src);
 	node_ctx.srcRev = 0;
@@ -209,7 +208,7 @@ static void read_props(void)
 static void handle_node(void)
 {
 	const uint32_t type = node_ctx.type;
-	const int have_props = node_ctx.propLength != LENGTH_UNKNOWN;
+	const int have_props = node_ctx.prop_length != -1;
 	const int have_text = node_ctx.text_length != -1;
 	/*
 	 * Old text for this node:
@@ -273,7 +272,7 @@ static void handle_node(void)
 	if (have_props) {
 		if (!node_ctx.prop_delta)
 			node_ctx.type = type;
-		if (node_ctx.propLength)
+		if (node_ctx.prop_length)
 			read_props();
 	}
 
@@ -409,22 +408,26 @@ void svndump_read(const char *url)
 			node_ctx.srcRev = atoi(val);
 			break;
 		case sizeof("Text-content-length"):
-			if (!constcmp(t, "Text-content-length")) {
+			if (constcmp(t, "Text") && constcmp(t, "Prop"))
+				continue;
+			if (constcmp(t + 4, "-content-length"))
+				continue;
+			{
 				char *end;
-				uintmax_t textlen;
+				uintmax_t len;
 
-				textlen = strtoumax(val, &end, 10);
+				len = strtoumax(val, &end, 10);
 				if (!isdigit(*val) || *end)
 					die("invalid dump: non-numeric length %s", val);
-				if (textlen > maximum_signed_value_of_type(off_t))
+				if (len > maximum_signed_value_of_type(off_t))
 					die("unrepresentable length in dump: %s", val);
-				node_ctx.text_length = (off_t) textlen;
+
+				if (*t == 'T')
+					node_ctx.text_length = (off_t) len;
+				else
+					node_ctx.prop_length = (off_t) len;
 				break;
 			}
-			if (constcmp(t, "Prop-content-length"))
-				continue;
-			node_ctx.propLength = atoi(val);
-			break;
 		case sizeof("Text-delta"):
 			if (!constcmp(t, "Text-delta")) {
 				node_ctx.text_delta = !strcmp(val, "true");
-- 
1.7.10.4

  parent reply	other threads:[~2012-07-06 17:28 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-06 21:55 What's cooking in git.git (Jun 2012, #02; Wed, 6) Junio C Hamano
2012-06-06 23:49 ` David Michael Barr
2012-06-07  0:39   ` Jonathan Nieder
2012-06-07  5:25     ` Junio C Hamano
2012-07-06 17:10       ` [GIT PULL] vcs-svn housekeeping Jonathan Nieder
2012-07-06 17:13         ` [PATCH 1/9] vcs-svn: drop no-op reset methods Jonathan Nieder
2012-07-06 17:16         ` [PATCH 2/9] vcs-svn: avoid self-assignment in dummy initialization of pre_off Jonathan Nieder
2012-07-06 17:18         ` [PATCH 3/9] vcs-svn: simplify cleanup in apply_one_window Jonathan Nieder
2012-07-06 17:18         ` [PATCH 4/9] vcs-svn: use constcmp instead of prefixcmp Jonathan Nieder
2012-07-06 17:19         ` [PATCH 5/9] vcs-svn: use strstr instead of memmem Jonathan Nieder
2012-07-06 17:21         ` [PATCH 6/9] vcs-svn: suppress signed/unsigned comparison warnings Jonathan Nieder
2012-07-06 17:22         ` [PATCH 7/9] vcs-svn: suppress a signed/unsigned comparison warning Jonathan Nieder
2012-07-06 17:25         ` [PATCH 8/9] " Jonathan Nieder
2012-07-06 17:27         ` Jonathan Nieder [this message]
2012-07-06 19:41         ` [GIT PULL] vcs-svn housekeeping David Michael Barr
2012-07-06 20:28           ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120706172750.GJ31001@burratino \
    --to=jrnieder@gmail.com \
    --cc=davidbarr@google.com \
    --cc=florian.achleitner2.6.31@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).