From: "Daniel P. Berrange" <dan@berrange.com>
Fixes to misc functions to address char * vs unsigned char * sign mis-matches, by adding casts to silence the compiler. git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@14902 67ed7778-7388-44ab-90cf-0a291f65f57c
This commit is contained in:
@@ -391,7 +391,7 @@ QVstatus (Camera *camera, char *status)
|
||||
cmd[0] = 'D';
|
||||
cmd[1] = 'S';
|
||||
cmd[2] = STX;
|
||||
CR (QVsend (camera, cmd, 3, status, 2));
|
||||
CR (QVsend (camera, cmd, 3, (unsigned char *)status, 2));
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
@@ -132,17 +132,17 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
|
||||
switch (type) {
|
||||
case GP_FILE_TYPE_RAW:
|
||||
CHECK_RESULT (QVgetCAMpic (camera, &data, &size, attr&2));
|
||||
CHECK_RESULT (QVgetCAMpic (camera, &data, (long unsigned *)&size, attr&2));
|
||||
CHECK_RESULT (gp_file_set_mime_type(file, GP_MIME_RAW));
|
||||
break;
|
||||
case GP_FILE_TYPE_PREVIEW:
|
||||
CHECK_RESULT (QVgetYCCpic (camera, &cam, &camSize));
|
||||
CHECK_RESULT (QVgetYCCpic (camera, &cam, (long unsigned *)&camSize));
|
||||
CHECK_RESULT (QVycctoppm(cam, camSize, THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, 2, &data, &size));
|
||||
free(cam);
|
||||
CHECK_RESULT (gp_file_set_mime_type (file, GP_MIME_PPM));
|
||||
break;
|
||||
case GP_FILE_TYPE_NORMAL:
|
||||
CHECK_RESULT (QVgetCAMpic (camera, &cam, &camSize, attr&2));
|
||||
CHECK_RESULT (QVgetCAMpic (camera, &cam, (long unsigned *)&camSize, attr&2));
|
||||
CHECK_RESULT ((attr&2 ? QVfinecamtojpeg : QVcamtojpeg)(cam, camSize, &data, &size));
|
||||
free(cam);
|
||||
CHECK_RESULT (gp_file_set_mime_type (file, GP_MIME_JPEG));
|
||||
|
||||
@@ -248,7 +248,7 @@ static int enigma13_download_img(Camera *camera, char *toc, int index, char **im
|
||||
|
||||
/* Offset for image informations .
|
||||
Each image has 16 bytes for name and 16 for size, and others*/
|
||||
p = toc + (index*2)*32;
|
||||
p = (uint8_t *)toc + (index*2)*32;
|
||||
|
||||
/* real size from toc*/
|
||||
aligned_size = file_size =
|
||||
|
||||
@@ -408,7 +408,7 @@ fuji_pic_name (Camera *camera, unsigned int i, const char **name,
|
||||
|
||||
memset (buf, 0, sizeof (buf));
|
||||
CR (fuji_transmit (camera, cmd, 6, buf, &buf_len, context));
|
||||
*name = buf;
|
||||
*name = (char *)buf;
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
@@ -427,7 +427,7 @@ fuji_version (Camera *camera, const char **version, GPContext *context)
|
||||
|
||||
memset (buf, 0, sizeof (buf));
|
||||
CR (fuji_transmit (camera, cmd, 4, buf, &buf_len, context));
|
||||
*version = buf;
|
||||
*version = (char *)buf;
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
@@ -446,7 +446,7 @@ fuji_model (Camera *camera, const char **model, GPContext *context)
|
||||
|
||||
memset (buf, 0, sizeof (buf));
|
||||
CR (fuji_transmit (camera, cmd, 4, buf, &buf_len, context));
|
||||
*model = buf;
|
||||
*model = (char *)buf;
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
@@ -465,7 +465,7 @@ fuji_id_get (Camera *camera, const char **id, GPContext *context)
|
||||
|
||||
memset (buf, 0, sizeof (buf));
|
||||
CR (fuji_transmit (camera, cmd, 4, buf, &buf_len, context));
|
||||
*id = buf;
|
||||
*id = (char *)buf;
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
@@ -165,7 +165,8 @@ file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
|
||||
void *data, GPContext *context)
|
||||
{
|
||||
Camera *camera = data;
|
||||
int n, i;
|
||||
int i;
|
||||
unsigned int n;
|
||||
const char *name;
|
||||
|
||||
/*
|
||||
@@ -237,7 +238,7 @@ put_file_func (CameraFilesystem *fs, const char *folder, const char *name,
|
||||
return GP_ERROR_BAD_PARAMETERS;
|
||||
CR (gp_file_get_data_and_size (file, &d, &d_len));
|
||||
CR (fuji_upload_init (camera, name, context));
|
||||
return fuji_upload (camera, d, d_len, context);
|
||||
return fuji_upload (camera, (unsigned char *)d, d_len, context);
|
||||
}
|
||||
|
||||
static int
|
||||
|
||||
@@ -218,9 +218,10 @@ static int get_file_func (CameraFilesystem *fs, const char *folder,
|
||||
|
||||
size = strlen( ppm ) + ( height * width * 3 );
|
||||
|
||||
gp_bayer_decode(raw, width, height, ptr, BAYER_TILE_GBRG );
|
||||
gp_bayer_decode((unsigned char *)raw, width, height,
|
||||
(unsigned char *)ptr, BAYER_TILE_GBRG );
|
||||
gp_gamma_fill_table( gtable, 0.5 );
|
||||
gp_gamma_correct_single( gtable, ptr, height * width );
|
||||
gp_gamma_correct_single( gtable, (unsigned char *)ptr, height * width );
|
||||
|
||||
CHECK_free (gp_file_set_mime_type (file, GP_MIME_PPM));
|
||||
CHECK_free (gp_file_append (file, ppm, size));
|
||||
@@ -241,10 +242,10 @@ static int get_file_func (CameraFilesystem *fs, const char *folder,
|
||||
|
||||
size = strlen( ppm ) + ( jc_file->width * jc_file->height * 3 );
|
||||
|
||||
gp_bayer_decode( raw, jc_file->width, jc_file->height, ptr,
|
||||
BAYER_TILE_GBRG );
|
||||
gp_bayer_decode((unsigned char *)raw, jc_file->width, jc_file->height,
|
||||
(unsigned char *)ptr, BAYER_TILE_GBRG );
|
||||
gp_gamma_fill_table( gtable, 0.5 );
|
||||
gp_gamma_correct_single( gtable, ptr, jc_file->width * jc_file->height );
|
||||
gp_gamma_correct_single( gtable, (unsigned char *)ptr, jc_file->width * jc_file->height );
|
||||
|
||||
CHECK_free (gp_file_set_mime_type (file, GP_MIME_PPM));
|
||||
CHECK_free (gp_file_append (file, ppm, size));
|
||||
|
||||
@@ -397,7 +397,7 @@ static int dc210_read_single_block
|
||||
|
||||
if (error) return GP_ERROR;
|
||||
|
||||
if (dc210_read_single_char(camera, &cs_read) < 0)
|
||||
if (dc210_read_single_char(camera, (unsigned char *)&cs_read) < 0)
|
||||
return GP_ERROR;
|
||||
|
||||
cs_computed = 0;
|
||||
@@ -698,7 +698,7 @@ int dc210_format_callback(Camera * camera, CameraWidget * widget, GPContext * co
|
||||
|
||||
static int dc210_check_battery (Camera *camera){
|
||||
|
||||
unsigned char cmd[8];
|
||||
char cmd[8];
|
||||
dc210_cmd_init(cmd, DC210_CHECK_BATTERY);
|
||||
|
||||
if (dc210_execute_command(camera, cmd) == GP_ERROR) return GP_ERROR;
|
||||
@@ -1174,7 +1174,7 @@ int dc210_get_status (Camera *camera, dc210_status *status) {
|
||||
dc210_cmd_init(cmd, DC210_GET_STATUS);
|
||||
|
||||
if (dc210_execute_command(camera, cmd) == GP_ERROR) return GP_ERROR;
|
||||
if (dc210_read_single_block(camera, data, DC210_STATUS_SIZE) == GP_ERROR) return GP_ERROR;
|
||||
if (dc210_read_single_block(camera, (unsigned char *)data, DC210_STATUS_SIZE) == GP_ERROR) return GP_ERROR;
|
||||
if (dc210_wait_for_response(camera, 0, NULL) != DC210_COMMAND_COMPLETE) return GP_ERROR;
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
@@ -156,7 +156,7 @@ static int folder_list_func (CameraFilesystem *fs, const char *folder,
|
||||
{
|
||||
Camera *camera = user_data;
|
||||
unsigned char *data = NULL;
|
||||
long data_len = 0;
|
||||
long unsigned data_len = 0;
|
||||
unsigned char *ptr_data_buff;
|
||||
char filename[13], *ptr;
|
||||
int res, i;
|
||||
@@ -237,7 +237,7 @@ static int file_list_func (CameraFilesystem *fs, const char *folder,
|
||||
{
|
||||
Camera *camera = user_data;
|
||||
unsigned char *data = NULL;
|
||||
long data_len = 0;
|
||||
long unsigned data_len = 0;
|
||||
unsigned char *ptr_data_buff;
|
||||
char filename[13];
|
||||
int res, i;
|
||||
@@ -290,7 +290,7 @@ static int file_list_func (CameraFilesystem *fs, const char *folder,
|
||||
/* add dot */
|
||||
strcat(filename, ".");
|
||||
/* copy extension, last 3 bytes*/
|
||||
strncat(filename, ptr_data_buff+8, 3);
|
||||
strncat(filename, (char *)ptr_data_buff+8, 3);
|
||||
|
||||
if(!strstr(filename, ".JPG") && !strstr(filename, ".jpg")) {
|
||||
ptr_data_buff += 20;
|
||||
@@ -316,7 +316,7 @@ static int get_file_func (CameraFilesystem *fs, const char *folder,
|
||||
{
|
||||
Camera *camera = user_data;
|
||||
unsigned char *data = NULL;
|
||||
long data_len = 0;
|
||||
long unsigned data_len = 0;
|
||||
int res;
|
||||
|
||||
if(camera->pl->context)
|
||||
@@ -372,7 +372,7 @@ get_info_func (CameraFilesystem *fs, const char *folder,
|
||||
{
|
||||
Camera *camera = user_data;
|
||||
unsigned char *data = NULL;
|
||||
long data_len = 0;
|
||||
long unsigned data_len = 0;
|
||||
int res;
|
||||
char file[1024];
|
||||
|
||||
|
||||
@@ -191,8 +191,8 @@ int dimagev_get_picture(dimagev_t *dimagev, int file_number, CameraFile *file) {
|
||||
}
|
||||
|
||||
#ifdef _gphoto_exif_
|
||||
exifdat.header = data;
|
||||
exifdat.data = data + 12 ;
|
||||
exifdat.header = (unsigned char *)data;
|
||||
exifdat.data = (unsigned char *)data + 12 ;
|
||||
|
||||
if ( gpi_exif_stat(&exifdat) != 0 ) {
|
||||
GP_DEBUG( "dimagev_get_picture::unable to stat EXIF tags");
|
||||
@@ -352,7 +352,7 @@ int dimagev_get_thumbnail(dimagev_t *dimagev, int file_number, CameraFile *file)
|
||||
return GP_ERROR_IO;
|
||||
}
|
||||
|
||||
data = dimagev_ycbcr_to_ppm(ycrcb_data);
|
||||
data = (char *)dimagev_ycbcr_to_ppm(ycrcb_data);
|
||||
size = 14413;
|
||||
|
||||
gp_file_set_data_and_size (file, data, size);
|
||||
|
||||
@@ -139,14 +139,16 @@ int dimagev_put_file(dimagev_t* dimagev, CameraFile *file) {
|
||||
|
||||
for ( sent_packets = (unsigned char) 1 ; sent_packets < total_packets ; sent_packets++ ) {
|
||||
if ( left_to_send > 993 ) {
|
||||
if ( ( p = dimagev_make_packet(&(data[(sent_packets * 993) - 1]), 993, sent_packets) ) == NULL ) {
|
||||
if ( ( p = dimagev_make_packet((unsigned char *)&(data[(sent_packets * 993) - 1]),
|
||||
993, sent_packets) ) == NULL ) {
|
||||
GP_DEBUG( "dimagev_put_file::unable to allocate data packet");
|
||||
free(p);
|
||||
return GP_ERROR_NO_MEMORY;
|
||||
}
|
||||
left_to_send-=993;
|
||||
} else {
|
||||
if ( ( p = dimagev_make_packet(&(data[((sent_packets * 993) - 1)]), left_to_send, sent_packets) ) == NULL ) {
|
||||
if ( ( p = dimagev_make_packet((unsigned char *)&(data[((sent_packets * 993) - 1)]),
|
||||
left_to_send, sent_packets) ) == NULL ) {
|
||||
GP_DEBUG( "dimagev_put_file::unable to allocate data packet");
|
||||
return GP_ERROR_NO_MEMORY;
|
||||
}
|
||||
|
||||
@@ -104,7 +104,8 @@ file_list_func (CameraFilesystem *fs, const char *folder,
|
||||
CameraList *list, void *data, GPContext *context)
|
||||
{
|
||||
Camera *camera = data;
|
||||
unsigned int i, filecount, id, size, type;
|
||||
unsigned int i, id, size, type;
|
||||
int filecount;
|
||||
CameraFile *file;
|
||||
CameraFileInfo info;
|
||||
unsigned char *buffer = NULL;
|
||||
|
||||
@@ -152,7 +152,8 @@ pccam300_get_file (GPPort *port, GPContext *context, int index,
|
||||
unsigned char **data, unsigned int *size,
|
||||
unsigned int *type)
|
||||
{
|
||||
int data_size, r;
|
||||
unsigned int data_size;
|
||||
int r;
|
||||
uint8_t *buf = NULL;
|
||||
|
||||
/* This is somewhat strange, but works, and the win driver does the
|
||||
|
||||
@@ -121,7 +121,7 @@ static int file_list_func (CameraFilesystem *fs, const char *folder,
|
||||
}
|
||||
for (n = 0; n != nr_of_blocks; n++)
|
||||
{
|
||||
CHECK(pccam600_read_data(camera->port, buffer));
|
||||
CHECK(pccam600_read_data(camera->port, (unsigned char *)buffer));
|
||||
for (i = offset; i <= 512-32; i=i+32)
|
||||
{
|
||||
memcpy(file_entry,&(buffer)[i],32);
|
||||
@@ -130,7 +130,7 @@ static int file_list_func (CameraFilesystem *fs, const char *folder,
|
||||
!((file_entry->state & 0x08) == 8) )
|
||||
{
|
||||
info.file.fields = 0;
|
||||
temp = &(file_entry->name)[5];
|
||||
temp = (char *)&(file_entry->name)[5];
|
||||
if (strncmp(temp,"JPG",3) == 0)
|
||||
{
|
||||
memcpy(&(file_entry->name)[5],".jpg",4);
|
||||
|
||||
@@ -486,7 +486,7 @@ camera_summary (Camera *camera, CameraText *summary, GPContext *context)
|
||||
char buf[12];
|
||||
|
||||
GP_DEBUG ("*** PDC320_ID ***");
|
||||
CR (pdc320_simple_command_reply (camera->port, PDC320_ID, 0, 12, buf));
|
||||
CR (pdc320_simple_command_reply (camera->port, PDC320_ID, 0, 12, (unsigned char *)buf));
|
||||
sprintf (summary->text, _("Model: %x, %x, %x, %x"), buf[8],buf[9],buf[10],buf[11]);
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
@@ -392,7 +392,7 @@ pdc700_baud (Camera *camera, int baud, GPContext *context)
|
||||
{
|
||||
unsigned char cmd[6];
|
||||
unsigned char buf[2048];
|
||||
int buf_len = 0;
|
||||
unsigned int buf_len = 0;
|
||||
|
||||
cmd[3] = PDC700_BAUD;
|
||||
switch (baud) {
|
||||
@@ -422,7 +422,7 @@ pdc700_baud (Camera *camera, int baud, GPContext *context)
|
||||
static int
|
||||
pdc700_init (Camera *camera, GPContext *context)
|
||||
{
|
||||
int buf_len = 0;
|
||||
unsigned int buf_len = 0;
|
||||
unsigned char cmd[5];
|
||||
unsigned char buf[2048];
|
||||
|
||||
@@ -436,7 +436,7 @@ static int
|
||||
pdc700_picinfo (Camera *camera, unsigned int n, PDCPicInfo *info,
|
||||
GPContext *context)
|
||||
{
|
||||
int buf_len = 0;
|
||||
unsigned int buf_len = 0;
|
||||
unsigned char cmd[7];
|
||||
unsigned char buf[2048];
|
||||
|
||||
@@ -492,7 +492,7 @@ pdc700_config (Camera *camera, PDCConf conf, unsigned char value, GPContext *con
|
||||
{
|
||||
unsigned char cmd[12];
|
||||
unsigned char buf[512];
|
||||
int buf_len = 0;
|
||||
unsigned int buf_len = 0;
|
||||
|
||||
cmd[3] = PDC700_CONFIG;
|
||||
cmd[4] = conf;
|
||||
@@ -507,7 +507,7 @@ pdc700_config (Camera *camera, PDCConf conf, unsigned char value, GPContext *con
|
||||
static int
|
||||
pdc700_info (Camera *camera, PDCInfo *info, GPContext *context)
|
||||
{
|
||||
int buf_len = 0;
|
||||
unsigned int buf_len = 0;
|
||||
unsigned char buf[2048];
|
||||
unsigned char cmd[5];
|
||||
|
||||
@@ -623,7 +623,7 @@ pdc700_set_date (Camera *camera, time_t time, GPContext *context)
|
||||
{
|
||||
unsigned char cmd[15];
|
||||
unsigned char buf[512];
|
||||
int buf_len = 0;
|
||||
unsigned int buf_len = 0;
|
||||
struct tm *tm;
|
||||
PDCInfo info;
|
||||
|
||||
|
||||
@@ -289,7 +289,7 @@ put_file_func (CameraFilesystem *fs, const char *folder, const char *name,
|
||||
if (type != GP_FILE_TYPE_NORMAL)
|
||||
return GP_ERROR_BAD_PARAMETERS;
|
||||
CR (gp_file_get_data_and_size (file, &data, &size));
|
||||
return ricoh_put_file (camera, context, name, data, size);
|
||||
return ricoh_put_file (camera, context, name, (const unsigned char *)data, size);
|
||||
}
|
||||
|
||||
#undef N_ELEMENTS
|
||||
|
||||
@@ -443,7 +443,7 @@ ricoh_get_pic_name (Camera *camera, GPContext *context, unsigned int n,
|
||||
CR (ricoh_transmit (camera, context, 0x95, p, 3, buf, &len));
|
||||
|
||||
if (name && *name) {
|
||||
*name = buf;
|
||||
*name = (char *)buf;
|
||||
buf[len] = '\0';
|
||||
}
|
||||
|
||||
@@ -465,7 +465,7 @@ ricoh_get_pic_memo (Camera *camera, GPContext *context, unsigned int n,
|
||||
CR (ricoh_transmit (camera, context, 0x95, p, 3, buf, &len));
|
||||
|
||||
if (memo && *memo) {
|
||||
*memo = buf;
|
||||
*memo = (char *)buf;
|
||||
buf[len] = '\0';
|
||||
}
|
||||
|
||||
@@ -772,10 +772,10 @@ ricoh_get_copyright (Camera *camera, GPContext *context, const char **copyright)
|
||||
static char buf[1024];
|
||||
|
||||
p[0] = 0x0f;
|
||||
CR (ricoh_transmit (camera, context, 0x51, p, 1, buf, &len));
|
||||
CR (ricoh_transmit (camera, context, 0x51, p, 1, (unsigned char *)buf, &len));
|
||||
|
||||
if (copyright && *copyright) {
|
||||
*copyright = buf;
|
||||
*copyright = (char *)buf;
|
||||
buf[len] = '\0';
|
||||
}
|
||||
|
||||
|
||||
@@ -269,7 +269,7 @@ file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
|
||||
buffer, SDSC_INFOSIZE));
|
||||
if (is_null (buffer))
|
||||
break;
|
||||
gp_list_append(list, buffer, NULL);
|
||||
gp_list_append(list, (char *)buffer, NULL);
|
||||
}
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
@@ -131,7 +131,8 @@ int sierra_change_folder (Camera *camera, const char *folder, GPContext *context
|
||||
|
||||
int sierra_list_files (Camera *camera, const char *folder, CameraList *list, GPContext *context)
|
||||
{
|
||||
int count, i, len = 0, r;
|
||||
int count, i, r;
|
||||
unsigned int len = 0;
|
||||
char filename[1024];
|
||||
|
||||
GP_DEBUG ("Listing files in folder '%s'", folder);
|
||||
@@ -168,7 +169,8 @@ int sierra_list_files (Camera *camera, const char *folder, CameraList *list, GPC
|
||||
* the list with dummy entries and return.
|
||||
*/
|
||||
GP_DEBUG ("Getting filename of first file");
|
||||
r = sierra_get_string_register (camera, 79, 1, NULL, filename,
|
||||
r = sierra_get_string_register (camera, 79, 1, NULL,
|
||||
(unsigned char *)filename,
|
||||
&len, context);
|
||||
if ((r < 0) || (len <= 0) || !strcmp (filename, " ")) {
|
||||
CHECK (gp_list_populate (list, "P101%04i.JPG", count));
|
||||
@@ -183,7 +185,8 @@ int sierra_list_files (Camera *camera, const char *folder, CameraList *list, GPC
|
||||
for (i = 1; i < count; i++) {
|
||||
GP_DEBUG ("Getting filename of file %i...", i + 1);
|
||||
CHECK (sierra_get_string_register (camera, 79, i + 1, NULL,
|
||||
filename, &len, context));
|
||||
(unsigned char *)filename,
|
||||
&len, context));
|
||||
if ((len <= 0) || !strcmp (filename, " "))
|
||||
snprintf (filename, sizeof (filename),
|
||||
"P101%04i.JPG", i + 1);
|
||||
@@ -197,7 +200,8 @@ int sierra_list_files (Camera *camera, const char *folder, CameraList *list, GPC
|
||||
int sierra_list_folders (Camera *camera, const char *folder, CameraList *list,
|
||||
GPContext *context)
|
||||
{
|
||||
int i, j, count, bsize;
|
||||
int j, count;
|
||||
unsigned int i, bsize;
|
||||
char buf[1024];
|
||||
|
||||
/* List the folders only if the camera supports them */
|
||||
@@ -214,7 +218,8 @@ int sierra_list_folders (Camera *camera, const char *folder, CameraList *list,
|
||||
bsize = 1024;
|
||||
GP_DEBUG ("*** getting name of folder %i", i + 1);
|
||||
CHECK (sierra_get_string_register (camera, 84, 0,
|
||||
NULL, buf, &bsize, context));
|
||||
NULL, (unsigned char *)buf,
|
||||
&bsize, context));
|
||||
|
||||
/* Remove trailing spaces */
|
||||
for (j = strlen (buf) - 1; j >= 0 && buf[j] == ' '; j--)
|
||||
@@ -549,7 +554,7 @@ sierra_read_packet (Camera *camera, unsigned char *packet, GPContext *context)
|
||||
if ((camera->port->type & (GP_PORT_USB_SCSI|GP_PORT_USB)) && (camera->pl->flags & SIERRA_WRAP_USB_MASK))
|
||||
result = usb_wrap_read_packet (camera->port,
|
||||
(camera->pl->flags & SIERRA_WRAP_USB_MASK),
|
||||
packet, blocksize);
|
||||
(char *)packet, blocksize);
|
||||
else
|
||||
result = gp_port_read (camera->port, (char *)packet, blocksize);
|
||||
if (result < 0) {
|
||||
@@ -726,7 +731,7 @@ sierra_read_packet_wait (Camera *camera, char *buf, GPContext *context)
|
||||
if (gp_context_cancel (context) == GP_CONTEXT_FEEDBACK_CANCEL)
|
||||
return (GP_ERROR_CANCEL);
|
||||
|
||||
result = sierra_read_packet (camera, buf, context);
|
||||
result = sierra_read_packet (camera, (unsigned char *)buf, context);
|
||||
if (result == GP_ERROR_TIMEOUT) {
|
||||
if (++r > 2) {
|
||||
gp_context_error (context, _("Transmission "
|
||||
@@ -760,7 +765,7 @@ sierra_transmit_ack (Camera *camera, char *packet, GPContext *context)
|
||||
/* Write packet and read the answer */
|
||||
CHECK (sierra_write_packet (camera, packet, context));
|
||||
buf[0] = 0;
|
||||
result = sierra_read_packet_wait (camera, buf, context);
|
||||
result = sierra_read_packet_wait (camera, (char *)buf, context);
|
||||
switch (result) {
|
||||
case GP_ERROR_CORRUPTED_DATA:
|
||||
if (++r > 2) {
|
||||
@@ -891,7 +896,7 @@ sierra_init (Camera *camera, GPContext *context)
|
||||
while (1) {
|
||||
|
||||
/* Send NUL */
|
||||
CHECK (sierra_write_packet (camera, packet, context));
|
||||
CHECK (sierra_write_packet (camera, (char *)packet, context));
|
||||
|
||||
/* Read the response */
|
||||
ret = sierra_read_packet (camera, buf, context);
|
||||
@@ -1065,16 +1070,16 @@ int sierra_get_int_register (Camera *camera, int reg, int *value, GPContext *con
|
||||
GP_DEBUG ("sierra_get_int_register: register 0x%02x...", reg);
|
||||
|
||||
/* Build and send the packet. */
|
||||
CHECK (sierra_build_packet (camera, SIERRA_PACKET_COMMAND, 0, 2, p));
|
||||
CHECK (sierra_build_packet (camera, SIERRA_PACKET_COMMAND, 0, 2, (char *)p));
|
||||
p[4] = 0x01;
|
||||
p[5] = reg;
|
||||
CHECK (sierra_write_packet (camera, p, context));
|
||||
CHECK (sierra_write_packet (camera, (char *)p, context));
|
||||
|
||||
while (1) {
|
||||
|
||||
/* Read the response */
|
||||
buf[0] = 0;
|
||||
CHECK (sierra_read_packet_wait (camera, buf, context));
|
||||
CHECK (sierra_read_packet_wait (camera, (char *)buf, context));
|
||||
GP_DEBUG ("Successfully read packet. Interpreting result "
|
||||
"(0x%02x)", buf[0]);
|
||||
switch (buf[0]) {
|
||||
@@ -1113,7 +1118,7 @@ int sierra_get_int_register (Camera *camera, int reg, int *value, GPContext *con
|
||||
CHECK (sierra_init (camera, context));
|
||||
CHECK (sierra_set_speed (camera, SIERRA_SPEED_19200,
|
||||
context));
|
||||
CHECK (sierra_write_packet (camera, p, context));
|
||||
CHECK (sierra_write_packet (camera, (char *)p, context));
|
||||
|
||||
break;
|
||||
|
||||
@@ -1229,7 +1234,7 @@ int sierra_get_string_register (Camera *camera, int reg, int fnumber,
|
||||
CHECK (sierra_set_int_register (camera, 4, fnumber, context));
|
||||
|
||||
/* Build and send the request */
|
||||
CHECK (sierra_build_packet (camera, SIERRA_PACKET_COMMAND, 0, 2, p));
|
||||
CHECK (sierra_build_packet (camera, SIERRA_PACKET_COMMAND, 0, 2, (char *)p));
|
||||
/*
|
||||
* If the extended protocol is enabled, use code 0x06 so we can send
|
||||
* and receive 32k size packages, otherwise code 0x04 is used and
|
||||
@@ -1243,7 +1248,7 @@ int sierra_get_string_register (Camera *camera, int reg, int fnumber,
|
||||
min_progress_bytes = 2 * 1024;
|
||||
}
|
||||
p[5] = reg;
|
||||
CHECK (sierra_write_packet (camera, p, context));
|
||||
CHECK (sierra_write_packet (camera, (char *)p, context));
|
||||
|
||||
if (file && total > min_progress_bytes) {
|
||||
id = gp_context_progress_start (context, total, _("Downloading data..."));
|
||||
@@ -1340,7 +1345,7 @@ sierra_capture_preview (Camera *camera, CameraFile *file, GPContext *context)
|
||||
CHECK (sierra_action (camera, SIERRA_ACTION_PREVIEW, context));
|
||||
|
||||
/* Retrieve the preview and set the MIME type */
|
||||
CHECK (sierra_get_int_register (camera, 12, &size, context));
|
||||
CHECK (sierra_get_int_register (camera, 12, (int *)&size, context));
|
||||
CHECK (sierra_get_string_register (camera, 14, 0, file, NULL, &size,
|
||||
context));
|
||||
CHECK (gp_file_set_mime_type (file, GP_MIME_JPEG));
|
||||
@@ -1352,7 +1357,8 @@ int
|
||||
sierra_capture (Camera *camera, CameraCaptureType type,
|
||||
CameraFilePath *filepath, GPContext *context)
|
||||
{
|
||||
int n, len = 0, r;
|
||||
int n, r;
|
||||
unsigned int len = 0;
|
||||
char filename[128];
|
||||
char *folder;
|
||||
int timeout;
|
||||
@@ -1413,7 +1419,8 @@ sierra_capture (Camera *camera, CameraCaptureType type,
|
||||
* ignore errors from that.
|
||||
*/
|
||||
CHECK (sierra_get_string_register (camera, 79, 0, NULL,
|
||||
filename, &len, context));
|
||||
(unsigned char *)filename,
|
||||
&len, context));
|
||||
if ((len <= 0) || !strcmp (filename, " "))
|
||||
snprintf (filename, sizeof (filename), "P101%04i.JPG", n);
|
||||
GP_DEBUG ("... done ('%s')", filename);
|
||||
@@ -1488,7 +1495,8 @@ int sierra_get_pic_info (Camera *camera, unsigned int n,
|
||||
* unsupported sierra commands return zero bytes.
|
||||
*/
|
||||
if ((sierra_get_string_register (camera, 43, n, NULL,
|
||||
(unsigned char *) &audio_info, &value,
|
||||
(unsigned char *) &audio_info,
|
||||
(unsigned int *)&value,
|
||||
context) == GP_OK) && (value != 0)) {
|
||||
pic_info->size_audio = audio_info[0];
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ camera_cam_desc_get_widget (Camera *camera, CameraRegisterType *reg_p,
|
||||
* the fly and make a union with reg_value and a void*.
|
||||
*/
|
||||
ret = sierra_get_string_register (camera, reg_p->reg_number,
|
||||
-1, NULL, buff, &value, context);
|
||||
-1, NULL, (unsigned char *)buff, (unsigned int *)&value, context);
|
||||
if ((ret == GP_OK) && value != reg_p->reg_len) {
|
||||
GP_DEBUG ("Bad length result %d", value);
|
||||
return (GP_ERROR);
|
||||
|
||||
@@ -538,7 +538,8 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
int jpeg_size;
|
||||
const char *data, *mime_type;
|
||||
long unsigned int size;
|
||||
int download_size, audio_info[8], transferred;
|
||||
int download_size, audio_info[8];
|
||||
unsigned int transferred;
|
||||
|
||||
/*
|
||||
* Get the file number from the CameraFileSystem.
|
||||
@@ -599,7 +600,7 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
|
||||
/* Get the file */
|
||||
CHECK_STOP (camera, sierra_get_string_register (camera, regd, n,
|
||||
file, NULL, &download_size, context));
|
||||
file, NULL, (unsigned int *)&download_size, context));
|
||||
if (download_size == 0) {
|
||||
/*
|
||||
* Assume a failure. At least coolpix 880 returns no error
|
||||
@@ -1942,15 +1943,20 @@ camera_summary (Camera *camera, CameraText *summary, GPContext *c)
|
||||
}
|
||||
/* Get all the string-related info */
|
||||
|
||||
if (sierra_get_string_register (camera, 27, 0, NULL, t, &v, c) >= 0)
|
||||
if (sierra_get_string_register (camera, 27, 0, NULL,
|
||||
(unsigned char *)t, (unsigned int *)&v, c) >= 0)
|
||||
sprintf (buf+strlen(buf), _("Camera Model: %s\n"), t);
|
||||
if (sierra_get_string_register (camera, 48, 0, NULL, t, &v, c) >= 0)
|
||||
if (sierra_get_string_register (camera, 48, 0, NULL,
|
||||
(unsigned char *)t, (unsigned int *)&v, c) >= 0)
|
||||
sprintf (buf+strlen(buf), _("Manufacturer: %s\n"), t);
|
||||
if (sierra_get_string_register (camera, 22, 0, NULL, t, &v, c) >= 0)
|
||||
if (sierra_get_string_register (camera, 22, 0, NULL,
|
||||
(unsigned char *)t, (unsigned int *)&v, c) >= 0)
|
||||
sprintf (buf+strlen(buf), _("Camera ID: %s\n"), t);
|
||||
if (sierra_get_string_register (camera, 25, 0, NULL, t, &v, c) >= 0)
|
||||
if (sierra_get_string_register (camera, 25, 0, NULL,
|
||||
(unsigned char *)t, (unsigned int *)&v, c) >= 0)
|
||||
sprintf (buf+strlen(buf), _("Serial Number: %s\n"), t);
|
||||
if (sierra_get_string_register (camera, 26, 0, NULL, t, &v, c) >= 0)
|
||||
if (sierra_get_string_register (camera, 26, 0, NULL,
|
||||
(unsigned char *)t, (unsigned int *)&v, c) >= 0)
|
||||
sprintf (buf+strlen(buf), _("Software Rev.: %s\n"), t);
|
||||
|
||||
/* Get all the integer information */
|
||||
@@ -2007,7 +2013,8 @@ storage_info_func (CameraFilesystem *fs,
|
||||
sif->fields |= GP_STORAGEINFO_FILESYSTEMTYPE;
|
||||
sif->fstype = GP_STORAGEINFO_FST_DCF;
|
||||
|
||||
if (sierra_get_string_register (camera, 25, 0, NULL, t, &v, c) >= 0) {
|
||||
if (sierra_get_string_register (camera, 25, 0, NULL,
|
||||
(unsigned char *)t, (unsigned int *)&v, c) >= 0) {
|
||||
sif->fields |= GP_STORAGEINFO_LABEL;
|
||||
strcpy (sif->label, t);
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ get_picture_information(GPPort *port,int *pmx_num, int outit)
|
||||
|
||||
strcpy(name, "/PIC_CAM/PIC00000/PIC_INF.PMF");
|
||||
F1ok(port);
|
||||
F1getdata(port, name, buf);
|
||||
F1getdata(port, name, (unsigned char *)buf);
|
||||
|
||||
n = buf[26] * 256 + buf[27]; /* how many files */
|
||||
*pmx_num = buf[31]; /* ??? */
|
||||
|
||||
@@ -142,7 +142,7 @@ int agfa_delete_picture(CameraPrivateLibrary *dev, const char *filename) {
|
||||
}
|
||||
|
||||
if (dev->file_list) free(dev->file_list);
|
||||
dev->file_list = buffer;
|
||||
dev->file_list = (char *)buffer;
|
||||
|
||||
ret=soundvision_send_command(SOUNDVISION_GET_PIC_SIZE,0,dev);
|
||||
if (ret<0) return ret;
|
||||
|
||||
@@ -348,7 +348,8 @@ get_file_func (CameraFilesystem *fs, const char *folder,
|
||||
|
||||
Camera *camera = user_data;
|
||||
unsigned char *data = NULL;
|
||||
int size, number, filetype, flash_file_count = 0;
|
||||
int number, filetype, flash_file_count = 0;
|
||||
unsigned int size;
|
||||
|
||||
CHECK (number =
|
||||
gp_filesystem_number (camera->fs, folder, filename, context));
|
||||
|
||||
@@ -647,7 +647,7 @@ spca500_flash_84D_get_file (CameraPrivateLibrary * pl,
|
||||
char tbuf[260]; /* for the file data blocks */
|
||||
int i, j; /* general loop vars */
|
||||
int blks; /* number of 256 byte blocks to fetch */
|
||||
unsigned int sz; /* number of bytes in image */
|
||||
int sz; /* number of bytes in image */
|
||||
uint8_t *buf; /* buffer for the read data */
|
||||
int type; /* type of image reported by header */
|
||||
int w, h; /* width, height of file being read */
|
||||
|
||||
@@ -158,7 +158,7 @@ spca50x_reset (CameraPrivateLibrary * lib)
|
||||
|
||||
|
||||
int
|
||||
yuv2rgb (int y, int u, int v, int *_r, int *_g, int *_b)
|
||||
yuv2rgb (uint32_t y, uint32_t u, uint32_t v, uint32_t *_r, uint32_t *_g, uint32_t *_b)
|
||||
{
|
||||
double r, g, b;
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ int spca50x_get_firmware_revision (CameraPrivateLibrary *lib);
|
||||
int spca50x_detect_storage_type (CameraPrivateLibrary *lib);
|
||||
int spca50x_reset (CameraPrivateLibrary * lib);
|
||||
int spca50x_capture (CameraPrivateLibrary * lib);
|
||||
int yuv2rgb (int y, int u, int v, int *r, int *g, int *b);
|
||||
int yuv2rgb (uint32_t y, uint32_t u, uint32_t v, uint32_t *r, uint32_t *g, uint32_t *b);
|
||||
void create_jpeg_from_data (uint8_t * dst, uint8_t * src, int qIndex,
|
||||
int w, int h, uint8_t format,
|
||||
int original_size, int *size,
|
||||
|
||||
@@ -504,7 +504,7 @@ int stv0680_capture_preview(GPPort *port, char **data, int *size)
|
||||
bayerpre = malloc(((*size)*3));
|
||||
/* no light enhancement here, we do not get the exposure values? */
|
||||
gp_bayer_decode (raw, w, h, bayerpre, BAYER_TILE_GBRG_INTERLACED);
|
||||
demosaic_sharpen (w, h, bayerpre, *data + strlen(header), 2, BAYER_TILE_GBRG_INTERLACED);
|
||||
demosaic_sharpen (w, h, bayerpre, (unsigned char *)*data + strlen(header), 2, BAYER_TILE_GBRG_INTERLACED);
|
||||
/* sharpen (w, h, bayerpre,*data + strlen(header), 20); */
|
||||
free(raw);
|
||||
free(bayerpre);
|
||||
|
||||
@@ -128,7 +128,7 @@ file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
|
||||
{
|
||||
Camera *camera = data;
|
||||
CameraFileInfo info;
|
||||
unsigned int tpages=0;
|
||||
int32_t tpages=0;
|
||||
int pcnt,ecnt; /* pagecounter, entrycounter*/
|
||||
struct traveler_toc_page toc;
|
||||
int id;
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
/*convert to correct endianness */
|
||||
static int
|
||||
sx330z_fill_req(int8_t *buf, struct traveler_req *req)
|
||||
sx330z_fill_req(uint8_t *buf, struct traveler_req *req)
|
||||
{
|
||||
*((int16_t*)buf) = htole16(req->always1); buf += 2;
|
||||
*((int16_t*)buf) = htole16(req->requesttype); buf += 2;
|
||||
@@ -47,7 +47,7 @@ sx330z_fill_req(int8_t *buf, struct traveler_req *req)
|
||||
|
||||
/*convert to correct endianness */
|
||||
static int
|
||||
sx330z_fill_ack(int8_t *buf, struct traveler_ack *ack)
|
||||
sx330z_fill_ack(uint8_t *buf, struct traveler_ack *ack)
|
||||
{
|
||||
ack->always3 = le32toh(*(int32_t*)buf); buf += 4;
|
||||
ack->timestamp = le32toh(*(int32_t*)buf); buf += 4;
|
||||
@@ -58,7 +58,7 @@ sx330z_fill_ack(int8_t *buf, struct traveler_ack *ack)
|
||||
|
||||
/*convert to correct endianness */
|
||||
static int
|
||||
sx330z_fill_toc_page(int8_t *buf, struct traveler_toc_page *toc)
|
||||
sx330z_fill_toc_page(uint8_t *buf, struct traveler_toc_page *toc)
|
||||
{
|
||||
int cnt;
|
||||
toc->data0 = le32toh(*(int32_t*)buf); buf += 4;
|
||||
@@ -94,7 +94,7 @@ sx330z_init(Camera *camera, GPContext *context)
|
||||
* Read block described by req
|
||||
*/
|
||||
static int
|
||||
sx330z_read_block(Camera *camera, GPContext *context, struct traveler_req *req, char *buf)
|
||||
sx330z_read_block(Camera *camera, GPContext *context, struct traveler_req *req, uint8_t *buf)
|
||||
{
|
||||
int ret;
|
||||
uint8_t trxbuf[0x20];
|
||||
@@ -150,7 +150,7 @@ sx330z_get_toc_page(Camera *camera, GPContext *context, struct traveler_toc_page
|
||||
{
|
||||
int ret;
|
||||
struct traveler_req req;
|
||||
char tocbuf[0x200];
|
||||
uint8_t tocbuf[0x200];
|
||||
|
||||
req.always1 = 1;
|
||||
req.requesttype = SX330Z_REQUEST_TOC; /* 0x03 */
|
||||
@@ -179,7 +179,7 @@ int
|
||||
sx330z_get_data(Camera *camera, GPContext *context, const char *filename,
|
||||
char **data, unsigned long int *size, int thumbnail)
|
||||
{
|
||||
char *dptr;
|
||||
uint8_t *dptr;
|
||||
int pages, cnt, ret;
|
||||
struct traveler_req req;
|
||||
int found;
|
||||
@@ -225,7 +225,7 @@ sx330z_get_data(Camera *camera, GPContext *context, const char *filename,
|
||||
|
||||
*size = 4096 * pages;
|
||||
*data = malloc(*size);
|
||||
dptr = *data;
|
||||
dptr = (uint8_t *)*data;
|
||||
/* load all parts */
|
||||
for (cnt = 0;cnt < pages;cnt++)
|
||||
{
|
||||
@@ -253,7 +253,7 @@ sx330z_delete_file(Camera *camera, GPContext *context, const char *filename)
|
||||
{
|
||||
struct traveler_req req;
|
||||
/* struct traveler_ack ack;*/
|
||||
char trxbuf[0x20];
|
||||
uint8_t trxbuf[0x20];
|
||||
int ret, id;
|
||||
req.always1 = 1;
|
||||
req.requesttype = SX330Z_REQUEST_DELETE; /* Delete */
|
||||
@@ -267,12 +267,12 @@ sx330z_delete_file(Camera *camera, GPContext *context, const char *filename)
|
||||
/* send delete request */
|
||||
sx330z_fill_req(trxbuf,&req);
|
||||
ret = gp_port_usb_msg_write(camera->port,
|
||||
USB_REQ_RESERVED, SX330Z_REQUEST_DELETE, 0, trxbuf, 0x20);
|
||||
USB_REQ_RESERVED, SX330Z_REQUEST_DELETE, 0, (char *)trxbuf, 0x20);
|
||||
if (ret != 0x20) return(GP_ERROR); /* simple error handling */
|
||||
gp_context_progress_update(context, id, 1); /* update context */
|
||||
/* read 16 Byte acknowledge packet */
|
||||
ret = gp_port_usb_msg_read(camera->port,
|
||||
USB_REQ_RESERVED, SX330Z_REQUEST_DELETE, 0, trxbuf, 0x10);
|
||||
USB_REQ_RESERVED, SX330Z_REQUEST_DELETE, 0, (char *)trxbuf, 0x10);
|
||||
if (ret != 0x10) return(GP_ERROR);
|
||||
|
||||
gp_context_progress_stop(context, id); /* stop context */
|
||||
|
||||
Reference in New Issue
Block a user