[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] svn status -v dies with revisions > 999999

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2002-08-03 15:50:54 CEST

"Jay Freeman \(saurik\)" <saurik@saurik.com> writes:

> BTW, it would be nice if it would actually output more than the first 6
> characters of the revision, but then again, I'm probably the only person who
> is going to run into this problem for _quite_ a while :).

In svn_cl__print_status_list youngest is the largest possible status,
so sprintf that into an array and run strlen. Then pass the length to
print_long_format.

>
> Index: ./status.c
> ===================================================================
> --- ./status.c
> +++ ./status.c Sat Aug 3 05:16:08 2002
> @@ -150,7 +150,7 @@
> svn_wc_status_t *status)
> {
> char str_status[5];
> - char str_rev[7];
> + char str_rev[11];

Why 11? I guess that's 2^32 in decimal plus one. Magic numbers
should be documented. What about 64 bit platforms?

> char update_char;
> svn_revnum_t local_rev;
> char last_committed[6 + 3 + 8 + 3 + 1] = { 0 };
> @@ -207,10 +207,10 @@
> else if (status->copied)
> strcpy (str_rev, " -");
> else
> - sprintf (str_rev, "%6ld", local_rev);
> + sprintf (str_rev, "%ld", local_rev);

"%ld" should be "%" SVN_REVNUM_T_FMT

>
> /* One Printf to rule them all, one Printf to bind them..." */
> - printf ("%s %c %s %s%s\n",
> + printf ("%s %c %6.6s %s%s\n",

Use the newly passed in length of youngest and either %*.* or
dynamically construct the format string.

> str_status,
> update_char,
> str_rev,

Please supply a log message.

-- 
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Aug 3 15:51:45 2002

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.