The dc_iostream_{read,write}() implementation had multiple issues:
- it would return DC_STATUS_SUCCESS even if no iostream implementation
existed.
Yes, it would also return a zero "actual" bytes, but most backends
don't even pass an "actual" pointer, so returning success was still
completely insane.
This one probably didn't matter, because all iostreams should have
read and write members, but the return value was completely wrong if
that ever were to happen.
- If the user passed in a NULL 'actual' pointer, the wrapper would
ignore that, and pass in its own pointer instead, in order to know
how many bytes to print for the debug message.
But that means that the low-level read/write functions cannot know
whether the user actually is able to handle a partial read or not.
This one _definitely_ matters, because some protocols need to have a
buffer for the whole incoming packet, but packerts may not always be
full-size. The low-level protocol needs to know whether to wait for
further packets (in order to fill the buffer) or to just return the
partial data.
This fixes these issues. If the user passes in a NULL actual pointer
(indicating that it needs all-or-nothing and is not ready to handle a
partial success), just loop over the IO until the buffer is fully
exhausted.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Overview ======== Libdivecomputer is a cross-platform and open source library for communication with dive computers from various manufacturers. The official web site is: http://www.libdivecomputer.org/ The sourceforge project page is: http://sourceforge.net/projects/libdivecomputer/ Installation ============ On UNIX-like systems (including Linux, Mac OS X, MinGW), use the autotools based build system. Run the following commands from the top directory (containing this file) to configure, build and install the library and utilities: $ ./configure $ make $ make install If you downloaded the libdivecomputer source code directly from the git source code repository, then you need to create the configure script as the first step: $ autoreconf --install To uninstall libdivecomputer again, run: $ make uninstall Support ======= Please send bug reports, feedback or questions to the mailing list: http://libdivecomputer.org/cgi-bin/mailman/listinfo/devel or contact me directly: jef@libdivecomputer.org License ======= Libdivecomputer is free software, released under the terms of the GNU Lesser General Public License (LGPL). You can find a copy of the license in the file COPYING.
Description
Languages
C
98.3%
M4
1.2%
Makefile
0.5%