* sync with verse cvs (for silencing some warnings +
authorNathan Letwory <nathan@letworyinteractive.com>
Thu, 25 Jan 2007 07:07:32 +0000 (07:07 +0000)
committerNathan Letwory <nathan@letworyinteractive.com>
Thu, 25 Jan 2007 07:07:32 +0000 (07:07 +0000)
 safe to do, since verse is not
 enabled in release).

extern/verse/dist/v_cmd_gen.c
extern/verse/dist/v_gen_pack_init.c
extern/verse/dist/v_man_pack_node.c
extern/verse/dist/v_network.c
extern/verse/dist/vs_node_bitmap.c
extern/verse/dist/vs_node_material.c
extern/verse/dist/vs_node_object.c

index 2305f94ebc4067d566393c7702dfaa464a2081b8..3d18f8cf1af4bc2809d917beb373d23b2e916c1f 100644 (file)
@@ -4,6 +4,7 @@
 
 #include <stdlib.h>
 #include <stdio.h>
+#include <string.h>
 
 #include "verse_header.h"
 #include "v_cmd_buf.h"
@@ -11,8 +12,9 @@
 #include "v_cmd_gen.h"
 
 #if defined _WIN32
-#define chdir _chdir
-#define snprintf _snprintf
+#include <direct.h>
+#define chdir          _chdir
+#define        snprintf        _snprintf
 #endif
 
 #if defined V_GENERATE_FUNC_MODE
@@ -50,7 +52,7 @@ extern void v_gen_audio_cmd_def(void);
 
 static int v_cg_init(const char *src_path)
 {
-    char       buf[1024];
+       char    buf[1024];
        int     i;
        FILE    *f;
 
@@ -122,7 +124,7 @@ static int v_cg_init(const char *src_path)
        else
        {
                fprintf(stderr, "mkprot: Couldn't find \"%s\" input file\n", buf);
-        return 0;
+               return 0;
        }
        fprintf(VCGData.verse_h, "\n/* Command sending functions begin. ----------------------------------------- */\n\n");
        return 1;
@@ -158,9 +160,9 @@ void v_cg_new_manual_cmd(unsigned int cmd_id, const char *name, const char *def,
        fprintf(VCGData.verse_h, "extern %s;\n", def);
        if(alias_def != NULL)
                fprintf(VCGData.verse_h, "extern %s;\n", alias_def);
-       fprintf(VCGData.init, "\tv_fs_add_func(%i, v_unpack_%s, verse_send_%s, ", cmd_id, name, name);
+       fprintf(VCGData.init, "\tv_fs_add_func(%i, v_unpack_%s, (void *) verse_send_%s, ", cmd_id, name, name);
        if(alias_name != NULL)
-               fprintf(VCGData.init, "verse_send_%s);\n", alias_name);
+               fprintf(VCGData.init, "(void *) verse_send_%s);\n", alias_name);
        else
                fprintf(VCGData.init, "NULL);\n");
        fprintf(VCGData.unpack, "extern unsigned int v_unpack_%s(const char *data, size_t length);\n", name);
@@ -881,36 +883,37 @@ void v_cg_end_cmd(void)
 
 int main(int argc, char *argv[])
 {
-       const char      *src = "";
-       int                             i;
-    
-    for(i = 1; argv[i] != NULL; i++)
-    {
-        if(strcmp(argv[i], "-h") == 0)
-        {
-            printf("Verse protocol generation tool.\nUsage:\n");
-            printf(" -h\t\tPrint this usage information, and exit.\n");
-            printf(" -src=PATH\tSets source path prefix to PATH. It must be possible to find\n");
-            printf("\t\tthe \"verse_header.h\" input file by appending that name to PATH.\n");
-            printf("\t\tThus, PATH must end with a proper directory separator character.\n");
-            printf(" -dst=PATH\tSets output directory, where all output files are written.\n");
-            printf("\t\tIf used, use -src to point to where \"verse_header.h\" is.\n");
-            return EXIT_SUCCESS;
-        }
-        else if(strncmp(argv[i], "-src=", 5) == 0)
-            src = argv[i] + 5;
-        else if(strncmp(argv[i], "-dst=", 5) == 0)
-        {
-            if(chdir(argv[i] + 5) != 0)
-                fprintf(stderr, "%s: Couldn't set output directory to \"%s\"\n", argv[0], argv[i]+5);
-        }
-        else
-            fprintf(stderr, "%s: Ignoring unknown uption \"%s\"\n", argv[0], argv[i]);
-    }
-    
+       const char      *src = "";
+       int             i;
+
+       for(i = 1; argv[i] != NULL; i++)
+       {
+               if(strcmp(argv[i], "-h") == 0)
+               {
+                       printf("Verse protocol generation tool.\nUsage:\n");
+                       printf(" -h\t\tPrint this usage information, and exit.\n");
+                       printf(" -src=PATH\tSets source path prefix to PATH. It must be possible to find\n");
+                       printf("\t\tthe \"verse_header.h\" input file by appending that name to PATH.\n");
+                       printf("\t\tThus, PATH must end with a proper directory separator character.\n");
+                       printf(" -dst=PATH\tSets output directory, where all output files are written.\n");
+                       printf("\t\tIf used, use -src to point to where \"verse_header.h\" is.\n");
+                       printf("\nThe -src and -dst options were added to simplify building of Verse-Blender.\n");
+                       return EXIT_SUCCESS;
+               }
+               else if(strncmp(argv[i], "-src=", 5) == 0)
+                       src = argv[i] + 5;
+               else if(strncmp(argv[i], "-dst=", 5) == 0)
+               {
+                       if(chdir(argv[i] + 5) != 0)
+                               fprintf(stderr, "%s: Couldn't set output directory to \"%s\"\n", argv[0], argv[i] + 5);
+               }
+               else
+                       fprintf(stderr, "%s: Ignoring unknown option \"%s\"\n", argv[0], argv[i]);
+       }
+
        printf("start\n");
        if(!v_cg_init(src))
-        return EXIT_FAILURE;
+               return EXIT_FAILURE;
        v_gen_system_cmd_def();
        fprintf(VCGData.verse_h, "\n");
        v_gen_object_cmd_def();
index 64aa83a3d272c7a95e743d5f6dcd6f64e9beaa92..e568cb989cba54ae3826428b9d6d351e3db7c915 100644 (file)
@@ -27,10 +27,10 @@ extern void verse_send_packet_nak(uint32 packet_id);
 
 void init_pack_and_unpack(void)
 {
-       v_fs_add_func(0, v_unpack_connect, verse_send_connect, NULL);
-       v_fs_add_func(1, v_unpack_connect_accept, verse_send_connect_accept, NULL);
-       v_fs_add_func(2, v_unpack_connect_terminate, verse_send_connect_terminate, NULL);
-       v_fs_add_func(5, v_unpack_ping, verse_send_ping, NULL);
+       v_fs_add_func(0, v_unpack_connect, (void *) verse_send_connect, NULL);
+       v_fs_add_func(1, v_unpack_connect_accept, (void *) verse_send_connect_accept, NULL);
+       v_fs_add_func(2, v_unpack_connect_terminate, (void *) verse_send_connect_terminate, NULL);
+       v_fs_add_func(5, v_unpack_ping, (void *) verse_send_ping, NULL);
        v_fs_add_func(7, v_unpack_packet_ack, verse_send_packet_ack, NULL);
        v_fs_add_func(8, v_unpack_packet_nak, verse_send_packet_nak, NULL);
        v_fs_add_func(9, v_unpack_node_index_subscribe, verse_send_node_index_subscribe, NULL);
@@ -76,14 +76,14 @@ void init_pack_and_unpack(void)
        v_fs_add_func(80, v_unpack_b_dimensions_set, verse_send_b_dimensions_set, NULL);
        v_fs_add_func(81, v_unpack_b_layer_create, verse_send_b_layer_create, verse_send_b_layer_destroy);
        v_fs_add_func(82, v_unpack_b_layer_subscribe, verse_send_b_layer_subscribe, verse_send_b_layer_unsubscribe);
-       v_fs_add_func(83, v_unpack_b_tile_set, verse_send_b_tile_set, NULL);
+       v_fs_add_func(83, v_unpack_b_tile_set, (void *) verse_send_b_tile_set, NULL);
        v_fs_add_func(96, v_unpack_t_language_set, verse_send_t_language_set, NULL);
        v_fs_add_func(97, v_unpack_t_buffer_create, verse_send_t_buffer_create, verse_send_t_buffer_destroy);
        v_fs_add_func(98, v_unpack_t_buffer_subscribe, verse_send_t_buffer_subscribe, verse_send_t_buffer_unsubscribe);
-       v_fs_add_func(99, v_unpack_t_text_set, verse_send_t_text_set, NULL);
+       v_fs_add_func(99, v_unpack_t_text_set, (void *) verse_send_t_text_set, NULL);
        v_fs_add_func(128, v_unpack_c_curve_create, verse_send_c_curve_create, verse_send_c_curve_destroy);
        v_fs_add_func(129, v_unpack_c_curve_subscribe, verse_send_c_curve_subscribe, verse_send_c_curve_unsubscribe);
-       v_fs_add_func(130, v_unpack_c_key_set, verse_send_c_key_set, verse_send_c_key_destroy);
+       v_fs_add_func(130, v_unpack_c_key_set, (void *) verse_send_c_key_set, (void *) verse_send_c_key_destroy);
        v_fs_add_func(160, v_unpack_a_buffer_create, verse_send_a_buffer_create, verse_send_a_buffer_destroy);
        v_fs_add_func(161, v_unpack_a_buffer_subscribe, verse_send_a_buffer_subscribe, verse_send_a_buffer_unsubscribe);
        v_fs_add_func(162, v_unpack_a_block_set, verse_send_a_block_set, verse_send_a_block_clear);
index 21b5acdbd8f03be202170e237fc5dd7d3ca8d66e..cc85c4383dfbaf79eede42a8332a098604319403 100644 (file)
@@ -66,6 +66,7 @@ void verse_send_b_tile_set(VNodeID node_id, VLayerID layer_id, uint16 tile_x, ui
        uint8 *buf;
        unsigned int buffer_pos = 0;
        VCMDBufHead *head;
+
        switch(type)
        {
                case VN_B_LAYER_UINT1 :
@@ -98,6 +99,8 @@ void verse_send_b_tile_set(VNodeID node_id, VLayerID layer_id, uint16 tile_x, ui
                        buffer_pos += pack_b_tile_set_head(head, node_id, layer_id, tile_x, tile_y, z, type, tile);
                        buffer_pos += vnp_raw_pack_real64_vector(&buf[buffer_pos], tile->vreal64, VN_B_TILE_SIZE * VN_B_TILE_SIZE);
                break;
+               default:
+                       head = NULL;
        }
        v_cmd_buf_set_address_size(head, 13);
        v_cmd_buf_set_size(head, buffer_pos);
index a7ed87762ceeabee000e6b4d84b47135a0437776..47bf7d970f35312400b89a08f5552a2b9efa735e 100644 (file)
@@ -100,9 +100,9 @@ VSocket v_n_socket_create(void)
                fprintf(stderr, "v_network: Failed to bind(), code %d (%s)\n", errno, strerror(errno));
                exit(0); /* FIX ME */
        }
-       if(setsockopt(my_socket, SOL_SOCKET, SO_SNDBUF, &buffer_size, sizeof buffer_size) != 0)
+       if(setsockopt(my_socket, SOL_SOCKET, SO_SNDBUF, (const char *) &buffer_size, sizeof buffer_size) != 0)
                fprintf(stderr, "v_network: Couldn't set send buffer size of socket to %d\n", buffer_size);
-       if(setsockopt(my_socket, SOL_SOCKET, SO_RCVBUF, &buffer_size, sizeof buffer_size) != 0)
+       if(setsockopt(my_socket, SOL_SOCKET, SO_RCVBUF, (const char *) &buffer_size, sizeof buffer_size) != 0)
                fprintf(stderr, "v_network: Couldn't set receive buffer size of socket to %d\n", buffer_size);
        return my_socket;
 }
@@ -209,7 +209,7 @@ unsigned int v_n_wait_for_incoming(unsigned int microseconds)
 int v_n_receive_data(VNetworkAddress *address, char *data, size_t length)
 {
        struct  sockaddr_in address_in;
-       int     from_length = sizeof address_in, len;
+       size_t  from_length = sizeof address_in, len;
 
        if(v_n_socket_create() == -1)
                return 0;
index a93f54b1ac525b557a0b61ae546340ef59002a02..566287a86d4e03080dac7845c5c5e0ff4a951617 100644 (file)
@@ -28,6 +28,8 @@ typedef struct {
        unsigned int    layer_count;
 } VSNodeBitmap;
 
+static unsigned long   tile_counter = 0;
+
 VSNodeBitmap * vs_b_create_node(unsigned int owner)
 {
        VSNodeBitmap *node;
@@ -83,7 +85,7 @@ void vs_b_unsubscribe(VSNodeBitmap *node)
 static void callback_send_b_dimensions_set(void *user, VNodeID node_id, uint16 width, uint16 height, uint16 depth)
 {
        VSNodeBitmap *node;
-       unsigned int i, j, k, count, tiles[2], read, write, end;
+       unsigned int i, j, k, count, tiles[2], read, write, end = 0;
 
        if((node = (VSNodeBitmap *)vs_get_node(node_id, V_NT_BITMAP)) == NULL)
                return;
@@ -271,12 +273,13 @@ static void callback_send_b_layer_create(void *user, VNodeID node_id, VLayerID l
 {
        VSNodeBitmap *node;
        unsigned int i, count;
+
        if((node = (VSNodeBitmap *)vs_get_node(node_id, V_NT_BITMAP)) == NULL)
                return;
-
        if(node->layer_count <= layer_id || node->layers[layer_id].name[0] == 0)
        {
-               for(layer_id = 0; layer_id < node->layer_count && node->layers[layer_id].name[0] != 0; layer_id++);
+               for(layer_id = 0; layer_id < node->layer_count && node->layers[layer_id].name[0] != 0; layer_id++)
+                       ;
                if(layer_id == node->layer_count)
                {
                        node->layers = realloc(node->layers, (sizeof *node->layers) * (node->layer_count + 16));
@@ -472,11 +475,22 @@ static void callback_send_b_tile_set(void *user, VNodeID node_id, VLayerID layer
        unsigned int i, count, tile[3];
 
        if((node = (VSNodeBitmap *)vs_get_node(node_id, V_NT_BITMAP)) == NULL)
+       {
+               printf("got tile for unknown bitmpa node %u, aborting\n", node_id);
                return;
+       }
        if(layer_id >= node->layer_count || node->layers[layer_id].layer == NULL || node->layers[layer_id].type != type)
+       {
+               printf("node %u got tile for bad layer %u (have %u) %p\n", node_id, layer_id, node->layer_count, layer_id < node->layer_count ? node->layers[layer_id].layer : NULL);
                return;
+       }
        if(tile_x >= ((node->size[0] + VN_B_TILE_SIZE - 1) / VN_B_TILE_SIZE) || tile_y >= ((node->size[1] + VN_B_TILE_SIZE - 1) / VN_B_TILE_SIZE) || tile_z >= node->size[2])
+       {
+               printf("got tile that is outside image, at (%u,%u,%u)\n", tile_x, tile_y, tile_z);
                return;
+       }
+
+       tile_counter++;
 
        tile[0] = ((node->size[0] + VN_B_TILE_SIZE - 1) / VN_B_TILE_SIZE);
        tile[1] = ((node->size[1] + VN_B_TILE_SIZE - 1) / VN_B_TILE_SIZE);
index 06983c599cc6a0541adf7c9528d9910e37bdec5f..b22c070e3487b8a36f53b2998f8aa715fbcab5e5 100644 (file)
@@ -70,10 +70,10 @@ static void callback_send_m_fragment_create(void *user, VNodeID node_id, VNMFrag
                        ;
        if(frag_id >= node->frag_count)
        {
-               node->frag = realloc(node->frag, (sizeof *node->frag) * (node->frag_count + 16));
-               for(i = node->frag_count; i < (node->frag_count + 16); i++)
+               node->frag = realloc(node->frag, (sizeof *node->frag) * (node->frag_count + 32));
+               for(i = node->frag_count; i < (node->frag_count + 32); i++)
                        node->frag[i].type = 255;
-               node->frag_count += 16;
+               node->frag_count += 32;
        }       
        node->frag[frag_id].type = type;
        node->frag[frag_id].frag = *fragment;
index 019419e43a1de58d45253a848d9f3e141b9ebd3c..d269a8ddb9954a70d859e6b2d72b914213eb1bc9 100644 (file)
@@ -161,6 +161,8 @@ void vs_o_subscribe(VSNodeObject *node)
                if(node->groups[i].name[0] != 0)
                        verse_send_o_method_group_create(node->head.id, i, node->groups[i].name);
        }
+       if(node->hidden)
+               verse_send_o_hide(node->head.id, TRUE);
 }
 
 void vs_o_unsubscribe(VSNodeObject *node)