You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ar...@apache.org on 2011/08/15 01:06:09 UTC

svn commit: r1157682 - /subversion/trunk/subversion/svn/status.c

Author: arfrever
Date: Sun Aug 14 23:06:09 2011
New Revision: 1157682

URL: http://svn.apache.org/viewvc?rev=1157682&view=rev
Log:
Follow-up to r1157537:

* subversion/svn/status.c
  (print_status): Include %s in translated messages to support languages,
   in which "from" / "to" are postpositions.

Modified:
    subversion/trunk/subversion/svn/status.c

Modified: subversion/trunk/subversion/svn/status.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/status.c?rev=1157682&r1=1157681&r2=1157682&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/status.c (original)
+++ subversion/trunk/subversion/svn/status.c Sun Aug 14 23:06:09 2011
@@ -268,8 +268,11 @@ print_status(const char *path,
       SVN_ERR(svn_dirent_get_absolute(&cwd, "", pool));
       relpath = make_relpath(cwd, status->moved_from_abspath, pool, pool);
       relpath = svn_dirent_local_style(relpath, pool);
-      moved_from_line = apr_psprintf(pool, "\n        > %s %s",
-                                     _("moved from"), relpath);
+      moved_from_line = apr_psprintf(pool,
+                                     apr_psprintf(pool,
+                                                  "\n        > %s",
+                                                  _("moved from %s")),
+                                     relpath);
     }
 
   /* Only print an extra moved-to line for the op-root of a move-away.
@@ -285,8 +288,11 @@ print_status(const char *path,
       SVN_ERR(svn_dirent_get_absolute(&cwd, "", pool));
       relpath = make_relpath(cwd, status->moved_to_abspath, pool, pool);
       relpath = svn_dirent_local_style(relpath, pool);
-      moved_to_line = apr_psprintf(pool, "\n        > %s %s",
-                                   _("moved to"), relpath);
+      moved_to_line = apr_psprintf(pool,
+                                   apr_psprintf(pool,
+                                                "\n        > %s",
+                                                _("moved to %s")),
+                                   relpath);
     }
 
   if (detailed)



Re: svn commit: r1157682 - /subversion/trunk/subversion/svn/status.c

Posted by Peter Samuelson <pe...@p12n.org>.
> -      moved_from_line = apr_psprintf(pool, "\n        > %s %s",
> -                                     _("moved from"), relpath);
> +      moved_from_line = apr_psprintf(pool,
> +                                     apr_psprintf(pool,
> +                                                  "\n        > %s",
> +                                                  _("moved from %s")),
> +                                     relpath);

I found sprintf inside sprintf to be quite confusing, so I changed it
to sprintf inside strcat, in r1158343.  strcat seemed appropriate
anyway, even without the confusing nesting issue.  Hope nobody minds.
-- 
Peter Samuelson | org-tld!p12n!peter | http://p12n.org/

Re: svn commit: r1157682 - /subversion/trunk/subversion/svn/status.c

Posted by Stefan Sperling <st...@elego.de>.
On Mon, Aug 15, 2011 at 07:18:18AM -0500, Hyrum K Wright wrote:
> Do we do this other places in our code, or does this introduce a new pattern?

We do this in lots of places.

> It *does* introduce new "format not a string literal, argument types
> not checked" warnings at compile-time.

Those warnings are normal. Of course the compiler cannot check argument
types for format strings allocated at runtime.
The format string is returned by gettext().

There are other ways of making sure format directives in translated
strings are valid, see http://svn.haxx.se/dev/archive-2011-08/0136.shtml

Re: svn commit: r1157682 - /subversion/trunk/subversion/svn/status.c

Posted by Stefan Sperling <st...@elego.de>.
On Mon, Aug 15, 2011 at 07:18:18AM -0500, Hyrum K Wright wrote:
> Do we do this other places in our code, or does this introduce a new pattern?

We do this in lots of places.

> It *does* introduce new "format not a string literal, argument types
> not checked" warnings at compile-time.

Those warnings are normal. Of course the compiler cannot check argument
types for format strings allocated at runtime.
The format string is returned by gettext().

There are other ways of making sure format directives in translated
strings are valid, see http://svn.haxx.se/dev/archive-2011-08/0136.shtml

Re: svn commit: r1157682 - /subversion/trunk/subversion/svn/status.c

Posted by Hyrum K Wright <hy...@wandisco.com>.
Do we do this other places in our code, or does this introduce a new pattern?

It *does* introduce new "format not a string literal, argument types
not checked" warnings at compile-time.

-Hyrum

On Sun, Aug 14, 2011 at 6:06 PM,  <ar...@apache.org> wrote:
> Author: arfrever
> Date: Sun Aug 14 23:06:09 2011
> New Revision: 1157682
>
> URL: http://svn.apache.org/viewvc?rev=1157682&view=rev
> Log:
> Follow-up to r1157537:
>
> * subversion/svn/status.c
>  (print_status): Include %s in translated messages to support languages,
>   in which "from" / "to" are postpositions.
>
> Modified:
>    subversion/trunk/subversion/svn/status.c
>
> Modified: subversion/trunk/subversion/svn/status.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/status.c?rev=1157682&r1=1157681&r2=1157682&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/svn/status.c (original)
> +++ subversion/trunk/subversion/svn/status.c Sun Aug 14 23:06:09 2011
> @@ -268,8 +268,11 @@ print_status(const char *path,
>       SVN_ERR(svn_dirent_get_absolute(&cwd, "", pool));
>       relpath = make_relpath(cwd, status->moved_from_abspath, pool, pool);
>       relpath = svn_dirent_local_style(relpath, pool);
> -      moved_from_line = apr_psprintf(pool, "\n        > %s %s",
> -                                     _("moved from"), relpath);
> +      moved_from_line = apr_psprintf(pool,
> +                                     apr_psprintf(pool,
> +                                                  "\n        > %s",
> +                                                  _("moved from %s")),
> +                                     relpath);
>     }
>
>   /* Only print an extra moved-to line for the op-root of a move-away.
> @@ -285,8 +288,11 @@ print_status(const char *path,
>       SVN_ERR(svn_dirent_get_absolute(&cwd, "", pool));
>       relpath = make_relpath(cwd, status->moved_to_abspath, pool, pool);
>       relpath = svn_dirent_local_style(relpath, pool);
> -      moved_to_line = apr_psprintf(pool, "\n        > %s %s",
> -                                   _("moved to"), relpath);
> +      moved_to_line = apr_psprintf(pool,
> +                                   apr_psprintf(pool,
> +                                                "\n        > %s",
> +                                                _("moved to %s")),
> +                                   relpath);
>     }
>
>   if (detailed)
>
>
>



-- 

uberSVN: Apache Subversion Made Easy
http://www.uberSVN.com/

Re: svn commit: r1157682 - /subversion/trunk/subversion/svn/status.c

Posted by Hyrum K Wright <hy...@wandisco.com>.
Do we do this other places in our code, or does this introduce a new pattern?

It *does* introduce new "format not a string literal, argument types
not checked" warnings at compile-time.

-Hyrum

On Sun, Aug 14, 2011 at 6:06 PM,  <ar...@apache.org> wrote:
> Author: arfrever
> Date: Sun Aug 14 23:06:09 2011
> New Revision: 1157682
>
> URL: http://svn.apache.org/viewvc?rev=1157682&view=rev
> Log:
> Follow-up to r1157537:
>
> * subversion/svn/status.c
>  (print_status): Include %s in translated messages to support languages,
>   in which "from" / "to" are postpositions.
>
> Modified:
>    subversion/trunk/subversion/svn/status.c
>
> Modified: subversion/trunk/subversion/svn/status.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/status.c?rev=1157682&r1=1157681&r2=1157682&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/svn/status.c (original)
> +++ subversion/trunk/subversion/svn/status.c Sun Aug 14 23:06:09 2011
> @@ -268,8 +268,11 @@ print_status(const char *path,
>       SVN_ERR(svn_dirent_get_absolute(&cwd, "", pool));
>       relpath = make_relpath(cwd, status->moved_from_abspath, pool, pool);
>       relpath = svn_dirent_local_style(relpath, pool);
> -      moved_from_line = apr_psprintf(pool, "\n        > %s %s",
> -                                     _("moved from"), relpath);
> +      moved_from_line = apr_psprintf(pool,
> +                                     apr_psprintf(pool,
> +                                                  "\n        > %s",
> +                                                  _("moved from %s")),
> +                                     relpath);
>     }
>
>   /* Only print an extra moved-to line for the op-root of a move-away.
> @@ -285,8 +288,11 @@ print_status(const char *path,
>       SVN_ERR(svn_dirent_get_absolute(&cwd, "", pool));
>       relpath = make_relpath(cwd, status->moved_to_abspath, pool, pool);
>       relpath = svn_dirent_local_style(relpath, pool);
> -      moved_to_line = apr_psprintf(pool, "\n        > %s %s",
> -                                   _("moved to"), relpath);
> +      moved_to_line = apr_psprintf(pool,
> +                                   apr_psprintf(pool,
> +                                                "\n        > %s",
> +                                                _("moved to %s")),
> +                                   relpath);
>     }
>
>   if (detailed)
>
>
>



-- 

uberSVN: Apache Subversion Made Easy
http://www.uberSVN.com/