From: <br...@us...> - 2008-08-12 10:42:56
|
Revision: 3502 http://openvrml.svn.sourceforge.net/openvrml/?rev=3502&view=rev Author: braden Date: 2008-08-12 10:43:05 +0000 (Tue, 12 Aug 2008) Log Message: ----------- Consistently use size_t when inserting stream handles into IOStreams. ptrdiff_t is signed; so mixing this with size_t can lead to badness. Modified Paths: -------------- trunk/ChangeLog trunk/mozilla-plugin/src/openvrml.cpp trunk/src/openvrml-player/player.cpp Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2008-08-12 10:29:15 UTC (rev 3501) +++ trunk/ChangeLog 2008-08-12 10:43:05 UTC (rev 3502) @@ -1,5 +1,29 @@ 2008-08-12 Braden McDaniel <br...@en...> + Consistently use size_t when inserting stream handles into + IOStreams. ptrdiff_t is signed; so mixing this with size_t can + lead to badness. + + * src/openvrml-player/player.cpp + (openvrml_player_curl_source_callback(gpointer)): Cast the + easy_handle to size_t instead of ptrdiff_t before inserting into + the command stream. + (openvrml_player_curl_write(void *, size_t, size_t, void *)): Cast + the easy_handle to size_t instead of ptrdiff_t before inserting + into the command stream. + * mozilla-plugin/src/openvrml.cpp + (NPP_NewStream(NPP, NPMIMEType, NPStream *, NPBool, uint16 *)): + Cast the stream handle to size_t instead of ptrdiff_t before + inserting into the command stream. + (NPP_DestroyStream(NPP, NPStream *, NPError)): Cast the stream + handle to size_t instead of ptrdiff_t before inserting into the + command stream. + (NPP_Write(NPP, NPStream *, int32, int32, void *)): Cast the stream + handle to size_t instead of ptrdiff_t before inserting into the + command stream. + +2008-08-12 Braden McDaniel <br...@en...> + Use G_DEFINE_TYPE for custom GTK+ widgets. * src/openvrml-xembed/gtkvrmlbrowser.cpp Modified: trunk/mozilla-plugin/src/openvrml.cpp =================================================================== --- trunk/mozilla-plugin/src/openvrml.cpp 2008-08-12 10:29:15 UTC (rev 3501) +++ trunk/mozilla-plugin/src/openvrml.cpp 2008-08-12 10:43:05 UTC (rev 3502) @@ -439,7 +439,7 @@ *static_cast<plugin_instance *>(instance->pdata); std::ostringstream command; - command << "new-stream " << ptrdiff_t(stream) << ' ' << type << ' ' + command << "new-stream " << size_t(stream) << ' ' << type << ' ' << stream->url << '\n'; const ssize_t bytes_written = pluginInstance.write_command(command.str()); return (bytes_written < 0) @@ -457,7 +457,7 @@ *static_cast<plugin_instance *>(instance->pdata); std::ostringstream command; - command << "destroy-stream " << ptrdiff_t(stream) << '\n'; + command << "destroy-stream " << size_t(stream) << '\n'; const ssize_t bytes_written = pluginInstance.write_command(command.str()); return (bytes_written < 0) ? NPERR_GENERIC_ERROR @@ -500,7 +500,7 @@ *static_cast<plugin_instance *>(instance->pdata); std::ostringstream command; - command << "write " << ptrdiff_t(stream) << ' ' << ' ' << len << '\n'; + command << "write " << size_t(stream) << ' ' << ' ' << len << '\n'; for (int32 i = 0; i < len; ++i) { command.put(static_cast<char *>(buffer)[i]); } Modified: trunk/src/openvrml-player/player.cpp =================================================================== --- trunk/src/openvrml-player/player.cpp 2008-08-12 10:29:15 UTC (rev 3501) +++ trunk/src/openvrml-player/player.cpp 2008-08-12 10:43:05 UTC (rev 3502) @@ -669,7 +669,7 @@ // if (entry->second.initialized()) { std::ostringstream command; - command << "destroy-stream " << ptrdiff_t(msg->easy_handle) + command << "destroy-stream " << size_t(msg->easy_handle) << '\n'; const ssize_t bytes_written = ::write_command(command.str()); g_return_val_if_fail( @@ -882,7 +882,7 @@ std::ostringstream new_stream_command; new_stream_command - << "new-stream " << ptrdiff_t(stream_data.handle()) << ' ' + << "new-stream " << size_t(stream_data.handle()) << ' ' << (type ? type : "application/octet-stream") << ' ' << stream_data.url() << '\n'; ::write_command(new_stream_command.str()); @@ -890,7 +890,7 @@ } std::ostringstream write_command; - write_command << "write " << ptrdiff_t(stream_data.handle()) << ' ' + write_command << "write " << size_t(stream_data.handle()) << ' ' << size * nmemb << '\n'; const char * data = static_cast<char *>(ptr); for (; data != static_cast<char *>(ptr) + size * nmemb; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |