- bug fix of verse server and verse library backported from verse cvs
authorJiri Hnidek <jiri.hnidek@tul.cz>
Tue, 22 Aug 2006 11:10:31 +0000 (11:10 +0000)
committerJiri Hnidek <jiri.hnidek@tul.cz>
Tue, 22 Aug 2006 11:10:31 +0000 (11:10 +0000)
31 files changed:
extern/verse/dist/Makefile
extern/verse/dist/Makefile.win32
extern/verse/dist/README [deleted file]
extern/verse/dist/README.html [new file with mode: 0644]
extern/verse/dist/examples/list-nodes.c [new file with mode: 0644]
extern/verse/dist/resources/Makefile.win32 [new file with mode: 0644]
extern/verse/dist/resources/verse.ico [new file with mode: 0644]
extern/verse/dist/resources/verse.rc [new file with mode: 0644]
extern/verse/dist/resources/verse.res [new file with mode: 0644]
extern/verse/dist/v_bignum.c
extern/verse/dist/v_cmd_buf.c
extern/verse/dist/v_cmd_def_g.c
extern/verse/dist/v_cmd_def_m.c
extern/verse/dist/v_cmd_gen.c
extern/verse/dist/v_connect.c
extern/verse/dist/v_connection.c
extern/verse/dist/v_gen_pack_g_node.c
extern/verse/dist/v_gen_pack_m_node.c
extern/verse/dist/v_man_pack_node.c
extern/verse/dist/v_network.c
extern/verse/dist/v_pack.c
extern/verse/dist/v_prime.c
extern/verse/dist/v_randgen.c
extern/verse/dist/v_util.c
extern/verse/dist/verse.h
extern/verse/dist/vs_main.c
extern/verse/dist/vs_node_geometry.c
extern/verse/dist/vs_node_head.c
extern/verse/dist/vs_node_object.c
extern/verse/dist/vs_node_storage.c
extern/verse/dist/vs_server.h

index 32ab7aea815e90ce50d6ccaca4c2d652e61f5629..34cc10603b425cab5c3e63341cdeb470932e7032 100644 (file)
@@ -8,8 +8,8 @@
 #
 
 CC     ?= gcc
-CFLAGS ?= "-I$(shell pwd)" -Wall -Wpointer-arith -ansi -g # -pg -O2 -finline-functions
-LDFLAGS        ?= -pg
+CFLAGS ?= "-I$(shell pwd)" -Wall -Wextra -Wpointer-arith -Wno-unused-parameter -ansi -g # -pg -O2 -finline-functions
+LDFLAGS        ?= -pg
 
 AR     ?= ar
 ARFLAGS        = rus
index be2a76a5b315481905a9672f2ef71abd60ecfe27..84ca20df7b5c34b216c96fc5d90b7a43ecf35b2d 100644 (file)
@@ -52,11 +52,11 @@ VERSE_OBJ = vs_connection.obj vs_main.obj vs_node_audio.obj vs_node_bitmap.obj v
 
 ALL:           verse.lib verse.exe
 
-verse.exe:     $(VERSE_OBJ) verse.lib
-               cl /Fe$@ $**  $** wsock32.lib
+verse.exe:     $(VERSE_OBJ) verse.lib resources\verse.res
+               cl /Fe$@ $** wsock32.lib
 
 verse.lib:     $(LIBVERSE_OBJ)
-               lib /nologo /out:$@ $**
+               link /lib /nologo /out:$@ $**
 
 # -----------------------------------------------------
 
diff --git a/extern/verse/dist/README b/extern/verse/dist/README
deleted file mode 100644 (file)
index 2554012..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-
-                               Verse
-
-This is the Verse protocol and sample server implementations.
-
-For more information, see <http://verse.blender.org/>.
-
-Running "make" here will build the API library, "libverse.a" (and its
-header file, "verse.h"). These two will then be used to build the
-reference Verse server binary, called "verse".
-
-
-RELEASE LABELING
-Verse uses a simple two-level numbering scheme to identify releases.
-There is a "release number", and a "patch level" on each release. The
-intent is that within a release, the API does not change and neither
-should the network protocol. Between releases, we might improve the
-API which will require application programmers to update their code
-to stay in sync. We can do non-API-altering changes within a release
-by increasing the patch level, for bug fixing and other things.
-       The symbols V_RELEASE_NUMBER and V_RELEASE_PATCH are integer
-literals that hold the values for the API you have, and can be used
-(and displayed) in application source code as you see fit.
diff --git a/extern/verse/dist/README.html b/extern/verse/dist/README.html
new file mode 100644 (file)
index 0000000..ab4f8bf
--- /dev/null
@@ -0,0 +1,141 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<style type="text/css">
+
+h1.title {
+text-align: center;
+}
+
+p.author {
+text-align: center;
+}
+
+p.note {
+background-color: #ffeeee;
+margin-left: 5em;
+margin-right: 5em;
+border-style: solid;
+border-color: black;
+border-width: thin;
+}
+
+pre.shell {
+background-color: #ddddff;
+border-color: black;
+padding: .5em;
+border-style: solid;
+border-color: black;
+border-width: thin;
+}
+
+ul.variables {
+list-style: none;
+font-family: monospace;
+}
+
+</style>
+</head>
+
+<body>
+<h1 class="title">Verse</h1>
+
+<p>
+This is the Verse protocol and sample server implementations.
+</p>
+<p>
+For more information, see <a href="http://verse.blender.org/">the Verse web site</a>.
+</p>
+<h1>Building the Verse Core</h1>
+<p class="note">
+Note: This section is only of interest to developers, who wish to build the Verse core themselves.
+If you have chosen a binary download, you will already have the server and can skip the rest
+of this section.
+</p>
+<p>
+Running "make" here will build the API library, "libverse.a" (and its
+header file, "verse.h"). These two will then be used to build the
+reference Verse server binary, called "verse".
+</p>
+
+<h1>Starting the Server</h1>
+<p>
+The Verse server is a command-line program, without a graphical user interface.
+You simply start it, and it will immediately begin listening for incoming
+connections on a network socket. Here is how a typical invocation looks:
+</p>
+<pre class="shell">~> verse
+</pre>
+<p>
+If you don't ask it to do otherwise, the Verse server will start listening for UDP packets
+on its default port. The port number currently used by Verse is 4950.
+</p>
+<p class="note">
+Note: This is not an official <a href="http://www.iana.org/">registered</a>, port number.
+It is possible that it gets assigned to someone else, in case Verse will need to change.
+</p>
+<p>
+You can use the following command line options to control the server's operation:
+</p>
+<dl>
+ <dt>-port=N</dt>
+ <dd>
+  Use the indicated port number, rather than the default.
+ </dd>
+ <dt>-master=IP</dt>
+ <dd>
+  Connect to a <a href="http://verse.blender.org/cms/Master_Server.713.0.html">master server</a> at address <i>IP</i>.
+ </dd>
+ <dt>-Q</dt>
+ <dd>
+  Don't register with a <a href="http://verse.blender.org/cms/Master_Server.713.0.html">master server</a>.
+  This is currently the default, as master server operation has not been widely used.
+ </dd>
+ <dt>-version</dt>
+ <dd>
+  Prints the version string of the server to the terminal, and then exits (successfully). See
+  <a href="#rellab">below</a> for information how the version string is constructed.
+ </dd>
+</dl>
+<p>
+For example, here is how to start the server, with a master server of <code>master.example.org</code>,
+and a port number equal to 16333:
+</p>
+<pre class="shell">~> ./server -master=master.example.org -port=16333
+</pre>
+<p>
+Options can occur in any order, with later options overriding earlier ones, in case of conflicts.
+</p>
+
+<h1><a name="rellab">Release Labeling</a></h1>
+<p>
+Verse uses a simple two-level numbering scheme to identify releases.
+There is a "release number", and a "patch level" on each release. The
+intent is that within a release, the API does not change and neither
+should the network protocol. Between releases, we might improve the
+API which will require application programmers to update their code
+to stay in sync. We can do non-API-altering changes within a release
+by increasing the patch level, for bug fixing and other things.
+</p>
+<p>
+The symbols <code>V_RELEASE_NUMBER</code> and <code>V_RELEASE_PATCH</code>
+are integer literals that hold the values for the API you have, and can be
+used (and displayed) in application source code as you see fit. There is
+also a string, <code>V_RELEASE_LABEL</code>, which is sometimes used.
+</p>
+<p>
+To form a complete Verse version number, the above-mentioned symbols are
+to be combined like so:
+"r<i><code>&lt;V_RELEASE_NUMBER&gt;</code></i>p<i><code>&lt;V_RELEASE_PATCH&gt;&lt;V_RELEASE_LABEL&gt;</code></i>".
+So, the following variable values:
+<ul class="variables">
+<li>V_RELEASE_VERSION = 2
+<li>V_RELEASE_VERSION = 51
+<li>V_RELEASE_LABEL = "foo"
+</ul>
+Would generate the version string "<code>r2p51foo</code>".
+</p>
+
+</body>
+</html>
diff --git a/extern/verse/dist/examples/list-nodes.c b/extern/verse/dist/examples/list-nodes.c
new file mode 100644 (file)
index 0000000..6c9cc00
--- /dev/null
@@ -0,0 +1,39 @@
+/* A minimalist Verse example. Ask server for nodes, print information. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "verse.h"      /* Bring in the Verse API. */
+
+/* A callback for connection acception: will be called when server accepts this client. */
+static void callback_accept_connect(void *user, uint32 avatar, void *address, void *connection, uint8 *host_id)
+{
+    uint32 i, mask = 0;
+
+    printf("Connected to a Verse host!\n\nListing nodes:\n");
+
+    /* Build node subscription mask. */
+    for(i = 0; i < V_NT_NUM_TYPES; i++)
+        mask |= 1 << i;
+    verse_send_node_index_subscribe(mask);     /* Request listing of all nodes. */
+}
+
+/* A callback for node creation: is called to report information about existing nodes, too. */
+static void callback_node_create(void *user, VNodeID node_id, VNodeType type, VNodeOwner ownership)
+{
+    printf(" Node #%u has type %u\n", node_id, type);
+}
+
+int main(void)
+{
+    /* Register callbacks for interesting commands. */
+    verse_callback_set(verse_send_connect_accept, callback_accept_connect, NULL);
+    verse_callback_set(verse_send_node_create,   callback_node_create, NULL);
+
+    /* Kick off program by connecting to Verse host on local machine. */
+    verse_send_connect("list-nodes", "<secret>", "localhost", NULL);
+    while(TRUE)
+        verse_callback_update(10000);   /* Listen to network, get callbacks. */
+
+    return EXIT_SUCCESS;    /* This is never reached. */
+}
diff --git a/extern/verse/dist/resources/Makefile.win32 b/extern/verse/dist/resources/Makefile.win32
new file mode 100644 (file)
index 0000000..8e7b4a0
--- /dev/null
@@ -0,0 +1,11 @@
+#
+# This builds a resource file for the Verse server, for the icon.
+#
+
+ALL:           verse.res
+
+verse.res:     verse.rc
+
+
+clean:
+               del *.res
diff --git a/extern/verse/dist/resources/verse.ico b/extern/verse/dist/resources/verse.ico
new file mode 100644 (file)
index 0000000..b30f4c9
Binary files /dev/null and b/extern/verse/dist/resources/verse.ico differ
diff --git a/extern/verse/dist/resources/verse.rc b/extern/verse/dist/resources/verse.rc
new file mode 100644 (file)
index 0000000..a068a6f
--- /dev/null
@@ -0,0 +1 @@
+1 ICON verse.ico
diff --git a/extern/verse/dist/resources/verse.res b/extern/verse/dist/resources/verse.res
new file mode 100644 (file)
index 0000000..ed4db6c
Binary files /dev/null and b/extern/verse/dist/resources/verse.res differ
index 7ca075f3a6d2de2168623582f3d8683f0ebd7e88..3f3ea7f9ccc680da36cd288a18829e7d11e59185 100644 (file)
@@ -29,6 +29,7 @@
  * 
  * In general, these routines do not do a lot of error checking, they
  * assume you know what you're doing. Numbers must have >0 digits.
+ * Shifts should not be overly large (1e3 bits: safe, ~2e9+: avoid).
 */
 
 #include <ctype.h>
@@ -98,7 +99,7 @@ void v_bignum_raw_export(const VBigDig *x, void *bits)
        for(i = *x++ - 1; i >= 0; i--)
        {
                *bytes++ = x[i] >> 8;
-               *bytes++ = x[i];
+               *bytes++ = (unsigned char) x[i];
        }
 }
 
@@ -184,7 +185,7 @@ void v_bignum_set_bignum(VBigDig *x, const VBigDig *y)
 /* Performs x = y[msb:msb-bits], right-adjusting the result. */
 void v_bignum_set_bignum_part(VBigDig *x, const VBigDig *y, unsigned int msb, unsigned int bits)
 {
-       int     i, bit;
+       unsigned int    i, bit;
 
        v_bignum_set_zero(x);
        if(y == NULL || msb > (y[0] * (CHAR_BIT * sizeof *x)))
@@ -304,7 +305,7 @@ void v_bignum_bit_shift_left(VBigDig *x, unsigned int count)
        {
                unsigned int    places = count / (CHAR_BIT * sizeof *x);
 
-               for(i = s - 1; i >= places; i--)
+               for(i = s - 1; i >= (int) places; i--)
                        x[i] = x[i - places];
                for(; i >= 0; i--)              /* Clear out the LSBs. */
                        x[i] = 0;
@@ -313,7 +314,7 @@ void v_bignum_bit_shift_left(VBigDig *x, unsigned int count)
                        return;
        }
        /* Shift bits. */
-       for(i = carry = 0; i < s; i++)
+       for(i = carry = 0; i < (int) s; i++)
        {
                t = (x[i] << count) | carry;
                x[i] = t;
@@ -339,7 +340,7 @@ void v_bignum_bit_shift_left_1(VBigDig *x)
 void v_bignum_bit_shift_right(VBigDig *x, unsigned int count)
 {
        unsigned int    t, carry, s = *x++;
-       int             i;
+       int     i;
 
        /* Shift entire digits first. */
        if(count >= CHAR_BIT * sizeof *x)
@@ -351,9 +352,9 @@ void v_bignum_bit_shift_right(VBigDig *x, unsigned int count)
                        memset(x, 0, s * sizeof *x);
                        return;
                }
-               for(i = 0; i < s - places; i++)
+               for(i = 0; i < (int) (s - places); i++)
                        x[i] = x[i + places];
-               for(; i < s; i++)
+               for(; i < (int) s; i++)
                        x[i] = 0;
                count -= places * CHAR_BIT * sizeof *x;
                if(count == 0)
index bee000abf55d5ef35a0287ff5c5aabd9204c3378..b7faf2273527ec313d92e65caf1e416dd25b65b8 100644 (file)
@@ -4,6 +4,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
 #include "verse_header.h"
 #include "v_pack.h"
@@ -34,7 +35,7 @@ void cmd_buf_init(void)
        for(i = 0; i < VCMDBS_COUNT; i++)
        {
                VCMDBufData.buffers[i] = NULL;
-               VCMDBufData.available[i] = vcmdbuf_chunk_size[i] * VCMDBUF_INIT_CHUNK_FACTOR;
+               VCMDBufData.available[i] = (unsigned int) (vcmdbuf_chunk_size[i] * VCMDBUF_INIT_CHUNK_FACTOR);
                for(j = 0, buf = NULL; j < VCMDBufData.available[i]; j++, buf = b)
                {
                        b = v_cmd_buf_allocate(i);
@@ -87,8 +88,6 @@ void v_cmd_buf_free(VCMDBufHead *head)
 
 void v_cmd_buf_set_size(VCMDBufHead *head, unsigned int size)
 {
-       if(head->address_size > size);
-               head->address_size = size;
        head->size = size;
 }
 
@@ -112,14 +111,9 @@ void v_cmd_buf_set_unique_address_size(VCMDBufHead *head, unsigned int size)
 
 boolean        v_cmd_buf_compare(VCMDBufHead *a, VCMDBufHead *b)
 {
-       unsigned int i;
-
        if(a->address_sum != b->address_sum)
                return FALSE;
        if(a->address_size != b->address_size)
                return FALSE;
-       for(i = 0; i < a->address_size; i++)
-               if(((VCMDBuffer1500 *)a)->buf[i] != ((VCMDBuffer1500 *)b)->buf[i])
-                       return FALSE;
-       return TRUE;
+       return memcmp(((VCMDBuffer1500 *)a)->buf, ((VCMDBuffer1500 *)b)->buf, a->address_size) == 0;
 }
index d3149f0f725269174e79a780b85b53d6cae10237..66c26e9eadd4fcb3ef5a215a50a92d2b8c216865 100644 (file)
@@ -91,7 +91,7 @@ void v_gen_geometry_cmd_def(void)
        v_cg_add_param(VCGP_UINT32,             "v1");
        v_cg_add_param(VCGP_UINT32,             "v2");
        v_cg_add_param(VCGP_UINT32,             "v3");
-       v_cg_alias(FALSE, "g_polygon_delete", "if(layer_id == (VLayerID) ~0)", 2, order);
+       v_cg_alias(FALSE, "g_polygon_delete", "if(layer_id == 1 && v0 == ~0u)", 2, order);
        v_cg_end_cmd();
 
        v_cg_new_cmd(V_NT_GEOMETRY,             "g_polygon_set_corner_real64", 56, VCGCT_NORMAL); 
index 212c9e3c303f14599ff0fd6a6f43d26959232904..3f4b9aa71781f5f9d5adb04b8ae07001c305bba1 100644 (file)
@@ -159,7 +159,7 @@ void v_gen_material_cmd_def(void)
        "\t\t\tbuffer_pos += vnp_raw_unpack_real64(&buf[buffer_pos], &frag.transparency.refraction_index);\n"
        "\t\t\tbreak;\n"
        "\t\tcase VN_M_FT_VOLUME :\n"
-       "\t\t\tif(buffer_pos + 34 > buffer_length)\n"
+       "\t\t\tif(buffer_pos + 32 > buffer_length)\n"
        "\t\t\t\treturn -1;\n"
        "\t\t\tbuffer_pos += vnp_raw_unpack_real64(&buf[buffer_pos], &frag.volume.diffusion);\n"
        "\t\t\tbuffer_pos += vnp_raw_unpack_real64(&buf[buffer_pos], &frag.volume.col_r);\n"
index ebe2735250b846734faaf03dd1f07fab6aa428a8..b687983382d083f2e536e0c8383bad8943dbcbf0 100644 (file)
@@ -403,7 +403,8 @@ static unsigned int v_cg_compute_command_size(unsigned int start, boolean end)
 
 void v_cg_set_command_address(FILE *f, boolean alias)
 {
-       unsigned int i, count = 0, length, size = 1, *param, def[] ={0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
+       unsigned int i, j, count = 0, length, size = 1, *param, def[] ={0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
+
        for(i = 0; i < VCGData.param_count; i++)
                if(VCGData.param_type[i] == VCGP_END_ADDRESS)
                        break;
@@ -422,9 +423,9 @@ void v_cg_set_command_address(FILE *f, boolean alias)
        if(i == VCGData.param_count)
                return;
        fprintf(f, "\tif(");
-       for(i = 0; i < length; i++)
+       for(i = j = 0; i < VCGData.param_count; i++)
        {
-               switch(VCGData.param_type[param[i]])
+               switch(VCGData.param_type[i])
                {
                        case  VCGP_UINT8 :
                        case  VCGP_ENUM :
@@ -434,25 +435,46 @@ void v_cg_set_command_address(FILE *f, boolean alias)
                        case  VCGP_LAYER_ID :
                        case  VCGP_BUFFER_ID :
                        case  VCGP_FRAGMENT_ID :
-                               if(count++ != 0)
-                                       fprintf(f, " || ");
-                               fprintf(f, "%s == (uint16)(-1)", VCGData.param_name[param[i]]);
                                size += 2;
                                break;
                        case  VCGP_NODE_ID : 
                        case  VCGP_UINT32 :
                        case  VCGP_REAL32 :
-                               if(count++ != 0)
-                                       fprintf(f, " || ");
-                               fprintf(f, "%s == (uint32)(-1)", VCGData.param_name[param[i]]);
                                size += 4;
                                break;
-                       case VCGP_END_ADDRESS :
-                               fprintf(f, ")\n");
-                               fprintf(f, "\t\tv_cmd_buf_set_unique_address_size(head, %u);\n", size);
-                               fprintf(f, "\telse\n");
-                               fprintf(f, "\t\tv_cmd_buf_set_address_size(head, %u);\n", size);
-                               return;
+               }
+               if(j < length && param[j] == i)
+               {
+                       switch(VCGData.param_type[param[j]])
+                       {
+                               case  VCGP_UINT8 :
+                               case  VCGP_ENUM :
+                                       break;
+                               case  VCGP_UINT16 :
+                               case  VCGP_LAYER_ID :
+                               case  VCGP_BUFFER_ID :
+                               case  VCGP_FRAGMENT_ID :
+                                       if(count++ != 0)
+                                               fprintf(f, " || ");
+                                       fprintf(f, "%s == (uint16)(-1)", VCGData.param_name[param[j]]);
+                                       break;
+                               case  VCGP_NODE_ID : 
+                               case  VCGP_UINT32 :
+                               case  VCGP_REAL32 :
+                                       if(count++ != 0)
+                                               fprintf(f, " || ");
+                                       fprintf(f, "%s == (uint32)(-1)", VCGData.param_name[param[j]]);
+                                       break;
+                       }
+                       j++;
+               }
+               if(VCGData.param_type[i] == VCGP_END_ADDRESS)
+               {
+                       fprintf(f, ")\n");
+                       fprintf(f, "\t\tv_cmd_buf_set_unique_address_size(head, %u);\n", size);
+                       fprintf(f, "\telse\n");
+                       fprintf(f, "\t\tv_cmd_buf_set_address_size(head, %u);\n", size);
+                       return;
                }
        }
        fprintf(f, ")\n");
@@ -568,7 +590,15 @@ static void v_cg_gen_pack(boolean alias)
                        break;
                }
                if(no_param)
-                       param = "-1";
+               {
+                       /* Horrible work-around, that prevents vertex/polygon deletes from misbehaving. */
+                       if(strncmp(VCGData.alias_name, "g_vertex_delete_real", 20) == 0 && i == 1)
+                               param = "0";
+                       else if(strncmp(VCGData.alias_name, "g_polygon_delete", 16) == 0 && i == 1)
+                               param = "1";
+                       else
+                               param = "-1";
+               }
                switch(VCGData.param_type[i])
                {       
                        case VCGP_NODE_ID :
index ae21bcb0618c0bbef1d41f28b5017364cfb524c0..31be90e2d475f6c6e27da929f809c457a0add466 100644 (file)
@@ -112,7 +112,7 @@ static void v_send_hidden_connect_terminate(VNetworkAddress *address, unsigned i
 
 VSession verse_send_connect(const char *name, const char *pass, const char *address, const uint8 *expected_key)
 {
-       uint8 *my_key, *key;
+       uint8 *my_key, *key = NULL;
        unsigned int i;
        VNetworkAddress a; 
        VSession *session;
@@ -151,9 +151,9 @@ VSession verse_send_connect(const char *name, const char *pass, const char *addr
 
 void v_update_connection_pending(boolean resend)
 {
-       VSession (* func_connect)(void *user_data, const char *name, const char *pass, const char *address, const uint8 *key);
+       VSession (* func_connect)(void *user_data, const char *name, const char *pass, const char *address, const uint8 *key) = NULL;
        VSession (* func_connect_accept)(void *user_data, VNodeID avatar, char *address, uint8 *host_id);
-       void (* func_connect_termanate)(void *user_data, char *address, const char *bye);
+       void (* func_connect_terminate)(void *user_data, char *address, const char *bye);
        char address_string[32];
 
        switch(v_con_get_connect_stage())
@@ -193,13 +193,13 @@ void v_update_connection_pending(boolean resend)
                break;
        case V_CS_PENDING_CLIENT_CALLBACK_TERMINATE : /* Host got login waits for accept connect callback */
                v_con_set_connect_stage(V_CS_CONNECTED);
-               func_connect_termanate = v_fs_get_user_func(2);
+               func_connect_terminate = v_fs_get_user_func(2);
                v_n_get_address_string(v_con_get_network_address(), address_string);
 #if defined(V_PRINT_RECEIVE_COMMANDS)
-               printf("receive: func_connect_termanate(address = %s, bye = %s); callback = %p\n", address_string, "no message", func_connect);
+               printf("receive: func_connect_terminate(address = %s, bye = %s); callback = %p\n", address_string, "no message", func_connect);
 #endif
-               if(func_connect_termanate != 0)
-                       func_connect_termanate(v_fs_get_user_data(2), address_string, "no message");
+               if(func_connect_terminate != 0)
+                       func_connect_terminate(v_fs_get_user_data(2), address_string, "no message");
                break;
        default:
                ;
index f7a4c23cf5fb3d37b7e3b452576ae52cbe11d5e8..b8631fc310b82c3df349b9fe6b30afb6dbfeec91 100644 (file)
@@ -252,11 +252,14 @@ boolean v_con_network_listen(void)
                else
                {
                        fprintf(stderr, __FILE__ ": Unhandled packet--dropping\n");
-                       fprintf(stderr, __FILE__ ": State: current=%u count=%u stage=%d id=%u\n",
-                              VConData.current_connection,
-                              VConData.con_count,
-                              VConData.con[VConData.current_connection].connect_stage,
-                              packet_id);
+                       if(VConData.con_count > 0)
+                       {
+                               fprintf(stderr, __FILE__ ": State: current=%u count=%u stage=%d id=%u\n",
+                                      VConData.current_connection,
+                                      VConData.con_count,
+                                      VConData.con[VConData.current_connection].connect_stage,
+                                       packet_id);
+                       }
                }
                size = v_n_receive_data(&address, buf, sizeof buf); /* See if there are more incoming packets. */
                ret = TRUE;
index af147d2b04dc76ca03223df503d6ade55bcb4dae..7b2b0259cfe97d3518ef90f46723d899c1ff8764 100644 (file)
@@ -234,15 +234,15 @@ void verse_send_g_vertex_delete_real32(VNodeID node_id, uint32 vertex_id)
        printf("send: verse_send_g_vertex_delete_real32(node_id = %u vertex_id = %u );\n", node_id, vertex_id);
 #endif
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
-       buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], -1);
+       buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], 0);
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], vertex_id);
        buffer_pos += vnp_raw_pack_real32(&buf[buffer_pos], V_REAL32_MAX);
        buffer_pos += vnp_raw_pack_real32(&buf[buffer_pos], V_REAL32_MAX);
        buffer_pos += vnp_raw_pack_real32(&buf[buffer_pos], V_REAL32_MAX);
        if(node_id == (uint32)(-1) || vertex_id == (uint32)(-1))
-               v_cmd_buf_set_unique_address_size(head, 9);
+               v_cmd_buf_set_unique_address_size(head, 11);
        else
-               v_cmd_buf_set_address_size(head, 9);
+               v_cmd_buf_set_address_size(head, 11);
        v_cmd_buf_set_size(head, buffer_pos);
        v_noq_send_buf(v_con_get_network_queue(), head);
 }
@@ -326,15 +326,15 @@ void verse_send_g_vertex_delete_real64(VNodeID node_id, uint32 vertex_id)
        printf("send: verse_send_g_vertex_delete_real64(node_id = %u vertex_id = %u );\n", node_id, vertex_id);
 #endif
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
-       buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], -1);
+       buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], 0);
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], vertex_id);
        buffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], V_REAL64_MAX);
        buffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], V_REAL64_MAX);
        buffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], V_REAL64_MAX);
        if(node_id == (uint32)(-1) || vertex_id == (uint32)(-1))
-               v_cmd_buf_set_unique_address_size(head, 9);
+               v_cmd_buf_set_unique_address_size(head, 11);
        else
-               v_cmd_buf_set_address_size(head, 9);
+               v_cmd_buf_set_address_size(head, 11);
        v_cmd_buf_set_size(head, buffer_pos);
        v_noq_send_buf(v_con_get_network_queue(), head);
 }
@@ -566,16 +566,16 @@ void verse_send_g_polygon_delete(VNodeID node_id, uint32 polygon_id)
        printf("send: verse_send_g_polygon_delete(node_id = %u polygon_id = %u );\n", node_id, polygon_id);
 #endif
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
-       buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], -1);
+       buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], 1);
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], polygon_id);
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], -1);
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], -1);
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], -1);
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], -1);
        if(node_id == (uint32)(-1) || polygon_id == (uint32)(-1))
-               v_cmd_buf_set_unique_address_size(head, 9);
+               v_cmd_buf_set_unique_address_size(head, 11);
        else
-               v_cmd_buf_set_address_size(head, 9);
+               v_cmd_buf_set_address_size(head, 11);
        v_cmd_buf_set_size(head, buffer_pos);
        v_noq_send_buf(v_con_get_network_queue(), head);
 }
@@ -603,12 +603,12 @@ unsigned int v_unpack_g_polygon_set_corner_uint32(const char *buf, size_t buffer
        buffer_pos += vnp_raw_unpack_uint32(&buf[buffer_pos], &v2);
        buffer_pos += vnp_raw_unpack_uint32(&buf[buffer_pos], &v3);
 #if defined V_PRINT_RECEIVE_COMMANDS
-       if(layer_id == (VLayerID) ~0)
+       if(layer_id == 1 && v0 == ~0u)
                printf("receive: verse_send_g_polygon_delete(node_id = %u polygon_id = %u ); callback = %p\n", node_id, polygon_id, v_fs_get_alias_user_func(55));
        else
                printf("receive: verse_send_g_polygon_set_corner_uint32(node_id = %u layer_id = %u polygon_id = %u v0 = %u v1 = %u v2 = %u v3 = %u ); callback = %p\n", node_id, layer_id, polygon_id, v0, v1, v2, v3, v_fs_get_user_func(55));
 #endif
-       if(layer_id == (VLayerID) ~0)
+       if(layer_id == 1 && v0 == ~0u)
        {
                void (* alias_g_polygon_delete)(void *user_data, VNodeID node_id, uint32 polygon_id);
                alias_g_polygon_delete = v_fs_get_alias_user_func(55);
index 623c11515b60c4be78ed90e3b6bab8cb82817673..518368d2c0aad5b9949029a7d9bd6d7247ec6195 100644 (file)
@@ -227,7 +227,7 @@ unsigned int v_unpack_m_fragment_create(const char *buf, size_t buffer_length)
                        buffer_pos += vnp_raw_unpack_real64(&buf[buffer_pos], &frag.transparency.refraction_index);
                        break;
                case VN_M_FT_VOLUME :
-                       if(buffer_pos + 34 > buffer_length)
+                       if(buffer_pos + 32 > buffer_length)
                                return -1;
                        buffer_pos += vnp_raw_unpack_real64(&buf[buffer_pos], &frag.volume.diffusion);
                        buffer_pos += vnp_raw_unpack_real64(&buf[buffer_pos], &frag.volume.col_r);
index 2b6a50f2e07bbcb0ae00991ae3a4a3e893b0125d..1b44bdadd1536df4b95be4efcfd58492043006eb 100644 (file)
@@ -336,26 +336,26 @@ void verse_send_c_key_set(VNodeID node_id, VLayerID curve_id, uint32 key_id, uin
                printf("send: verse_send_c_key_set(node_id = %u curve_id = %u key_id = %u dimensions = %u pre_value = %f pre_pos = %u value = %f pos = %f, pre_value = %f pre_pos = %u ); callback = %p\n", node_id, curve_id, key_id, dimensions, pre_value[0], pre_pos[0], value[0], pos, pre_value[0], pre_pos[0], v_fs_get_user_func(130));
        break;
        case 2:
-               printf("sende: verse_send_c_key_set(node_id = %u curve_id = %u key_id = %u dimensions = %u pre_value = {%f, %f} pre_pos = {%u, %u} value = {%f, %f} pos = {%f, %f}, pre_value = {%f, %f} pre_pos = {%u, %u}); callback = %p\n",
+               printf("sende: verse_send_c_key_set(node_id = %u curve_id = %u key_id = %u dimensions = %u pre_value = {%f, %f} pre_pos = {%u, %u} value = {%f, %f} pos = %f, pre_value = {%f, %f} pre_pos = {%u, %u}); callback = %p\n",
                        node_id, curve_id, key_id, dimensions, 
                        pre_value[0], pre_value[1], 
                        pre_pos[0], pre_pos[1], 
-                       value[0], value[1], pos, 
+                       value[0], value[1], pos,
                        pre_value[0], pre_value[1],  
                        pre_pos[0], pre_pos[1], v_fs_get_user_func(130));
        break;
        case 3:
-               printf("send: verse_send_c_key_set(node_id = %u curve_id = %u key_id = %u dimensions = %u pre_value = {%f, %f, %f} pre_pos = {%u, %u, %u} value = {%f, %f, %f} pos = {%f, %f, %f}, pre_value = {%f, %f, %f} pre_pos = {%u, %u, %u}); callback = %p\n",
+               printf("send: verse_send_c_key_set(node_id = %u curve_id = %u key_id = %u dimensions = %u pre_value = {%f, %f, %f} pre_pos = {%u, %u, %u} value = {%f, %f, %f} pos = %f, pre_value = {%f, %f, %f} pre_pos = {%u, %u, %u}); callback = %p\n",
                        node_id, curve_id, key_id, dimensions, 
                        pre_value[0], pre_value[1], pre_value[2],  
                        pre_pos[0], pre_pos[1], pre_pos[2],  
-                       value[0], value[1], value[2], pos, 
+                       value[0], value[1], value[2], pos,
                        pre_value[0], pre_value[1], pre_value[2],  
                        pre_pos[0], pre_pos[1], pre_pos[2], v_fs_get_user_func(130));
                
        break;
        case 4:
-               printf("send: verse_send_c_key_set(node_id = %u curve_id = %u key_id = %u dimensions = %u pre_value = {%f, %f, %f, %f} pre_pos = {%u, %u, %u, %u} value = {%f, %f, %f, %f} pos = {%f, %f, %f, %f}, pre_value = {%f, %f, %f, %f} pre_pos = {%u, %u, %u, %u}); callback = %p\n",
+               printf("send: verse_send_c_key_set(node_id = %u curve_id = %u key_id = %u dimensions = %u pre_value = {%f, %f, %f, %f} pre_pos = {%u, %u, %u, %u} value = {%f, %f, %f, %f} pos = %f, pre_value = {%f, %f, %f, %f} pre_pos = {%u, %u, %u, %u}); callback = %p\n",
                        node_id, curve_id, key_id, dimensions, 
                        pre_value[0], pre_value[1], pre_value[2], pre_value[3], 
                        pre_pos[0], pre_pos[1], pre_pos[2], pre_pos[3], 
@@ -448,7 +448,7 @@ unsigned int v_unpack_c_key_set(const char *buf, size_t buffer_length)
                        printf("receive: verse_send_c_key_set(node_id = %u curve_id = %u key_id = %u dimensions = %u pre_value = %f pre_pos = %u value = %f pos = %f, pre_value = %f pre_pos = %u ); callback = %p\n", node_id, curve_id, key_id, dimensions, pre_value[0], pre_pos[0], value[0], pos, pre_value[0], pre_pos[0], v_fs_get_user_func(130));
                break;
                case 2:
-                       printf("receive: verse_send_c_key_set(node_id = %u curve_id = %u key_id = %u dimensions = %u pre_value = {%f, %f} pre_pos = {%u, %u} value = {%f, %f} pos = {%f, %f}, pre_value = {%f, %f} pre_pos = {%u, %u}); callback = %p\n",
+                       printf("receive: verse_send_c_key_set(node_id = %u curve_id = %u key_id = %u dimensions = %u pre_value = {%f, %f} pre_pos = {%u, %u} value = {%f, %f} pos = %f, pre_value = {%f, %f} pre_pos = {%u, %u}); callback = %p\n",
                                node_id, curve_id, key_id, dimensions, 
                                pre_value[0], pre_value[1], 
                                pre_pos[0], pre_pos[1], 
@@ -457,7 +457,7 @@ unsigned int v_unpack_c_key_set(const char *buf, size_t buffer_length)
                                pre_pos[0], pre_pos[1], v_fs_get_user_func(130));
                break;
                case 3:
-                       printf("receive: verse_send_c_key_set(node_id = %u curve_id = %u key_id = %u dimensions = %u pre_value = {%f, %f, %f} pre_pos = {%u, %u, %u} value = {%f, %f, %f} pos = {%f, %f, %f}, pre_value = {%f, %f, %f} pre_pos = {%u, %u, %u}); callback = %p\n",
+                       printf("receive: verse_send_c_key_set(node_id = %u curve_id = %u key_id = %u dimensions = %u pre_value = {%f, %f, %f} pre_pos = {%u, %u, %u} value = {%f, %f, %f} pos = %f, pre_value = {%f, %f, %f} pre_pos = {%u, %u, %u}); callback = %p\n",
                                node_id, curve_id, key_id, dimensions, 
                                pre_value[0], pre_value[1], pre_value[2],  
                                pre_pos[0], pre_pos[1], pre_pos[2],  
@@ -467,7 +467,7 @@ unsigned int v_unpack_c_key_set(const char *buf, size_t buffer_length)
                        
                break;
                case 4:
-                       printf("receive: verse_send_c_key_set(node_id = %u curve_id = %u key_id = %u dimensions = %u pre_value = {%f, %f, %f, %f} pre_pos = {%u, %u, %u, %u} value = {%f, %f, %f, %f} pos = {%f, %f, %f, %f}, pre_value = {%f, %f, %f, %f} pre_pos = {%u, %u, %u, %u}); callback = %p\n",
+                       printf("receive: verse_send_c_key_set(node_id = %u curve_id = %u key_id = %u dimensions = %u pre_value = {%f, %f, %f, %f} pre_pos = {%u, %u, %u, %u} value = {%f, %f, %f, %f} pos = %f, pre_value = {%f, %f, %f, %f} pre_pos = {%u, %u, %u, %u}); callback = %p\n",
                                node_id, curve_id, key_id, dimensions, 
                                pre_value[0], pre_value[1], pre_value[2], pre_value[3], 
                                pre_pos[0], pre_pos[1], pre_pos[2], pre_pos[3], 
index 7f9d527c1ac9f0491dc96bd92e61b741a8112f2e..2341edf9994db80466114e2657df1ad02e914c5e 100644 (file)
@@ -180,7 +180,7 @@ unsigned int v_n_wait_for_incoming(unsigned int microseconds)
        v_n_get_current_time(&s1, &f1);
        select(1, &fd_select, NULL, NULL, &tv);
        v_n_get_current_time(&s2, &f2);
-       return 1000000 * (s2 - s1) + (1000000.0 / 0xffffffffu) * (long) (f2 - f1);      /* Must cast to (long) for f1 > f2 case! */
+       return (unsigned int) (1000000 * (s2 - s1) + (1000000.0 / 0xffffffffu) * (long) (f2 - f1));     /* Must cast to (long) for f1 > f2 case! */
 }
 
 #endif
@@ -221,9 +221,9 @@ void v_n_get_current_time(uint32 *seconds, uint32 *fractions)
 
        QueryPerformanceCounter(&counter);
        if(seconds != NULL)
-               *seconds = counter.QuadPart / frequency.QuadPart;
+               *seconds = (uint32) (counter.QuadPart / frequency.QuadPart);
        if(fractions != NULL)
-               *fractions = (uint32)((0xffffffffULL * (counter.QuadPart % frequency.QuadPart)) / frequency.QuadPart);
+               *fractions = (uint32) ((0xffffffffUL * (counter.QuadPart % frequency.QuadPart)) / frequency.QuadPart);
 }
 
 #else
index da80c4bca4f107875f7a4c4435e78c71b750deb4..f521360b11ff1ab4a679e1e7132f6e8785e0e3b4 100644 (file)
@@ -48,7 +48,7 @@ size_t vnp_raw_pack_uint16(void *buffer, uint16 data)
 
 size_t vnp_raw_unpack_uint16(const void *buffer, uint16 *data)
 {
-       const register uint8    *b = buffer;
+       register const uint8    *b = buffer;
        register uint16 tmp;
 
        tmp = ((uint16) *b++) << 8;
index c9f787ca89cc80742ab2aad41662c4311099bd1d..cebdf4fb03d1e3230f8994e2397cfb49c3ce7b55 100644 (file)
@@ -24,7 +24,7 @@ static int quick_filter(const VBigDig *n)
 {
        VBigDig VBIGNUM(m, 16), VBIGNUM(tmp, BITS / 2);
        const unsigned int      prime[] = { 3, 5, 7, 11, 13, 17, 19, 23, 39, 31, 37, 41, 43, 47, 53 };
-       int     i;
+       unsigned int    i;
 
        for(i = 0; i < sizeof prime / sizeof *prime; i++)
        {
index baff4b293ad9031356c81e5b5c66cc3a3a6178b1..c65b48be60bbd58f4f32c657ca276f860c937405 100644 (file)
@@ -84,7 +84,7 @@ void v_randgen_get(VRandGen *gen, void *bytes, size_t num)
 {
        if(gen != NULL && bytes != NULL)
        {
-               if(read(gen->fd, bytes, num) != num)
+               if(read(gen->fd, bytes, num) != (int) num)
                        fprintf(stderr, __FILE__ ": Failed to read %u bytes of random data from " SOURCE "\n", (unsigned int) num);
        }
 }
index a2608c38115c0492dd79741ce70a9abe666c44dc..a36f4c77791ee8c6dc6f38f3e83b2923122a373f 100644 (file)
@@ -34,8 +34,8 @@ void v_timer_advance(VUtilTimer *timer, double seconds)
 {
        if(timer == NULL)
                return;
-       timer->seconds   += (int) seconds;
-       timer->fractions += (seconds - (int) seconds) * (double) 0xffffffff;
+       timer->seconds   += (uint32) seconds;
+       timer->fractions += (uint32) ((seconds - (int) seconds) * (double) 0xffffffff);
 }
 
 double v_timer_elapsed(const VUtilTimer *timer)
@@ -79,10 +79,10 @@ VNQuat32 * v_quat32_from_quat64(VNQuat32 *dst, const VNQuat64 *src)
 {
        if(dst == NULL || src == NULL)
                return NULL;
-       dst->x = src->x;        
-       dst->y = src->y;
-       dst->z = src->z;        
-       dst->w = src->w;
+       dst->x = (real32) src->x;
+       dst->y = (real32) src->y;
+       dst->z = (real32) src->z;       
+       dst->w = (real32) src->w;
        return dst;
 }
 
index ddf9dd96d3fc1974c2674db0caa71a58ed2bbdfd..75207c943db12f52f49ed83f6e79070383db3154 100644 (file)
@@ -415,8 +415,10 @@ extern void                verse_session_get_time(uint32 *seconds, uint32 *fractions);
 extern VNOPackedParams * verse_method_call_pack(uint32 param_count, const VNOParamType *param_type, const VNOParam *params);
 extern boolean verse_method_call_unpack(const VNOPackedParams *data, uint32 param_count, const VNOParamType *param_type, VNOParam *params);
 
+/*
 #define V_PRINT_SEND_COMMANDS
 #define V_PRINT_RECEIVE_COMMANDS
+*/
 
 #endif         /* VERSE_TYPES */
 
index 5ffed833dee621973ea31b71da3dcff375babb1b..7e7655a70823163999c22841ee6c5c5bc1d97d83 100644 (file)
@@ -113,7 +113,7 @@ int main(int argc, char **argv)
 
        signal(SIGINT, cb_sigint_handler);
 
-       for(i = 1; i < argc; i++)
+       for(i = 1; i < (uint32) argc; i++)
        {
                if(strcmp(argv[i], "-Q") == 0)
                        ms_address = NULL;
@@ -121,6 +121,11 @@ int main(int argc, char **argv)
                        ms_address = argv[i] + 9;
                else if(strncmp(argv[i], "-port=", 6) == 0)
                        port = strtoul(argv[i] + 6, NULL, 0);
+               else if(strcmp(argv[i], "-version") == 0)
+               {
+                       printf("r%up%u%s\n", V_RELEASE_NUMBER, V_RELEASE_PATCH, V_RELEASE_LABEL);
+                       return EXIT_SUCCESS;
+               }
                else
                        fprintf(stderr, "Ignoring unknown argument \"%s\"\n", argv[i]);
        }
index 4b0ac52f7123d2b98cff9069f3492530bd1b863b..c3b7a268a72069c32cccb48c681cbeeb90499d1b 100644 (file)
@@ -429,7 +429,7 @@ static unsigned int vs_g_extend_arrays(VSNodeGeometry *node, boolean vertex, boo
 {
        unsigned int i, j;
 
-       if(base_layer && id == -1)
+       if(base_layer && id == ~0u)
        {
                if(vertex)
                {
@@ -438,7 +438,7 @@ static unsigned int vs_g_extend_arrays(VSNodeGeometry *node, boolean vertex, boo
                        id = node->vertex_hole;
                }else
                {
-                       while(node->polygon_hole < node->poly_size && ((uint32 *)node->layer[1].layer)[node->polygon_hole * 4] != -1)
+                       while(node->polygon_hole < node->poly_size && ((uint32 *)node->layer[1].layer)[node->polygon_hole * 4] != ~0u)
                                node->polygon_hole++;
                        id = node->polygon_hole;
                }
@@ -525,7 +525,7 @@ static void callback_send_g_vertex_set_xyz_real32(void *user, VNodeID node_id, V
                return;
        if(layer_id >= node->layer_count || node->layer[layer_id].layer == NULL || node->layer[layer_id].type != VN_G_LAYER_VERTEX_XYZ)
                return;
-       if((vertex_id = vs_g_extend_arrays(node, TRUE, layer_id == 0, vertex_id)) == -1)
+       if((vertex_id = vs_g_extend_arrays(node, TRUE, layer_id == 0, vertex_id)) == ~0u)
                return;
        if(((real64 *)node->layer[0].layer)[vertex_id * 3] == V_REAL64_MAX)
        {
@@ -570,7 +570,7 @@ static void callback_send_g_vertex_set_xyz_real64(void *user, VNodeID node_id, V
                return;
        if(layer_id >= node->layer_count || node->layer[layer_id].layer == NULL || node->layer[layer_id].type != VN_G_LAYER_VERTEX_XYZ)
                return;
-       if((vertex_id = vs_g_extend_arrays(node, TRUE, layer_id == 0, vertex_id)) == -1)
+       if((vertex_id = vs_g_extend_arrays(node, TRUE, layer_id == 0, vertex_id)) == ~0u)
                return;
        if(((real64 *)node->layer[0].layer)[vertex_id * 3] == V_REAL64_MAX)
        {
@@ -643,7 +643,7 @@ static void callback_send_g_vertex_set_uint32(void *user, VNodeID node_id, VLaye
                return;
        if(layer_id >= node->layer_count || node->layer[layer_id].layer == NULL || node->layer[layer_id].type != VN_G_LAYER_VERTEX_UINT32)
                return;
-       if((vertex_id = vs_g_extend_arrays(node, TRUE, FALSE, vertex_id)) == -1)
+       if((vertex_id = vs_g_extend_arrays(node, TRUE, FALSE, vertex_id)) == ~0u)
                return;
        ((uint32 *)node->layer[layer_id].layer)[vertex_id] = value;
        count = vs_get_subscript_count(node->layer[layer_id].subscribers);
@@ -664,7 +664,7 @@ static void callback_send_g_vertex_set_real64(void *user, VNodeID node_id, VLaye
                return;
        if(layer_id >= node->layer_count || node->layer[layer_id].layer == NULL || node->layer[layer_id].type != VN_G_LAYER_VERTEX_REAL)
                return;
-       if((vertex_id = vs_g_extend_arrays(node, TRUE, FALSE, vertex_id)) == -1)
+       if((vertex_id = vs_g_extend_arrays(node, TRUE, FALSE, vertex_id)) == ~0u)
                return;
        ((real64 *)node->layer[layer_id].layer)[vertex_id] = value;
        count = vs_get_subscript_count(node->layer[layer_id].subscribers);
@@ -691,7 +691,7 @@ static void callback_send_g_vertex_set_real32(void *user, VNodeID node_id, VLaye
                return;
        if(layer_id >= node->layer_count || node->layer[layer_id].layer == NULL || node->layer[layer_id].type != VN_G_LAYER_VERTEX_REAL)
                return;
-       if((vertex_id = vs_g_extend_arrays(node, TRUE, FALSE, vertex_id)) == -1)
+       if((vertex_id = vs_g_extend_arrays(node, TRUE, FALSE, vertex_id)) == ~0u)
                return;
        ((real64 *)node->layer[layer_id].layer)[vertex_id] = (real64)value;
        count = vs_get_subscript_count(node->layer[layer_id].subscribers);
@@ -720,7 +720,7 @@ static void callback_send_g_polygon_set_corner_uint32(void *user, VNodeID node_i
                return;
        if(layer_id == 1 && (v0 == v1 || v1 == v2 || v2 == v3 || v3 == v0 || v0 == v2 || v1 == v3))
                return;
-       if((polygon_id = vs_g_extend_arrays(node, FALSE, layer_id == 1, polygon_id)) == -1)
+       if((polygon_id = vs_g_extend_arrays(node, FALSE, layer_id == 1, polygon_id)) == ~0u)
                return;
        ((uint32 *)node->layer[layer_id].layer)[polygon_id * 4] = v0;
        ((uint32 *)node->layer[layer_id].layer)[polygon_id * 4 + 1] = v1;
@@ -744,7 +744,7 @@ static void callback_send_g_polygon_set_corner_real64(void *user, VNodeID node_i
                return;
        if(layer_id >= node->layer_count || node->layer[layer_id].layer == NULL || node->layer[layer_id].type != VN_G_LAYER_POLYGON_CORNER_REAL)
                return;
-       if((polygon_id = vs_g_extend_arrays(node, FALSE, FALSE, polygon_id)) == -1)
+       if((polygon_id = vs_g_extend_arrays(node, FALSE, FALSE, polygon_id)) == ~0u)
                return;
        ((real64 *)node->layer[layer_id].layer)[polygon_id * 4] = v0;
        ((real64 *)node->layer[layer_id].layer)[polygon_id * 4 + 1] = v1;
@@ -775,7 +775,7 @@ static void callback_send_g_polygon_set_corner_real32(void *user, VNodeID node_i
                return;
        if(layer_id >= node->layer_count || node->layer[layer_id].layer == NULL || node->layer[layer_id].type != VN_G_LAYER_POLYGON_CORNER_REAL)
                return;
-       if((polygon_id = vs_g_extend_arrays(node, FALSE, FALSE, polygon_id)) == -1)
+       if((polygon_id = vs_g_extend_arrays(node, FALSE, FALSE, polygon_id)) == ~0u)
                return;
        ((real64 *)node->layer[layer_id].layer)[polygon_id * 4] = v0;
        ((real64 *)node->layer[layer_id].layer)[polygon_id * 4 + 1] = v1;
@@ -806,7 +806,7 @@ static void callback_send_g_polygon_set_face_uint8(void *user, VNodeID node_id,
                return;
        if(layer_id >= node->layer_count || node->layer[layer_id].layer == NULL || node->layer[layer_id].type != VN_G_LAYER_POLYGON_FACE_UINT8)
                return;
-       if((polygon_id = vs_g_extend_arrays(node, FALSE, FALSE, polygon_id)) == -1)
+       if((polygon_id = vs_g_extend_arrays(node, FALSE, FALSE, polygon_id)) == ~0u)
                return;
        ((uint8 *)node->layer[layer_id].layer)[polygon_id] = value;
        count = vs_get_subscript_count(node->layer[layer_id].subscribers);
@@ -828,7 +828,7 @@ static void callback_send_g_polygon_set_face_uint32(void *user, VNodeID node_id,
                return;
        if(layer_id >= node->layer_count || node->layer[layer_id].layer == NULL || node->layer[layer_id].type != VN_G_LAYER_POLYGON_FACE_UINT32)
                return;
-       if((polygon_id = vs_g_extend_arrays(node, FALSE, FALSE, polygon_id)) == -1)
+       if((polygon_id = vs_g_extend_arrays(node, FALSE, FALSE, polygon_id)) == ~0u)
                return;
        ((uint32 *)node->layer[layer_id].layer)[polygon_id] = value;
        count = vs_get_subscript_count(node->layer[layer_id].subscribers);
@@ -849,7 +849,7 @@ static void callback_send_g_polygon_set_face_real64(void *user, VNodeID node_id,
                return;
        if(layer_id >= node->layer_count || node->layer[layer_id].layer == NULL || node->layer[layer_id].type != VN_G_LAYER_POLYGON_FACE_REAL)
                return;
-       if((polygon_id = vs_g_extend_arrays(node, FALSE, FALSE, polygon_id)) == -1)
+       if((polygon_id = vs_g_extend_arrays(node, FALSE, FALSE, polygon_id)) == ~0u)
                return;
        ((real64 *)node->layer[layer_id].layer)[polygon_id] = value;
        count = vs_get_subscript_count(node->layer[layer_id].subscribers);
@@ -876,7 +876,7 @@ static void callback_send_g_polygon_set_face_real32(void *user, VNodeID node_id,
                return;
        if(layer_id >= node->layer_count || node->layer[layer_id].layer == NULL || node->layer[layer_id].type != VN_G_LAYER_POLYGON_FACE_REAL)
                return;
-       if((polygon_id = vs_g_extend_arrays(node, FALSE, FALSE, polygon_id)) == -1)
+       if((polygon_id = vs_g_extend_arrays(node, FALSE, FALSE, polygon_id)) == ~0u)
                return;
        ((real64 *)node->layer[layer_id].layer)[polygon_id] = (real64)value;
        count = vs_get_subscript_count(node->layer[layer_id].subscribers);
@@ -902,13 +902,12 @@ static void callback_send_g_polygon_delete(void *user, VNodeID node_id, uint32 p
        if(node == NULL)
                return;
 
-       if(polygon_id >= node->poly_size || ((uint32 *)node->layer[1].layer)[polygon_id * 4] == -1)
+       if(polygon_id >= node->poly_size || ((uint32 *)node->layer[1].layer)[polygon_id * 4] == ~0u)
                return;
        if(polygon_id < node->polygon_hole)
                node->polygon_hole = polygon_id;
 
-
-       ((uint32 *)node->layer[1].layer)[polygon_id * 4] = -1;
+       ((uint32 *)node->layer[1].layer)[polygon_id * 4] = ~0u;
        count = vs_get_subscript_count(node->layer[1].subscribers);
        for(i = 0; i < count; i++)
        {
index 3200a933a4671060c0e1a012b80114c456ef3652..9e926411542c45ba8d332b42e4a39c258b4d5454 100644 (file)
@@ -64,7 +64,7 @@ void destroy_node_head(VSNodeHead *node)
        }
 }
 
- void callback_send_tag_group_create(void *user, VNodeID node_id, uint16 group_id, char *name)
+ void callback_send_tag_group_create(void *user, VNodeID node_id, uint16 group_id, const char *name)
 {
        VSNodeHead *node;
        unsigned int count, i, j, element;
index 74061d0bbb2bf3a49fc5ecfb39b58466be1d4b29..cee0b8162de62deae2ceb01c9645f766583bfc11 100644 (file)
@@ -335,7 +335,7 @@ static void callback_send_o_transform_pos_real64(void *user, VNodeID node_id, ui
                for(i = 0; i < count; i++)
                {
                        vs_set_subscript_session(node->trans_sub32, i);
-                       verse_send_o_transform_pos_real32(node_id, time_s, time_f, ps, p[0], p[1], p[2], drag);
+                       verse_send_o_transform_pos_real32(node_id, time_s, time_f, ps, p[0], p[1], p[2], (real32) drag);
                }
        }
        vs_reset_subscript_session();
@@ -357,7 +357,7 @@ static void callback_send_o_transform_rot_real64(void *user, VNodeID node_id, ui
                vs_set_subscript_session(node->trans_sub64, i);
                verse_send_o_transform_rot_real64(node_id, time_s, time_f, &node->transform.rotation, speed, accelerate, drag_normal, drag);
        }
-       if((count = vs_get_subscript_count(node->trans_sub32)) >= 0)    /* Anyone listening at 32 bits? */
+       if((count = vs_get_subscript_count(node->trans_sub32)) > 0)     /* Anyone listening at 32 bits? */
        {
                VNQuat32        rt, spd, acc, drn, *p[3];
 
@@ -368,7 +368,7 @@ static void callback_send_o_transform_rot_real64(void *user, VNodeID node_id, ui
                for(i = 0; i < count; i++)
                {
                        vs_set_subscript_session(node->trans_sub32, i);
-                       verse_send_o_transform_rot_real32(node_id, time_s, time_f, &rt, p[0], p[1], p[2], drag);
+                       verse_send_o_transform_rot_real32(node_id, time_s, time_f, &rt, p[0], p[1], p[2], (real32) drag);
                }
        }
        vs_reset_subscript_session();
@@ -394,7 +394,7 @@ static void callback_send_o_transform_scale_real64(void *user, VNodeID node_id,
        for(i = 0; i < count; i++)
        {
                vs_set_subscript_session(node->trans_sub32, i);
-               verse_send_o_transform_scale_real32(node_id, scale_x, scale_y, scale_z);
+               verse_send_o_transform_scale_real32(node_id, (real32) scale_x, (real32) scale_y, (real32) scale_z);
        }
        vs_reset_subscript_session();
 }
@@ -417,10 +417,10 @@ static void callback_send_o_transform_subscribe(void *user, VNodeID node_id, VNR
                tpos[0] = node->transform.position[0];
                tpos[1] = node->transform.position[1];
                tpos[2] = node->transform.position[2];
-               verse_send_o_transform_pos_real32(node_id, time_s, time_f, tpos, NULL, NULL, NULL, 0);
+               verse_send_o_transform_pos_real32(node_id, time_s, time_f, tpos, NULL, NULL, NULL, 0.0f);
                v_quat32_from_quat64(&rot, &node->transform.rotation);
-               verse_send_o_transform_rot_real32(node_id, time_s, time_f, &rot, NULL, NULL, NULL, 0);
-               verse_send_o_transform_scale_real32(node_id, node->transform.scale[0], node->transform.scale[1], node->transform.scale[2]);
+               verse_send_o_transform_rot_real32(node_id, time_s, time_f, &rot, NULL, NULL, NULL, 0.0f);
+               verse_send_o_transform_scale_real32(node_id, (real32) node->transform.scale[0], (real32) node->transform.scale[1], (real32) node->transform.scale[2]);
        }
        else
        {
@@ -551,7 +551,7 @@ static void callback_send_o_method_group_create(void *user, VNodeID node_id, uin
                if(group_id == node->group_count)
                {
                        node->groups = realloc(node->groups, sizeof(*node->groups) * (node->group_count + 16));
-                       for(i = node->group_count; i < node->group_count + 16; i++)
+                       for(i = node->group_count; i < node->group_count + 16u; i++)
                        {
                                node->groups[i].name[0] = 0;
                                node->groups[i].methods = NULL;
@@ -793,7 +793,7 @@ static void callback_send_o_hide(void *user, VNodeID node_id, uint8 hidden)
        unsigned int i, count;
 
        node = (VSNodeObject *)vs_get_node(node_id, V_NT_OBJECT);
-       if(node == NULL && hidden == node->hidden)
+       if(node == NULL || hidden == node->hidden)
                return;
        node->hidden = hidden;
        count = vs_get_subscript_count(node->head.subscribers);
index 0c5a103f7a390a987a13f500c709ef2848dfda94..480ceb1f90036760a6c60a7c44b3c986da097c59 100644 (file)
@@ -20,6 +20,8 @@ static struct {
        VSSubscriptionList *list[V_NT_NUM_TYPES];
 } VSNodeStorage;
 
+extern void    callback_send_tag_group_create(void *user, VNodeID node_id, uint16 group_id, const char *name);
+
 void vs_init_node_storage(void)
 {
        unsigned int i;
index 499908c3a67dd3bd08a5e82fe1cc193ee49d21bb..0a8716dc2609c4e7385e1bda2eda992abc22111a 100644 (file)
@@ -15,7 +15,7 @@ extern VSSubscriptionList * vs_create_subscription_list(void);
 extern void                    vs_destroy_subscription_list(VSSubscriptionList *list);
 extern int                     vs_add_new_subscriptor(VSSubscriptionList *list);
 extern void                    vs_remove_subscriptor(VSSubscriptionList *list);
-extern size_t          vs_get_subscript_count(const VSSubscriptionList *list);
+extern unsigned int            vs_get_subscript_count(const VSSubscriptionList *list);
 extern void                    vs_set_subscript_session(VSSubscriptionList *list, unsigned int session);
 extern void                    vs_reset_subscript_session(void);
 extern uint32          vs_get_avatar(void);