Author: julianfoad
Date: Thu Apr 12 10:19:01 2012
New Revision: 1325187

URL: http://svn.apache.org/viewvc?rev=1325187&view=rev
Log:
Add a 'const' in a serialization function input parameter, and so avoid
having to cast away 'const' in some calls to it.  Avoids three warnings in
compiling temp_serializer.c (for me, with GCC).

* subversion/include/private/svn_temp_serializer.h,
  subversion/libsvn_subr/svn_temp_serializer.c
  (svn_temp_deserializer__ptr): Add 'const' to the second input pointer. Fix
    a doc string typo.

* subversion/libsvn_fs_fs/temp_serializer.c
  (find_entry, svn_fs_fs__extract_dir_entry, svn_fs_fs__replace_dir_entry):
    Adjust the casts in all callers.

Modified:
    subversion/trunk/subversion/include/private/svn_temp_serializer.h
    subversion/trunk/subversion/libsvn_fs_fs/temp_serializer.c
    subversion/trunk/subversion/libsvn_subr/svn_temp_serializer.c

Modified: subversion/trunk/subversion/include/private/svn_temp_serializer.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_temp_serializer.h?rev=1325187&r1=1325186&r2=1325187&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_temp_serializer.h (original)
+++ subversion/trunk/subversion/include/private/svn_temp_serializer.h Thu Apr 
12 10:19:01 2012
@@ -188,10 +188,10 @@ svn_temp_deserializer__resolve(void *buf
 /**
  * Similar to svn_temp_deserializer__resolve() but instead of modifying
  * the buffer content, the resulting pointer is passed back to the caller
- * a the return value.
+ * as the return value.
  */
 const void *
-svn_temp_deserializer__ptr(const void *buffer, const void **ptr);
+svn_temp_deserializer__ptr(const void *buffer, const void *const *ptr);
 
 #ifdef __cplusplus
 }

Modified: subversion/trunk/subversion/libsvn_fs_fs/temp_serializer.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/temp_serializer.c?rev=1325187&r1=1325186&r2=1325187&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/temp_serializer.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/temp_serializer.c Thu Apr 12 
10:19:01 2012
@@ -879,9 +879,9 @@ find_entry(svn_fs_dirent_t **entries,
   for (middle = upper / 2; lower < upper; middle = (upper + lower) / 2)
     {
       const svn_fs_dirent_t *entry =
-          svn_temp_deserializer__ptr(entries, (const void **)&entries[middle]);
+          svn_temp_deserializer__ptr(entries, (const void *const 
*)&entries[middle]);
       const char* entry_name =
-          svn_temp_deserializer__ptr(entry, (const void **)&entry->name);
+          svn_temp_deserializer__ptr(entry, (const void *const *)&entry->name);
 
       int diff = strcmp(entry_name, name);
       if (diff < 0)
@@ -895,9 +895,9 @@ find_entry(svn_fs_dirent_t **entries,
   if (lower < count)
     {
       const svn_fs_dirent_t *entry =
-          svn_temp_deserializer__ptr(entries, (const void **)&entries[lower]);
+          svn_temp_deserializer__ptr(entries, (const void *const 
*)&entries[lower]);
       const char* entry_name =
-          svn_temp_deserializer__ptr(entry, (const void **)&entry->name);
+          svn_temp_deserializer__ptr(entry, (const void *const *)&entry->name);
 
       if (strcmp(entry_name, name) == 0)
         *found = TRUE;
@@ -919,11 +919,11 @@ svn_fs_fs__extract_dir_entry(void **out,
 
   /* resolve the reference to the entries array */
   const svn_fs_dirent_t * const *entries =
-    svn_temp_deserializer__ptr(data, (const void **)&hash_data->entries);
+    svn_temp_deserializer__ptr(data, (const void *const *)&hash_data->entries);
 
   /* resolve the reference to the lengths array */
   const apr_uint32_t *lengths =
-    svn_temp_deserializer__ptr(data, (const void **)&hash_data->lengths);
+    svn_temp_deserializer__ptr(data, (const void *const *)&hash_data->lengths);
 
   /* binary search for the desired entry by name */
   apr_size_t pos = find_entry((svn_fs_dirent_t **)entries,
@@ -936,7 +936,7 @@ svn_fs_fs__extract_dir_entry(void **out,
   if (found)
     {
       const svn_fs_dirent_t *source =
-          svn_temp_deserializer__ptr(entries, (const void **)&entries[pos]);
+          svn_temp_deserializer__ptr(entries, (const void *const 
*)&entries[pos]);
 
       /* Entries have been serialized one-by-one, each time including all
        * nestes structures and strings. Therefore, they occupy a single
@@ -1007,12 +1007,12 @@ svn_fs_fs__replace_dir_entry(void **data
   /* resolve the reference to the entries array */
   entries = (svn_fs_dirent_t **)
     svn_temp_deserializer__ptr((const char *)hash_data,
-                               (const void **)&hash_data->entries);
+                               (const void *const *)&hash_data->entries);
 
   /* resolve the reference to the lengths array */
   lengths = (apr_uint32_t *)
     svn_temp_deserializer__ptr((const char *)hash_data,
-                               (const void **)&hash_data->lengths);
+                               (const void *const *)&hash_data->lengths);
 
   /* binary search for the desired entry by name */
   pos = find_entry(entries, replace_baton->name, hash_data->count, &found);
@@ -1081,7 +1081,7 @@ svn_fs_fs__replace_dir_entry(void **data
   hash_data = (hash_data_t *)*data;
   lengths = (apr_uint32_t *)
     svn_temp_deserializer__ptr((const char *)hash_data,
-                               (const void **)&hash_data->lengths);
+                               (const void *const *)&hash_data->lengths);
   lengths[pos] = length;
 
   return SVN_NO_ERROR;

Modified: subversion/trunk/subversion/libsvn_subr/svn_temp_serializer.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/svn_temp_serializer.c?rev=1325187&r1=1325186&r2=1325187&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/svn_temp_serializer.c (original)
+++ subversion/trunk/subversion/libsvn_subr/svn_temp_serializer.c Thu Apr 12 
10:19:01 2012
@@ -352,7 +352,7 @@ svn_temp_deserializer__resolve(void *buf
 }
 
 const void *
-svn_temp_deserializer__ptr(const void *buffer, const void **ptr)
+svn_temp_deserializer__ptr(const void *buffer, const void *const *ptr)
 {
   return (apr_size_t)*ptr == 0
       ? NULL


Reply via email to