subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kot...@apache.org
Subject svn commit: r1703072 - in /subversion/trunk/subversion: svndumpfilter/svndumpfilter.c svnrdump/svnrdump.c
Date Mon, 14 Sep 2015 22:22:13 GMT
Author: kotkov
Date: Mon Sep 14 22:22:12 2015
New Revision: 1703072

URL: http://svn.apache.org/r1703072
Log:
Use the standard way of initializing STDIN and STDOUT streams in svnrdump
and svndumpfiler with svn_stream_for_stdin2() and svn_stream_for_stdout()
functions respectively.

* subversion/svndumpfilter/svndumpfilter.c
  (open_fn_t): Remove this typedef.
  (create_stdio_stream): Remove this helper.
  (parse_baton_initialize): Use the functions from stream API to open the
   standard input and output streams.

* svnrdump/svnrdump.c
  (load_revisions): Use svn_stream_for_stdin2() to open the standard input.

Modified:
    subversion/trunk/subversion/svndumpfilter/svndumpfilter.c
    subversion/trunk/subversion/svnrdump/svnrdump.c

Modified: subversion/trunk/subversion/svndumpfilter/svndumpfilter.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svndumpfilter/svndumpfilter.c?rev=1703072&r1=1703071&r2=1703072&view=diff
==============================================================================
--- subversion/trunk/subversion/svndumpfilter/svndumpfilter.c (original)
+++ subversion/trunk/subversion/svndumpfilter/svndumpfilter.c Mon Sep 14 22:22:12 2015
@@ -48,42 +48,8 @@
 #include "private/svn_cmdline_private.h"
 #include "private/svn_sorts_private.h"
 
-#ifdef _WIN32
-typedef apr_status_t (__stdcall *open_fn_t)(apr_file_t **, apr_pool_t *);
-#else
-typedef apr_status_t (*open_fn_t)(apr_file_t **, apr_pool_t *);
-#endif
-
 /*** Code. ***/
 
-/* Helper to open stdio streams */
-
-/* NOTE: we used to call svn_stream_from_stdio(), which wraps a stream
-   around a standard stdio.h FILE pointer.  The problem is that these
-   pointers operate through C Run Time (CRT) on Win32, which does all
-   sorts of translation on them: LF's become CRLF's, and ctrl-Z's
-   embedded in Word documents are interpreted as premature EOF's.
-
-   So instead, we use apr_file_open_std*, which bypass the CRT and
-   directly wrap the OS's file-handles, which don't know or care about
-   translation.  Thus dump/load works correctly on Win32.
-*/
-static svn_error_t *
-create_stdio_stream(svn_stream_t **stream,
-                    open_fn_t open_fn,
-                    apr_pool_t *pool)
-{
-  apr_file_t *stdio_file;
-  apr_status_t apr_err = open_fn(&stdio_file, pool);
-
-  if (apr_err)
-    return svn_error_wrap_apr(apr_err, _("Can't open stdio file"));
-
-  *stream = svn_stream_from_aprfile2(stdio_file, TRUE, pool);
-  return SVN_NO_ERROR;
-}
-
-
 /* Writes a property in dumpfile format to given stringbuf. */
 static void
 write_prop_to_stringbuf(svn_stringbuf_t *strbuf,
@@ -1065,12 +1031,10 @@ parse_baton_initialize(struct parse_bato
   struct parse_baton_t *baton = apr_palloc(pool, sizeof(*baton));
 
   /* Read the stream from STDIN.  Users can redirect a file. */
-  SVN_ERR(create_stdio_stream(&(baton->in_stream),
-                              apr_file_open_stdin, pool));
+  SVN_ERR(svn_stream_for_stdin2(&baton->in_stream, FALSE, pool));
 
   /* Have the parser dump results to STDOUT. Users can redirect a file. */
-  SVN_ERR(create_stdio_stream(&(baton->out_stream),
-                              apr_file_open_stdout, pool));
+  SVN_ERR(svn_stream_for_stdout(&baton->out_stream, pool));
 
   baton->do_exclude = do_exclude;
 

Modified: subversion/trunk/subversion/svnrdump/svnrdump.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnrdump/svnrdump.c?rev=1703072&r1=1703071&r2=1703072&view=diff
==============================================================================
--- subversion/trunk/subversion/svnrdump/svnrdump.c (original)
+++ subversion/trunk/subversion/svnrdump/svnrdump.c Mon Sep 14 22:22:12 2015
@@ -564,11 +564,9 @@ load_revisions(svn_ra_session_t *session
                apr_hash_t *skip_revprops,
                apr_pool_t *pool)
 {
-  apr_file_t *stdin_file;
   svn_stream_t *stdin_stream;
 
-  apr_file_open_stdin(&stdin_file, pool);
-  stdin_stream = svn_stream_from_aprfile2(stdin_file, FALSE, pool);
+  SVN_ERR(svn_stream_for_stdin2(&stdin_stream, FALSE, pool));
 
   SVN_ERR(svn_rdump__load_dumpstream(stdin_stream, session, aux_session,
                                      quiet, skip_revprops,



Mime
View raw message