You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2014/09/30 15:08:23 UTC
svn commit: r1628427 - in /subversion/trunk/subversion/libsvn_fs_fs: fs_fs.c
index.c
Author: stefan2
Date: Tue Sep 30 13:08:23 2014
New Revision: 1628427
URL: http://svn.apache.org/r1628427
Log:
Don't use the platform-specific APR_*_FMT macros in translatable strings.
* subversion/libsvn_fs_fs/index.c
(read_uint32_from_proto_index,
read_off_t_from_proto_index,
read_p2l_entry_from_proto_index): Convert numbers to strings before
using them in a translatable format
string.
* subversion/libsvn_fs_fs/fs_fs.c
(verify_block_size): Same.
(read_config): Update caller.
Found by: brane
Modified:
subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
subversion/trunk/subversion/libsvn_fs_fs/index.c
Modified: subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c?rev=1628427&r1=1628426&r2=1628427&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c Tue Sep 30 13:08:23 2014
@@ -647,34 +647,43 @@ svn_fs_fs__fs_supports_mergeinfo(svn_fs_
/* Check that BLOCK_SIZE is a valid block / page size, i.e. it is within
* the range of what the current system may address in RAM and it is a
* power of 2. Assume that the element size within the block is ITEM_SIZE.
+ * Use SCRATCH_POOL for temporary allocations.
*/
static svn_error_t *
verify_block_size(apr_int64_t block_size,
apr_size_t item_size,
- const char *name)
+ const char *name,
+ apr_pool_t *scratch_pool
+ )
{
/* Limit range. */
if (block_size <= 0)
return svn_error_createf(SVN_ERR_BAD_CONFIG_VALUE, NULL,
- _("%" APR_INT64_T_FMT " is too small for "
- "fsfs.conf setting '%s'."),
- block_size, name);
+ _("%s is too small for fsfs.conf setting '%s'."),
+ apr_psprintf(scratch_pool,
+ "%" APR_INT64_T_FMT,
+ block_size),
+ name);
if (block_size > SVN_MAX_OBJECT_SIZE / item_size)
return svn_error_createf(SVN_ERR_BAD_CONFIG_VALUE, NULL,
- _("%" APR_INT64_T_FMT " is too large for "
- "fsfs.conf setting '%s'."),
- block_size, name);
+ _("%s is too large for fsfs.conf setting '%s'."),
+ apr_psprintf(scratch_pool,
+ "%" APR_INT64_T_FMT,
+ block_size),
+ name);
/* Ensure it is a power of two.
* For positive X, X & (X-1) will reset the lowest bit set.
* If the result is 0, at most one bit has been set. */
if (0 != (block_size & (block_size - 1)))
return svn_error_createf(SVN_ERR_BAD_CONFIG_VALUE, NULL,
- _("%" APR_INT64_T_FMT " is invalid for "
- "fsfs.conf setting '%s' because it is "
- "not a power of 2."),
- block_size, name);
+ _("%s is invalid for fsfs.conf setting '%s' "
+ "because it is not a power of 2."),
+ apr_psprintf(scratch_pool,
+ "%" APR_INT64_T_FMT,
+ block_size),
+ name);
return SVN_NO_ERROR;
}
@@ -782,11 +791,11 @@ read_config(fs_fs_data_t *ffd,
* Block size and P2L page size are in kbytes;
* L2P blocks are arrays of apr_off_t. */
SVN_ERR(verify_block_size(ffd->block_size, 0x400,
- CONFIG_OPTION_BLOCK_SIZE));
+ CONFIG_OPTION_BLOCK_SIZE, scratch_pool));
SVN_ERR(verify_block_size(ffd->p2l_page_size, 0x400,
- CONFIG_OPTION_P2L_PAGE_SIZE));
+ CONFIG_OPTION_P2L_PAGE_SIZE, scratch_pool));
SVN_ERR(verify_block_size(ffd->l2p_page_size, sizeof(apr_off_t),
- CONFIG_OPTION_L2P_PAGE_SIZE));
+ CONFIG_OPTION_L2P_PAGE_SIZE, scratch_pool));
/* convert kBytes to bytes */
ffd->block_size *= 0x400;
Modified: subversion/trunk/subversion/libsvn_fs_fs/index.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/index.c?rev=1628427&r1=1628426&r2=1628427&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/index.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/index.c Tue Sep 30 13:08:23 2014
@@ -552,10 +552,13 @@ read_uint32_from_proto_index(apr_file_t
{
if (value > APR_UINT32_MAX)
return svn_error_createf(SVN_ERR_FS_INDEX_OVERFLOW, NULL,
- _("UINT32 0x%" APR_UINT64_T_HEX_FMT
- " too large, max = 0x%"
- APR_UINT64_T_HEX_FMT),
- value, (apr_uint64_t)APR_UINT32_MAX);
+ _("UINT32 0x%s too large, max = 0x%s"),
+ apr_psprintf(scratch_pool,
+ "%" APR_UINT64_T_HEX_FMT,
+ value),
+ apr_psprintf(scratch_pool,
+ "%" APR_UINT64_T_HEX_FMT,
+ (apr_uint64_t)APR_UINT32_MAX));
/* This conversion is not lossy because the value can be represented
* in the target type. */
@@ -581,10 +584,13 @@ read_off_t_from_proto_index(apr_file_t *
{
if (value > off_t_max)
return svn_error_createf(SVN_ERR_FS_INDEX_OVERFLOW, NULL,
- _("File offset 0x%" APR_UINT64_T_HEX_FMT
- " too large, max = 0x%"
- APR_UINT64_T_HEX_FMT),
- value, off_t_max);
+ _("File offset 0x%s too large, max = 0x%s"),
+ apr_psprintf(scratch_pool,
+ "%" APR_UINT64_T_HEX_FMT,
+ value),
+ apr_psprintf(scratch_pool,
+ "%" APR_UINT64_T_HEX_FMT,
+ off_t_max));
/* Shortening conversion from unsigned to signed int is well-defined
* and not lossy in C because the value can be represented in the
@@ -1850,9 +1856,13 @@ read_p2l_entry_from_proto_index(apr_file
/* Be careful with the arithmetics here (overflows and wrap-around): */
if (revision > 0 && revision - 1 > LONG_MAX)
return svn_error_createf(SVN_ERR_FS_INDEX_OVERFLOW, NULL,
- _("Revision 0x%" APR_UINT64_T_HEX_FMT
- " too large, max = 0x%" APR_UINT64_T_HEX_FMT),
- revision, (apr_uint64_t)LONG_MAX);
+ _("Revision 0x%s too large, max = 0x%s"),
+ apr_psprintf(scratch_pool,
+ "%" APR_UINT64_T_HEX_FMT,
+ revision),
+ apr_psprintf(scratch_pool,
+ "%" APR_UINT64_T_HEX_FMT,
+ (apr_uint64_t)LONG_MAX));
/* Shortening conversion from unsigned to signed int is well-defined
* and not lossy in C because the value can be represented in the