changed _manual, _about, and _summary to use CameraText to guarantee 32k of text space
git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@730 67ed7778-7388-44ab-90cf-0a291f65f57c
This commit is contained in:
@@ -438,7 +438,7 @@ int camera_capture (CameraFile *file, CameraCaptureInfo *info) {
|
||||
return (GP_ERROR);
|
||||
}
|
||||
|
||||
int camera_summary (char *summary) {
|
||||
int camera_summary (CameraText *summary) {
|
||||
|
||||
int num;
|
||||
char *firm;
|
||||
@@ -446,7 +446,7 @@ int camera_summary (char *summary) {
|
||||
num = camera_file_count();
|
||||
firm = barbie_read_firmware();
|
||||
|
||||
sprintf(summary,
|
||||
sprintf(summary->text,
|
||||
"Number of pictures: %i
|
||||
Firmware Version: %s", num,firm);
|
||||
|
||||
@@ -455,15 +455,15 @@ Firmware Version: %s", num,firm);
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
int camera_manual (char *manual) {
|
||||
int camera_manual (CameraText *manual) {
|
||||
|
||||
strcpy(manual, "No manual available.");
|
||||
strcpy(manual->text, "No manual available.");
|
||||
|
||||
return GP_OK;
|
||||
}
|
||||
int camera_about (char *about) {
|
||||
int camera_about (CameraText *about) {
|
||||
|
||||
strcpy(about,
|
||||
strcpy(about->text,
|
||||
"Barbie/HotWheels/WWF
|
||||
Scott Fritzinger <scottf@unr.edu>
|
||||
Andreas Meyer <ahm@spies.com>
|
||||
|
||||
@@ -252,16 +252,16 @@ int camera_capture (CameraFile *file, CameraCaptureInfo *info) {
|
||||
return (GP_ERROR);
|
||||
}
|
||||
|
||||
int camera_summary (char *summary) {
|
||||
int camera_summary (CameraText *summary) {
|
||||
|
||||
sprintf(summary, "Current directory:\n%s", dir_directory);
|
||||
sprintf(summary->text, "Current directory:\n%s", dir_directory);
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
int camera_manual (char *manual) {
|
||||
int camera_manual (CameraText *manual) {
|
||||
|
||||
strcpy(manual,
|
||||
strcpy(manual->text,
|
||||
"The Directory Browse \"camera\" lets you index
|
||||
photos on your hard drive. The folder list on the
|
||||
left contains the folders on your hard drive,
|
||||
@@ -271,9 +271,9 @@ beginning at the root directory (\"/\").
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
int camera_about (char *about) {
|
||||
int camera_about (CameraText *about) {
|
||||
|
||||
strcpy(about,
|
||||
strcpy(about->text,
|
||||
"Directory Browse Mode
|
||||
Scott Fritzinger <scottf@unr.edu>");
|
||||
|
||||
|
||||
@@ -388,7 +388,7 @@ int camera_capture (CameraFile *file, CameraCaptureInfo *info) {
|
||||
return (GP_ERROR);
|
||||
}
|
||||
|
||||
int camera_summary (char *summary) {
|
||||
int camera_summary (CameraText *summary) {
|
||||
|
||||
char buf[1024*32];
|
||||
int value;
|
||||
@@ -533,7 +533,7 @@ return (GP_ERROR);
|
||||
if (fujitsu_get_int_register(glob_dev, 38, &value)!=GP_ERROR)
|
||||
sprintf(buf, "%sLCD AutoOff : %i seconds\n", buf, value);
|
||||
|
||||
strcpy(summary, buf);
|
||||
strcpy(summary->text, buf);
|
||||
|
||||
if (camera_stop()==GP_ERROR)
|
||||
return (GP_ERROR);
|
||||
@@ -541,20 +541,20 @@ return (GP_ERROR);
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
int camera_manual (char *manual) {
|
||||
int camera_manual (CameraText *manual) {
|
||||
|
||||
debug_print("Getting camera manual");
|
||||
|
||||
strcpy(manual, "Manual Not Available");
|
||||
strcpy(manual->text, "Manual Not Available");
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
int camera_about (char *about) {
|
||||
int camera_about (CameraText *about) {
|
||||
|
||||
debug_print("Getting 'about' information");
|
||||
|
||||
strcpy(about,
|
||||
strcpy(about->text,
|
||||
"Fujitsu SPARClite library
|
||||
Scott Fritzinger <scottf@unr.edu>
|
||||
Support for Fujitsu-based digital cameras
|
||||
|
||||
@@ -525,7 +525,7 @@ int camera_file_delete (int file_number)
|
||||
}
|
||||
|
||||
|
||||
int camera_summary (char *summary)
|
||||
int camera_summary (CameraText *summary)
|
||||
{
|
||||
gchar *model = NULL;
|
||||
gchar *serial_number = NULL;
|
||||
@@ -568,7 +568,7 @@ int camera_summary (char *summary)
|
||||
&minute,
|
||||
&second))) return (GP_ERROR);
|
||||
else {
|
||||
sprintf (summary,
|
||||
sprintf (summary->text,
|
||||
"About the camera:\n"
|
||||
" Model: %s\n"
|
||||
" Serial Number: %s,\n"
|
||||
@@ -615,9 +615,9 @@ int camera_summary (char *summary)
|
||||
}
|
||||
|
||||
|
||||
int camera_about (char *about)
|
||||
int camera_about (CameraText *about)
|
||||
{
|
||||
strcpy (about,
|
||||
strcpy (about->text,
|
||||
"Konica library\n"
|
||||
"Lutz Müller <urc8@rz.uni-karlsruhe.de>\n"
|
||||
"Support for Konica and HP cameras.");
|
||||
@@ -637,4 +637,3 @@ int camera_config_set (CameraSetting *conf, int count)
|
||||
printf ("Not yet implemented...\n");
|
||||
return (GP_ERROR);
|
||||
}
|
||||
|
||||
|
||||
@@ -542,23 +542,23 @@ int camera_capture (CameraFile *file, CameraCaptureInfo *info) {
|
||||
return (GP_ERROR);
|
||||
}
|
||||
|
||||
int camera_summary (char *summary) {
|
||||
int camera_summary (CameraText *summary) {
|
||||
|
||||
strcpy(summary, "Summary Not Available");
|
||||
strcpy(summary->text, "Summary Not Available");
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
int camera_manual (char *manual) {
|
||||
int camera_manual (CameraText *manual) {
|
||||
|
||||
strcpy(manual, "Manual Not Available");
|
||||
strcpy(manual->text, "Manual Not Available");
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
int camera_about (char *about) {
|
||||
int camera_about (CameraText *about) {
|
||||
|
||||
strcpy(about,
|
||||
strcpy(about->text,
|
||||
"Panasonic PV-DC1580 gPhoto library\n"
|
||||
"Mariusz Zynel <mariusz@mizar.org>\n\n"
|
||||
"Based on dc1000 program written by\n"
|
||||
|
||||
@@ -102,23 +102,23 @@ int camera_capture (CameraFile *file, CameraCaptureInfo *info) {
|
||||
return (GP_ERROR);
|
||||
}
|
||||
|
||||
int camera_summary (char *summary) {
|
||||
int camera_summary (CameraText *summary) {
|
||||
|
||||
strcpy(summary, "Summary Not Available");
|
||||
strcpy(summary->text, "Summary Not Available");
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
int camera_manual (char *manual) {
|
||||
int camera_manual (CameraText *manual) {
|
||||
|
||||
strcpy(manual, "Manual Not Available");
|
||||
strcpy(manual->text, "Manual Not Available");
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
int camera_about (char *about) {
|
||||
int camera_about (CameraText *about) {
|
||||
|
||||
strcpy(about,
|
||||
strcpy(about->text,
|
||||
"Library Name
|
||||
YOUR NAME <email@somewhere.com>
|
||||
Quick description of the library.
|
||||
|
||||
@@ -569,47 +569,47 @@ OPTION_CALLBACK(upload_picture) {
|
||||
|
||||
OPTION_CALLBACK(summary) {
|
||||
|
||||
char buf[1024*32];
|
||||
CameraText buf;
|
||||
|
||||
if (set_globals() == GP_ERROR)
|
||||
return (GP_ERROR);
|
||||
|
||||
if (gp_summary(buf)==GP_ERROR) {
|
||||
if (gp_summary(&buf)==GP_ERROR) {
|
||||
error_print("Could not get camera summary");
|
||||
return (GP_ERROR);
|
||||
}
|
||||
printf("Camera Summary:\n%s\n", buf);
|
||||
printf("Camera Summary:\n%s\n", buf.text);
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
OPTION_CALLBACK(manual) {
|
||||
|
||||
char buf[1024*32];
|
||||
CameraText buf;
|
||||
|
||||
if (set_globals() == GP_ERROR)
|
||||
return (GP_ERROR);
|
||||
|
||||
if (gp_manual(buf)==GP_ERROR) {
|
||||
if (gp_manual(&buf)==GP_ERROR) {
|
||||
error_print("Could not get camera manual");
|
||||
return (GP_ERROR);
|
||||
}
|
||||
printf("Camera Manual:\n%s\n", buf);
|
||||
printf("Camera Manual:\n%s\n", buf.text);
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
OPTION_CALLBACK(about) {
|
||||
|
||||
char buf[1024*32];
|
||||
CameraText buf;
|
||||
|
||||
if (set_globals() == GP_ERROR)
|
||||
return (GP_ERROR);
|
||||
|
||||
if (gp_about(buf)==GP_ERROR) {
|
||||
if (gp_about(&buf)==GP_ERROR) {
|
||||
error_print("Could not get camera manual");
|
||||
return (GP_ERROR);
|
||||
}
|
||||
printf("About the library:\n%s\n", buf);
|
||||
printf("About the library:\n%s\n", buf.text);
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
@@ -111,16 +111,13 @@
|
||||
/* ============================================================================== */
|
||||
|
||||
/* Retrieves camera status (number of pictures, charge, etc...) */
|
||||
/* "summary" should be allocated to 32k */
|
||||
int gp_summary (char *summary);
|
||||
int gp_summary (CameraText *summary);
|
||||
|
||||
/* Retrieves usage of the camera library (config settings, problems, etc) */
|
||||
/* "manual" should be allocated to 32k */
|
||||
int gp_manual (char *manual);
|
||||
int gp_manual (CameraText *manual);
|
||||
|
||||
/* Retrieves information about the camera library (author, version, etc) */
|
||||
/* "about" should be allocated to 32k */
|
||||
int gp_about (char *about);
|
||||
int gp_about (CameraText *about);
|
||||
|
||||
/* Widget functions */
|
||||
/* ============================================================================== */
|
||||
|
||||
@@ -170,3 +170,7 @@ typedef struct {
|
||||
char name[32];
|
||||
char value[32];
|
||||
} CameraSetting;
|
||||
|
||||
typedef struct {
|
||||
char text[32*1024];
|
||||
} CameraText;
|
||||
|
||||
@@ -97,15 +97,15 @@ int camera_capture (CameraFile *f, CameraCaptureInfo *info);
|
||||
/* For each of the following functions, the char* buffers */
|
||||
/* passed in are 32k large. */
|
||||
|
||||
int camera_summary (char *summary);
|
||||
int camera_summary (CameraText *summary);
|
||||
/* Returns information about the current status of the */
|
||||
/* camera, such as pictures taken/left, battery */
|
||||
/* percent, etc... */
|
||||
|
||||
int camera_manual (char *manual);
|
||||
int camera_manual (CameraText *manual);
|
||||
/* Returns information on using the camera library. */
|
||||
|
||||
int camera_about (char *about);
|
||||
int camera_about (CameraText *about);
|
||||
/* Returns information about the camera library. */
|
||||
/* Includes author's name, email, models supported, */
|
||||
/* and anything else library-specific. */
|
||||
|
||||
@@ -392,7 +392,7 @@ int gp_capture (CameraFile *f, CameraCaptureInfo *info) {
|
||||
return(glob_c.capture(f, info));
|
||||
}
|
||||
|
||||
int gp_summary (char *summary) {
|
||||
int gp_summary (CameraText *summary) {
|
||||
|
||||
if (glob_c.summary == NULL)
|
||||
return (GP_ERROR);
|
||||
@@ -400,7 +400,7 @@ int gp_summary (char *summary) {
|
||||
return(glob_c.summary(summary));
|
||||
}
|
||||
|
||||
int gp_manual (char *manual) {
|
||||
int gp_manual (CameraText *manual) {
|
||||
|
||||
if (glob_c.manual == NULL)
|
||||
return (GP_ERROR);
|
||||
@@ -408,7 +408,7 @@ int gp_manual (char *manual) {
|
||||
return(glob_c.manual(manual));
|
||||
}
|
||||
|
||||
int gp_about (char *about) {
|
||||
int gp_about (CameraText *about) {
|
||||
|
||||
if (glob_c.about == NULL)
|
||||
return (GP_ERROR);
|
||||
|
||||
@@ -29,9 +29,9 @@ typedef int (*c_file_unlock) (int);
|
||||
typedef int (*c_config_get) (CameraWidget*);
|
||||
typedef int (*c_config_set) (CameraSetting*, int);
|
||||
typedef int (*c_capture) (CameraFile*, CameraCaptureInfo *);
|
||||
typedef int (*c_summary) (char*);
|
||||
typedef int (*c_manual) (char*);
|
||||
typedef int (*c_about) (char*);
|
||||
typedef int (*c_summary) (CameraText*);
|
||||
typedef int (*c_manual) (CameraText*);
|
||||
typedef int (*c_about) (CameraText*);
|
||||
|
||||
|
||||
/* Function pointers to the current library functions */
|
||||
|
||||
Reference in New Issue
Block a user