Skip to content

Commit

Permalink
fix white-space and indentation inconsistencies (second round)
Browse files Browse the repository at this point in the history
This is basically a continuation of the work from gphoto#1002 but her for the
camlibs directory. The purpose was to replace spaces as a means for
indentation with tab characters.

Note: there are some files which are still offending the general
rule but are (mostly) consistent within themselves. I let them be for
the moment. Fixing them would basically replace the whole file.

Also: there are still a ton of whitespace related inconsistencies like
"x=10" vs "x = 10" or "func(10)" vs "func (10)".

This is a whitespace only change (if you include newlines as whitespace).
  • Loading branch information
axxel committed Sep 14, 2024
1 parent e68b3ea commit 6ea237f
Show file tree
Hide file tree
Showing 123 changed files with 5,302 additions and 5,407 deletions.
32 changes: 16 additions & 16 deletions camlibs/adc65/adc65.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ adc65_ping(Camera *camera) {

static int
adc65_file_count (Camera *camera) {
unsigned char cmd, resp[65538];
unsigned char cmd, resp[65538];
int ret;

GP_DEBUG("Getting the number of pictures.");
cmd = 0x00;
ret = adc65_exchange(camera, &cmd, 1, resp, 65538);
GP_DEBUG("Getting the number of pictures.");
cmd = 0x00;
ret = adc65_exchange(camera, &cmd, 1, resp, 65538);
if (ret < 2) /* must have at least a 2 byte reply */
return ret;
return resp[1] - 1;
return ret;
return resp[1] - 1;
}

static char *
Expand All @@ -102,7 +102,7 @@ adc65_read_data (Camera *camera, unsigned char *cmd, int cmd_size, int data_type
/* get the picture */
ret = adc65_exchange (camera, cmd, cmd_size, resp, 2);
if (ret < 2)
return NULL;
return NULL;

us = malloc (65536);
if (!us)
Expand Down Expand Up @@ -224,23 +224,23 @@ get_file_func ( CameraFilesystem *fs, const char *folder,
CameraFile *file, void *user_data, GPContext *context)
{
Camera *camera = user_data;
int size, num;
char *data;
int size, num;
char* data;

gp_file_set_mime_type (file, GP_MIME_PPM);
num = gp_filesystem_number (fs, folder, filename, context);
gp_file_set_mime_type (file, GP_MIME_PPM);
num = gp_filesystem_number (fs, folder, filename, context);
if (num < 0)
return num;
data = adc65_read_picture (camera, num, &size);
if (!data)
data = adc65_read_picture (camera, num, &size);
if (!data)
return GP_ERROR;
return gp_file_append (file,data,size);
return gp_file_append (file, data, size);
}

static int
camera_about (Camera *camera, CameraText *about, GPContext *context) {
strcpy (about->text, _("Adc65\nBenjamin Moos <[email protected]>"));
return GP_OK;
strcpy (about->text, _("Adc65\nBenjamin Moos <[email protected]>"));
return GP_OK;
}

static CameraFilesystemFuncs fsfuncs = {
Expand Down
16 changes: 8 additions & 8 deletions camlibs/agfa-cl20/agfa_cl20.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
result[19] = 0x00;

memmove(&result[20],
&result[app1len + 4],
(unsigned int)(size - app1len - 4));
&result[app1len + 4],
(unsigned int)(size - app1len - 4));

size = size - app1len + 20 + 4;

Expand Down Expand Up @@ -439,8 +439,8 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
result[19] = 0x00;

memmove(&result[20],
&result[app1len + 4],
(unsigned int)(size - app1len - 4));
&result[app1len + 4],
(unsigned int)(size - app1len - 4));

size = size - app1len + 24;

Expand Down Expand Up @@ -664,10 +664,10 @@ camera_init (Camera *camera, GPContext *context)

GP_DEBUG(" * camera_init()");

/* First, set up all the function pointers */
camera->functions->exit = camera_exit;
camera->functions->summary = camera_summary;
camera->functions->about = camera_about;
/* First, set up all the function pointers */
camera->functions->exit = camera_exit;
camera->functions->summary = camera_summary;
camera->functions->about = camera_about;

/* Now, tell the filesystem where to get lists, files and info */
gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);
Expand Down
44 changes: 22 additions & 22 deletions camlibs/aox/aox.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,27 +49,27 @@ int aox_init (GPPort *port, Model *model, Info *info)

READ(port, 1, 0, 0, c,0x10);
WRITE(port, 8, 1, 0, c, 0x10);
READ(port, 0xff, 0x07, 0xfffc, c, 4); /* Returns version number, apparently */
READ(port, 0x06, 0x0, 0x0, c, 2);
READ(port, 0x04, 0x1, 0x1, (char *)lo, 2);
GP_DEBUG("%02x %02x number of lo-res pics\n", lo[0],lo[1]);
READ(port, 0xff, 0x07, 0xfffc, c, 4); /* Returns version number, apparently */
READ(port, 0x06, 0x0, 0x0, c, 2);
READ(port, 0x04, 0x1, 0x1, (char*)lo, 2);
GP_DEBUG("%02x %02x number of lo-res pics\n", lo[0], lo[1]);
/* We need to keep this information. We presume that
* more than 255 pictures is impossible with this camera.
*/
memcpy (info, &lo[0], 1);
READ(port, 0x04, 0x2, 0x1, c, 2);
READ(port, 0x04, 0x3, 0x1, c, 2);
READ(port, 0x04, 0x4, 0x1, c, 2);
READ(port, 0x04, 0x5, 0x1, (char *)hi, 2);
READ(port, 0x04, 0x2, 0x1, c, 2);
READ(port, 0x04, 0x3, 0x1, c, 2);
READ(port, 0x04, 0x4, 0x1, c, 2);
READ(port, 0x04, 0x5, 0x1, (char*)hi, 2);
GP_DEBUG("%02i %02i number of hi-res pics\n", hi[0], hi[1]);
/* This information, too. */
memcpy (info +1, &hi[0], 1);
READ(port, 0x04, 0x6, 0x1, c, 2); /* "Completion" flag.*/
memcpy (info + 1, &hi[0], 1);
READ(port, 0x04, 0x6, 0x1, c, 2); /* "Completion" flag.*/
GP_DEBUG("info[0] = 0x%x\n", info[0]);
GP_DEBUG("info[1] = 0x%x\n", info[1]);
GP_DEBUG("Leaving aox_init\n");

return GP_OK;
return GP_OK;
}


Expand All @@ -89,16 +89,16 @@ int aox_get_picture_size (GPPort *port, int lo, int hi, int n, int k)
{

unsigned char c[4];
unsigned int size;
unsigned int size;
memset (c,0,4);

GP_DEBUG("Running aox_get_picture_size for aox_pic%03i\n", k+1);

if ( ( (lo) && ( n ==k ) && (k ==0)) ) {
READ(port, 0x04, 0x1, 0x1, (char *)c, 2);
READ(port, 0x04, 0x1, 0x1, (char *)c, 2);
}
if ( ( (hi) && ( n < k ) && (n == 0)) ) {
READ(port, 0x04, 0x5, 0x1, (char *)c, 2);
READ(port, 0x04, 0x5, 0x1, (char *)c, 2);
}
READ(port, 0x05, n+1, 0x1, (char *)c, 4);
size = (int)c[0] + (int)c[1]*0x100 + (int)c[2]*0x10000;
Expand All @@ -113,21 +113,21 @@ static int aox_read_data (GPPort *port, char *data, int size)
{
int MAX_BULK = 0x1000;

while(size > 0) {
int len = (size>MAX_BULK)?MAX_BULK:size;
gp_port_read (port, data, len); /* 0x84 = EP IN NEEDED HERE.*/
data += len;
while (size > 0) {
int len = (size > MAX_BULK) ? MAX_BULK : size;
gp_port_read (port, data, len); /* 0x84 = EP IN NEEDED HERE.*/
data += len;
size -= len;
}
return 1;
return 1;
}

int aox_read_picture_data (GPPort *port, char *data, int size, int n) {
char c[4];
memset(c,0,4);

READ(port, 0x06, n+1, 0x1, c, 4);
aox_read_data (port, data , size);
READ(port, 0x06, n + 1, 0x1, c, 4);
aox_read_data (port, data, size);

return GP_OK;
return GP_OK;
}
Loading

0 comments on commit 6ea237f

Please sign in to comment.