pilot-link/pilot-link-0.12.5-compiler_warnings.patch
Peter Schiffer ebfc4acddc - related: #757011
cleaned patch
2012-05-30 17:31:43 +02:00

3068 lines
107 KiB
Diff

diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/bindings/Perl/Pilot.xs pilot-link-0.12.5/bindings/Perl/Pilot.xs
--- pilot-link-0.12.5-old/bindings/Perl/Pilot.xs 2011-12-19 18:30:45.000000000 +0100
+++ pilot-link-0.12.5/bindings/Perl/Pilot.xs 2011-12-19 17:51:55.364828217 +0100
@@ -642,7 +642,7 @@ Unpack(record)
STRLEN len;
int i;
AV * e;
- HV * ret, *h;
+ HV * ret;
struct Appointment a;
char *str;
@@ -740,7 +740,6 @@ Pack(record)
{
SV ** s;
HV * h;
- long advance;
struct Appointment a;
if (!SvOK(record) || !SvRV(record) || (SvTYPE(h=(HV*)SvRV(record))!=SVt_PVHV))
@@ -881,9 +880,7 @@ UnpackAppBlock(record)
CODE:
{
STRLEN len;
- AV * e;
HV * ret;
- int i;
struct AppointmentAppInfo a;
if (SvOK(record) && SvRV(record) && (SvTYPE(SvRV(record)) == SVt_PVHV)) {
@@ -917,11 +914,9 @@ PackAppBlock(record)
SV * record
CODE:
{
- int i;
int len;
SV ** s;
HV * h;
- AV * av;
struct AppointmentAppInfo a;
if (!SvRV(record) || (SvTYPE(h=(HV*)SvRV(record))!=SVt_PVHV))
@@ -953,8 +948,6 @@ Unpack(record)
CODE:
{
STRLEN len;
- int i;
- AV * e;
HV * ret;
struct ToDo a;
char *str;
@@ -1049,9 +1042,7 @@ UnpackAppBlock(record)
CODE:
{
STRLEN len;
- AV * e;
HV * ret;
- int i;
struct ToDoAppInfo a;
if (SvOK(record) && SvRV(record) && (SvTYPE(SvRV(record)) == SVt_PVHV)) {
@@ -1086,11 +1077,9 @@ PackAppBlock(record)
SV * record
CODE:
{
- int i;
int len;
SV ** s;
HV * h;
- AV * av;
struct ToDoAppInfo a;
if (!SvRV(record) || (SvTYPE(h=(HV*)SvRV(record))!=SVt_PVHV))
@@ -1342,8 +1331,6 @@ Unpack(record)
CODE:
{
STRLEN len;
- int i;
- AV * e;
HV * ret;
struct Memo a;
char *str;
@@ -1422,9 +1409,7 @@ UnpackAppBlock(record)
CODE:
{
STRLEN len;
- AV * e;
HV * ret;
- int i;
struct MemoAppInfo a;
if (SvOK(record) && SvRV(record) && (SvTYPE(SvRV(record)) == SVt_PVHV)) {
@@ -1457,11 +1442,9 @@ PackAppBlock(record)
SV * record
CODE:
{
- int i;
int len;
SV ** s;
HV * h;
- AV * av;
struct MemoAppInfo a;
if (!SvRV(record) || (SvTYPE(h=(HV*)SvRV(record))!=SVt_PVHV))
@@ -1494,7 +1477,6 @@ Unpack(record)
CODE:
{
STRLEN len;
- int i;
HV * ret;
struct Expense e;
@@ -1665,15 +1647,15 @@ PackAppBlock(record)
for(i=0;i<4;i++) {
HV * hv;
if ((s=av_fetch(av, i, 0)) && SvOK(*s) && SvRV(*s) && (SvTYPE(hv=(HV*)SvRV(*s))==SVt_PVHV)) {
- if (s = hv_fetch(hv, "name", 4, 0)) {
+ if ((s = hv_fetch(hv, "name", 4, 0))) {
strncpy(e.currencies[i].name, SvPV(*s, PL_na), 16);
e.currencies[i].name[15] = 0;
}
- if (s = hv_fetch(hv, "symbol", 6, 0)) {
+ if ((s = hv_fetch(hv, "symbol", 6, 0))) {
strncpy(e.currencies[i].symbol, SvPV(*s, PL_na), 4);
e.currencies[i].symbol[3] = 0;
}
- if (s = hv_fetch(hv, "rate", 4, 0)) {
+ if ((s = hv_fetch(hv, "rate", 4, 0))) {
strncpy(e.currencies[i].rate, SvPV(*s, PL_na), 8);
e.currencies[i].rate[7] = 0;
}
@@ -1794,8 +1776,6 @@ Unpack(record)
CODE:
{
STRLEN len;
- int i;
- AV * e;
HV * ret;
struct Mail a;
@@ -1897,9 +1877,7 @@ UnpackAppBlock(record)
CODE:
{
STRLEN len;
- AV * e;
HV * ret;
- int i;
struct MailAppInfo a;
if (SvOK(record) && SvRV(record) && (SvTYPE(SvRV(record)) == SVt_PVHV)) {
@@ -1935,11 +1913,9 @@ PackAppBlock(record)
SV * record
CODE:
{
- int i;
int len;
SV ** s;
HV * h;
- AV * av;
struct MailAppInfo a;
if (!SvRV(record) || (SvTYPE(h=(HV*)SvRV(record))!=SVt_PVHV))
@@ -1973,9 +1949,7 @@ UnpackSyncPref(record)
CODE:
{
STRLEN len;
- AV * e;
HV * ret;
- int i;
struct MailSyncPref a;
if (SvOK(record) && SvRV(record) && (SvTYPE(SvRV(record)) == SVt_PVHV)) {
@@ -2017,11 +1991,9 @@ PackSyncPref(record, id)
int id
CODE:
{
- int i;
int len;
SV ** s;
HV * h;
- AV * av;
struct MailSyncPref a;
if (!SvRV(record) || (SvTYPE(h=(HV*)SvRV(record))!=SVt_PVHV))
@@ -2057,9 +2029,7 @@ UnpackSignaturePref(record)
CODE:
{
STRLEN len;
- AV * e;
HV * ret;
- int i;
struct MailSignaturePref a;
if (SvOK(record) && SvRV(record) && (SvTYPE(SvRV(record)) == SVt_PVHV)) {
@@ -2092,11 +2062,9 @@ PackSignaturePref(record, id)
int id
CODE:
{
- int i;
int len;
SV ** s;
HV * h;
- AV * av;
struct MailSignaturePref a;
if (!SvRV(record) || (SvTYPE(h=(HV*)SvRV(record))!=SVt_PVHV))
@@ -2599,7 +2567,6 @@ getRecordIDs(self, sort=0)
int start;
int count;
int i;
- AV * list = newAV();
start = 0;
for(;;) {
@@ -2784,7 +2751,6 @@ getPref(self, id=0, backup=1)
Char4 creator;
int version, result;
size_t len;
- SV * c, n, v;
int r;
if (self->Class) {
int count;
@@ -2846,7 +2812,7 @@ setPrefRaw(self, data, number, version,
{
STRLEN len;
Char4 creator;
- int version, result;
+ int result;
void * buf;
PackRaw;
buf = SvPV(data, len);
@@ -3063,8 +3029,6 @@ delete(self, name, cardno=0)
int cardno
CODE:
{
- UserInfo info;
- int result;
RETVAL = dlp_DeleteDB(self->socket, cardno, name);
}
OUTPUT:
@@ -3113,7 +3077,6 @@ open(self, name, mode=0, cardno=0)
self->errnop = result;
RETVAL = &PL_sv_undef;
} else {
- int type;
PDA__Pilot__DLP__DB * x = malloc(sizeof(PDA__Pilot__DLP__DB));
SV * sv = newSViv((IV)(void*)x);
SvREFCNT_inc(ST(0));
@@ -3205,7 +3168,6 @@ getPref(self, creator, id=0, backup=1)
{
int version, result;
size_t len;
- SV * c, n, v;
result = dlp_ReadAppPreference(self->socket, creator, id, backup, 0xFFFF, mybuf, &len, &version);
ReturnReadPref(mybuf, len);
}
@@ -3245,7 +3207,7 @@ setPrefRaw(self, data, creator, number,
PPCODE:
{
STRLEN len;
- int version, result;
+ int result;
void * buf;
PackRaw;
buf = SvPV(data, len);
@@ -3323,8 +3285,6 @@ getDBInfo(self, start, RAM=1, ROM=0, car
int cardno
CODE:
{
- struct DBInfo info;
-
int where = (RAM ? dlpDBListRAM : 0) | (ROM ? dlpDBListROM : 0);
int result = dlp_ReadDBList(self->socket, cardno, where, start, &pibuf);
pack_dbinfo(RETVAL,(*(struct DBInfo *)(pibuf.data)), result);
@@ -3388,7 +3348,6 @@ getROMToken(self,token)
PPCODE:
{
char buffer[50];
- long long_token;
size_t size;
int result;
@@ -3592,7 +3551,7 @@ getRecords(self)
PDA::Pilot::File *self
CODE:
{
- int len, result = 0;
+ int len;
pi_file_get_entries(self->pf, &len);
RETVAL = newSViv((int)len);
}
@@ -3715,7 +3674,6 @@ addResource(self, data, type, id)
CODE:
{
STRLEN len;
- int result;
void * buf;
PackResource;
buf = SvPV(data, len);
@@ -3733,7 +3691,6 @@ addRecord(self, data)
STRLEN len;
unsigned long id;
int attr, category;
- int result;
void * buf;
PackRecord;
buf = SvPV(data, len);
@@ -3752,7 +3709,6 @@ addRecordRaw(self, data, uid, attr, cate
CODE:
{
STRLEN len;
- int result;
void * buf;
PackRaw;
buf = SvPV(data, len);
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/include/pi-debug.h pilot-link-0.12.5/include/pi-debug.h
--- pilot-link-0.12.5-old/include/pi-debug.h 2008-11-06 11:45:33.000000000 +0100
+++ pilot-link-0.12.5/include/pi-debug.h 2011-12-12 16:04:53.892605487 +0100
@@ -57,10 +57,10 @@ extern void pi_debug_set_file PI_ARGS((c
extern void pi_log PI_ARGS((int type, int level, PI_CONST char *format, ...));
extern void pi_dumpline
- PI_ARGS((PI_CONST char *buf, size_t len, unsigned int addr));
+ PI_ARGS((PI_CONST unsigned char *buf, size_t len, unsigned int addr));
extern void pi_dumpdata
- PI_ARGS((PI_CONST char *buf, size_t len));
+ PI_ARGS((PI_CONST unsigned char *buf, size_t len));
#ifdef PI_DEBUG
#define ASSERT(expr) \
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/include/pi-header.h pilot-link-0.12.5/include/pi-header.h
--- pilot-link-0.12.5-old/include/pi-header.h 2006-10-17 15:24:07.000000000 +0200
+++ pilot-link-0.12.5/include/pi-header.h 2011-12-19 16:44:54.555489570 +0100
@@ -25,7 +25,7 @@
#ifndef SWIG
/* Print the version splash */
-void print_splash(const char *progname) PI_DEPRECATED;
+void print_splash(const char *progname);
/* Connect to the Palm device */
int pilot_connect(const char *port) PI_DEPRECATED;
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/include/pi-md5.h pilot-link-0.12.5/include/pi-md5.h
--- pilot-link-0.12.5-old/include/pi-md5.h 2010-02-07 04:42:37.000000000 +0100
+++ pilot-link-0.12.5/include/pi-md5.h 2011-12-14 17:40:52.551602121 +0100
@@ -23,7 +23,7 @@
#if HAVE_STDINT_H
#include <stdint.h>
#endif
-#ifdef HAVE_INTTYPES_H || HAVE_STDINT_H
+#if defined(HAVE_INTTYPES_H) || defined(HAVE_STDINT_H)
#define UINT8 uint8_t
#define UINT32 uint32_t
#else
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/include/pi-md5.h.in pilot-link-0.12.5/include/pi-md5.h.in
--- pilot-link-0.12.5-old/include/pi-md5.h.in 2010-02-07 04:42:49.000000000 +0100
+++ pilot-link-0.12.5/include/pi-md5.h.in 2011-12-20 16:40:09.826454843 +0100
@@ -22,7 +22,7 @@
#if HAVE_STDINT_H
#include <stdint.h>
#endif
-#ifdef HAVE_INTTYPES_H || HAVE_STDINT_H
+#if defined(HAVE_INTTYPES_H) || defined(HAVE_STDINT_H)
#define UINT8 uint8_t
#define UINT32 uint32_t
#else
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/include/pi-source.h pilot-link-0.12.5/include/pi-source.h
--- pilot-link-0.12.5-old/include/pi-source.h 2006-10-17 15:24:07.000000000 +0200
+++ pilot-link-0.12.5/include/pi-source.h 2011-12-14 13:03:26.571720585 +0100
@@ -145,10 +145,10 @@ extern "C" {
pi_dumpline() and pi_dumpdata() */
extern void dumpline
- PI_ARGS((PI_CONST char *buf, size_t len, unsigned int addr)) PI_DEPRECATED;
+ PI_ARGS((PI_CONST unsigned char *buf, size_t len, unsigned int addr)) PI_DEPRECATED;
extern void dumpdata
- PI_ARGS((PI_CONST char *buf, size_t len)) PI_DEPRECATED;
+ PI_ARGS((PI_CONST unsigned char *buf, size_t len)) PI_DEPRECATED;
#ifdef __cplusplus
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/include/pi-util.h pilot-link-0.12.5/include/pi-util.h
--- pilot-link-0.12.5-old/include/pi-util.h 2006-10-17 15:24:07.000000000 +0200
+++ pilot-link-0.12.5/include/pi-util.h 2011-12-07 21:25:14.513131657 +0100
@@ -64,19 +64,19 @@ extern "C" {
PI_ARGS((int *establishrate, int *establishhighrate));
extern int convert_ToPilotChar_WithCharset
- PI_ARGS((const char *charset, const char *text, int bytes,
+ PI_ARGS((const char *charset, char *text, int bytes,
char **ptext, const char *pi_charset));
extern int convert_ToPilotChar
- PI_ARGS((const char *charset, const char *text, int bytes,
+ PI_ARGS((const char *charset, char *text, int bytes,
char **ptext));
extern int convert_FromPilotChar_WithCharset
- PI_ARGS((const char *charset, const char *ptext, int bytes,
+ PI_ARGS((const char *charset, char *ptext, int bytes,
char **text, const char *pi_charset));
extern int convert_FromPilotChar
- PI_ARGS((const char *charset, const char *ptext, int bytes,
+ PI_ARGS((const char *charset, char *ptext, int bytes,
char **text));
/** @brief Convert a milliseconds timeout value to an absolute timespec
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/libpisock/address.c pilot-link-0.12.5/libpisock/address.c
--- pilot-link-0.12.5-old/libpisock/address.c 2007-01-15 01:29:59.000000000 +0100
+++ pilot-link-0.12.5/libpisock/address.c 2011-12-07 20:24:45.951236249 +0100
@@ -209,7 +209,7 @@ unpack_AddressAppInfo(AddressAppInfo_t *
size_t i,
destlen = 4 + 16 * 22 + 2 + 2;
- unsigned char *start = record;
+ const unsigned char *start = record;
unsigned long r;
ai->type = address_v1;
@@ -276,11 +276,6 @@ pack_AddressAppInfo(const AddressAppInfo
pos += i;
len -= i;
- for (i = 3; i < 8; i++)
- strcpy(ai->phoneLabels[i - 3], ai->labels[i]);
- for (i = 19; i < 22; i++)
- strcpy(ai->phoneLabels[i - 19 + 5], ai->labels[i]);
-
memset(pos, 0, destlen);
r = 0;
@@ -297,11 +292,6 @@ pack_AddressAppInfo(const AddressAppInfo
set_byte(pos, ai->sortByCompany);
pos += 2;
- for (i = 3; i < 8; i++)
- strcpy(ai->phoneLabels[i - 3], ai->labels[i]);
- for (i = 19; i < 22; i++)
- strcpy(ai->phoneLabels[i - 19 + 5], ai->labels[i]);
-
return (pos - record);
}
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/libpisock/bluetooth.c pilot-link-0.12.5/libpisock/bluetooth.c
--- pilot-link-0.12.5-old/libpisock/bluetooth.c 2008-05-03 22:21:22.000000000 +0200
+++ pilot-link-0.12.5/libpisock/bluetooth.c 2012-01-04 19:54:41.494267929 +0100
@@ -286,14 +286,11 @@ static pi_protocol_t*
pi_bluetooth_protocol (pi_device_t *dev)
{
pi_protocol_t *prot;
- struct pi_bluetooth_data *data;
ASSERT (dev != NULL);
prot = (pi_protocol_t *) malloc(sizeof (pi_protocol_t));
- data = (struct pi_bluetooth_data *)(dev->data);
-
if (prot != NULL) {
prot->level = PI_LEVEL_DEV;
prot->dup = pi_bluetooth_protocol_dup;
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/libpisock/calendar.c pilot-link-0.12.5/libpisock/calendar.c
--- pilot-link-0.12.5-old/libpisock/calendar.c 2010-02-07 03:21:18.000000000 +0100
+++ pilot-link-0.12.5/libpisock/calendar.c 2012-01-13 16:07:09.096320373 +0100
@@ -461,7 +461,7 @@ unpack_CalendarEvent(CalendarEvent_t *a,
}
}
if(p2 - buf->data < buf->used) {
- printf("Extra data found %ld bytes\n", (buf->used - (p2 - buf->data)));
+ printf("Extra data found %zu bytes\n", (buf->used - (p2 - buf->data)));
return -1;
}
} else {
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/libpisock/darwinusb.c pilot-link-0.12.5/libpisock/darwinusb.c
--- pilot-link-0.12.5-old/libpisock/darwinusb.c 2007-01-15 01:29:59.000000000 +0100
+++ pilot-link-0.12.5/libpisock/darwinusb.c 2011-12-13 16:25:22.825510660 +0100
@@ -1096,7 +1096,7 @@ find_interfaces(usb_connection_t *c,
{
/* got something! */
LOG((PI_DBG_DEV, PI_DBG_LVL_DEBUG, "darwinusb: got %d bytes there!\n", (int)size));
- CHECK(PI_DBG_DEV, PI_DBG_LVL_DEBUG, pi_dumpdata(c->read_buffer, size));
+ CHECK(PI_DBG_DEV, PI_DBG_LVL_DEBUG, pi_dumpdata((unsigned char *)c->read_buffer, size));
if (!memcmp(c->read_buffer, "VNDR10", 6))
{
/* VNDR version 1.0 */
@@ -1235,7 +1235,7 @@ read_visor_connection_information (IOUSB
}
else
{
- CHECK(PI_DBG_DEV, PI_DBG_LVL_DEBUG, pi_dumpdata((const char *)&ci, sizeof(ci)));
+ CHECK(PI_DBG_DEV, PI_DBG_LVL_DEBUG, pi_dumpdata((unsigned char *)&ci, sizeof(ci)));
ci.num_ports = CFSwapInt16LittleToHost(ci.num_ports); /* number of ports is little-endian */
if (ci.num_ports > 8)
ci.num_ports = 8;
@@ -1280,7 +1280,7 @@ decode_generic_connection_information(pa
{
int i;
- CHECK(PI_DBG_DEV, PI_DBG_LVL_DEBUG, pi_dumpdata((const char *)ci, sizeof(palm_ext_connection_info)));
+ CHECK(PI_DBG_DEV, PI_DBG_LVL_DEBUG, pi_dumpdata((unsigned char *)ci, sizeof(palm_ext_connection_info)));
LOG((PI_DBG_DEV, PI_DBG_LVL_DEBUG, "darwinusb: decode_generic_connection_information num_ports=%d, endpoint_numbers_different=%d\n", ci->num_ports, ci->endpoint_numbers_different));
for (i=0; i < ci->num_ports; i++)
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/libpisock/debug.c pilot-link-0.12.5/libpisock/debug.c
--- pilot-link-0.12.5-old/libpisock/debug.c 2006-10-12 16:21:22.000000000 +0200
+++ pilot-link-0.12.5/libpisock/debug.c 2011-12-14 13:03:16.364897382 +0100
@@ -173,7 +173,7 @@ pi_log (int type, int level, const char
}
void
-pi_dumpline(const char *buf, size_t len, unsigned int addr)
+pi_dumpline(const unsigned char *buf, size_t len, unsigned int addr)
{
unsigned int i;
int offset;
@@ -212,14 +212,14 @@ pi_dumpline(const char *buf, size_t len,
}
void
-dumpline(const char *buf, size_t len, unsigned int addr)
+dumpline(const unsigned char *buf, size_t len, unsigned int addr)
{
/* this function will be removed in 0.13. Use pi_dumpline() instead. */
pi_dumpline(buf, len, addr);
}
void
-pi_dumpdata(const char *buf, size_t len)
+pi_dumpdata(const unsigned char *buf, size_t len)
{
unsigned int i;
@@ -228,7 +228,7 @@ pi_dumpdata(const char *buf, size_t len)
}
void
-dumpdata(const char *buf, size_t len)
+dumpdata(const unsigned char *buf, size_t len)
{
/* this function will be removed in 0.13. Use pi_dumpdata() instead */
pi_dumpdata(buf, len);
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/libpisock/dlp.c pilot-link-0.12.5/libpisock/dlp.c
--- pilot-link-0.12.5-old/libpisock/dlp.c 2011-12-19 18:30:44.000000000 +0100
+++ pilot-link-0.12.5/libpisock/dlp.c 2011-12-13 18:12:50.807265809 +0100
@@ -173,7 +173,7 @@ static void record_dump (unsigned long r
(flags & dlpRecAttrArchived) ? " Archive" : "",
(!flags) ? " None" : "",
flags, data_len));
- pi_dumpdata(data, (size_t)data_len);
+ pi_dumpdata((unsigned char *)data, (size_t)data_len);
}
#endif
@@ -1663,7 +1663,7 @@ dlp_CallApplication(int sd, unsigned lon
get_long(DLP_RESPONSE_DATA(res, 0, 0)),
data_len));
CHECK(PI_DBG_DLP, PI_DBG_LVL_DEBUG,
- pi_dumpdata(DLP_RESPONSE_DATA(res, 0, 16),
+ pi_dumpdata((unsigned char *)DLP_RESPONSE_DATA(res, 0, 16),
(size_t)data_len));
}
@@ -1711,7 +1711,7 @@ dlp_CallApplication(int sd, unsigned lon
(unsigned int)get_short(DLP_RESPONSE_DATA(res, 0, 2)),
data_len));
CHECK(PI_DBG_DLP, PI_DBG_LVL_DEBUG,
- pi_dumpdata(DLP_RESPONSE_DATA(res, 0, 6),
+ pi_dumpdata((unsigned char *)DLP_RESPONSE_DATA(res, 0, 6),
(size_t)data_len));
}
}
@@ -2497,7 +2497,7 @@ dlp_ReadRecordIDList(int sd, int dbhandl
LOG((PI_DBG_DLP, PI_DBG_LVL_INFO,
"DLP ReadRecordIDList %d IDs:\n", ret));
CHECK(PI_DBG_DLP, PI_DBG_LVL_DEBUG,
- pi_dumpdata(DLP_RESPONSE_DATA(res, 0, 2),
+ pi_dumpdata((unsigned char *)DLP_RESPONSE_DATA(res, 0, 2),
(size_t)(ret * 4)));
}
@@ -2731,7 +2731,7 @@ dlp_ReadResourceByType(int sd, int dbhan
printlong(type), resID,
get_short(DLP_RESPONSE_DATA(res, 0, 6)),(size_t)data_len));
CHECK(PI_DBG_DLP, PI_DBG_LVL_DEBUG,
- pi_dumpdata(DLP_RESPONSE_DATA(res, 0, 10),(size_t)data_len));
+ pi_dumpdata((unsigned char *)DLP_RESPONSE_DATA(res, 0, 10),(size_t)data_len));
} else {
data_len = result;
}
@@ -2830,7 +2830,7 @@ dlp_ReadResourceByIndex(int sd, int dbha
get_short(DLP_RESPONSE_DATA(res, 0, 4)),
resindex, data_len));
CHECK(PI_DBG_DLP, PI_DBG_LVL_DEBUG,
- pi_dumpdata(DLP_RESPONSE_DATA(res, 0, (large ? 12 : 10)),
+ pi_dumpdata((unsigned char *)DLP_RESPONSE_DATA(res, 0, (large ? 12 : 10)),
(size_t)data_len));
} else {
data_len = result;
@@ -2961,7 +2961,7 @@ dlp_ReadAppBlock(int sd, int dbhandle, i
LOG((PI_DBG_DLP, PI_DBG_LVL_INFO,
"DLP ReadAppBlock %d bytes\n", data_len));
CHECK(PI_DBG_DLP, PI_DBG_LVL_DEBUG,
- pi_dumpdata(DLP_RESPONSE_DATA(res, 0, 2),
+ pi_dumpdata((unsigned char *)DLP_RESPONSE_DATA(res, 0, 2),
(size_t)data_len));
}
} else {
@@ -3048,7 +3048,7 @@ dlp_ReadSortBlock(int sd, int dbhandle,
LOG((PI_DBG_DLP, PI_DBG_LVL_INFO,
"DLP ReadSortBlock %d bytes\n", data_len));
CHECK(PI_DBG_DLP, PI_DBG_LVL_DEBUG,
- pi_dumpdata(DLP_RESPONSE_DATA(res, 0, 2),
+ pi_dumpdata((unsigned char *)DLP_RESPONSE_DATA(res, 0, 2),
(size_t)data_len));
}
} else {
@@ -3254,7 +3254,7 @@ dlp_ReadNextRecInCategory(int sd, int db
(!flags) ? " None" : "",
flags, data_len));
CHECK(PI_DBG_DLP, PI_DBG_LVL_DEBUG,
- pi_dumpdata(DLP_RESPONSE_DATA(res, 0, 10),
+ pi_dumpdata((unsigned char *)DLP_RESPONSE_DATA(res, 0, 10),
(size_t)data_len));
} else {
data_len = result;
@@ -3362,7 +3362,7 @@ dlp_ReadAppPreference(int sd, unsigned l
get_short(DLP_RESPONSE_DATA(res, 0, 2)),
get_short(DLP_RESPONSE_DATA(res, 0, 4))));
CHECK(PI_DBG_DLP, PI_DBG_LVL_DEBUG,
- pi_dumpdata(DLP_RESPONSE_DATA(res, 0, 6),
+ pi_dumpdata((unsigned char *)DLP_RESPONSE_DATA(res, 0, 6),
(size_t)data_len));
} else {
data_len = result;
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/libpisock/hinote.c pilot-link-0.12.5/libpisock/hinote.c
--- pilot-link-0.12.5-old/libpisock/hinote.c 2006-10-12 16:21:22.000000000 +0200
+++ pilot-link-0.12.5/libpisock/hinote.c 2012-01-04 20:01:27.297338187 +0100
@@ -121,8 +121,7 @@ pack_HiNoteNote(HiNoteNote_t *hinote, un
int
unpack_HiNoteAppInfo(HiNoteAppInfo_t *appinfo, unsigned char *record, size_t len)
{
- int i,
- idx;
+ int i;
unsigned char *start;
start = record;
@@ -133,7 +132,7 @@ unpack_HiNoteAppInfo(HiNoteAppInfo_t *ap
len -= i;
if (len < 48)
return 0;
- for (idx = 0; i < 48; i++)
+ for (i = 0; i < 48; i++)
appinfo->reserved[i] = *record++;
return (record - start);
}
@@ -153,8 +152,7 @@ unpack_HiNoteAppInfo(HiNoteAppInfo_t *ap
int
pack_HiNoteAppInfo(HiNoteAppInfo_t *appinfo, unsigned char *record, size_t len)
{
- int i,
- idx;
+ int i;
unsigned char *start = record;
i = pack_CategoryAppInfo(&appinfo->category, record, len);
@@ -166,7 +164,7 @@ pack_HiNoteAppInfo(HiNoteAppInfo_t *appi
len -= i;
if (len < 48)
return (record - start);
- for (idx = 0; i < 48; i++)
+ for (i = 0; i < 48; i++)
*record++ = appinfo->reserved[i];
return (record - start);
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/libpisock/inet.c pilot-link-0.12.5/libpisock/inet.c
--- pilot-link-0.12.5-old/libpisock/inet.c 2006-10-12 16:21:22.000000000 +0200
+++ pilot-link-0.12.5/libpisock/inet.c 2012-01-04 19:11:50.256766421 +0100
@@ -112,12 +112,9 @@ static pi_protocol_t*
pi_inet_protocol (pi_device_t *dev)
{
pi_protocol_t *prot;
- pi_inet_data_t *data;
ASSERT (dev != NULL);
- data = dev->data;
-
prot = (pi_protocol_t *)malloc (sizeof (pi_protocol_t));
if (prot != NULL) {
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/libpisock/libusb.c pilot-link-0.12.5/libpisock/libusb.c
--- pilot-link-0.12.5-old/libpisock/libusb.c 2007-02-09 17:06:22.000000000 +0100
+++ pilot-link-0.12.5/libpisock/libusb.c 2012-01-04 19:57:15.495647341 +0100
@@ -468,7 +468,7 @@ u_write(struct pi_socket *ps, const unsi
if (len <= 0)
return 0;
- ret = usb_bulk_write (USB_handle, USB_out_endpoint, buf, len, timeout);
+ ret = usb_bulk_write (USB_handle, USB_out_endpoint, (char *)buf, len, timeout);
LOG((PI_DBG_DEV, PI_DBG_LVL_DEBUG, "Wrote: %d.\n", ret));
if (ret > 0)
CHECK (PI_DBG_DEV, PI_DBG_LVL_DEBUG, pi_dumpdata (buf, ret));
@@ -505,7 +505,6 @@ u_read_i(struct pi_socket *ps, pi_buffer
if (RD_buffer_used < len) {
struct timeval now;
struct timespec when, nownow;
- int last_used;
gettimeofday(&now, NULL);
when.tv_sec = now.tv_sec + timeout / 1000;
when.tv_nsec = (now.tv_usec + (timeout % 1000) * 1000) * 1000;
@@ -516,8 +515,6 @@ u_read_i(struct pi_socket *ps, pi_buffer
RD_wanted = len;
do {
- last_used = RD_buffer_used;
-
LOG((PI_DBG_DEV, PI_DBG_LVL_DEBUG, "%s %d (%s): %d %d.\n",
__FILE__, __LINE__, __FUNCTION__, len, RD_buffer_used));
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/libpisock/linuxusb.c pilot-link-0.12.5/libpisock/linuxusb.c
--- pilot-link-0.12.5-old/libpisock/linuxusb.c 2006-10-12 16:21:22.000000000 +0200
+++ pilot-link-0.12.5/libpisock/linuxusb.c 2011-12-07 16:52:23.942559596 +0100
@@ -27,6 +27,7 @@
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/socket.h>
#include "pi-debug.h"
#include "pi-source.h"
@@ -48,8 +49,8 @@
static int u_open(pi_socket_t *ps, struct pi_sockaddr *addr, size_t addrlen);
static int u_close(pi_socket_t *ps);
-static int u_write(pi_socket_t *ps, unsigned char *buf, size_t len, int flags);
-static int u_read(pi_socket_t *ps, pi_buffer_t *buf, size_t len, int flags);
+static ssize_t u_write(pi_socket_t *ps, const unsigned char *buf, size_t len, int flags);
+static ssize_t u_read(pi_socket_t *ps, pi_buffer_t *buf, size_t len, int flags);
static int u_poll(pi_socket_t *ps, int timeout);
static int u_flush(pi_socket_t *ps, int flags);
@@ -188,8 +189,8 @@ u_poll(pi_socket_t *ps, int timeout)
* Returns: Nothing
*
***********************************************************************/
-static int
-u_write(pi_socket_t *ps, unsigned char *buf, size_t len, int flags)
+static ssize_t
+u_write(pi_socket_t *ps, const unsigned char *buf, size_t len, int flags)
{
int total,
nwrote;
@@ -281,7 +282,7 @@ u_read_buf (pi_socket_t *ps, pi_buffer_t
* Returns: number of bytes read or negative otherwise
*
***********************************************************************/
-static int
+static ssize_t
u_read(pi_socket_t *ps, pi_buffer_t *buf, size_t len, int flags)
{
ssize_t rbuf = 0,
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/libpisock/Makefile.am pilot-link-0.12.5/libpisock/Makefile.am
--- pilot-link-0.12.5-old/libpisock/Makefile.am 2009-05-25 05:22:55.000000000 +0200
+++ pilot-link-0.12.5/libpisock/Makefile.am 2011-12-19 13:22:17.375486115 +0100
@@ -1,5 +1,4 @@
INCLUDES = \
- -I../include \
-I$(top_srcdir)/include
bluetooth_FILES = \
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/libpisock/Makefile.in pilot-link-0.12.5/libpisock/Makefile.in
--- pilot-link-0.12.5-old/libpisock/Makefile.in 2012-01-04 17:53:04.413603881 +0100
+++ pilot-link-0.12.5/libpisock/Makefile.in 2012-01-04 22:52:56.453905685 +0100
@@ -317,7 +317,6 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
usb_libs = @usb_libs@
INCLUDES = \
- -I../include \
-I$(top_srcdir)/include
bluetooth_FILES = \
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/libpisock/memo.c pilot-link-0.12.5/libpisock/memo.c
--- pilot-link-0.12.5-old/libpisock/memo.c 2007-01-15 01:30:00.000000000 +0100
+++ pilot-link-0.12.5/libpisock/memo.c 2011-12-07 20:35:30.203369247 +0100
@@ -122,7 +122,7 @@ unpack_MemoAppInfo(struct MemoAppInfo *a
size_t len)
{
int i = unpack_CategoryAppInfo(&appinfo->category, record, len);
- unsigned char *start = record;
+ const unsigned char *start = record;
appinfo->type = memo_v1;
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/libpisock/net.c pilot-link-0.12.5/libpisock/net.c
--- pilot-link-0.12.5-old/libpisock/net.c 2006-10-12 16:21:22.000000000 +0200
+++ pilot-link-0.12.5/libpisock/net.c 2011-12-13 18:18:46.987142736 +0100
@@ -382,7 +382,7 @@ net_tx(pi_socket_t *ps, const unsigned c
}
CHECK(PI_DBG_NET, PI_DBG_LVL_INFO, net_dump_header(buf, 1, ps->sd));
- CHECK(PI_DBG_NET, PI_DBG_LVL_DEBUG, pi_dumpdata((char *)msg, len));
+ CHECK(PI_DBG_NET, PI_DBG_LVL_DEBUG, pi_dumpdata(msg, len));
free(buf);
return len;
@@ -513,7 +513,7 @@ net_rx(pi_socket_t *ps, pi_buffer_t *msg
LOG ((PI_DBG_NET, PI_DBG_LVL_ERR,
"NET RX (%i): Unknown packet type\n",
ps->sd));
- CHECK(PI_DBG_NET, PI_DBG_LVL_INFO, pi_dumpdata((char *)header->data, PI_NET_HEADER_LEN));
+ CHECK(PI_DBG_NET, PI_DBG_LVL_INFO, pi_dumpdata(header->data, PI_NET_HEADER_LEN));
pi_buffer_free(header);
return pi_set_error(ps->sd, PI_ERR_PROT_BADPACKET);
}
@@ -704,7 +704,7 @@ net_dump(unsigned char *header, unsigned
size_t size;
size = get_long(&header[PI_NET_OFFSET_SIZE]);
- pi_dumpdata((char *)data, size);
+ pi_dumpdata(data, size);
}
/* vi: set ts=8 sw=4 sts=4 noexpandtab: cin */
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/libpisock/padp.c pilot-link-0.12.5/libpisock/padp.c
--- pilot-link-0.12.5-old/libpisock/padp.c 2007-02-16 17:25:43.000000000 +0100
+++ pilot-link-0.12.5/libpisock/padp.c 2011-12-12 16:18:02.112726207 +0100
@@ -959,7 +959,7 @@ padp_dump(const unsigned char *data)
if (size > PI_PADP_MTU)
size = PI_PADP_MTU;
if (type != padAck)
- pi_dumpdata((char *)&data[header_size], size);
+ pi_dumpdata(&data[header_size], size);
}
/* vi: set ts=8 sw=4 sts=4 noexpandtab: cin */
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/libpisock/palmpix.c pilot-link-0.12.5/libpisock/palmpix.c
--- pilot-link-0.12.5-old/libpisock/palmpix.c 2006-10-12 16:21:22.000000000 +0200
+++ pilot-link-0.12.5/libpisock/palmpix.c 2012-01-04 19:26:38.628945553 +0100
@@ -1609,22 +1609,24 @@ static int
int
unpack_PalmPixHeader (struct PalmPixHeader *h, const unsigned char *p, int len)
{
- int magic1, magic2;
+ /* int magic1, magic2; */
if (len != 196)
return 0;
+ /*
magic1 = p[1];
magic2 = get_le_short (&p[46]);
-
+ */
+
/* FIXME For now, don't check the magic. I've seen 0x0002 and 0x0201.
I'm not sure that the endianness is right on this one. Possibly it
should be interpreted as two bytes instead (major and minor?). */
- #if 0
+ /*
if (magic1 != 0 || (magic2 != 0x0102 && magic2 != 0x0002))
return 0;
- #endif
-
+ */
+
h->numRec= p[0];
h->month= p[2];
h->day= p[3];
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/libpisock/pi-file.c pilot-link-0.12.5/libpisock/pi-file.c
--- pilot-link-0.12.5-old/libpisock/pi-file.c 2006-10-12 16:21:22.000000000 +0200
+++ pilot-link-0.12.5/libpisock/pi-file.c 2011-12-21 16:00:10.858944394 +0100
@@ -382,7 +382,7 @@ pi_file_read_resource_by_type_id(pi_file
int resid, void **bufp, size_t *sizep,
int *resindex)
{
- int i,
+ int i = 0,
result;
result = pi_file_find_resource_by_type_id(pf, restype, resid, &i);
@@ -1351,7 +1351,9 @@ pi_file_close_for_write(pi_file_t *pf)
}
/* This may just be packing */
- fwrite("\0\0", 1, 2, f);
+ if (fwrite("\0\0", 1, 2, f) != 2) {
+ goto bad;
+ }
if (pf->app_info
&& (fwrite(pf->app_info, 1,(size_t) pf->app_info_size, f) !=
@@ -1364,7 +1366,9 @@ pi_file_close_for_write(pi_file_t *pf)
goto bad;
- fwrite(pf->tmpbuf->data, pf->tmpbuf->used, 1, f);
+ if (fwrite(pf->tmpbuf->data, pf->tmpbuf->used, 1, f) != 1) {
+ goto bad;
+ }
fflush(f);
if (ferror(f) || feof(f))
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/libpisock/serial.c pilot-link-0.12.5/libpisock/serial.c
--- pilot-link-0.12.5-old/libpisock/serial.c 2011-12-19 18:30:44.000000000 +0100
+++ pilot-link-0.12.5/libpisock/serial.c 2011-12-20 17:38:49.101508096 +0100
@@ -374,7 +374,9 @@ begin:
# endif /* PATH_MAX */
#endif /* MAXPATHLEN */
- realpath(pa->pi_device, realport);
+ if (!realpath(pa->pi_device, realport)) {
+ strncpy(realport, pa->pi_device, sizeof(pa->pi_device));
+ }
errno = save_errno;
if (errno == ENOENT) {
@@ -482,7 +484,7 @@ pi_serial_accept(pi_socket_t *ps, struct
LOG((PI_DBG_DEV, PI_DBG_LVL_DEBUG, "%s: %d, poll result: %d.\n", __FILE__, __LINE__, result));
if (result < 0) {
- char buf[] = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 };
+ unsigned char buf[] = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 };
data->impl.write(ps, buf, sizeof (buf), 1000);
}
}
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/libpisock/slp.c pilot-link-0.12.5/libpisock/slp.c
--- pilot-link-0.12.5-old/libpisock/slp.c 2006-10-17 15:19:53.000000000 +0200
+++ pilot-link-0.12.5/libpisock/slp.c 2011-12-12 16:18:40.700958799 +0100
@@ -362,7 +362,7 @@ slp_rx(pi_socket_t *ps, pi_buffer_t *buf
} else {
LOG((PI_DBG_SLP, PI_DBG_LVL_WARN,
"SLP RX Header checksum failed for header:\n"));
- pi_dumpdata((const char *)slp_buf->data, PI_SLP_HEADER_LEN);
+ pi_dumpdata(slp_buf->data, PI_SLP_HEADER_LEN);
pi_buffer_free (slp_buf);
return 0;
}
@@ -646,7 +646,7 @@ slp_dump_header(const unsigned char *dat
void
slp_dump(const unsigned char *data)
{
- pi_dumpdata((char *)&data[PI_SLP_HEADER_LEN], get_short(&data[PI_SLP_OFFSET_SIZE]));
+ pi_dumpdata(&data[PI_SLP_HEADER_LEN], get_short(&data[PI_SLP_OFFSET_SIZE]));
}
/* vi: set ts=8 sw=4 sts=4 noexpandtab: cin */
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/libpisock/socket.c pilot-link-0.12.5/libpisock/socket.c
--- pilot-link-0.12.5-old/libpisock/socket.c 2007-01-15 01:30:00.000000000 +0100
+++ pilot-link-0.12.5/libpisock/socket.c 2012-01-12 19:43:34.935489417 +0100
@@ -1106,7 +1106,9 @@ pi_listen(int pi_sd, int backlog)
{
pi_socket_t *ps;
- if (!(ps = find_pi_socket(pi_sd))) {
+ ps = find_pi_socket(pi_sd);
+
+ if (!ps || !ps->device) {
errno = ESRCH;
return PI_ERR_SOCK_INVALID;
}
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/libpisock/sys.c pilot-link-0.12.5/libpisock/sys.c
--- pilot-link-0.12.5-old/libpisock/sys.c 2006-10-12 16:21:22.000000000 +0200
+++ pilot-link-0.12.5/libpisock/sys.c 2012-01-04 19:27:23.408239457 +0100
@@ -241,14 +241,12 @@ sys_rx(pi_socket_t *ps, pi_buffer_t *buf
pi_protocol_t *next,
*prot;
- pi_sys_data_t *data;
size_t data_len;
prot = pi_protocol(ps->sd, PI_LEVEL_SYS);
if (prot == NULL)
return pi_set_error(ps->sd, PI_ERR_SOCK_INVALID);
- data = (pi_sys_data_t *)prot->data;
next = pi_protocol_next(ps->sd, PI_LEVEL_SYS);
if (next == NULL)
return pi_set_error(ps->sd, PI_ERR_SOCK_INVALID);
@@ -360,7 +358,7 @@ sys_dump_header(const unsigned char *dat
void
sys_dump(const unsigned char *data, size_t len)
{
- pi_dumpdata((char *)&data[PI_SYS_HEADER_LEN], len);
+ pi_dumpdata(&data[PI_SYS_HEADER_LEN], len);
}
/* vi: set ts=8 sw=4 sts=4 noexpandtab: cin */
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/libpisock/todo.c pilot-link-0.12.5/libpisock/todo.c
--- pilot-link-0.12.5-old/libpisock/todo.c 2007-01-15 01:30:00.000000000 +0100
+++ pilot-link-0.12.5/libpisock/todo.c 2011-12-07 20:47:25.134224235 +0100
@@ -232,7 +232,7 @@ int
unpack_ToDoAppInfo(ToDoAppInfo_t *appinfo, const unsigned char *record, size_t len)
{
int i;
- unsigned char *start = record;
+ const unsigned char *start = record;
appinfo->type = todo_v1;
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/libpisync/Makefile.am pilot-link-0.12.5/libpisync/Makefile.am
--- pilot-link-0.12.5-old/libpisync/Makefile.am 2005-02-17 20:01:35.000000000 +0100
+++ pilot-link-0.12.5/libpisync/Makefile.am 2011-12-19 13:22:30.210258195 +0100
@@ -1,5 +1,4 @@
INCLUDES = \
- -I../include \
-I$(top_srcdir)/include \
$(ICONV_CFLAGS)
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/libpisync/Makefile.in pilot-link-0.12.5/libpisync/Makefile.in
--- pilot-link-0.12.5-old/libpisync/Makefile.in 2012-01-04 17:53:04.463602027 +0100
+++ pilot-link-0.12.5/libpisync/Makefile.in 2012-01-04 22:52:56.503897733 +0100
@@ -284,7 +284,6 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
usb_libs = @usb_libs@
INCLUDES = \
- -I../include \
-I$(top_srcdir)/include \
$(ICONV_CFLAGS)
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/libpisync/sync.c pilot-link-0.12.5/libpisync/sync.c
--- pilot-link-0.12.5-old/libpisync/sync.c 2006-08-06 17:55:57.000000000 +0200
+++ pilot-link-0.12.5/libpisync/sync.c 2011-12-07 21:09:46.536334579 +0100
@@ -330,7 +330,7 @@ static int open_db(SyncHandler * sh, int
{
if (sh->secret)
return dlp_OpenDB(sh->sd, 0, dlpOpenReadWrite
- && dlpOpenSecret, sh->name, dbhandle);
+ | dlpOpenSecret, sh->name, dbhandle);
else
return dlp_OpenDB(sh->sd, 0, dlpOpenReadWrite, sh->name,
dbhandle);
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/libpisync/util.c pilot-link-0.12.5/libpisync/util.c
--- pilot-link-0.12.5-old/libpisync/util.c 2006-08-25 14:33:25.000000000 +0200
+++ pilot-link-0.12.5/libpisync/util.c 2011-12-07 21:25:04.906262096 +0100
@@ -60,7 +60,7 @@
*
***********************************************************************/
int
-convert_ToPilotChar(const char *charset, const char *text,
+convert_ToPilotChar(const char *charset, char *text,
int bytes, char **ptext)
{
#ifdef HAVE_ICONV
@@ -100,7 +100,7 @@ convert_ToPilotChar(const char *charset,
*
***********************************************************************/
int
-convert_ToPilotChar_WithCharset(const char *charset, const char *text,
+convert_ToPilotChar_WithCharset(const char *charset, char *text,
int bytes, char **ptext, const char * pi_charset)
{
#ifdef HAVE_ICONV
@@ -155,7 +155,7 @@ convert_ToPilotChar_WithCharset(const ch
*
***********************************************************************/
int
-convert_FromPilotChar(const char *charset, const char *ptext,
+convert_FromPilotChar(const char *charset, char *ptext,
int bytes, char **text)
{
#ifdef HAVE_ICONV
@@ -191,7 +191,7 @@ convert_FromPilotChar(const char *charse
*
***********************************************************************/
int
-convert_FromPilotChar_WithCharset(const char *charset, const char *ptext,
+convert_FromPilotChar_WithCharset(const char *charset, char *ptext,
int bytes, char **text, const char * pi_charset)
{
#ifdef HAVE_ICONV
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/popt/popt.c pilot-link-0.12.5/popt/popt.c
--- pilot-link-0.12.5-old/popt/popt.c 2004-08-27 18:27:48.000000000 +0200
+++ pilot-link-0.12.5/popt/popt.c 2012-01-04 19:47:06.517804911 +0100
@@ -367,7 +367,6 @@ static int execCommand(poptContext con)
poptItem item = con->doExec;
const char ** argv;
int argc = 0;
- int rc;
if (item == NULL) /*XXX can't happen*/
return POPT_ERROR_NOARG;
@@ -411,8 +410,7 @@ static int execCommand(poptContext con)
argv[argc] = NULL;
#ifdef __hpux
- rc = setresuid(getuid(), getuid(),-1);
- if (rc) return POPT_ERROR_ERRNO;
+ if (setresuid(getuid(), getuid(),-1)) return POPT_ERROR_ERRNO;
#else
/*
* XXX " ... on BSD systems setuid() should be preferred over setreuid()"
@@ -420,11 +418,10 @@ static int execCommand(poptContext con)
* XXX from Norbert Warmuth <nwarmuth@privat.circular.de>
*/
#if defined(HAVE_SETUID)
- rc = setuid(getuid());
- if (rc) return POPT_ERROR_ERRNO;
+ if (setuid(getuid())) return POPT_ERROR_ERRNO;
#elif defined (HAVE_SETREUID)
- rc = setreuid(getuid(), getuid()); /*hlauer: not portable to hpux9.01 */
- if (rc) return POPT_ERROR_ERRNO;
+ /*hlauer: not portable to hpux9.01 */
+ if (setreuid(getuid(), getuid())) return POPT_ERROR_ERRNO;
#else
; /* Can't drop privileges */
#endif
@@ -443,7 +440,7 @@ if (_popt_debug)
}
#endif
- rc = execvp(argv[0], (char *const *)argv);
+ execvp(argv[0], (char *const *)argv);
return POPT_ERROR_ERRNO;
}
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/src/Makefile.am pilot-link-0.12.5/src/Makefile.am
--- pilot-link-0.12.5-old/src/Makefile.am 2007-11-12 15:52:14.000000000 +0100
+++ pilot-link-0.12.5/src/Makefile.am 2011-12-16 17:42:55.878155194 +0100
@@ -72,6 +72,8 @@ libpiuserland_la_SOURCES = \
userland.c
libpiuserland_la_LDFLAGS = \
-static
+libpiuserland_la_LIBADD = \
+ $(POPT_LIBS)
#getrom_SOURCES = \
# getrom.c
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/src/Makefile.in pilot-link-0.12.5/src/Makefile.in
--- pilot-link-0.12.5-old/src/Makefile.in 2012-01-04 17:53:04.645595287 +0100
+++ pilot-link-0.12.5/src/Makefile.in 2012-01-04 22:52:56.694867357 +0100
@@ -87,7 +87,9 @@ CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
-libpiuserland_la_LIBADD =
+am__DEPENDENCIES_1 =
+@ENABLE_CONDUITS_TRUE@libpiuserland_la_DEPENDENCIES = \
+@ENABLE_CONDUITS_TRUE@ $(am__DEPENDENCIES_1)
am__libpiuserland_la_SOURCES_DIST = plu_args.c userland.c
@ENABLE_CONDUITS_TRUE@am_libpiuserland_la_OBJECTS = plu_args.lo \
@ENABLE_CONDUITS_TRUE@ userland.lo
@@ -102,7 +104,6 @@ am__pilot_addresses_SOURCES_DIST = pilot
@ENABLE_CONDUITS_TRUE@am_pilot_addresses_OBJECTS = \
@ENABLE_CONDUITS_TRUE@ pilot-addresses.$(OBJEXT)
pilot_addresses_OBJECTS = $(am_pilot_addresses_OBJECTS)
-am__DEPENDENCIES_1 =
@ENABLE_CONDUITS_TRUE@pilot_addresses_DEPENDENCIES = libpiuserland.la \
@ENABLE_CONDUITS_TRUE@ $(am__DEPENDENCIES_1) \
@ENABLE_CONDUITS_TRUE@ $(top_builddir)/libpisock/libpisock.la
@@ -689,6 +690,9 @@ SUBDIRS = prc pix
@ENABLE_CONDUITS_TRUE@libpiuserland_la_LDFLAGS = \
@ENABLE_CONDUITS_TRUE@ -static
+@ENABLE_CONDUITS_TRUE@libpiuserland_la_LIBADD = \
+@ENABLE_CONDUITS_TRUE@ $(POPT_LIBS)
+
#getrom_SOURCES = \
# getrom.c
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/src/pilot-addresses.c pilot-link-0.12.5/src/pilot-addresses.c
--- pilot-link-0.12.5-old/src/pilot-addresses.c 2009-06-04 15:32:30.000000000 +0200
+++ pilot-link-0.12.5/src/pilot-addresses.c 2011-12-21 16:08:30.778052438 +0100
@@ -613,7 +613,8 @@ int main(int argc, const char *argv[]) {
int c, /* switch */
db,
l,
- sd = -1;
+ sd = -1,
+ old_quiet = 0;
enum { mode_none, mode_read, mode_write, mode_delete_all, mode_delete }
run_mode = mode_none;
@@ -744,7 +745,7 @@ int main(int argc, const char *argv[]) {
" tool. The data format of the AddressBook has changed. The legacy format\n"
" is called \"Classic\" and PalmOS 5.x and later uses \"Extended\" databases\n"
" with a different structure. Your Palm has \"Contacts\", and this tool reads\n"
- " the \"AddressBook\" database. (Found OS version: %x)\n\n"
+ " the \"AddressBook\" database. (Found OS version: %lu)\n\n"
" Due to this change, pilot-addresses and other tools must be rewritten to\n"
" compensate. Sorry about the inconvenience.\n\n", info.romVersion);
@@ -775,7 +776,6 @@ int main(int argc, const char *argv[]) {
switch(run_mode) {
FILE *f;
int i;
- int old_quiet;
case mode_none:
/* impossible */
fprintf(stderr,"%s",mode_error);
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/src/pilot-clip.c pilot-link-0.12.5/src/pilot-clip.c
--- pilot-link-0.12.5-old/src/pilot-clip.c 2009-06-04 15:26:19.000000000 +0200
+++ pilot-link-0.12.5/src/pilot-clip.c 2011-12-20 17:46:26.422661747 +0100
@@ -189,7 +189,9 @@ int main(int argc, const char *argv[])
if (b == NULL)
goto error_close;
if (ret > 0)
- write(fileno(stdout), b, ret);
+ if (write(fileno(stdout), b, ret) < 0) {
+ goto error_close;
+ }
}
if (pi_close(sd) < 0)
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/src/pilot-csd.c pilot-link-0.12.5/src/pilot-csd.c
--- pilot-link-0.12.5-old/src/pilot-csd.c 2009-06-04 15:32:31.000000000 +0200
+++ pilot-link-0.12.5/src/pilot-csd.c 2011-12-19 14:45:25.245377872 +0100
@@ -383,7 +383,7 @@ int main(int argc, const char *argv[])
if ((get_byte(mesg + 2) == 0x01) && (n > 12)) {
struct in_addr ip, mask;
- char *name = mesg + 12;
+ char *name = (char *)mesg + 12;
memcpy(&ip, mesg + 4, 4);
memcpy(&mask, mesg + 8, 4);
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/src/pilot-debug.c pilot-link-0.12.5/src/pilot-debug.c
--- pilot-link-0.12.5-old/src/pilot-debug.c 2009-06-04 15:26:19.000000000 +0200
+++ pilot-link-0.12.5/src/pilot-debug.c 2011-12-13 18:20:08.241744455 +0100
@@ -253,7 +253,7 @@ Read_Pilot(ClientData clientData, int ma
return;
/* puts("From Palm:");
- pi_dumpdata((unsigned char *)buf, l); */
+ pi_dumpdata(buf, l); */
if (buf[2] == 0) { /* SysPkt command */
if (buf[0] == 2) { /* UI */
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/src/pilot-dlpsh.c pilot-link-0.12.5/src/pilot-dlpsh.c
--- pilot-link-0.12.5-old/src/pilot-dlpsh.c 2009-06-04 15:26:19.000000000 +0200
+++ pilot-link-0.12.5/src/pilot-dlpsh.c 2012-01-04 20:04:15.478831743 +0100
@@ -378,7 +378,6 @@ int rm_fn(int sd, int argc, const char *
***********************************************************************/
int time_fn(int sd, int argc, const char *argv[])
{
- int s;
time_t ltime;
struct tm *tm_ptr;
struct timeval tv;
@@ -389,11 +388,11 @@ int time_fn(int sd, int argc, const char
strftime(timebuf, 80, "Now setting Palm time from desktop to: "
"%a %b %d %H:%M:%S %Z %Y\n", tm_ptr);
- printf(timebuf);
+ printf("%s", timebuf);
gettimeofday(&tv, 0);
ltime = tv.tv_sec + 1;
usleep(1000000 - tv.tv_usec);
- s = dlp_SetSysDateTime(sd, ltime);
+ dlp_SetSysDateTime(sd, ltime);
return 0;
}
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/src/pilot-file.c pilot-link-0.12.5/src/pilot-file.c
--- pilot-link-0.12.5-old/src/pilot-file.c 2009-06-04 15:26:19.000000000 +0200
+++ pilot-link-0.12.5/src/pilot-file.c 2011-12-20 18:05:28.584045279 +0100
@@ -243,9 +243,12 @@ static void list_records(struct pi_file
sprintf(name, "%4s%04x.bin",
printlong(type), id_);
fp = fopen(name, "w");
- fwrite(buf, size, 1, fp);
+ if (fwrite(buf, size, 1, fp) == 1) {
+ printf("(written to %s)\n", name);
+ } else {
+ printf("(failed to write to %s)\n", name);
+ }
fclose(fp);
- printf("(written to %s)\n", name);
}
}
}
@@ -326,9 +329,12 @@ static void dump_record(struct pi_file *
sprintf(name, "%4s%04x.bin", printlong(type), id_);
fp = fopen(name, "w");
- fwrite(buf, size, 1, fp);
+ if (fwrite(buf, size, 1, fp) == 1) {
+ printf("(written to %s)\n", name);
+ } else {
+ printf("(failed to write to %s)\n", name);
+ }
fclose(fp);
- printf("(written to %s)\n", name);
}
} else {
printf("entries\n");
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/src/pilot-foto.c pilot-link-0.12.5/src/pilot-foto.c
--- pilot-link-0.12.5-old/src/pilot-foto.c 2009-06-04 15:26:19.000000000 +0200
+++ pilot-link-0.12.5/src/pilot-foto.c 2011-12-20 18:49:18.859925180 +0100
@@ -85,9 +85,15 @@ int get_jpg_info(FILE * in, char *type,
rewind(in);
/* marker identifier, application use marker */
- fread(&word, 2, 1, in);
+ if (fread(&word, 2, 1, in) != 1) {
+ rewind(in);
+ return -1;
+ }
word1 = htons(word);
- fread(&word, 2, 1, in);
+ if (fread(&word, 2, 1, in) != 1) {
+ rewind(in);
+ return -1;
+ }
word2 = htons(word);
/* printf("start of image 0x%02x 0x%02x\n", str[0], str[1]); */
/* printf("application use marker 0x%02x 0x%02x\n", str[2], str[3]); */
@@ -101,7 +107,10 @@ int get_jpg_info(FILE * in, char *type,
*height = *width = -1;
/* length of application block */
- fread(&word, 2, 1, in);
+ if (fread(&word, 2, 1, in) != 1) {
+ rewind(in);
+ return -1;
+ }
len = htons(word);
/* printf("len %d\n", len); */
if (len > 65535) {
@@ -110,7 +119,10 @@ int get_jpg_info(FILE * in, char *type,
return -1;
}
- fread(str, 5, 1, in);
+ if (fread(str, 5, 1, in) != 1) {
+ rewind(in);
+ return -1;
+ }
str[6] = '\0';
/* printf("%s\n", str); */
if (strncmp(str, "JFIF", 4) && strncmp(str, "Exif", 4)
@@ -123,18 +135,27 @@ int get_jpg_info(FILE * in, char *type,
type[4] = '\0';
/* Version */
- fread(&word, 2, 1, in);
+ if (fread(&word, 2, 1, in) != 1) {
+ rewind(in);
+ return -1;
+ }
*version = htons(word);
/* printf("version %d.%02d\n", ((*version)&0xFF00)>>8, (*version)&0xFF); */
- fread(str, len - 9, 1, in);
+ if (fread(str, len - 9, 1, in) != 1) {
+ rewind(in);
+ return -1;
+ }
/* Units 1 byte
* X and Y density, 1 byte each
* X and Y thumbnail size, 2 bytes each
*/
while (!feof(in)) {
/* marker identifier */
- fread(&word, 2, 1, in);
+ if (fread(&word, 2, 1, in) != 1) {
+ rewind(in);
+ return -1;
+ }
word1 = htons(word);
m1 = (word1 & 0xFF00) >> 8;
m2 = word1 & 0xFF;
@@ -143,18 +164,30 @@ int get_jpg_info(FILE * in, char *type,
if ((m1 == 0xFF) && (m2 == 0xC0)) {
/* The SOF0 marker (Start of Frame 0) */
/* length(2 bytes) and data precision(1 byte) */
- fread(str, 3, 1, in);
+ if (fread(str, 3, 1, in) != 1) {
+ rewind(in);
+ return -1;
+ }
/* Height */
- fread(&word, 2, 1, in);
+ if (fread(&word, 2, 1, in) != 1) {
+ rewind(in);
+ return -1;
+ }
*height = htons(word);
/* printf("height %d\n", *height); */
/* Width */
- fread(&word, 2, 1, in);
+ if (fread(&word, 2, 1, in) != 1) {
+ rewind(in);
+ return -1;
+ }
*width = htons(word);
/* printf("width %d\n", *width); */
break;
}
- fread(&word, 2, 1, in);
+ if (fread(&word, 2, 1, in) != 1) {
+ rewind(in);
+ return -1;
+ }
len = htons(word);
/* printf("len %d\n", len); */
if (len > 65535) {
@@ -162,7 +195,10 @@ int get_jpg_info(FILE * in, char *type,
rewind(in);
return -1;
}
- fread(str, len - 2, 1, in);
+ if (fread(str, len - 2, 1, in) != 1) {
+ rewind(in);
+ return -1;
+ }
}
rewind(in);
@@ -432,7 +468,9 @@ int do_fetch(int sd, const char **fetch_
&attr, &category);
index++;
if (ret > 0 && buffer->used > 8)
- fwrite(buffer->data + 8, buffer->used - 8, 1, out);
+ if (fwrite(buffer->data + 8, buffer->used - 8, 1, out) != 1) {
+ fprintf(stderr, "Failed, unable to write data.\n");
+ }
} while (ret > 0);
dlp_CloseDB(sd, db);
@@ -691,7 +729,7 @@ int pdb_to_jpg(const char *filename)
int ret;
void *Pbuf;
size_t size;
- int total_size;
+ int total_size, actual_size;
int attr;
int cat;
recordid_t uid;
@@ -712,19 +750,24 @@ int pdb_to_jpg(const char *filename)
index = 0;
total_size = 0;
+ actual_size = 0;
ret = 1;
while (ret >= 0) {
ret = pi_file_read_record(pi_fp, index, &Pbuf, &size, &attr,
&cat, &uid);
index++;
if ((ret >= 0) && (size > 8)) {
- fwrite(((char *) Pbuf) + 8, size - 8, 1, out);
- total_size += size - 8;
+ total_size += size - 8;
+ if (fwrite(((char *) Pbuf) + 8, size - 8, 1, out) != 1) {
+ printf("FAILED: could not write data.\n");
+ continue;
+ }
+ actual_size += size - 8;
}
}
fclose(out);
- printf("OK, wrote %d bytes to %s\n", total_size, info.name);
+ printf("OK, wrote %d of %d bytes to %s\n", actual_size, total_size, info.name);
return 0;
}
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/src/pilot-foto-treo600.c pilot-link-0.12.5/src/pilot-foto-treo600.c
--- pilot-link-0.12.5-old/src/pilot-foto-treo600.c 2009-06-04 15:32:30.000000000 +0200
+++ pilot-link-0.12.5/src/pilot-foto-treo600.c 2011-12-20 20:26:16.865031433 +0100
@@ -82,12 +82,15 @@ int extract_image(struct pi_file *pi_fp,
if (pi_file_read_record
(pi_fp, i, &Pbuf, &size, &attr, &cat, &uid) < 0) {
fprintf(stderr," WARNING: Error reading image record %d\n\n", i);
+ close(fd);
return -1;
}
if (req_uid && uid == req_uid) {
memcpy(&req_uid, Pbuf, 4); /* get next req_uid for image 'block' */
- write(fd, Pbuf + 4, size - 4); /* The rest is just jpeg data */
+ if (write(fd, Pbuf + 4, size - 4) < 0) { /* The rest is just jpeg data */
+ fprintf(stderr," WARNING: Error writing image data to %s\n", imgfilename);
+ }
}
}
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/src/pilot-foto-treo650.c pilot-link-0.12.5/src/pilot-foto-treo650.c
--- pilot-link-0.12.5-old/src/pilot-foto-treo650.c 2009-06-04 15:32:30.000000000 +0200
+++ pilot-link-0.12.5/src/pilot-foto-treo650.c 2012-01-04 22:12:18.456346583 +0100
@@ -41,13 +41,11 @@
static int
pi_file_retrieve_VFS(const int fd, const int socket, FileRef file, const char *rpath )
{
- int rpathlen = vfsMAXFILENAME;
- long attributes;
- pi_buffer_t *buffer;
- ssize_t readsize,writesize;
- int filesize;
- int original_filesize;
- int written_so_far;
+ unsigned long attributes;
+ pi_buffer_t *buffer;
+ ssize_t readsize,writesize;
+ int filesize;
+ int written_so_far;
pi_progress_t progress;
enum
@@ -60,8 +58,6 @@ static int
internal_=-6
};
- rpathlen=strlen(rpath);
-
if (dlp_VFSFileGetAttributes(socket,file,&attributes) < 0)
{
fprintf(stderr," Could not get attributes of VFS file.\n");
@@ -78,7 +74,6 @@ static int
}
dlp_VFSFileSize(socket,file,&filesize);
- original_filesize = filesize;
memset(&progress, 0, sizeof(progress));
progress.type = PI_PROGRESS_RECEIVE_VFS;
@@ -226,7 +221,7 @@ static void
}
else
{
- if( index = rindex( infos[i].name, '.' ))
+ if(( index = rindex( infos[i].name, '.' )))
{
// printf( "index: %s %d strlen %d\n", infos[i].name, index, strlen( infos[i].name ) );
if(( index + 4 ) == (infos[i].name + strlen( infos[i].name )))
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/src/pilot-getrom.c pilot-link-0.12.5/src/pilot-getrom.c
--- pilot-link-0.12.5-old/src/pilot-getrom.c 2009-06-04 15:32:31.000000000 +0200
+++ pilot-link-0.12.5/src/pilot-getrom.c 2011-12-20 18:56:35.349427789 +0100
@@ -176,7 +176,10 @@ int do_get_rom(int sd,const char *filena
if (j == len)
lseek(file, len, SEEK_CUR);
else
- write(file, buffer, len);
+ if (write(file, buffer, len) < 0) {
+ printf("\n Failed to write to file!\n");
+ goto cancel;
+ }
offset += len;
if (cancel || !(i++ % 8))
if (cancel || (dlp_OpenConduit(sd) < 0)) {
@@ -272,7 +275,7 @@ int do_get_ram(int sd, const char *filen
PackRPC(&p, 0xA026, RPC_IntReply, RPC_Ptr(print, 8),
RPC_Long(penPtr), RPC_Long(8), RPC_End);
/* err = */ dlp_RPC(sd, &p, 0);
- pi_dumpdata(print, 8);
+ pi_dumpdata((unsigned char *)print, 8);
#endif
signal(SIGINT, sighandler);
@@ -304,7 +307,10 @@ int do_get_ram(int sd, const char *filen
if (j == len)
lseek(file, len, SEEK_CUR);
else
- write(file, buffer, len);
+ if (write(file, buffer, len) < 0) {
+ printf("\n Failed to write to file!\n");
+ goto cancel;
+ }
offset += len;
if (cancel || !(i++ % 4))
@@ -414,27 +420,31 @@ int main(int argc, const char *argv[])
const char *opthelp = NULL;
/* These are optimized away compile-time */
- if (DEFAULT_MODE == mode_getrom) {
- progname = "pilot-getrom";
- opthelp=
- "[filename]\n\n"
- " Retrieves the ROM image from your Palm device.\n\n";
- } else if (DEFAULT_MODE == mode_gettoken) {
- progname="pilot-getromtoken";
- opthelp=
- "\n\n"
- " Reads a ROM token from a Palm Handheld device.\n"
- " Tokens you may currently extract are:\n"
- " adcc: Entropy for internal A->D convertor calibration\n"
- " irda: Present only on memory card w/IrDA support\n"
- " snum: Device serial number (from Memory Card Flash ID)\n\n"
- " Example arguments:\n"
- " -p /dev/pilot -t snum\n\n";
- } else if (DEFAULT_MODE == mode_getram) {
- progname="pilot-getram";
- opthelp=
- "[filename]\n\n"
- " Retrieves the RAM image from your Palm device\n\n";
+ switch (DEFAULT_MODE) {
+ case mode_getrom:
+ progname = "pilot-getrom";
+ opthelp=
+ "[filename]\n\n"
+ " Retrieves the ROM image from your Palm device.\n\n";
+ break;
+ case mode_gettoken:
+ progname="pilot-getromtoken";
+ opthelp=
+ "\n\n"
+ " Reads a ROM token from a Palm Handheld device.\n"
+ " Tokens you may currently extract are:\n"
+ " adcc: Entropy for internal A->D convertor calibration\n"
+ " irda: Present only on memory card w/IrDA support\n"
+ " snum: Device serial number (from Memory Card Flash ID)\n\n"
+ " Example arguments:\n"
+ " -p /dev/pilot -t snum\n\n";
+ break;
+ case mode_getram:
+ progname="pilot-getram";
+ opthelp=
+ "[filename]\n\n"
+ " Retrieves the RAM image from your Palm device\n\n";
+ break;
}
if (!progname) {
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/src/pilot-hinotes.c pilot-link-0.12.5/src/pilot-hinotes.c
--- pilot-link-0.12.5-old/src/pilot-hinotes.c 2009-06-04 15:26:19.000000000 +0200
+++ pilot-link-0.12.5/src/pilot-hinotes.c 2012-01-04 20:08:29.926499751 +0100
@@ -51,13 +51,11 @@ void write_memo_mbox(struct PilotUser Us
time_t ltime;
struct tm *tm_ptr;
- char c,
- fromtmbuf[80],
- recvtmbuf[80];
+ char fromtmbuf[80],
+ recvtmbuf[80];
time(&ltime);
tm_ptr = localtime(&ltime);
- c = *asctime(tm_ptr);
strftime(fromtmbuf, 80, "%a, %d %b %H:%M:%S %Y (%Z)\n", tm_ptr);
strftime(recvtmbuf, 80, "%d %b %H:%M:%S %Y\n", tm_ptr);
@@ -80,7 +78,7 @@ void write_memo_mbox(struct PilotUser Us
else
printf("\n");
printf("\n");
- printf(m.text);
+ printf("%s", m.text);
printf("\n");
}
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/src/pilot-install-datebook.c pilot-link-0.12.5/src/pilot-install-datebook.c
--- pilot-link-0.12.5-old/src/pilot-install-datebook.c 2009-06-04 15:26:19.000000000 +0200
+++ pilot-link-0.12.5/src/pilot-install-datebook.c 2011-12-20 19:00:42.654177819 +0100
@@ -106,7 +106,11 @@ int main(int argc, const char *argv[])
return 1;
}
- fread(file_text, filelen, 1, f);
+ if (fread(file_text, filelen, 1, f) != 1) {
+ fprintf(stderr," ERROR: Failed to read the %s file.\n", filename);
+ fclose(f);
+ return 1;
+ }
fclose(f);
f = NULL;
@@ -252,13 +256,13 @@ int main(int argc, const char *argv[])
dlp_WriteUserInfo(sd, &User);
if (dlp_AddSyncLogEntry(sd, "Successfully wrote Appointment to Palm.\n"
- "Thank you for using pilot-link.\n") < 0);
+ "Thank you for using pilot-link.\n") < 0)
goto error_close;
- if(dlp_EndOfSync(sd, 0) < 0);
+ if (dlp_EndOfSync(sd, 0) < 0)
goto error_close;
- if(pi_close(sd) < 0)
+ if (pi_close(sd) < 0)
goto error;
error_close:
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/src/pilot-install-expenses.c pilot-link-0.12.5/src/pilot-install-expenses.c
--- pilot-link-0.12.5-old/src/pilot-install-expenses.c 2009-06-04 15:26:19.000000000 +0200
+++ pilot-link-0.12.5/src/pilot-install-expenses.c 2011-12-19 16:05:49.391042875 +0100
@@ -45,8 +45,8 @@ int main(int argc, const char *argv[])
size_t size;
int found;
- unsigned char buf[0xffff];
- unsigned char *b;
+ char buf[0xffff];
+ char *b;
pi_buffer_t *appblock;
struct PilotUser User;
@@ -214,8 +214,7 @@ int main(int argc, const char *argv[])
b += strlen(theExpense.note) + 1;
size = b - buf;
- dlp_WriteRecord(sd, (unsigned char)db, 0, 0, category,
- (unsigned char *)buf, size, 0);
+ dlp_WriteRecord(sd, db, 0, 0, category, buf, size, 0);
/* Close the database */
dlp_CloseDB(sd, db);
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/src/pilot-install-hinote.c pilot-link-0.12.5/src/pilot-install-hinote.c
--- pilot-link-0.12.5-old/src/pilot-install-hinote.c 2009-06-04 15:26:19.000000000 +0200
+++ pilot-link-0.12.5/src/pilot-install-hinote.c 2011-12-20 19:05:05.836653456 +0100
@@ -164,7 +164,11 @@ int main(int argc, const char *argv[])
strcpy(file_text, file_arg);
file_text[filenamelen] = '\n';
- fread(file_text + filenamelen + 1, filelen, 1, f);
+ if (fread(file_text + filenamelen + 1, filelen, 1, f) != 1) {
+ fprintf(stderr," WARNING: Failed to read from file.\n");
+ file_text[filenamelen + 1] = '\0';
+ continue;
+ }
file_text[filenamelen + 1 + filelen] = '\0';
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/src/pilot-install-memo.c pilot-link-0.12.5/src/pilot-install-memo.c
--- pilot-link-0.12.5-old/src/pilot-install-memo.c 2009-06-04 15:32:32.000000000 +0200
+++ pilot-link-0.12.5/src/pilot-install-memo.c 2011-12-20 19:26:49.803270983 +0100
@@ -89,7 +89,6 @@ int install_memo(int sd, int db, int cat
{
struct stat sbuf;
FILE *f = NULL;
- char *tmp = NULL;
char *memo_buf = NULL;
int memo_size, preamble;
@@ -125,7 +124,11 @@ int install_memo(int sd, int db, int cat
filename, strerror(errno));
return 1;
}
- fread(memo_buf + preamble, memo_size, 1, f);
+ if (fread(memo_buf + preamble, memo_size, 1, f) != 1) {
+ fprintf(stderr," ERROR: Unable to read from %s\n\n", filename);
+ fclose(f);
+ return 1;
+ }
fclose(f);
dlp_WriteRecord(sd, db, 0, 0, category, memo_buf, -1, 0);
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/src/pilot-install-todo.c pilot-link-0.12.5/src/pilot-install-todo.c
--- pilot-link-0.12.5-old/src/pilot-install-todo.c 2009-06-04 15:26:19.000000000 +0200
+++ pilot-link-0.12.5/src/pilot-install-todo.c 2011-12-20 19:36:06.838721596 +0100
@@ -76,7 +76,13 @@ int read_file(char *filename, char **tex
return -1;
}
- fread(*text, filelen, 1, f);
+ if (fread(*text, filelen, 1, f) != 1) {
+ fprintf(stderr," ERROR: Could not read the file %s.\n", filename);
+ fclose(f);
+ return -1;
+ }
+
+ fclose(f);
return 0;
}
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/src/pilot-install-todos.c pilot-link-0.12.5/src/pilot-install-todos.c
--- pilot-link-0.12.5-old/src/pilot-install-todos.c 2009-06-04 15:26:19.000000000 +0200
+++ pilot-link-0.12.5/src/pilot-install-todos.c 2011-12-20 19:38:49.488931153 +0100
@@ -63,7 +63,13 @@ void install_ToDos(int sd, int db, char
exit(EXIT_FAILURE);
}
- fread(file_text, filelen, 1, f);
+ if (fread(file_text, filelen, 1, f) != 1) {
+ fprintf(stderr," ERROR: Failed to read from file %s.\n", filename);
+ fclose(f);
+ exit(EXIT_FAILURE);
+ }
+
+ fclose(f);
cPtr = file_text;
begPtr = cPtr;
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/src/pilot-memos.c pilot-link-0.12.5/src/pilot-memos.c
--- pilot-link-0.12.5-old/src/pilot-memos.c 2009-06-04 15:26:19.000000000 +0200
+++ pilot-link-0.12.5/src/pilot-memos.c 2011-12-21 16:46:00.842502232 +0100
@@ -113,27 +113,27 @@ write_memo_in_directory(char *dirname, s
mkdir(dirname, 0700);
/* Create a directory for the category */
- strncat(pathbuffer, dirname, MAXDIRNAMELEN);
- strncat(pathbuffer, "/", 1);
+ strncat(pathbuffer, dirname, sizeof(pathbuffer) - strlen(pathbuffer) - 1);
+ strncat(pathbuffer, "/", sizeof(pathbuffer) - strlen(pathbuffer) - 1);
/* Should make sure category doesn't have slashes in it */
- strncat(pathbuffer, mai.category.name[category], 60);
+ strncat(pathbuffer, mai.category.name[category], sizeof(pathbuffer) - strlen(pathbuffer) - 1);
/* Should check if pathbuffer exists and is a directory */
mkdir(pathbuffer, 0700);
/* Should check if there were problems creating directory */
/* open the actual file to write */
- strncat(pathbuffer, "/", 1);
+ strncat(pathbuffer, "/", sizeof(pathbuffer) - strlen(pathbuffer) - 1);
for (j = 0; j < 40; j++) {
if ((!m.text[j]) || (m.text[j] == '\n'))
break;
if (m.text[j] == '/') {
- strncat(pathbuffer, "=2F", 3);
+ strncat(pathbuffer, "=2F", sizeof(pathbuffer) - strlen(pathbuffer) - 1);
continue;
}
if (m.text[j] == '=') {
- strncat(pathbuffer, "=3D", 3);
+ strncat(pathbuffer, "=3D", sizeof(pathbuffer) - strlen(pathbuffer) - 1);
continue;
}
#ifdef OS2
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/src/pilot-port.c pilot-link-0.12.5/src/pilot-port.c
--- pilot-link-0.12.5-old/src/pilot-port.c 2009-06-04 15:26:19.000000000 +0200
+++ pilot-link-0.12.5/src/pilot-port.c 2011-12-12 16:11:16.697469186 +0100
@@ -41,7 +41,7 @@
#include "pi-userland.h"
-void do_read(struct pi_socket *ps, int type, char *buffer, int length);
+void do_read(struct pi_socket *ps, int type, unsigned char *buffer, int length);
/***********************************************************************
*
@@ -54,7 +54,7 @@ void do_read(struct pi_socket *ps, int t
* Returns: Nothing
*
***********************************************************************/
-void do_read(struct pi_socket *ps, int type, char *buffer, int length)
+void do_read(struct pi_socket *ps, int type, unsigned char *buffer, int length)
{
int len;
@@ -92,8 +92,8 @@ int main(int argc, char *argv[])
struct pi_socket *ps;
struct sockaddr_in serv_addr;
- char *buffer,
- *slpbuffer;
+ char *slpbuffer;
+ unsigned char *buffer;
poptContext pc;
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/src/pilot-read-expenses.c pilot-link-0.12.5/src/pilot-read-expenses.c
--- pilot-link-0.12.5-old/src/pilot-read-expenses.c 2009-06-04 15:26:19.000000000 +0200
+++ pilot-link-0.12.5/src/pilot-read-expenses.c 2011-12-13 18:24:19.844407496 +0100
@@ -41,8 +41,8 @@ int main(int argc, const char *argv[])
sd = -1;
enum { mode_none, mode_write = 257 } run_mode = mode_none;
- char buffer[0xffff];
- char buffer2[0xffff];
+ unsigned char buffer[0xffff];
+ unsigned char buffer2[0xffff];
pi_buffer_t *recbuf,
*appblock;
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/src/pilot-read-notepad.c pilot-link-0.12.5/src/pilot-read-notepad.c
--- pilot-link-0.12.5-old/src/pilot-read-notepad.c 2009-06-04 15:26:19.000000000 +0200
+++ pilot-link-0.12.5/src/pilot-read-notepad.c 2012-01-04 21:20:20.727758321 +0100
@@ -39,7 +39,7 @@
#ifdef HAVE_PNG
#include "png.h"
-#if (PNG_LIBPNG_VER < 10201)
+#if (PNG_LIBPNG_VER < 10201 || PNG_LIBPNG_VER >= 10400)
#define png_voidp_NULL (png_voidp)NULL
#define png_error_ptr_NULL (png_error_ptr)NULL
#endif
@@ -115,10 +115,15 @@ void write_ppm( FILE *f, struct NotePad
for( k=0; k<8; k++ )
{
- if( n->data[i].data & 1<<(7-k) )
- fwrite( &black, 3, 1, f );
- else
- fwrite( &white, 3, 1, f );
+ if( n->data[i].data & 1<<(7-k) ) {
+ if (fwrite( &black, 3, 1, f ) != 1) {
+ fprintf(stderr," WARNING: Failed to write.\n");
+ }
+ } else {
+ if (fwrite( &white, 3, 1, f ) != 1) {
+ fprintf(stderr," WARNING: Failed to write.\n");
+ }
+ }
}
}
}
@@ -127,17 +132,27 @@ void write_ppm( FILE *f, struct NotePad
{
for( k=0; k<8; k++ )
{
- if( n->data[i].repeat & 1<<(7-k) )
- fwrite( &black, 3, 1, f );
- else
- fwrite( &white, 3, 1, f );
+ if( n->data[i].repeat & 1<<(7-k) ) {
+ if (fwrite( &black, 3, 1, f ) != 1) {
+ fprintf(stderr," WARNING: Failed to write.\n");
+ }
+ } else {
+ if (fwrite( &white, 3, 1, f ) != 1) {
+ fprintf(stderr," WARNING: Failed to write.\n");
+ }
+ }
}
for( k=0; k<8; k++ )
{
- if( n->data[i].data & 1<<(7-k) )
- fwrite( &black, 3, 1, f );
- else
- fwrite( &white, 3, 1, f );
+ if( n->data[i].data & 1<<(7-k) ) {
+ if (fwrite( &black, 3, 1, f ) != 1) {
+ fprintf(stderr," WARNING: Failed to write.\n");
+ }
+ } else {
+ if (fwrite( &white, 3, 1, f ) != 1) {
+ fprintf(stderr," WARNING: Failed to write.\n");
+ }
+ }
}
}
@@ -257,7 +272,9 @@ void write_png_v2( FILE *f, struct NoteP
return;
}
- fwrite( n->data, n->body.dataLen, 1, f );
+ if (fwrite( n->data, n->body.dataLen, 1, f ) != 1) {
+ fprintf(stderr, "Failed to write.");
+ }
fflush( f );
}
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/src/pilot-read-palmpix.c pilot-link-0.12.5/src/pilot-read-palmpix.c
--- pilot-link-0.12.5-old/src/pilot-read-palmpix.c 2009-06-04 15:26:19.000000000 +0200
+++ pilot-link-0.12.5/src/pilot-read-palmpix.c 2012-01-04 21:20:45.604415083 +0100
@@ -42,7 +42,7 @@
#ifdef HAVE_PNG
#include "png.h"
-#if (PNG_LIBPNG_VER < 10201)
+#if (PNG_LIBPNG_VER < 10201 || PNG_LIBPNG_VER >= 10400)
#define png_voidp_NULL (png_voidp)NULL
#define png_error_ptr_NULL (png_error_ptr)NULL
#endif
@@ -125,7 +125,7 @@ static int getrecord_pi_socket (struct P
void **buf, size_t *bufsize)
{
- static char buffer[65536];
+ static unsigned char buffer[65536];
static pi_buffer_t fakebuf;
struct PalmPixState_pi_socket *state =
@@ -199,7 +199,9 @@ void write_ppm (FILE *f, const struct Pa
fprintf (f, "P6\n# %s (taken at %s)\n%d %d\n255\n",
state->pixname, fmt_date (header), header->w, header->h);
- fwrite (state->pixmap, header->w * header->h * 3, 1, f);
+ if (fwrite (state->pixmap, header->w * header->h * 3, 1, f) != 1) {
+ fprintf(stderr, "ERROR: Failed to write.\n");
+ }
}
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/src/pilot-read-screenshot.c pilot-link-0.12.5/src/pilot-read-screenshot.c
--- pilot-link-0.12.5-old/src/pilot-read-screenshot.c 2009-06-04 15:26:19.000000000 +0200
+++ pilot-link-0.12.5/src/pilot-read-screenshot.c 2012-01-04 21:55:29.073067865 +0100
@@ -40,7 +40,7 @@
#ifdef HAVE_PNG
# include "png.h"
-# if (PNG_LIBPNG_VER < 10201)
+# if (PNG_LIBPNG_VER < 10201 || PNG_LIBPNG_VER >= 10400)
# define png_voidp_NULL (png_voidp)NULL
# define png_error_ptr_NULL (png_error_ptr)NULL
# endif
@@ -77,7 +77,7 @@ struct ss_state {
#ifdef HAVE_PNG
void write_png ( char *fname, struct ss_state *state )
{
- unsigned char *gray_buf;
+ unsigned char *gray_buf = 0;
int i, j;
png_structp png_ptr;
png_infop info_ptr;
@@ -103,7 +103,6 @@ void write_png ( char *fname, struct ss_
if (setjmp (png_jmpbuf (png_ptr)))
{
png_destroy_write_struct (&png_ptr, &info_ptr);
- fclose (f);
return;
}
@@ -169,7 +168,9 @@ void write_ppm ( char *fname, struct ss_
fprintf (f, "255\n" );
for( i = 0; i < 3*state->h*state->w; i += 3 )
- fwrite( &state->pix_map[i], 3, 1, f);
+ if (fwrite( &state->pix_map[i], 3, 1, f) != 1) {
+ fprintf(stderr, "Failed to write to %s\n", fname);
+ }
fclose( f );
}
@@ -194,7 +195,7 @@ void WritePictures (int sd, int db, int
// unsigned char inBuf[61440], *pixelBuf;
pi_buffer_t *inBuf, *pixelBuf;
unsigned long clut[256], magic;
- int attr, category, val, mask, j, k;
+ int attr, category, val, mask = 0, j, k;
struct ss_state state;
if( type == OUT_PPM )
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/src/pilot-read-todos.c pilot-link-0.12.5/src/pilot-read-todos.c
--- pilot-link-0.12.5-old/src/pilot-read-todos.c 2009-06-04 15:32:32.000000000 +0200
+++ pilot-link-0.12.5/src/pilot-read-todos.c 2011-12-19 16:14:28.191121790 +0100
@@ -202,8 +202,8 @@ int main(int argc, const char *argv[])
for (i = 0;; i++) {
int attr,
- category,
- len;
+ category;
+ size_t len;
struct ToDo todo;
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/src/pilot-read-veo.c pilot-link-0.12.5/src/pilot-read-veo.c
--- pilot-link-0.12.5-old/src/pilot-read-veo.c 2009-06-04 15:26:19.000000000 +0200
+++ pilot-link-0.12.5/src/pilot-read-veo.c 2012-01-04 22:08:08.269082847 +0100
@@ -41,7 +41,7 @@
#ifdef HAVE_PNG
# include "png.h"
-# if (PNG_LIBPNG_VER < 10201)
+# if (PNG_LIBPNG_VER < 10201 || PNG_LIBPNG_VER >= 10400)
# define png_voidp_NULL (png_voidp)NULL
# define png_error_ptr_NULL (png_error_ptr)NULL
# endif
@@ -676,13 +676,12 @@ int ColourCorrect (struct Veo *v, uint8_
***********************************************************************/
int Gen24bitRow (long flags, int r, struct Veo *v, unsigned char *row)
{
- int i, rawW, rawH, modR = r % 4;
+ int i, rawW, modR = r % 4;
unsigned char rowA[2560], rowB[2560];
unsigned char *rAP, *rBP, *rCP;
rawW = v->width / 2;
- rawH = v->height / 2;
if (r == 0)
{
@@ -924,7 +923,9 @@ void write_ppm (FILE * f, struct Veo *v,
{
Gen24bitRow (flags, i, v, outBuf);
- fwrite (outBuf, v->width * 3, 1, f);
+ if (fwrite (outBuf, v->width * 3, 1, f) != 1) {
+ fprintf(stderr, "WARNING: Failed to write.\n");
+ }
}
}
@@ -944,7 +945,6 @@ void WritePicture (int sd, int db, int t
char fname[FILENAME_MAX];
FILE *f;
char extension[8];
- static int len;
struct Veo v;
pi_buffer_t *inBuf;
int attr, category;
@@ -971,8 +971,7 @@ void WritePicture (int sd, int db, int t
if (sd)
{
inBuf = pi_buffer_new (2560);
- len =
- dlp_ReadRecordByIndex (sd, db, 0, inBuf, 0, &attr, &category);
+ dlp_ReadRecordByIndex (sd, db, 0, inBuf, 0, &attr, &category);
unpack_Veo (&v, inBuf->data, inBuf->used);
pi_buffer_free (inBuf);
v.sd = sd;
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/src/pilot-wav.c pilot-link-0.12.5/src/pilot-wav.c
--- pilot-link-0.12.5-old/src/pilot-wav.c 2009-06-04 15:26:19.000000000 +0200
+++ pilot-link-0.12.5/src/pilot-wav.c 2012-01-04 22:23:44.024691316 +0100
@@ -107,31 +107,54 @@ long write_header(FILE * out)
wWaveLength = 0;
/* RIFF Header */
- fwrite("RIFF", 4, 1, out);
- fwrite(&wWaveLength, 4, 1, out);
- fwrite("WAVE", 4, 1, out);
+ if (
+ fwrite("RIFF", 4, 1, out) != 1
+ || fwrite(&wWaveLength, 4, 1, out) != 1
+ || fwrite("WAVE", 4, 1, out) != 1
+ ) {
+ fprintf(stderr," WARNING: Error writing header of wave file.\n");
+ return 0;
+ }
/* Format Chunk */
- fwrite(formatChunkID, 4, 1, out);
+ if (fwrite(formatChunkID, 4, 1, out) != 1) {
+ fprintf(stderr," WARNING: Error writing header of wave file.\n");
+ return 0;
+ }
/* Length of Format Chunk - 4 (fmt ) - 4 (length value itself) */
- fwrite(&formatChunkSize, 4, 1, out);
- fwrite(&wFormatTag, 2, 1, out);
- fwrite(&wChannels, 2, 1, out);
- fwrite(&dwSamplesPerSec, 4, 1, out);
- fwrite(&dwAvgBytesPerSec, 4, 1, out);
- fwrite(&wBlockAlign, 2, 1, out);
- fwrite(&wBitsPerSample, 2, 1, out);
+ if (
+ fwrite(&formatChunkSize, 4, 1, out) != 1
+ || fwrite(&wFormatTag, 2, 1, out) != 1
+ || fwrite(&wChannels, 2, 1, out) != 1
+ || fwrite(&dwSamplesPerSec, 4, 1, out) != 1
+ || fwrite(&dwAvgBytesPerSec, 4, 1, out) != 1
+ || fwrite(&wBlockAlign, 2, 1, out) != 1
+ || fwrite(&wBitsPerSample, 2, 1, out) != 1
+ ) {
+ fprintf(stderr," WARNING: Error writing header of wave file.\n");
+ return 0;
+ }
/* Extended Format Chunk Fields */
/* Extended format block size including(it appears) cbSize itself */
- fwrite(&cbSize, 2, 1, out);
- fwrite(&wSamplesPerBlock, 2, 1, out);
+ if (
+ fwrite(&cbSize, 2, 1, out) != 1
+ || fwrite(&wSamplesPerBlock, 2, 1, out) != 1
+ ) {
+ fprintf(stderr," WARNING: Error writing header of wave file.\n");
+ return 0;
+ }
/* Data Chunk */
- fwrite(dataChunkID, 4, 1, out);
- fwrite(&dataChunkSize, 4, 1, out);
+ if (
+ fwrite(dataChunkID, 4, 1, out) != 1
+ || fwrite(&dataChunkSize, 4, 1, out) != 1
+ ) {
+ fprintf(stderr," WARNING: Error writing header of wave file.\n");
+ return 0;
+ }
return formatChunkSize;
}
@@ -154,10 +177,16 @@ long write_header(FILE * out)
long write_data(char *buffer, int index, int size, long dataChunkSize, FILE *out)
{
if (index == 0) {
- fwrite(buffer + 122, size - 122, 1, out);
+ if (fwrite(buffer + 122, size - 122, 1, out) != 1) {
+ fprintf(stderr," WARNING: Error writing data.\n");
+ return 0;
+ }
dataChunkSize += size - 122;
} else {
- fwrite(buffer + 8, size - 8, 1, out);
+ if (fwrite(buffer + 8, size - 8, 1, out) != 1) {
+ fprintf(stderr," WARNING: Error writing data.\n");
+ return 0;
+ }
dataChunkSize += size - 8;
}
return dataChunkSize;
@@ -254,15 +283,19 @@ int fetch_wavs(int sd, char *dbname)
PI_ARGS((sd, db, index, buffer, &id_,
&attr, &category));
if (ret > 0) {
- dataChunkSize = write_data(buffer->data, index, buffer->used, dataChunkSize, out);
+ dataChunkSize = write_data((char *)buffer->data, index, buffer->used, dataChunkSize, out);
}
index++;
}
wWaveLength = 4 + 4 + 4 + formatChunkSize + 4 + 4 + dataChunkSize;
fseek(out, 44, SEEK_SET);
- fwrite(&dataChunkSize, 4, 1, out);
+ if (fwrite(&dataChunkSize, 4, 1, out) != 1) {
+ fprintf(stderr," WARNING: Error writing data.\n");
+ }
fseek(out, 4, SEEK_SET);
- fwrite(&wWaveLength, 4, 1, out);
+ if (fwrite(&wWaveLength, 4, 1, out) != 1) {
+ fprintf(stderr," WARNING: Error writing data.\n");
+ }
dlp_CloseDB(sd, db);
fclose(out);
if (!plu_quiet) {
@@ -288,12 +321,11 @@ int fetch_wavs(int sd, char *dbname)
***********************************************************************/
int do_fetch(char *dbname)
{
- int sd = -1,
- ret;
+ int sd = -1;
sd = plu_connect();
- ret = fetch_wavs(sd, dbname);
+ fetch_wavs(sd, dbname);
dlp_EndOfSync(sd, dlpEndCodeNormal);
pi_close(sd);
@@ -364,9 +396,13 @@ int pdb_to_wav(char *filename)
}
wWaveLength = 4 + 4 + 4 + formatChunkSize + 4 + 4 + dataChunkSize;
fseek(out, 44, SEEK_SET);
- fwrite(&dataChunkSize, 4, 1, out);
+ if (fwrite(&dataChunkSize, 4, 1, out) != 1) {
+ fprintf(stderr," WARNING: Error writing data.\n");
+ }
fseek(out, 4, SEEK_SET);
- fwrite(&wWaveLength, 4, 1, out);
+ if (fwrite(&wWaveLength, 4, 1, out) != 1) {
+ fprintf(stderr," WARNING: Error writing data.\n");
+ }
fclose(out);
pi_file_close(pi_fp);
if (!plu_quiet) {
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/src/pilot-xfer.c pilot-link-0.12.5/src/pilot-xfer.c
--- pilot-link-0.12.5-old/src/pilot-xfer.c 2010-02-07 03:21:18.000000000 +0100
+++ pilot-link-0.12.5/src/pilot-xfer.c 2012-01-04 22:28:32.040166439 +0100
@@ -713,7 +713,6 @@ pi_file_retrieve_VFS(const int fd, const
pi_buffer_t *buffer;
ssize_t readsize,writesize;
int filesize;
- int original_filesize;
int written_so_far;
pi_progress_t progress;
@@ -762,7 +761,6 @@ pi_file_retrieve_VFS(const int fd, const
}
dlp_VFSFileSize(socket,file,&filesize);
- original_filesize = filesize;
memset(&progress, 0, sizeof(progress));
progress.type = PI_PROGRESS_RECEIVE_VFS;
@@ -2478,7 +2476,7 @@ main(int argc, const char *argv[])
fprintf(stderr, " ERROR: '%s' is not a directory or does not exist.\n"
" Please supply a directory name when performing a "
"backup or restore and try again.\n\n", dirname);
- fprintf(stderr,gracias);
+ fprintf(stderr, "%s", gracias);
return 1;
}
}
@@ -2488,13 +2486,13 @@ main(int argc, const char *argv[])
if (rargc > 0)
{
fprintf(stderr," ERROR: Do not pass additional arguments to -busrlLC.\n");
- fprintf(stderr,gracias);
+ fprintf(stderr, "%s", gracias);
return 1;
}
break;
case palm_op_noop:
fprintf(stderr," ERROR: Must specify one of -bursimfdlC.\n");
- fprintf(stderr,gracias);
+ fprintf(stderr, "%s", gracias);
return 1;
break;
case palm_op_merge:
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/tests/calendardb-test.c pilot-link-0.12.5/tests/calendardb-test.c
--- pilot-link-0.12.5-old/tests/calendardb-test.c 2010-02-07 03:21:18.000000000 +0100
+++ pilot-link-0.12.5/tests/calendardb-test.c 2012-01-13 16:04:45.000000000 +0100
@@ -225,7 +225,7 @@ void parse(pi_file_t *pf)
if(pi_buf->used != test->used) {
int i;
- printf("Error: Different record sizes unpack: %ld pack: %ld last byte unpack: 0x%02X pack: 0x%02X\n", pi_buf->used, test->used, pi_buf->data[pi_buf->used-1], test->data[test->used-1]);
+ printf("Error: Different record sizes unpack: %zd pack: %zd last byte unpack: 0x%02X pack: 0x%02X\n", pi_buf->used, test->used, pi_buf->data[pi_buf->used-1], test->data[test->used-1]);
for(i=0; i<pi_buf->used; ++i) {
if(pi_buf->data[i] != test->data[i]) {
printf("Error: Byte %d is different unpack: 0x%02X pack: 0x%02X\n", i, pi_buf->data[i], test->data[i]);
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/tests/contactsdb-test.c pilot-link-0.12.5/tests/contactsdb-test.c
--- pilot-link-0.12.5-old/tests/contactsdb-test.c 2009-05-25 05:22:56.000000000 +0200
+++ pilot-link-0.12.5/tests/contactsdb-test.c 2011-12-14 17:30:21.000000000 +0100
@@ -31,6 +31,7 @@
#include "pi-header.h"
#include "pi-appinfo.h"
#include "pi-contact.h"
+#include "pi-userland.h"
#undef PRINT_USELESS_INFO
#undef SAVE_PICTURES
@@ -319,7 +320,7 @@ print_records (int sd, int db, struct Co
fclose (f);
}
#else
- printf (" Picture : JPEG (%zu bytes)\n",
+ printf (" Picture : JPEG (%u bytes)\n",
c.picture->length);
#endif /* SAVE_PICTURES */
}
@@ -345,7 +346,8 @@ main (const int argc, const char **argv)
return 1;
}
- sd = pilot_connect (argv[1]);
+ setenv("PILOTPORT", argv[1], 1);
+ sd = plu_connect();
if (sd < 0)
goto error;
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/tests/locationdb-test.c pilot-link-0.12.5/tests/locationdb-test.c
--- pilot-link-0.12.5-old/tests/locationdb-test.c 2009-02-22 09:09:02.000000000 +0100
+++ pilot-link-0.12.5/tests/locationdb-test.c 2012-01-13 16:05:12.000000000 +0100
@@ -149,7 +149,7 @@ void parse(pi_file_t *pf)
if(pi_buf->used != test->used) {
int i;
- printf("Error: Different record sizes unpack: %d pack: %d last byte unpack: 0x%02X pack: 0x%02X\n", pi_buf->used, test->used, pi_buf->data[pi_buf->used-1], test->data[test->used-1]);
+ printf("Error: Different record sizes unpack: %zu pack: %zu last byte unpack: 0x%02X pack: 0x%02X\n", pi_buf->used, test->used, pi_buf->data[pi_buf->used-1], test->data[test->used-1]);
for(i=0; i<pi_buf->used; ++i) {
if(pi_buf->data[i] != test->data[i]) {
printf("Error: Byte %d is different unpack: 0x%02X pack: 0x%02X\n", i, pi_buf->data[i], test->data[i]);
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/tests/Makefile.am pilot-link-0.12.5/tests/Makefile.am
--- pilot-link-0.12.5-old/tests/Makefile.am 2009-05-25 06:32:06.000000000 +0200
+++ pilot-link-0.12.5/tests/Makefile.am 2011-12-19 13:21:52.692923303 +0100
@@ -1,5 +1,4 @@
INCLUDES = \
- -I../include \
-I$(top_srcdir)/include \
$(POPT_INCLUDES)
@@ -24,7 +23,8 @@ locationdb_test_LDADD = \
contactsdb_test_SOURCES = \
contactsdb-test.c
contactsdb_test_LDADD = \
- $(top_builddir)/libpisock/libpisock.la
+ $(top_builddir)/libpisock/libpisock.la \
+ $(top_builddir)/src/libpiuserland.la
dlp_test_SOURCES = \
dlp-test.c
@@ -34,7 +34,8 @@ dlp_test_LDADD = \
vfs_test_SOURCES = \
vfs-test.c
vfs_test_LDADD = \
- $(top_builddir)/libpisock/libpisock.la
+ $(top_builddir)/libpisock/libpisock.la \
+ $(top_builddir)/src/libpiuserland.la
versamail_test_SOURCES = \
versamail-test.c
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/tests/Makefile.in pilot-link-0.12.5/tests/Makefile.in
--- pilot-link-0.12.5-old/tests/Makefile.in 2012-01-04 17:53:04.788589991 +0100
+++ pilot-link-0.12.5/tests/Makefile.in 2012-01-04 22:52:56.840844137 +0100
@@ -63,7 +63,8 @@ calendardb_test_OBJECTS = $(am_calendard
calendardb_test_DEPENDENCIES = $(top_builddir)/libpisock/libpisock.la
am_contactsdb_test_OBJECTS = contactsdb-test.$(OBJEXT)
contactsdb_test_OBJECTS = $(am_contactsdb_test_OBJECTS)
-contactsdb_test_DEPENDENCIES = $(top_builddir)/libpisock/libpisock.la
+contactsdb_test_DEPENDENCIES = $(top_builddir)/libpisock/libpisock.la \
+ $(top_builddir)/src/libpiuserland.la
am_dlp_test_OBJECTS = dlp-test.$(OBJEXT)
dlp_test_OBJECTS = $(am_dlp_test_OBJECTS)
dlp_test_DEPENDENCIES = $(top_builddir)/libpisock/libpisock.la
@@ -78,7 +79,8 @@ versamail_test_OBJECTS = $(am_versamail_
versamail_test_DEPENDENCIES = $(top_builddir)/libpisock/libpisock.la
am_vfs_test_OBJECTS = vfs-test.$(OBJEXT)
vfs_test_OBJECTS = $(am_vfs_test_OBJECTS)
-vfs_test_DEPENDENCIES = $(top_builddir)/libpisock/libpisock.la
+vfs_test_DEPENDENCIES = $(top_builddir)/libpisock/libpisock.la \
+ $(top_builddir)/src/libpiuserland.la
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -I$(top_builddir)/include
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@@ -288,7 +290,6 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
usb_libs = @usb_libs@
INCLUDES = \
- -I../include \
-I$(top_srcdir)/include \
$(POPT_INCLUDES)
@@ -308,7 +309,8 @@ contactsdb_test_SOURCES = \
contactsdb-test.c
contactsdb_test_LDADD = \
- $(top_builddir)/libpisock/libpisock.la
+ $(top_builddir)/libpisock/libpisock.la \
+ $(top_builddir)/src/libpiuserland.la
dlp_test_SOURCES = \
dlp-test.c
@@ -320,7 +322,8 @@ vfs_test_SOURCES = \
vfs-test.c
vfs_test_LDADD = \
- $(top_builddir)/libpisock/libpisock.la
+ $(top_builddir)/libpisock/libpisock.la \
+ $(top_builddir)/src/libpiuserland.la
versamail_test_SOURCES = \
versamail-test.c
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/tests/packers.c pilot-link-0.12.5/tests/packers.c
--- pilot-link-0.12.5-old/tests/packers.c 2005-06-16 17:38:28.000000000 +0200
+++ pilot-link-0.12.5/tests/packers.c 2011-12-20 16:33:46.072123761 +0100
@@ -20,13 +20,14 @@
#include "pi-dlp.h"
#include "pi-expense.h"
#include "pi-mail.h"
+#include "pi-debug.h"
unsigned char seed;
-char *target;
+unsigned char *target;
int targetlen;
-void reset_block(char *buffer, int len)
+void reset_block(unsigned char *buffer, int len)
{
unsigned int i;
@@ -34,19 +35,19 @@ void reset_block(char *buffer, int len)
buffer[i] = (i + seed) & 0xff;
}
-int check_block(int test, const char *buffer, int len, int start,
+int check_block(int test, const unsigned char *buffer, int len, int start,
int count, const char *name)
{
unsigned int i;
int fore = 0, aft = 0;
for (i = 0; i < start; i++)
- if (buffer[i] != (char) ((i + seed) & 0xff)) {
+ if (buffer[i] != ((i + seed) & 0xff)) {
fore = start - i;
break;
}
for (i = start + count; i < len; i++)
- if (buffer[i] != (char) ((i + seed) & 0xff)) {
+ if (buffer[i] != ((i + seed) & 0xff)) {
aft = i - start;
break;
}
@@ -64,7 +65,7 @@ int check_block(int test, const char *bu
return 0;
}
-char MemoAppBlock[17 * 16 + 10] = "\
+unsigned char MemoAppBlock[17 * 16 + 10] = "\
\x00\x00\x55\x6e\x66\x69\x6c\x65\x64\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x42\x75\x73\x69\x6e\x65\x73\x73\x00\x00\x00\x00\x00\x00\
\x00\x00\x50\x65\x72\x73\x6f\x6e\x61\x6c\x00\x00\x00\x00\x00\x00\
@@ -84,7 +85,7 @@ char MemoAppBlock[17 * 16 + 10] = "\
\x00\x00\x00\x01\x02\x10\x11\x12\x13\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x13\x00\x00\x00\x00\x00\x01\x00";
-char MemoRecord[3 * 16 + 7] = "\
+unsigned char MemoRecord[3 * 16 + 7] = "\
\x61\x61\x4d\x61\x6b\x65\x66\x69\x6c\x65\x0a\x52\x45\x41\x44\x4d\
\x45\x0a\x6c\x69\x63\x65\x6e\x73\x65\x2e\x74\x65\x72\x6d\x73\x0a\
\x70\x69\x6c\x6f\x74\x6c\x69\x6e\x6b\x2e\x63\x0a\x74\x65\x73\x74\
@@ -103,7 +104,7 @@ int test_memo()
if (l != sizeof(MemoAppBlock)) {
errors++;
printf
- ("1: unpack_MemoAppInfo returned incorrect length (got %d, expected %d)\n",
+ ("1: unpack_MemoAppInfo returned incorrect length (got %d, expected %lu)\n",
l, sizeof(MemoAppBlock));
}
@@ -112,7 +113,7 @@ int test_memo()
if (l != sizeof(MemoAppBlock)) {
errors++;
printf
- ("2: unpack_MemoAppInfo returned incorrect length (got %d, expected %d)\n",
+ ("2: unpack_MemoAppInfo returned incorrect length (got %d, expected %lu)\n",
l, sizeof(MemoAppBlock));
}
@@ -141,7 +142,7 @@ int test_memo()
if (l != sizeof(MemoAppBlock)) {
errors++;
printf
- ("5: unpack_MemoAppInfo returned incorrect length (got %d, expected %d)\n",
+ ("5: unpack_MemoAppInfo returned incorrect length (got %d, expected %lu)\n",
l, sizeof(MemoAppBlock));
}
@@ -205,7 +206,7 @@ int test_memo()
if (l != sizeof(MemoAppBlock)) {
errors++;
printf
- ("7: pack_MemoAppInfo returned incorrect allocation length (got %d, expected %d)\n",
+ ("7: pack_MemoAppInfo returned incorrect allocation length (got %d, expected %lu)\n",
l, sizeof(MemoAppBlock));
}
@@ -230,7 +231,7 @@ int test_memo()
if (l != sizeof(MemoAppBlock)) {
errors++;
printf
- ("10: pack_MemoAppInfo returned incorrect length (got %d, expected %d)\n",
+ ("10: pack_MemoAppInfo returned incorrect length (got %d, expected %lu)\n",
l, sizeof(MemoAppBlock));
}
@@ -271,7 +272,7 @@ int test_memo()
if (RecordBuffer->used != sizeof(MemoRecord)) {
errors++;
printf
- ("15: pack_MemoRecord returned incorrect allocation length (got %d, expected %d)\n",
+ ("15: pack_MemoRecord returned incorrect allocation length (got %lu, expected %lu)\n",
RecordBuffer->used, sizeof(MemoRecord));
}
@@ -290,7 +291,7 @@ int test_memo()
return errors;
}
-char AddressAppBlock[39 * 16 + 14] = "\
+unsigned char AddressAppBlock[39 * 16 + 14] = "\
\x00\x10\x55\x6e\x66\x69\x6c\x65\x64\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x42\x75\x73\x69\x6e\x65\x73\x73\x00\x00\x00\x00\x00\x00\
\x00\x00\x50\x65\x72\x73\x6f\x6e\x61\x6c\x00\x00\x00\x00\x00\x00\
@@ -332,7 +333,7 @@ char AddressAppBlock[39 * 16 + 14] = "\
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x4d\x6f\x62\x69\x6c\x65\
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x17\x00\x00\x00";
-char AddressRecord[2 * 16 + 12] = "\
+unsigned char AddressRecord[2 * 16 + 12] = "\
\x00\x14\x32\x10\x00\x04\x41\x03\x00\x53\x68\x61\x77\x00\x42\x65\
\x72\x6e\x61\x72\x64\x00\x4e\x6f\x6e\x65\x20\x6b\x6e\x6f\x77\x6e\
\x00\x43\x31\x00\x41\x20\x6e\x6f\x74\x65\x2e\x00";
@@ -352,7 +353,7 @@ int test_address()
if (l != sizeof(AddressAppBlock)) {
errors++;
printf
- ("1: unpack_AddressAppInfo returned incorrect length (got %d, expected %d)\n",
+ ("1: unpack_AddressAppInfo returned incorrect length (got %d, expected %lu)\n",
l, sizeof(AddressAppBlock));
}
@@ -363,7 +364,7 @@ int test_address()
if (l != sizeof(AddressAppBlock)) {
errors++;
printf
- ("2: unpack_AddressAppInfo returned incorrect length (got %d, expected %d)\n",
+ ("2: unpack_AddressAppInfo returned incorrect length (got %d, expected %lu)\n",
l, sizeof(AddressAppBlock));
}
@@ -396,7 +397,7 @@ int test_address()
if (l != sizeof(AddressAppBlock)) {
errors++;
printf
- ("5: unpack_AddressAppInfo returned incorrect length (got %d, expected %d)\n",
+ ("5: unpack_AddressAppInfo returned incorrect length (got %d, expected %lu)\n",
l, sizeof(AddressAppBlock));
}
@@ -458,7 +459,7 @@ int test_address()
if (l != sizeof(AddressAppBlock)) {
errors++;
printf
- ("7: pack_AddressAppInfo returned incorrect allocation length (got %d, expected %d)\n",
+ ("7: pack_AddressAppInfo returned incorrect allocation length (got %d, expected %lu)\n",
l, sizeof(AddressAppBlock));
}
@@ -484,7 +485,7 @@ int test_address()
if (l != sizeof(AddressAppBlock)) {
errors++;
printf
- ("10: pack_AddressAppInfo returned incorrect length (got %d, expected %d)\n",
+ ("10: pack_AddressAppInfo returned incorrect length (got %d, expected %lu)\n",
l, sizeof(AddressAppBlock));
}
@@ -534,7 +535,7 @@ int test_address()
if (RecordBuffer->used != sizeof(AddressRecord)) {
errors++;
printf
- ("15: pack_Address returned incorrect length (got %d, expected %d)\n",
+ ("15: pack_Address returned incorrect length (got %lu, expected %lu)\n",
RecordBuffer->used, sizeof(AddressRecord));
}
@@ -553,7 +554,7 @@ int test_address()
return errors;
}
-char AppointmentAppBlock[17 * 16 + 8] = "\
+unsigned char AppointmentAppBlock[17 * 16 + 8] = "\
\x00\x00\x55\x6e\x66\x69\x6c\x65\x64\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
@@ -577,7 +578,7 @@ char AppointmentAppBlock[17 * 16 + 8] =
and thus have a floating value. This sample record has
been altered to make theses bytes zero, to match what our
packing code generates. */
-char AppointmentRecord[2 * 16 + 3] = "\
+unsigned char AppointmentRecord[2 * 16 + 3] = "\
\x09\x00\x0d\x28\xbb\x02\x7c\x00\x1d\x02\x02\x00\xbd\x24\x02\x55\
\x00\x00\x00\x01\xbb\x0c\x47\x65\x6f\x72\x67\x65\x00\x4e\x6f\x74\
\x65\x21\x00";
@@ -598,7 +599,7 @@ int test_appointment()
if (l != sizeof(AppointmentAppBlock)) {
errors++;
printf
- ("1: unpack_AppointmentAppInfo returned incorrect length (got %d, expected %d)\n",
+ ("1: unpack_AppointmentAppInfo returned incorrect length (got %d, expected %lu)\n",
l, sizeof(AppointmentAppBlock));
}
@@ -609,7 +610,7 @@ int test_appointment()
if (l != sizeof(AppointmentAppBlock)) {
errors++;
printf
- ("2: unpack_AppointmentAppInfo returned incorrect length (got %d, expected %d)\n",
+ ("2: unpack_AppointmentAppInfo returned incorrect length (got %d, expected %lu)\n",
l, sizeof(AppointmentAppBlock));
}
@@ -642,7 +643,7 @@ int test_appointment()
if (l != sizeof(AppointmentAppBlock)) {
errors++;
printf
- ("5: unpack_AppointmentAppInfo returned incorrect length (got %d, expected %d)\n",
+ ("5: unpack_AppointmentAppInfo returned incorrect length (got %d, expected %lu)\n",
l, sizeof(AppointmentAppBlock));
}
@@ -707,7 +708,7 @@ int test_appointment()
if (l != sizeof(AppointmentAppBlock)) {
errors++;
printf
- ("7: pack_AppointmentAppInfo returned incorrect allocation length (got %d, expected %d)\n",
+ ("7: pack_AppointmentAppInfo returned incorrect allocation length (got %d, expected %lu)\n",
l, sizeof(AppointmentAppBlock));
}
@@ -733,7 +734,7 @@ int test_appointment()
if (l != sizeof(AppointmentAppBlock)) {
errors++;
printf
- ("10: pack_AppointmentAppInfo returned incorrect length (got %d, expected %d)\n",
+ ("10: pack_AppointmentAppInfo returned incorrect length (got %d, expected %lu)\n",
l, sizeof(AppointmentAppBlock));
}
@@ -785,7 +786,7 @@ int test_appointment()
if (RecordBuffer->used != sizeof(AppointmentRecord)) {
errors++;
printf
- ("15: pack_Appointment returned incorrect length (got %d, expected %d)\n",
+ ("15: pack_Appointment returned incorrect length (got %lu, expected %lu)\n",
RecordBuffer->used, sizeof(AppointmentRecord));
}
@@ -804,7 +805,7 @@ int test_appointment()
return errors;
}
-char ToDoAppBlock[17 * 16 + 10] = "\
+unsigned char ToDoAppBlock[17 * 16 + 10] = "\
\x00\x08\x55\x6e\x66\x69\x6c\x65\x64\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x42\x75\x73\x69\x6e\x65\x73\x73\x00\x00\x00\x00\x00\x00\
\x00\x00\x50\x65\x72\x73\x6f\x6e\x61\x6c\x00\x00\x00\x00\x00\x00\
@@ -824,7 +825,7 @@ char ToDoAppBlock[17 * 16 + 10] = "\
\x00\x00\x00\x01\x02\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x11\x00\x00\x00\xff\xff\x01\x00";
-char ToDoRecord[1 * 16 + 1] = "\
+unsigned char ToDoRecord[1 * 16 + 1] = "\
\xbb\x09\x05\x54\x6f\x64\x6f\x33\x00\x41\x20\x6e\x6f\x74\x65\x2e\
\x00";
@@ -841,7 +842,7 @@ int test_todo()
if (l != sizeof(ToDoAppBlock)) {
errors++;
printf
- ("1: unpack_ToDoAppInfo returned incorrect length (got %d, expected %d)\n",
+ ("1: unpack_ToDoAppInfo returned incorrect length (got %d, expected %lu)\n",
l, sizeof(ToDoAppBlock));
}
@@ -850,7 +851,7 @@ int test_todo()
if (l != sizeof(ToDoAppBlock)) {
errors++;
printf
- ("2: unpack_ToDoAppInfo returned incorrect length (got %d, expected %d)\n",
+ ("2: unpack_ToDoAppInfo returned incorrect length (got %d, expected %lu)\n",
l, sizeof(ToDoAppBlock));
}
@@ -877,7 +878,7 @@ int test_todo()
if (l != sizeof(ToDoAppBlock)) {
errors++;
printf
- ("5: unpack_ToDoAppInfo returned incorrect length (got %d, expected %d)\n",
+ ("5: unpack_ToDoAppInfo returned incorrect length (got %d, expected %lu)\n",
l, sizeof(ToDoAppBlock));
}
@@ -941,7 +942,7 @@ int test_todo()
if (l != sizeof(ToDoAppBlock)) {
errors++;
printf
- ("7: pack_ToDoAppInfo returned incorrect allocation length (got %d, expected %d)\n",
+ ("7: pack_ToDoAppInfo returned incorrect allocation length (got %d, expected %lu)\n",
l, sizeof(ToDoAppBlock));
}
@@ -966,7 +967,7 @@ int test_todo()
if (l != sizeof(ToDoAppBlock)) {
errors++;
printf
- ("10: pack_ToDoAppInfo returned incorrect length (got %d, expected %d)\n",
+ ("10: pack_ToDoAppInfo returned incorrect length (got %d, expected %lu)\n",
l, sizeof(ToDoAppBlock));
}
@@ -1020,7 +1021,7 @@ int test_todo()
if (RecordBuffer->used != sizeof(ToDoRecord)) {
errors++;
printf
- ("15: pack_ToDo returned incorrect length (got %d, expected %d)\n",
+ ("15: pack_ToDo returned incorrect length (got %d, expected %lu)\n",
l, sizeof(ToDoRecord));
}
@@ -1039,7 +1040,7 @@ int test_todo()
return errors;
}
-char ExpenseAppBlock[24 * 16 + 8] = "\
+unsigned char ExpenseAppBlock[24 * 16 + 8] = "\
\x00\x00\x55\x6e\x66\x69\x6c\x65\x64\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x4e\x65\x77\x20\x59\x6f\x72\x6b\x00\x00\x00\x00\x00\x00\
\x00\x00\x50\x61\x72\x69\x73\x00\x00\x00\x00\x00\x00\x00\x00\x00\
@@ -1067,7 +1068,7 @@ char ExpenseAppBlock[24 * 16 + 8] = "\
\x00\x00\x00\x00\x00\x00\x00\x00";
/* Byte five is floating */
-char ExpenseRecord[1 * 16 + 14] = "\
+unsigned char ExpenseRecord[1 * 16 + 14] = "\
\xbb\x2a\x09\x01\x08\x00\x32\x39\x2e\x37\x32\x00\x55\x00\x43\x00\
\x41\x74\x74\x00\x54\x68\x65\x20\x6e\x6f\x74\x65\x2e\x00";
@@ -1086,7 +1087,7 @@ int test_expense()
if (l != sizeof(ExpenseAppBlock)) {
errors++;
printf
- ("1: unpack_ExpenseAppInfo returned incorrect length (got %d, expected %d)\n",
+ ("1: unpack_ExpenseAppInfo returned incorrect length (got %d, expected %lu)\n",
l, sizeof(ExpenseAppBlock));
}
@@ -1097,7 +1098,7 @@ int test_expense()
if (l != sizeof(ExpenseAppBlock)) {
errors++;
printf
- ("2: unpack_ExpenseAppInfo returned incorrect length (got %d, expected %d)\n",
+ ("2: unpack_ExpenseAppInfo returned incorrect length (got %d, expected %lu)\n",
l, sizeof(ExpenseAppBlock));
}
@@ -1115,7 +1116,7 @@ int test_expense()
if (l != sizeof(ExpenseAppBlock)) {
errors++;
printf
- ("3: unpack_ExpenseAppInfo returned incorrect length (got %d, expected %d)\n",
+ ("3: unpack_ExpenseAppInfo returned incorrect length (got %d, expected %lu)\n",
l, sizeof(ExpenseAppBlock));
}
@@ -1180,7 +1181,7 @@ int test_expense()
if (l != sizeof(ExpenseAppBlock)) {
errors++;
printf
- ("5: pack_ExpenseAppInfo returned incorrect allocation length (got %d, expected %d)\n",
+ ("5: pack_ExpenseAppInfo returned incorrect allocation length (got %d, expected %lu)\n",
l, sizeof(ExpenseAppBlock));
}
@@ -1206,7 +1207,7 @@ int test_expense()
if (l != sizeof(ExpenseAppBlock)) {
errors++;
printf
- ("8: pack_ExpenseAppInfo returned incorrect length (got %d, expected %d)\n",
+ ("8: pack_ExpenseAppInfo returned incorrect length (got %d, expected %lu)\n",
l, sizeof(ExpenseAppBlock));
}
@@ -1229,7 +1230,7 @@ int test_expense()
if (l != sizeof(ExpenseRecord)) {
errors++;
printf
- ("11: unpack_Expense returned incorrect length (got %d, expected %d)\n",
+ ("11: unpack_Expense returned incorrect length (got %d, expected %lu)\n",
l, sizeof(ExpenseRecord));
}
@@ -1256,7 +1257,7 @@ int test_expense()
if (l != sizeof(ExpenseRecord)) {
errors++;
printf
- ("13: pack_Expense returned incorrect allocation length (got %d, expected %d)\n",
+ ("13: pack_Expense returned incorrect allocation length (got %d, expected %lu)\n",
l, sizeof(ExpenseRecord));
}
@@ -1281,7 +1282,7 @@ int test_expense()
if (l != sizeof(ExpenseRecord)) {
errors++;
printf
- ("16: pack_Expense returned incorrect length (got %d, expected %d)\n",
+ ("16: pack_Expense returned incorrect length (got %d, expected %lu)\n",
l, sizeof(ExpenseRecord));
}
@@ -1302,7 +1303,7 @@ int test_expense()
return errors;
}
-char MailAppBlock[18 * 16 + 1] = "\
+unsigned char MailAppBlock[18 * 16 + 1] = "\
\x00\x1f\x49\x6e\x62\x6f\x78\x00\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x4f\x75\x74\x62\x6f\x78\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x44\x65\x6c\x65\x74\x65\x64\x00\x00\x00\x00\x00\x00\x00\
@@ -1323,14 +1324,14 @@ char MailAppBlock[18 * 16 + 1] = "\
\x0e\x0f\x0f\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x01\x20\
\x00";
-char MailRecord[1 * 16 + 2] = "\
+unsigned char MailRecord[1 * 16 + 2] = "\
\x00\x00\x00\x00\x78\x00\x43\x00\x00\x61\x00\x62\x00\x00\x00\x00\
\x44\x00"; /*\x27"; This byte seems to be spurious */
-char MailSigPreference[3] = "\
+unsigned char MailSigPreference[3] = "\
\x61\x62\x00";
-char MailSyncPreference[13] = "\
+unsigned char MailSyncPreference[13] = "\
\x02\x01\x00\x00\x17\x70\x61\x74\x00\x6c\x64\x00\x00";
int test_mail()
@@ -1347,7 +1348,7 @@ int test_mail()
if (l != sizeof(MailAppBlock)) {
errors++;
printf
- ("1: unpack_MailAppInfo returned incorrect length (got %d, expected %d)\n",
+ ("1: unpack_MailAppInfo returned incorrect length (got %d, expected %lu)\n",
l, sizeof(MailAppBlock));
}
@@ -1356,7 +1357,7 @@ int test_mail()
if (l != sizeof(MailAppBlock)) {
errors++;
printf
- ("2: unpack_MailAppInfo returned incorrect length (got %d, expected %d)\n",
+ ("2: unpack_MailAppInfo returned incorrect length (got %d, expected %lu)\n",
l, sizeof(MailAppBlock));
}
@@ -1372,7 +1373,7 @@ int test_mail()
if (l != sizeof(MailAppBlock)) {
errors++;
printf
- ("3: unpack_MailAppInfo returned incorrect length (got %d, expected %d)\n",
+ ("3: unpack_MailAppInfo returned incorrect length (got %d, expected %lu)\n",
l, sizeof(MailAppBlock));
}
@@ -1437,7 +1438,7 @@ int test_mail()
if (l != sizeof(MailAppBlock)) {
errors++;
printf
- ("5: pack_MailAppInfo returned incorrect allocation length (got %d, expected %d)\n",
+ ("5: pack_MailAppInfo returned incorrect allocation length (got %d, expected %lu)\n",
l, sizeof(MailAppBlock));
}
@@ -1462,7 +1463,7 @@ int test_mail()
if (l != sizeof(MailAppBlock)) {
errors++;
printf
- ("8: pack_MailAppInfo returned incorrect length (got %d, expected %d)\n",
+ ("8: pack_MailAppInfo returned incorrect length (got %d, expected %lu)\n",
l, sizeof(MailAppBlock));
}
@@ -1485,7 +1486,7 @@ int test_mail()
if (l != sizeof(MailRecord)) {
errors++;
printf
- ("11: unpack_Mail returned incorrect length (got %d, expected %d)\n",
+ ("11: unpack_Mail returned incorrect length (got %d, expected %lu)\n",
l, sizeof(MailRecord));
}
@@ -1512,7 +1513,7 @@ int test_mail()
if (l != sizeof(MailRecord)) {
errors++;
printf
- ("13: pack_Mail returned incorrect allocation length (got %d, expected %d)\n",
+ ("13: pack_Mail returned incorrect allocation length (got %d, expected %lu)\n",
l, sizeof(MailRecord));
}
@@ -1536,7 +1537,7 @@ int test_mail()
if (l != sizeof(MailRecord)) {
errors++;
printf
- ("16: pack_Mail returned incorrect length (got %d, expected %d)\n",
+ ("16: pack_Mail returned incorrect length (got %d, expected %lu)\n",
l, sizeof(MailRecord));
}
@@ -1560,7 +1561,7 @@ int test_mail()
if (l != sizeof(MailSyncPreference)) {
errors++;
printf
- ("19: unpack_MailSyncPref returned incorrect length (got %d, expected %d)\n",
+ ("19: unpack_MailSyncPref returned incorrect length (got %d, expected %lu)\n",
l, sizeof(MailSyncPreference));
}
@@ -1571,7 +1572,7 @@ int test_mail()
if (l != sizeof(MailSyncPreference)) {
errors++;
printf
- ("20: unpack_MailSyncPref returned incorrect length (got %d, expected %d)\n",
+ ("20: unpack_MailSyncPref returned incorrect length (got %d, expected %lu)\n",
l, sizeof(MailSyncPreference));
}
@@ -1582,7 +1583,7 @@ int test_mail()
if (l != sizeof(MailSyncPreference)) {
errors++;
printf
- ("21: unpack_MailSyncPref returned incorrect length (got %d, expected %d)\n",
+ ("21: unpack_MailSyncPref returned incorrect length (got %d, expected %lu)\n",
l, sizeof(MailSyncPreference));
}
@@ -1609,7 +1610,7 @@ int test_mail()
if (l != sizeof(MailSyncPreference)) {
errors++;
printf
- ("23: pack_MailSyncPref returned incorrect allocation length (got %d, expected %d)\n",
+ ("23: pack_MailSyncPref returned incorrect allocation length (got %d, expected %lu)\n",
l, sizeof(MailSyncPreference));
}
@@ -1635,7 +1636,7 @@ int test_mail()
if (l != sizeof(MailSyncPreference)) {
errors++;
printf
- ("26: pack_MailSyncPref returned incorrect length (got %d, expected %d)\n",
+ ("26: pack_MailSyncPref returned incorrect length (got %d, expected %lu)\n",
l, sizeof(MailSyncPreference));
}
@@ -1661,7 +1662,7 @@ int test_mail()
if (l != sizeof(MailSigPreference)) {
errors++;
printf
- ("29: unpack_MailSigPref returned incorrect length (got %d, expected %d)\n",
+ ("29: unpack_MailSigPref returned incorrect length (got %d, expected %lu)\n",
l, sizeof(MailSyncPreference));
}
@@ -1672,7 +1673,7 @@ int test_mail()
if (l != sizeof(MailSigPreference)) {
errors++;
printf
- ("30: unpack_MailSigPref returned incorrect length (got %d, expected %d)\n",
+ ("30: unpack_MailSigPref returned incorrect length (got %d, expected %lu)\n",
l, sizeof(MailSyncPreference));
}
@@ -1683,7 +1684,7 @@ int test_mail()
if (l != sizeof(MailSigPreference)) {
errors++;
printf
- ("31: unpack_MailSigPref returned incorrect length (got %d, expected %d)\n",
+ ("31: unpack_MailSigPref returned incorrect length (got %d, expected %lu)\n",
l, sizeof(MailSyncPreference));
}
@@ -1710,7 +1711,7 @@ int test_mail()
if (l != sizeof(MailSigPreference)) {
errors++;
printf
- ("33: pack_MailSignaturePref returned incorrect allocation length (got %d, expected %d)\n",
+ ("33: pack_MailSignaturePref returned incorrect allocation length (got %d, expected %lu)\n",
l, sizeof(MailSigPreference));
}
@@ -1736,7 +1737,7 @@ int test_mail()
if (l != sizeof(MailSigPreference)) {
errors++;
printf
- ("36: pack_MailSignaturePref returned incorrect length (got %d, expected %d)\n",
+ ("36: pack_MailSignaturePref returned incorrect length (got %d, expected %lu)\n",
l, sizeof(MailSigPreference));
}
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/tests/versamail-test.c pilot-link-0.12.5/tests/versamail-test.c
--- pilot-link-0.12.5-old/tests/versamail-test.c 2005-04-21 17:21:30.000000000 +0200
+++ pilot-link-0.12.5/tests/versamail-test.c 2011-12-14 16:39:27.926393327 +0100
@@ -186,7 +186,7 @@ int main(int argc, char *argv[])
{
struct pi_file *pi_fp;
char *DBname;
- int r;
+ int r = 0;
int idx;
size_t size;
int attr;
diff -upr -x '*.deps*' -x '*Makefile' -x '*config.*' pilot-link-0.12.5-old/tests/vfs-test.c pilot-link-0.12.5/tests/vfs-test.c
--- pilot-link-0.12.5-old/tests/vfs-test.c 2007-02-05 10:48:10.000000000 +0100
+++ pilot-link-0.12.5/tests/vfs-test.c 2011-12-14 20:07:53.702893697 +0100
@@ -35,6 +35,7 @@
#include "pi-error.h"
#include "pi-source.h"
#include "pi-header.h"
+#include "pi-userland.h"
/* For various protocol versions, set to 0 to not test those versions */
@@ -77,7 +78,8 @@ int main (int argc, char **argv)
unsigned long flags;
- sd = pilot_connect (argv[1]);
+ setenv("PILOTPORT", argv[1], 1);
+ sd = plu_connect();
if (sd < 0) return 1;
t1 = time (NULL);
@@ -297,7 +299,7 @@ int main (int argc, char **argv)
LOG((PI_DBG_USER, PI_DBG_LVL_INFO, "* ERROR: File read: read %d instead of the expected %d\n", len, strlen (name)));
} else if (memcmp (name, fileBuf->data, fileBuf->used)) {
LOG((PI_DBG_USER, PI_DBG_LVL_INFO, "* ERROR: File read: read data mismatch\n", fileBuf->used, strlen (name)));
- pi_dumpdata (name, fileBuf->used);
+ pi_dumpdata ((unsigned char*)name, fileBuf->used);
pi_dumpdata (fileBuf->data, fileBuf->used);
} else {
LOG((PI_DBG_USER, PI_DBG_LVL_INFO, "* File read: successfully read the data back\n"));