[brlcad-commits] SF.net SVN: brlcad:[43438] brlcad/trunk/src/librt/primitives/metaball/ metaball.c
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: <br...@us...> - 2011-02-24 04:59:19
|
Revision: 43438 http://brlcad.svn.sourceforge.net/brlcad/?rev=43438&view=rev Author: brlcad Date: 2011-02-24 04:59:12 +0000 (Thu, 24 Feb 2011) Log Message: ----------- more conversion from xdr routines to ntohl()/htonl() being careful to increment the buffer as char pointers, not as uint32_t pointers. Modified Paths: -------------- brlcad/trunk/src/librt/primitives/metaball/metaball.c Modified: brlcad/trunk/src/librt/primitives/metaball/metaball.c =================================================================== --- brlcad/trunk/src/librt/primitives/metaball/metaball.c 2011-02-24 04:56:56 UTC (rev 43437) +++ brlcad/trunk/src/librt/primitives/metaball/metaball.c 2011-02-24 04:59:12 UTC (rev 43438) @@ -698,7 +698,7 @@ if (dbip) RT_CK_DBI(dbip); BU_CK_EXTERNAL(ep); - metaball_count = bu_glong((unsigned char *)ep->ext_buf); + metaball_count = ntohl(*(uint32_t *)ep->ext_buf); buf = (fastf_t *)bu_malloc((metaball_count*5+1)*SIZEOF_NETWORK_DOUBLE, "rt_metaball_import5: buf"); ntohd((unsigned char *)buf, (unsigned char *)ep->ext_buf+2*SIZEOF_NETWORK_LONG, metaball_count*5+1); @@ -709,7 +709,7 @@ ip->idb_ptr = bu_malloc(sizeof(struct rt_metaball_internal), "rt_metaball_internal"); mb = (struct rt_metaball_internal *)ip->idb_ptr; mb->magic = RT_METABALL_INTERNAL_MAGIC; - mb->method = bu_glong((unsigned char *)ep->ext_buf + SIZEOF_NETWORK_LONG); + mb->method = ntohl(*(uint32_t *)(ep->ext_buf + SIZEOF_NETWORK_LONG)); mb->threshold = buf[0]; BU_LIST_INIT(&mb->metaball_ctrl_head); if (mat == NULL) mat = bn_mat_identity; @@ -768,8 +768,8 @@ ep->ext_buf = (genptr_t)bu_malloc(ep->ext_nbytes, "metaball external"); if (ep->ext_buf == NULL) bu_bomb("Failed to allocate DB space!\n"); - bu_plong((unsigned char *)ep->ext_buf, metaball_count); - bu_plong((unsigned char *)ep->ext_buf + SIZEOF_NETWORK_LONG, mb->method); + *(uint32_t *)ep->ext_buf = htonl(metaball_count); + *(uint32_t *)(ep->ext_buf + SIZEOF_NETWORK_LONG) = htonl(mb->method); /* pack the point data */ buf = (fastf_t *)bu_malloc((metaball_count*5+1)*SIZEOF_NETWORK_DOUBLE, "rt_metaball_export5: buf"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |