You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2012/11/21 22:51:36 UTC
svn commit: r1412320 - in /subversion/trunk/tools/server-side: fsfs-reorg.c
fsfs-stats.c
Author: julianfoad
Date: Wed Nov 21 21:51:35 2012
New Revision: 1412320
URL: http://svn.apache.org/viewvc?rev=1412320&view=rev
Log:
Fix most of the warnings I'm seeing in fsfs-reorg.c and fsfs-stats.c.
* tools/server-side/fsfs-reorg.c
(read_revision_header, compare_noderev_offsets,
compare_representation_offsets): Don't cast away 'const'.
(find_noderev, write_revisions, update_text, get_fragment_content): Make
printf format specifiers match the data type.
* tools/server-side/fsfs-stats.c
(representation_t): Use svn_revnum_t for revision numbers.
(read_revision_header, compare_representation_offsets): Don't cast away
'const'.
(find_representation, read_rep_base, parse_representation): Use
svn_revnum_t for revision numbers.
(parse_dir): Make printf format specifiers match the data type.
Modified:
subversion/trunk/tools/server-side/fsfs-reorg.c
subversion/trunk/tools/server-side/fsfs-stats.c
Modified: subversion/trunk/tools/server-side/fsfs-reorg.c
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/server-side/fsfs-reorg.c?rev=1412320&r1=1412319&r2=1412320&view=diff
==============================================================================
--- subversion/trunk/tools/server-side/fsfs-reorg.c (original)
+++ subversion/trunk/tools/server-side/fsfs-reorg.c Wed Nov 21 21:51:35 2012
@@ -828,7 +828,7 @@ read_revision_header(apr_size_t *changes
{
char buf[64];
const char *line;
- const char *space;
+ char *space;
apr_uint64_t val;
apr_size_t len;
@@ -857,7 +857,7 @@ read_revision_header(apr_size_t *changes
return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
_("Final line in revision file missing space"));
- *(char *)space = 0;
+ *space = 0;
SVN_ERR(svn_cstring_strtoui64(&val, line+1, 0, APR_SIZE_MAX, 10));
*root_noderev = (apr_size_t)val;
@@ -998,8 +998,8 @@ key_matches(svn_string_t *string, const
static int
compare_noderev_offsets(const void *data, const void *key)
{
- apr_ssize_t diff = (*(const noderev_t **)data)->original.offset
- - *(const apr_size_t *)key;
+ apr_ssize_t diff = (*(const noderev_t *const *)data)->original.offset
+ - *(const apr_size_t *)key;
/* sizeof(int) may be < sizeof(ssize_t) */
if (diff < 0)
@@ -1050,14 +1050,14 @@ find_noderev(noderev_t **result,
compare_noderev_offsets);
if ((idx < 0) || (idx >= revision_info->node_revs->nelts))
return svn_error_createf(SVN_ERR_BAD_VERSION_FILE_FORMAT, NULL,
- _("No noderev found at offset %" APR_OFF_T_FMT),
- offset);
+ _("No noderev found at offset %ld"),
+ (long)offset);
*result = APR_ARRAY_IDX(revision_info->node_revs, idx, noderev_t *);
if ((*result)->original.offset != offset)
return svn_error_createf(SVN_ERR_BAD_VERSION_FILE_FORMAT, NULL,
- _("No noderev found at offset %" APR_OFF_T_FMT),
- offset);
+ _("No noderev found at offset %ld"),
+ (long)offset);
return SVN_NO_ERROR;
}
@@ -1079,8 +1079,8 @@ parse_pred(noderev_t **result,
static int
compare_representation_offsets(const void *data, const void *key)
{
- apr_ssize_t diff = (*(const representation_t **)data)->original.offset
- - *(const apr_size_t *)key;
+ apr_ssize_t diff = (*(const representation_t *const *)data)->original.offset
+ - *(const apr_size_t *)key;
/* sizeof(int) may be < sizeof(ssize_t) */
if (diff < 0)
@@ -2290,7 +2290,7 @@ write_revisions(fs_fs_t *fs,
revision_info_t *info = APR_ARRAY_IDX(pack->info, i,
revision_info_t *);
SVN_ERR(svn_stream_printf(stream, itempool,
- "%" APR_UINT64_T_FMT "\n",
+ "%" APR_SIZE_T_FMT "\n",
info->target.offset));
svn_pool_clear(itempool);
}
@@ -2471,8 +2471,8 @@ update_text(svn_stringbuf_t *node_rev,
char *newline_pos = strchr(val_pos, '\n');
svn_checksum_t checksum = {representation->dir->target_md5,
svn_checksum_md5};
- const char* temp = apr_psprintf(scratch_pool, "%ld %" APR_UINT64_T_FMT " %"
- APR_UINT64_T_FMT" %" APR_SIZE_T_FMT " %s",
+ const char* temp = apr_psprintf(scratch_pool, "%ld %" APR_SIZE_T_FMT " %"
+ APR_SIZE_T_FMT" %" APR_SIZE_T_FMT " %s",
representation->revision->revision,
representation->target.offset - representation->revision->target.offset,
representation->target.size,
@@ -2491,7 +2491,7 @@ update_text(svn_stringbuf_t *node_rev,
val_pos = end_pos + 1;
end_pos = strchr(strchr(val_pos, ' ') + 1, ' ');
- temp = apr_psprintf(scratch_pool, "%" APR_UINT64_T_FMT " %" APR_UINT64_T_FMT,
+ temp = apr_psprintf(scratch_pool, "%" APR_SIZE_T_FMT " %" APR_SIZE_T_FMT,
representation->target.offset - representation->revision->target.offset,
representation->target.size);
@@ -2520,7 +2520,7 @@ get_fragment_content(svn_string_t **cont
case header_fragment:
info = fragment->data;
*content = svn_string_createf(pool,
- "\n%" APR_UINT64_T_FMT " %" APR_UINT64_T_FMT "\n",
+ "\n%" APR_SIZE_T_FMT " %" APR_SIZE_T_FMT "\n",
info->root_noderev->target.offset - info->target.offset,
info->target.changes);
return SVN_NO_ERROR;
@@ -2557,7 +2557,7 @@ get_fragment_content(svn_string_t **cont
header = svn_stringbuf_create("DELTA\n", pool);
else
header = svn_stringbuf_createf(pool,
- "DELTA %ld %" APR_UINT64_T_FMT " %" APR_UINT64_T_FMT "\n",
+ "DELTA %ld %" APR_SIZE_T_FMT " %" APR_SIZE_T_FMT "\n",
representation->delta_base->revision->revision,
representation->delta_base->target.offset
- representation->delta_base->revision->target.offset,
@@ -2600,7 +2600,7 @@ get_fragment_content(svn_string_t **cont
{
representation_t *base_rep = representation->delta_base;
header = svn_stringbuf_createf(pool,
- "DELTA %ld %" APR_UINT64_T_FMT " %" APR_UINT64_T_FMT "\n",
+ "DELTA %ld %" APR_SIZE_T_FMT " %" APR_SIZE_T_FMT "\n",
base_rep->revision->revision,
base_rep->target.offset - base_rep->revision->target.offset,
base_rep->target.size);
Modified: subversion/trunk/tools/server-side/fsfs-stats.c
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/server-side/fsfs-stats.c?rev=1412320&r1=1412319&r2=1412320&view=diff
==============================================================================
--- subversion/trunk/tools/server-side/fsfs-stats.c (original)
+++ subversion/trunk/tools/server-side/fsfs-stats.c Wed Nov 21 21:51:35 2012
@@ -81,7 +81,7 @@ typedef struct representation_t
/* revision that contains this representation
* (may be referenced by other revisions, though) */
- apr_uint32_t revision;
+ svn_revnum_t revision;
apr_uint32_t ref_count;
/* length of the PLAIN / DELTA line in the source file in bytes */
@@ -418,7 +418,7 @@ read_revision_header(apr_size_t *changes
{
char buf[64];
const char *line;
- const char *space;
+ char *space;
apr_uint64_t val;
apr_size_t len;
@@ -447,7 +447,7 @@ read_revision_header(apr_size_t *changes
return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
_("Final line in revision file missing space"));
- *(char *)space = 0;
+ *space = 0;
SVN_ERR(svn_cstring_strtoui64(&val, line+1, 0, APR_SIZE_MAX, 10));
*root_noderev = (apr_size_t)val;
@@ -588,8 +588,8 @@ key_matches(svn_string_t *string, const
static int
compare_representation_offsets(const void *data, const void *key)
{
- apr_ssize_t diff = (*(const representation_t **)data)->offset
- - *(const apr_size_t *)key;
+ apr_ssize_t diff = (*(const representation_t *const *)data)->offset
+ - *(const apr_size_t *)key;
/* sizeof(int) may be < sizeof(ssize_t) */
if (diff < 0)
@@ -601,7 +601,7 @@ static representation_t *
find_representation(int *idx,
fs_fs_t *fs,
revision_info_t **revision_info,
- int revision,
+ svn_revnum_t revision,
apr_size_t offset)
{
revision_info_t *info;
@@ -645,7 +645,8 @@ read_rep_base(representation_t **represe
apr_pool_t *scratch_pool)
{
char *str, *last_str;
- int idx, revision;
+ int idx;
+ svn_revnum_t revision;
apr_uint64_t temp;
const char *buffer = file_content->data + offset;
@@ -673,7 +674,7 @@ read_rep_base(representation_t **represe
/* We hopefully have a DELTA vs. a non-empty base revision. */
str = svn_cstring_tokenize(" ", &last_str);
str = svn_cstring_tokenize(" ", &last_str);
- SVN_ERR(svn_cstring_atoi(&revision, str));
+ SVN_ERR(svn_revnum_parse(&revision, str, NULL));
str = svn_cstring_tokenize(" ", &last_str);
SVN_ERR(svn_cstring_strtoui64(&temp, str, 0, APR_SIZE_MAX, 10));
@@ -692,7 +693,7 @@ parse_representation(representation_t **
apr_pool_t *scratch_pool)
{
representation_t *result;
- int revision;
+ svn_revnum_t revision;
apr_uint64_t offset;
apr_uint64_t size;
@@ -700,7 +701,7 @@ parse_representation(representation_t **
int idx;
char *c = (char *)value->data;
- SVN_ERR(svn_cstring_atoi(&revision, svn_cstring_tokenize(" ", &c)));
+ SVN_ERR(svn_revnum_parse(&revision, svn_cstring_tokenize(" ", &c), NULL));
SVN_ERR(svn_cstring_strtoui64(&offset, svn_cstring_tokenize(" ", &c), 0, APR_SIZE_MAX, 10));
SVN_ERR(svn_cstring_strtoui64(&size, svn_cstring_tokenize(" ", &c), 0, APR_SIZE_MAX, 10));
SVN_ERR(svn_cstring_strtoui64(&expanded_size, svn_cstring_tokenize(" ", &c), 0, APR_SIZE_MAX, 10));
@@ -907,7 +908,7 @@ parse_dir(fs_fs_t *fs,
text_pool));
current = text->data;
- revision_key = apr_psprintf(text_pool, "r%d/", representation->revision);
+ revision_key = apr_psprintf(text_pool, "r%ld/", representation->revision);
key_len = strlen(revision_key);
/* Translate the string dir entries into real entries. */
@@ -923,9 +924,9 @@ parse_dir(fs_fs_t *fs,
next = current ? strchr(++current, '\n') : NULL;
if (next == NULL)
return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
- _("Corrupt directory representation in rev %d at offset %ld"),
+ _("Corrupt directory representation in rev %ld at offset %ld"),
representation->revision,
- representation->offset);
+ (long)representation->offset);
*next = 0;
current = strstr(current, revision_key);