Revision: 42352
          http://brlcad.svn.sourceforge.net/brlcad/?rev=42352&view=rev
Author:   johnranderson
Date:     2011-01-17 01:55:08 +0000 (Mon, 17 Jan 2011)

Log Message:
-----------
The region color table is no longer output as part of the GLOBAL object.
If no attributes of the GLOBAL object are output, the GLOBAL object itself is 
not output.
fixed some size_t issues.

Modified Paths:
--------------
    brlcad/trunk/src/conv/asc/g2asc.c

Modified: brlcad/trunk/src/conv/asc/g2asc.c
===================================================================
--- brlcad/trunk/src/conv/asc/g2asc.c   2011-01-17 01:09:32 UTC (rev 42351)
+++ brlcad/trunk/src/conv/asc/g2asc.c   2011-01-17 01:55:08 UTC (rev 42352)
@@ -218,21 +218,29 @@
 
                /* save the associated attributes of
                 * _GLOBAL (except for title and units
-                * which were already written out)
+                * which were already written out) and
+                 * regionid_colortable (which is written out below)
                 */
                if (g_avs.count) {
-                   fprintf(ofp, "attr set {_GLOBAL}");
+                    int printedHeader = 0;
                    for (i=0; i < g_avs.count; i++) {
                        if (strncmp(g_avs.avp[i].name, "title", 6) == 0) {
                            continue;
                        } else if (strncmp(g_avs.avp[i].name, "units", 6) == 0) 
{
                            continue;
+                        } else if (strncmp(g_avs.avp[i].name, 
"regionid_colortable", 19) == 0) {
+                            continue;
                        } else if (strlen(g_avs.avp[i].name) <= 0) {
                            continue;
                        }
+                        if (printedHeader == 0) {
+                            fprintf(ofp, "attr set {_GLOBAL}");
+                            printedHeader = 1;
+                        }
                        fprintf(ofp, " {%s} {%s}", g_avs.avp[i].name, 
g_avs.avp[i].value);
                    }
-                   fprintf(ofp, "\n");
+                    if (printedHeader == 1)
+                        fprintf(ofp, "\n");
                }
 
                value = bu_avs_get( &g_avs, "regionid_colortable" );
@@ -472,7 +480,7 @@
     if ( count != (size_t)ngran-1 )  {
        fprintf(stderr,
                "g2asc: get_ext:  wanted to read %lu granules, got %lu\n",
-               ngran-1, count);
+               (unsigned long)ngran-1, (unsigned long)count);
        bu_exit(1, NULL);
     }
 }
@@ -500,11 +508,11 @@
        struct_count[j] = bu_glong( &record.nmg.N_structs[j*4] );
 
     /* output some header info */
-    (void)fprintf(ofp,  "%c %d %.16s %ld\n",
+    (void)fprintf(ofp,  "%c %d %.16s %lu\n",
                  record.nmg.N_id,      /* N */
                  record.nmg.N_version, /* NMG version */
                  record.nmg.N_name,    /* solid name */
-                 granules );           /* number of additional granules */
+                 (unsigned long)granules );            /* number of additional 
granules */
 
     /* output the structure counts */
     for ( j=0; j<26; j++ )
@@ -690,18 +698,18 @@
     (void)fprintf(ofp, "%d ", bot->mode );
     (void)fprintf(ofp, "%d ", bot->orientation );
     (void)fprintf(ofp, "%d ", 0 );     /* was error_mode */
-    (void)fprintf(ofp, "%lu ", bot->num_vertices );
-    (void)fprintf(ofp, "%lu", bot->num_faces );
+    (void)fprintf(ofp, "%lu ", (unsigned long)bot->num_vertices );
+    (void)fprintf(ofp, "%lu", (unsigned long)bot->num_faces );
     (void)fprintf(ofp, "\n");
 
     for ( i=0; i<bot->num_vertices; i++ )
-       fprintf(ofp,  " %lu: %26.20e %26.20e %26.20e\n", i, V3ARGS( 
&bot->vertices[i*3] ) );
+       fprintf(ofp,  " %lu: %26.20e %26.20e %26.20e\n", (unsigned long)i, 
V3ARGS( &bot->vertices[i*3] ) );
     if ( bot->mode == RT_BOT_PLATE )
     {
        struct bu_vls vls;
 
        for ( i=0; i<bot->num_faces; i++ )
-           fprintf(ofp,  "     %lu: %d %d %d %26.20e\n", i, V3ARGS( 
&bot->faces[i*3] ), bot->thickness[i] );
+           fprintf(ofp,  "     %lu: %d %d %d %26.20e\n", (unsigned long)i, 
V3ARGS( &bot->faces[i*3] ), bot->thickness[i] );
        bu_vls_init( &vls );
        bu_bitv_to_hex( &vls, bot->face_mode );
        fprintf(ofp,  " %s\n", bu_vls_addr( &vls ) );
@@ -710,7 +718,7 @@
     else
     {
        for ( i=0; i<bot->num_faces; i++ )
-           fprintf(ofp,  "     %lu: %d %d %d\n", i, V3ARGS( &bot->faces[i*3] ) 
);
+           fprintf(ofp,  "     %lu: %d %d %d\n", (unsigned long)i, V3ARGS( 
&bot->faces[i*3] ) );
     }
 
     rt_db_free_internal(&intern);
@@ -850,7 +858,7 @@
     arbn = (struct rt_arbn_internal *)intern.idb_ptr;
     RT_ARBN_CK_MAGIC(arbn);
 
-    fprintf(ofp, "%c %.16s %lu\n", 'n', name, arbn->neqn);
+    fprintf(ofp, "%c %.16s %lu\n", 'n', name, (unsigned long)arbn->neqn);
     for ( i = 0; i < arbn->neqn; i++ )  {
        fprintf(ofp, "n %26.20e %20.26e %26.20e %26.20e\n",
                arbn->eqn[i][X], arbn->eqn[i][Y],
@@ -1246,7 +1254,7 @@
     (void)fprintf(ofp, "%.12e %.12e %.12e ", V3ARGS( skt->V ) );
     (void)fprintf(ofp, "%.12e %.12e %.12e ", V3ARGS( skt->u_vec ) );
     (void)fprintf(ofp, "%.12e %.12e %.12e ", V3ARGS( skt->v_vec ) );
-    (void)fprintf(ofp, "%lu %lu\n", skt->vert_count, crv->seg_count );
+    (void)fprintf(ofp, "%lu %lu\n", (unsigned long)skt->vert_count, (unsigned 
long)crv->seg_count );
     for ( i=0; i<skt->vert_count; i++ )
        (void)fprintf(ofp, " %.12e %.12e", V2ARGS( skt->verts[i] ) );
     (void)fprintf(ofp, "\n" );


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

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to