GNOME Bugzilla – Bug 649246
g_output_stream_splice() cannot be used on 32-bit machines for splices bigger than 2GB (uses gssize)
Last modified: 2011-07-06 12:40:00 UTC
g_output_stream_splice_finish() cannot be used on 32-bit machines to do splices bigger than 2GB because it returns a gssize, which will overflow. This is likely not a problem for general reading and writing, because you are unlikely to be dealing with buffers such a size, but when splicing between a file and a socket, you could be reading for a while and easily wrap past 2GB.
applies to sync version too so what are you using splice for, and do you find the lack of progress notification to be inconvenient? I was wondering recently if these functions should look more like g_file_copy{,async}()
I am splicing from a socket to a file. File transfers in Telepathy are sent between the client and the Connection Manager via a socket and then from the CM to the network. When sending or receiving a file, you are given a socket address which you connect to and transfer the file in or out of. In my specific example I don't need progress notification, because I'm receiving it from the CM, but there are circumstances in which it could be useful.
Created attachment 189433 [details] [review] g_output_stream_splice: deal with overflow On 32-bit machines in particular, bytes_written may overflow a gssize. Notice when that happens and just return G_MAXSSIZE instead. ==== other options would be (a) stop at G_MAXSSIZE and return that, or (b) stop at G_MAXSSIZE and return -1/G_IO_ERROR_FAILED. None is great, but a better solution needs new API.
Review of attachment 189433 [details] [review]: Looks OK to me.
Attachment 189433 [details] pushed as 37ab5ce - g_output_stream_splice: deal with overflow