~ubuntu-branches/ubuntu/trusty/subversion/trusty-proposed

« back to all changes in this revision

Viewing changes to subversion/libsvn_subr/xml.c

  • Committer: Package Import Robot
  • Author(s): Andy Whitcroft
  • Date: 2012-06-21 15:36:36 UTC
  • mfrom: (0.4.13 sid)
  • Revision ID: package-import@ubuntu.com-20120621153636-amqqmuidgwgxz1ly
Tags: 1.7.5-1ubuntu1
* Merge from Debian unstable.  Remaining changes:
  - Create pot file on build.
  - Build a python-subversion-dbg package.
  - Build-depend on python-dbg.
  - Build-depend on default-jre-headless/-jdk.
  - Do not apply java-build patch.
  - debian/rules: Manually create the doxygen output directory, otherwise
    we get weird build failures when running parallel builds.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * xml.c:  xml helper code shared among the Subversion libraries.
3
3
 *
4
4
 * ====================================================================
5
 
 * Copyright (c) 2000-2006, 2009 CollabNet.  All rights reserved.
6
 
 *
7
 
 * This software is licensed as described in the file COPYING, which
8
 
 * you should have received as part of this distribution.  The terms
9
 
 * are also available at http://subversion.tigris.org/license-1.html.
10
 
 * If newer versions of this license are posted there, you may use a
11
 
 * newer version instead, at your option.
12
 
 *
13
 
 * This software consists of voluntary contributions made by many
14
 
 * individuals.  For exact contribution history, see the revision
15
 
 * history and logs, available at http://subversion.tigris.org/.
 
5
 *    Licensed to the Apache Software Foundation (ASF) under one
 
6
 *    or more contributor license agreements.  See the NOTICE file
 
7
 *    distributed with this work for additional information
 
8
 *    regarding copyright ownership.  The ASF licenses this file
 
9
 *    to you under the Apache License, Version 2.0 (the
 
10
 *    "License"); you may not use this file except in compliance
 
11
 *    with the License.  You may obtain a copy of the License at
 
12
 *
 
13
 *      http://www.apache.org/licenses/LICENSE-2.0
 
14
 *
 
15
 *    Unless required by applicable law or agreed to in writing,
 
16
 *    software distributed under the License is distributed on an
 
17
 *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 
18
 *    KIND, either express or implied.  See the License for the
 
19
 *    specific language governing permissions and limitations
 
20
 *    under the License.
16
21
 * ====================================================================
17
22
 */
18
23
 
296
301
         ### should probably share code, even though they escape
297
302
         ### different characters.
298
303
      */
299
 
      sprintf(escaped_char, "?\\%03u", (unsigned char) *q);
 
304
      apr_snprintf(escaped_char, sizeof(escaped_char), "?\\%03u",
 
305
                   (unsigned char) *q);
300
306
      svn_stringbuf_appendcstr(outstr, escaped_char);
301
307
 
302
308
      p = q + 1;
396
402
  int success;
397
403
 
398
404
  /* Parse some xml data */
399
 
  success = XML_Parse(svn_parser->parser, buf, len, is_final);
 
405
  success = XML_Parse(svn_parser->parser, buf, (int) len, is_final);
400
406
 
401
407
  /* If expat choked internally, return its error. */
402
408
  if (! success)
468
474
/*** Printing XML ***/
469
475
 
470
476
void
471
 
svn_xml_make_header(svn_stringbuf_t **str, apr_pool_t *pool)
 
477
svn_xml_make_header2(svn_stringbuf_t **str, const char *encoding,
 
478
                     apr_pool_t *pool)
472
479
{
 
480
 
473
481
  if (*str == NULL)
474
482
    *str = svn_stringbuf_create("", pool);
475
 
  svn_stringbuf_appendcstr(*str,
476
 
                           "<?xml version=\"1.0\"?>\n");
 
483
  svn_stringbuf_appendcstr(*str, "<?xml version=\"1.0\"");
 
484
  if (encoding)
 
485
    {
 
486
      encoding = apr_psprintf(pool, " encoding=\"%s\"", encoding);
 
487
      svn_stringbuf_appendcstr(*str, encoding);
 
488
    }
 
489
  svn_stringbuf_appendcstr(*str, "?>\n");
477
490
}
478
491
 
479
492