Hi,

obexapp uses 'int' for return of read/write functions, but they return
ssize_t which may not be the same.. also int for buffer size which should
be size_t. patch attached fixes this to avoid some complier warnings..

regards,
iain
--- util.c.orig 2010-01-08 18:31:22.000000000 +0000
+++ util.c      2010-01-08 19:51:02.000000000 +0000
@@ -288,14 +288,14 @@ obexapp_util_locale_to_utf16be(char cons
  * Read upto buffer_length bytes into the buffer from the file descriptor fd
  */
 
-int
-obexapp_util_read(int fd, uint8_t *buffer, int buffer_length)
+ssize_t
+obexapp_util_read(int fd, uint8_t *buffer, size_t buffer_length)
 {
-       int     length;
+       ssize_t length;
 
 again:
        length = read(fd, buffer, buffer_length);
-       if (length < 0 && errno == EINTR)
+       if (length == -1 && errno == EINTR)
                goto again;
 
        return (length);
@@ -305,15 +305,16 @@ again:
  * Write buffer_length bytes from the buffer to the descriptor fd
  */
 
-int
-obexapp_util_write(int fd, uint8_t const *buffer, int buffer_length)
+ssize_t
+obexapp_util_write(int fd, uint8_t const *buffer, size_t buffer_length)
 {
-       int     wrote, size;
+       ssize_t size;
+       size_t wrote;
 
        wrote = 0;
        while (wrote < buffer_length) {
                size = write(fd, buffer + wrote, buffer_length - wrote);
-               if (size < 0) {
+               if (size == -1) {
                        if (errno == EINTR)
                                continue;
 
--- util.h.orig 2010-01-08 18:31:22.000000000 +0000
+++ util.h      2010-01-08 19:51:22.000000000 +0000
@@ -39,8 +39,8 @@ int obexapp_util_locale_to_utf8(char con
 int obexapp_util_locale_from_utf16be(uint8_t const *src, size_t srclen, char 
*dst, size_t dstlen);
 int obexapp_util_locale_to_utf16be(char const *src, size_t srclen, uint8_t 
*dst, size_t dstlen);
 
-int obexapp_util_read(int fd, uint8_t *buffer, int buffer_length);
-int obexapp_util_write(int fd, uint8_t const *buffer, int buffer_length);
+ssize_t obexapp_util_read(int fd, uint8_t *buffer, size_t buffer_length);
+ssize_t obexapp_util_write(int fd, uint8_t const *buffer, size_t 
buffer_length);
 int obexapp_util_display_folder_listing(char const *ls);
 char * obexapp_util_gets(char const *prompt, char *buffer, int buffer_size);
 char * obexapp_util_strsep(char **sp, char const *delim);
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bluetooth
To unsubscribe, send any mail to "[email protected]"

Reply via email to