Revision: 68952
          http://sourceforge.net/p/brlcad/code/68952
Author:   brlcad
Date:     2016-09-30 22:05:27 +0000 (Fri, 30 Sep 2016)
Log Message:
-----------
convert the version number to a size_t for now, though this will almost 
certainly be going away (the storage layer needs to handle versioning)

Modified Paths:
--------------
    brlcad/trunk/include/rt/func.h
    brlcad/trunk/include/rt/functab.h
    brlcad/trunk/src/librt/cache.c
    brlcad/trunk/src/librt/primitives/brep/brep.cpp
    brlcad/trunk/src/librt/primitives/obj_prep.c
    brlcad/trunk/src/librt/primitives/table.c

Modified: brlcad/trunk/include/rt/func.h
===================================================================
--- brlcad/trunk/include/rt/func.h      2016-09-30 21:04:54 UTC (rev 68951)
+++ brlcad/trunk/include/rt/func.h      2016-09-30 22:05:27 UTC (rev 68952)
@@ -180,7 +180,7 @@
 /**
  * if `stp` is prepped, serialize; otherwise, deserialize from `external`
  */
-RT_EXPORT extern int rt_obj_prep_serialize(struct soltab *stp, const struct 
rt_db_internal *ip, struct bu_external *external, uint32_t *version);
+RT_EXPORT extern int rt_obj_prep_serialize(struct soltab *stp, const struct 
rt_db_internal *ip, struct bu_external *external, size_t *version);
 
 __END_DECLS
 

Modified: brlcad/trunk/include/rt/functab.h
===================================================================
--- brlcad/trunk/include/rt/functab.h   2016-09-30 21:04:54 UTC (rev 68951)
+++ brlcad/trunk/include/rt/functab.h   2016-09-30 22:05:27 UTC (rev 68952)
@@ -263,8 +263,8 @@
 #define RTFUNCTAB_FUNC_PROCESS_SELECTION_CAST(_func) ((int (*)(struct 
rt_db_internal *, struct db_i *, const struct rt_selection *, const struct 
rt_selection_operation *))_func)
 
     /** cache and uncache prep data for faster future lookup */
-    int (*ft_prep_serialize)(struct soltab *stp, const struct rt_db_internal 
*ip, struct bu_external *external, uint32_t *version);
-#define RTFUNCTAB_FUNC_PREP_SERIALIZE_CAST(_func) ((int (*)(struct soltab *, 
const struct rt_db_internal *, struct bu_external *, uint32_t *))_func)
+    int (*ft_prep_serialize)(struct soltab *stp, const struct rt_db_internal 
*ip, struct bu_external *external, size_t *version);
+#define RTFUNCTAB_FUNC_PREP_SERIALIZE_CAST(_func) ((int (*)(struct soltab *, 
const struct rt_db_internal *, struct bu_external *, size_t *))_func)
 };
 
 

Modified: brlcad/trunk/src/librt/cache.c
===================================================================
--- brlcad/trunk/src/librt/cache.c      2016-09-30 21:04:54 UTC (rev 68951)
+++ brlcad/trunk/src/librt/cache.c      2016-09-30 22:05:27 UTC (rev 68952)
@@ -23,14 +23,17 @@
  *
  */
 
-
 #include "common.h"
 
+/* interface header */
+#include "./cache.h"
+
+/* system headers */
 #include <errno.h>
 #include <zlib.h>
+#include "bnetwork.h"
 
-#include "cache.h"
-#include "bnetwork.h"
+/* implementation headers */
 #include "bu/cv.h"
 #include "bu/log.h"
 #include "bu/path.h"
@@ -40,41 +43,7 @@
 #include "rt/db_io.h"
 #include "rt/func.h"
 
-/* Make sure we have PRINTF_INT32_MODIFIER defined */
-#if !defined (_PSTDINT_H_INCLUDED)
-#  if ((defined(__STDC__) && __STDC__ && __STDC_VERSION__ >= 199901L) || 
(defined (__WATCOMC__) && (defined (_STDINT_H_INCLUDED) || __WATCOMC__ >= 
1250)) || (defined(__GNUC__) && (defined(_STDINT_H) || defined(_STDINT_H_) || 
defined (__UINT_FAST64_TYPE__)) ))
-#    ifndef PRINTF_INT32_MODIFIER
-#     define PRINTF_INT32_MODIFIER "l"
-#    endif
-#  endif
-#  if (ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S)
-#    ifndef PRINTF_INT32_MODIFIER
-#      define PRINTF_INT32_MODIFIER "l"
-#    endif
-#  elif (UINT_MAX == UINT32_MAX)
-#    ifndef PRINTF_INT32_MODIFIER
-#     define PRINTF_INT32_MODIFIER ""
-#    endif
-#  elif (USHRT_MAX == UINT32_MAX)
-#    ifndef PRINTF_INT32_MODIFIER
-#     define PRINTF_INT32_MODIFIER ""
-#    endif
-#  endif
-#  if (LONG_MAX == INT32_MAX) || defined (S_SPLINT_S)
-#    ifndef PRINTF_INT32_MODIFIER
-#     define PRINTF_INT32_MODIFIER "l"
-#    endif
-#  elif (INT_MAX == INT32_MAX)
-#    ifndef PRINTF_INT32_MODIFIER
-#     define PRINTF_INT32_MODIFIER ""
-#    endif
-#  endif
-#  ifndef PRINTF_INT32_MODIFIER
-#    define PRINTF_INT32_MODIFIER ""
-#  endif
-#endif
 
-
 static const char * const cache_mime_type = "brlcad/cache";
 
 
@@ -84,7 +53,7 @@
 
 
 HIDDEN void
-rt_cache_check(const struct rt_cache *cache)
+cache_check(const struct rt_cache *cache)
 {
     if (!cache)
        bu_bomb("NULL rt_cache pointer");
@@ -94,7 +63,7 @@
 
 
 HIDDEN void
-rt_cache_generate_name(char name[STATIC_ARRAY(37)], const struct soltab *stp)
+cache_generate_name(char name[STATIC_ARRAY(37)], const struct soltab *stp)
 {
     struct bu_external raw_external;
     struct db5_raw_internal raw_internal;
@@ -199,7 +168,7 @@
 void
 rt_cache_close(struct rt_cache *cache)
 {
-    rt_cache_check(cache);
+    cache_check(cache);
 
     db_close(cache->dbip);
     BU_PUT(cache, struct rt_cache);
@@ -251,14 +220,14 @@
 
 
 HIDDEN int
-rt_cache_try_load(const struct rt_cache *cache,
-                 const struct directory *cache_dir, struct soltab *stp,
-                 const struct rt_db_internal *internal)
+cache_try_load(const struct rt_cache *cache,
+              const struct directory *cache_dir, struct soltab *stp,
+              const struct rt_db_internal *internal)
 {
     struct bu_external data_external = BU_EXTERNAL_INIT_ZERO;
-    uint32_t version = UINT32_MAX;
+    size_t version = (size_t)-1;
 
-    rt_cache_check(cache);
+    cache_check(cache);
     RT_CK_DIR(cache_dir);
     RT_CK_SOLTAB(stp);
 
@@ -320,14 +289,14 @@
 
 
 HIDDEN void
-rt_cache_try_store(struct rt_cache *cache, struct directory *cache_dir,
-                  struct soltab *stp, const struct rt_db_internal *internal)
+cache_try_store(struct rt_cache *cache, struct directory *cache_dir,
+               struct soltab *stp, const struct rt_db_internal *internal)
 {
     struct bu_external attributes_external;
     struct bu_external data_external = BU_EXTERNAL_INIT_ZERO;
-    uint32_t version = UINT32_MAX;
+    size_t version = (size_t)-1;
 
-    rt_cache_check(cache);
+    cache_check(cache);
     RT_CK_DIR(cache_dir);
     RT_CK_SOLTAB(stp);
 
@@ -338,7 +307,7 @@
     cache_dir->d_minor_type = 0;
 
     if (rt_obj_prep_serialize(stp, internal, &data_external, &version)
-       || version == UINT32_MAX)
+       || version == (size_t)-1)
        bu_bomb("rt_obj_prep_serialize() failed");
 
     compress_external(&data_external);
@@ -347,7 +316,7 @@
        struct bu_attribute_value_set attributes = BU_AVS_INIT_ZERO;
        struct bu_vls version_vls = BU_VLS_INIT_ZERO;
 
-       bu_vls_sprintf(&version_vls, "%" PRINTF_INT32_MODIFIER "u", version);
+       bu_vls_sprintf(&version_vls, "%zu", version);
        bu_avs_add(&attributes, "mime_type", cache_mime_type);
        bu_avs_add(&attributes, "rt_cache::version", bu_vls_addr(&version_vls));
        db5_export_attributes(&attributes_external, &attributes);
@@ -377,16 +346,16 @@
     char name[37];
     struct directory *dir;
 
-    rt_cache_check(cache);
+    cache_check(cache);
     RT_CK_SOLTAB(stp);
     RT_CK_DB_INTERNAL(internal);
 
-    rt_cache_generate_name(name, stp);
+    cache_generate_name(name, stp);
     dir = db_lookup(cache->dbip, name, 0);
 
     if (dir) {
-       if (!rt_cache_try_load(cache, dir, stp, internal))
-           bu_bomb("rt_cache_try_load() failed");
+       if (!cache_try_load(cache, dir, stp, internal))
+           bu_bomb("cache_try_load() failed");
     } else {
        char type = 0;
 
@@ -398,7 +367,7 @@
                                  (void *)&type)))
                bu_bomb("db_diradd() failed");
 
-           rt_cache_try_store(cache, dir, stp, internal);
+           cache_try_store(cache, dir, stp, internal);
        }
     }
 

Modified: brlcad/trunk/src/librt/primitives/brep/brep.cpp
===================================================================
--- brlcad/trunk/src/librt/primitives/brep/brep.cpp     2016-09-30 21:04:54 UTC 
(rev 68951)
+++ brlcad/trunk/src/librt/primitives/brep/brep.cpp     2016-09-30 22:05:27 UTC 
(rev 68952)
@@ -97,7 +97,7 @@
 struct rt_selection_set *rt_brep_find_selections(const struct rt_db_internal 
*ip, const struct rt_selection_query *query);
 int rt_brep_process_selection(struct rt_db_internal *ip, const struct 
rt_selection *selection, const struct rt_selection_operation *op);
 int rt_brep_valid(struct rt_db_internal *ip, struct bu_vls *log);
-int rt_brep_prep_serialize(struct soltab *stp, const struct rt_db_internal 
*ip, struct bu_external *external, uint32_t *version);
+int rt_brep_prep_serialize(struct soltab *stp, const struct rt_db_internal 
*ip, struct bu_external *external, size_t *version);
 #ifdef __cplusplus
 }
 #endif
@@ -5033,13 +5033,13 @@
 
 
 int
-rt_brep_prep_serialize(struct soltab *stp, const struct rt_db_internal *ip, 
struct bu_external *external, uint32_t *version)
+rt_brep_prep_serialize(struct soltab *stp, const struct rt_db_internal *ip, 
struct bu_external *external, size_t *version)
 {
     RT_CK_SOLTAB(stp);
     RT_CK_DB_INTERNAL(ip);
     BU_CK_EXTERNAL(external);
 
-    const uint32_t current_version = 0;
+    const size_t current_version = 0;
 
     RT_CK_SOLTAB(stp);
     BU_CK_EXTERNAL(external);

Modified: brlcad/trunk/src/librt/primitives/obj_prep.c
===================================================================
--- brlcad/trunk/src/librt/primitives/obj_prep.c        2016-09-30 21:04:54 UTC 
(rev 68951)
+++ brlcad/trunk/src/librt/primitives/obj_prep.c        2016-09-30 22:05:27 UTC 
(rev 68952)
@@ -51,7 +51,8 @@
 }
 
 
-int rt_obj_prep_serialize(struct soltab *stp, const struct rt_db_internal *ip, 
struct bu_external *external, uint32_t *version)
+int
+rt_obj_prep_serialize(struct soltab *stp, const struct rt_db_internal *ip, 
struct bu_external *external, size_t *version)
 {
     const struct rt_functab *ft;
 

Modified: brlcad/trunk/src/librt/primitives/table.c
===================================================================
--- brlcad/trunk/src/librt/primitives/table.c   2016-09-30 21:04:54 UTC (rev 
68951)
+++ brlcad/trunk/src/librt/primitives/table.c   2016-09-30 22:05:27 UTC (rev 
68952)
@@ -78,7 +78,7 @@
     extern struct rt_selection_set *rt_##name##_find_selections(const struct 
rt_db_internal *ip, const struct rt_selection_query *query); \
     extern struct rt_selection *rt_##name##_evaluate_selection(const struct 
rt_db_internal *ip, int op, const struct rt_selection *a, const struct 
rt_selection *b); \
     extern int rt_##name##_process_selection(struct rt_db_internal *ip, struct 
db_i *, const struct rt_selection *selection, const struct 
rt_selection_operation *op); \
-    extern int rt_##name##_prep_serialize(struct soltab *stp, const struct 
rt_db_internal *ip, struct bu_external *external, uint32_t *version)
+    extern int rt_##name##_prep_serialize(struct soltab *stp, const struct 
rt_db_internal *ip, struct bu_external *external, size_t *version)
 
 RT_DECLARE_INTERFACE(tor);
 RT_DECLARE_INTERFACE(tgc);

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to