obexapp-1.4
Maksim Yevmenkin
maksim.yevmenkin at savvis.net
Sat Dec 25 15:46:29 PST 2004
Hello Guido,
> Hello! I'm updating the port for obexapp, and was testing the build on
> an AMD64 machine I recently got an account on. While it builds fine on
> i386, after adding the changes needed for the new iconv dependancy, it's
> generating these warnings on amd64:
[...]
> and the binary seems not to work properly. Unlickyly this machine does
> not have any bluetooth hardware, so my only tedst is launching it and
> checking if the binary reacts properly...if should react like this, if
> i'm right:
>
> mad at wedge:~ [0]> obexapp
> obexapp: Must specify server BD_ADDR
>
> BTW I'll file a PR leaving the BREOKEN flag in place for not i386 shortly.
thanks for reporting this. please try the attacted patch. if it works,
then i will include it in obexapp-1.4.3.
thanks,
max
-------------- next part --------------
Index: client.c
===================================================================
RCS file: /usr/local/cvs/ports/obexapp/client.c,v
retrieving revision 1.13
diff -u -r1.13 client.c
--- client.c 23 Dec 2004 23:09:48 -0000 1.13
+++ client.c 25 Dec 2004 21:47:54 -0000
@@ -36,6 +36,7 @@
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
+#include <inttypes.h>
#include <libgen.h>
#include <limits.h>
#include <obex.h>
@@ -745,7 +746,7 @@
goto done;
}
- syslog(LOG_INFO, "%s(): Putting object %s as %s, size %lld",
+ syslog(LOG_INFO, "%s(): Putting object %s as %s, size %" PRId64,
__func__, local, remote, st.st_size);
hv.bq4 = st.st_size;
Index: server.c
===================================================================
RCS file: /usr/local/cvs/ports/obexapp/server.c,v
retrieving revision 1.6
diff -u -r1.6 server.c
--- server.c 23 Dec 2004 23:09:49 -0000 1.6
+++ server.c 25 Dec 2004 21:48:45 -0000
@@ -37,6 +37,7 @@
#include <fcntl.h>
#include <dirent.h>
#include <grp.h>
+#include <inttypes.h>
#include <limits.h>
#include <obex.h>
#include <pwd.h>
@@ -835,7 +836,7 @@
ls = NULL;
asprintf(&ls,
-" <%s name=\"%s\" size=\"%lld\" " \
+" <%s name=\"%s\" size=\"%" PRId64 "\" " \
"owner=\"%s\" group=\"%s\" " \
"user-perm=\"%s\" group-perm=\"%s\" other-perm=\"%s\" " \
"created=\"%04d%02d%02dT%02d%02d%02dZ\" " \
Index: util.c
===================================================================
RCS file: /usr/local/cvs/ports/obexapp/util.c,v
retrieving revision 1.6
diff -u -r1.6 util.c
--- util.c 23 Dec 2004 23:09:49 -0000 1.6
+++ util.c 25 Dec 2004 22:00:43 -0000
@@ -154,8 +154,8 @@
*/
int
-obexapp_util_locale_from_utf8(char const *src, int srclen,
- char *dst, int dstlen)
+obexapp_util_locale_from_utf8(char const *src, size_t srclen,
+ char *dst, size_t dstlen)
{
char const *s = src;
char *d = dst;
@@ -186,7 +186,8 @@
*/
int
-obexapp_util_locale_to_utf8(char const *src, int srclen, char *dst, int dstlen)
+obexapp_util_locale_to_utf8(char const *src, size_t srclen,
+ char *dst, size_t dstlen)
{
char const *s = src;
char *d = dst;
@@ -217,8 +218,8 @@
*/
int
-obexapp_util_locale_from_utf16be(char const *src, int srclen,
- char *dst, int dstlen)
+obexapp_util_locale_from_utf16be(char const *src, size_t srclen,
+ char *dst, size_t dstlen)
{
char const *s = src;
char *d = dst;
@@ -242,12 +243,12 @@
*d = '\0';
if (utf16) {
+ if (dstlen == 0)
+ return (-1); /* buffer is too short */
+
d ++;
dstlen --;
- if (dstlen <= 0)
- return (-1); /* buffer is too short */
-
*d = '\0';
}
@@ -259,8 +260,8 @@
*/
int
-obexapp_util_locale_to_utf16be(char const *src, int srclen,
- char *dst, int dstlen)
+obexapp_util_locale_to_utf16be(char const *src, size_t srclen,
+ char *dst, size_t dstlen)
{
char const *s = src;
char *d = dst;
@@ -282,12 +283,13 @@
} while (n > 0);
*d = '\0';
- d ++;
- dstlen --;
- if (dstlen <= 0)
+ if (dstlen == 0)
return (-1); /* buffer is too short */
+ d ++;
+ dstlen --;
+
*d = '\0';
return (0);
Index: util.h
===================================================================
RCS file: /usr/local/cvs/ports/obexapp/util.h,v
retrieving revision 1.4
diff -u -r1.4 util.h
--- util.h 23 Dec 2004 23:09:49 -0000 1.4
+++ util.h 25 Dec 2004 21:58:43 -0000
@@ -34,10 +34,10 @@
int obexapp_util_locale_init(void);
void obexapp_util_locale_fini(void);
-int obexapp_util_locale_from_utf8(char const *src, int srclen, char *dst, int dstlen);
-int obexapp_util_locale_to_utf8(char const *src, int srclen, char *dst, int dstlen);
-int obexapp_util_locale_from_utf16be(char const *src, int srclen, char *dst, int dstlen);
-int obexapp_util_locale_to_utf16be(char const *src, int srclen, char *dst, int dstlen);
+int obexapp_util_locale_from_utf8(char const *src, size_t srclen, char *dst, size_t dstlen);
+int obexapp_util_locale_to_utf8(char const *src, size_t srclen, char *dst, size_t dstlen);
+int obexapp_util_locale_from_utf16be(char const *src, size_t srclen, char *dst, size_t dstlen);
+int obexapp_util_locale_to_utf16be(char const *src, size_t srclen, char *dst, size_t dstlen);
int obexapp_util_read(int fd, char *buffer, int buffer_length);
int obexapp_util_write(int fd, char const *buffer, int buffer_length);
More information about the freebsd-bluetooth
mailing list