summaryrefslogtreecommitdiff
path: root/camlibs/sonydscf1
diff options
context:
space:
mode:
authorArnaud Launay <asl@launay.org>2002-12-29 12:45:16 +0000
committerArnaud Launay <asl@launay.org>2002-12-29 12:45:16 +0000
commit65d768d6ecbea0b4e5d14cf30c6f26ba82073c9c (patch)
treeff95240a6aa4b325541e4eabe217deaf06d2224c /camlibs/sonydscf1
parentd85e4c11b5860f058d7eee627cc0f474368ffd22 (diff)
downloadlibgphoto2-65d768d6ecbea0b4e5d14cf30c6f26ba82073c9c.tar.gz
Fix warnings
git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@5984 67ed7778-7388-44ab-90cf-0a291f65f57c
Diffstat (limited to 'camlibs/sonydscf1')
-rw-r--r--camlibs/sonydscf1/chotplay.c22
-rw-r--r--camlibs/sonydscf1/chotplay.h17
-rw-r--r--camlibs/sonydscf1/command.c25
-rw-r--r--camlibs/sonydscf1/command.h11
-rw-r--r--camlibs/sonydscf1/getuint.c2
-rw-r--r--camlibs/sonydscf1/getuint.h4
6 files changed, 43 insertions, 38 deletions
diff --git a/camlibs/sonydscf1/chotplay.c b/camlibs/sonydscf1/chotplay.c
index a3e8891b4..1c4501003 100644
--- a/camlibs/sonydscf1/chotplay.c
+++ b/camlibs/sonydscf1/chotplay.c
@@ -3,7 +3,6 @@
#include <string.h>
#include <errno.h>
#include <gphoto2.h>
-extern int errno;
#define BINARYFILEMODE
@@ -21,11 +20,15 @@ extern int errno;
#else
#define MAXPATHLEN 256
#endif
+#include <termios.h>
+
+#include "chotplay.h"
#include "common.h"
#include "command.h"
-#include <termios.h>
+#include "getuint.h"
#include "pmp.h"
-//#include <io.h>
+
+extern int errno;
#define MAX_PICTURE_NUM 200
@@ -191,12 +194,9 @@ int get_picture_information(int *pmx_num, int outit)
u_char buforg[PMF_MAXSIZ];
char name[64];
long len;
- int i,n;
+ int i, n;
int j, k;
- FILE *outfp;
- int fh;
- int offset=0;
- char *buf = &buforg;
+ char *buf = (char *) &buforg;
sprintf(name, "/PIC_CAM/PIC00000/PIC_INF.PMF");
F1ok();
@@ -298,8 +298,8 @@ long get_file(char *name, char **data, int format, int verbose)
total = total + len;
// gp_camera_progress(camera, ((float)total / (float)filelen));
if(verbose){
- fprintf(stderr, "%6u/", total);
- fprintf(stderr, "%6u", filelen);
+ fprintf(stderr, "%6lu/", total);
+ fprintf(stderr, "%6lu", filelen);
fprintf(stderr, "\b\b\b\b\b\b\b\b\b\b\b\b\b");
}
/*result = fwrite(buf, sizeof(u_char), (size_t) len, fp);*/
@@ -347,7 +347,7 @@ long get_thumbnail(char *name, char **data, int format, int verbose, int n)
}
total = total + len;
if(verbose){
- fprintf(stderr, "%4u/", total);
+ fprintf(stderr, "%4lu/", total);
fprintf(stderr, "%4u", 0x1000);
fprintf(stderr, "\b\b\b\b\b\b\b\b\b");
}
diff --git a/camlibs/sonydscf1/chotplay.h b/camlibs/sonydscf1/chotplay.h
index 42d3b5bb8..12714994b 100644
--- a/camlibs/sonydscf1/chotplay.h
+++ b/camlibs/sonydscf1/chotplay.h
@@ -1,8 +1,9 @@
-int make_jpeg_comment P__((u_char *, u_char *));
-int get_picture_information P__((int *, int));
-long get_file P__((char *, FILE *, int, int));
-long get_thumbnail P__((char *, FILE *, int, int, int));
-void get_date_info P__((char *, char * ,char *));
-long get_picture P__((int, char **, int, int, int));
-void get_all_pictures P__((int, int, char *, int, int));
-void delete_picture P__((int, int));
+int write_file(u_char *buf, int len, FILE *outfp);
+int make_jpeg_comment(u_char *buf, u_char *jpeg_comment);
+int get_picture_information (int *, int);
+long get_file(char *name, char **data, int format, int verbose);
+long get_thumbnail(char *name, char **data, int format, int verbose, int n);
+void get_date_info (char *, char * ,char *);
+long get_picture (int, char **, int, int, int);
+void get_all_pictures (int, int, char *, int, int);
+void delete_picture (int, int);
diff --git a/camlibs/sonydscf1/command.c b/camlibs/sonydscf1/command.c
index d4dac77ba..1e51ad63f 100644
--- a/camlibs/sonydscf1/command.c
+++ b/camlibs/sonydscf1/command.c
@@ -1,27 +1,28 @@
-
#include "config.h"
+
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
-#include "common.h"
#include <termios.h>
-
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
+
+#include <gphoto2.h>
+
+#include "command.h"
+#include "common.h"
+
#ifdef DEBUG
#define dprintf(x) printf x
#else
#define dprintf(x)
#endif
-#include <gphoto2.h>
-
extern gp_port *dev;
-
-static int F1fd = -1;
+/* static int F1fd = -1; */
static u_char address = 0;
static u_char sendaddr[8] = { 0x00, 0x22, 0x44, 0x66, 0x88, 0xaa, 0xcc, 0xee };
static u_char recvaddr[8] = { 0x0e, 0x20, 0x42, 0x64, 0x86, 0xa8, 0xca, 0xec };
@@ -98,7 +99,7 @@ void sendcommand(u_char *p, int len)
if(address >7 ) address = 0;
}
-void Abort()
+void Abort(void)
{
u_char buf[4];
buf[0] = BOFRAME;
@@ -284,7 +285,7 @@ int F1fopen(char *name)
buf[1] = 0x0A;
buf[2] = 0x00;
buf[3] = 0x00;
- sprintf(&buf[4], "%s\0", name);
+ snprintf(&buf[4], sizeof(name), "%s", name);
len = strlen(name) + 5;
sendcommand(buf, len);
recvdata(buf, 6);
@@ -459,7 +460,7 @@ u_long F1finfo(char *name)
buf[0] = 0x02;
buf[1] = 0x0F;
- sprintf(&buf[2], "%s\0", name);
+ snprintf(&buf[2], sizeof(name), "%s", name);
len = strlen(name) + 3;
sendcommand(buf, len);
@@ -511,8 +512,8 @@ long F1getdata(char *name, u_char *data, int verbose)
p = p + len;
total = total + len;
if(verbose){
- fprintf(stderr, "%6d/", total);
- fprintf(stderr, "%6d", filelen);
+ fprintf(stderr, "%6ld/", total);
+ fprintf(stderr, "%6ld", filelen);
fprintf(stderr, "\b\b\b\b\b\b\b\b\b\b\b\b\b");
}
}
diff --git a/camlibs/sonydscf1/command.h b/camlibs/sonydscf1/command.h
index 7c718907d..ffebf615b 100644
--- a/camlibs/sonydscf1/command.h
+++ b/camlibs/sonydscf1/command.h
@@ -10,15 +10,18 @@ void wbyte P__((u_char));
u_char rbyte P__((void));
void wstr P__((u_char *, int));
void rstr P__((u_char *, int));
-u_char checksum P__((u_char));
+u_char checksum(u_char addr, u_char *cp, int len);
int F1ok P__((void));
long F1getdata P__((char *, u_char *, int));
-
+void sendcommand(u_char *p, int len);
+void Abort(void);
+int recvdata(u_char *p, int len);
int F1status P__((int));
char F1newstatus P__((int, char *));
int F1howmany P__((void));
int F1fopen P__((char *));
-long F1fread P__((u_char *, int));
+long F1fread(u_char *data, long len);
+long F1fwrite(u_char *data, long len, u_char b);
long F1fseek P__((long, int));
u_long F1finfo P__((char *));
int F1fclose P__((void));
@@ -26,6 +29,4 @@ int F1fclose P__((void));
int F1deletepicture P__((int));
int F1ffs P__((void));
-long F1fwrite P__((u_char *, int, u_char ));
-
#endif /* __COMMAND_H__ */
diff --git a/camlibs/sonydscf1/getuint.c b/camlibs/sonydscf1/getuint.c
index 3453401c0..47ba5ef0c 100644
--- a/camlibs/sonydscf1/getuint.c
+++ b/camlibs/sonydscf1/getuint.c
@@ -1,6 +1,8 @@
#include "config.h"
#include <sys/types.h>
+#include "getuint.h"
+
u_short
get_u_short(buf)
u_char *buf;
diff --git a/camlibs/sonydscf1/getuint.h b/camlibs/sonydscf1/getuint.h
index 692d94f76..fe19cb239 100644
--- a/camlibs/sonydscf1/getuint.h
+++ b/camlibs/sonydscf1/getuint.h
@@ -1,2 +1,2 @@
-u_short get_u_short P__((u_char *));
-u_int get_u_int P__((u_char *));
+u_short get_u_short (u_char *buf);
+u_int get_u_int (u_char *buf);