Patch: Uemis fixing whitespace issues

Dirk Hohndel dirk at hohndel.org
Thu Sep 10 12:43:44 PDT 2015


Hmm, I don't know about all of these :-)
Is there a bug in the QtCreator settings I gave you? I thought QtCreator
got the continuation lines right...

> @@ -71,8 +71,8 @@ static void uemis_ts(char *buffer, void *_when)
>  
>  	memset(&tm, 0, sizeof(tm));
>  	sscanf(buffer, "%d-%d-%dT%d:%d:%d",
> -	       &tm.tm_year, &tm.tm_mon, &tm.tm_mday,
> -	       &tm.tm_hour, &tm.tm_min, &tm.tm_sec);
> +		&tm.tm_year, &tm.tm_mon, &tm.tm_mday,
> +		&tm.tm_hour, &tm.tm_min, &tm.tm_sec);

This is an aligned continuation line - you forced this to be tab aligned.
That's not what we do...

> @@ -118,8 +118,8 @@ static void uemis_add_string(const char *buffer, char **text, const char *delimi
>  static void uemis_get_weight(char *buffer, weightsystem_t *weight, int diveid)
>  {
>  	weight->weight.grams = uemis_get_weight_unit(diveid) ?
> -				       lbs_to_grams(ascii_strtod(buffer, NULL)) :
> -				       ascii_strtod(buffer, NULL) * 1000;
> +					lbs_to_grams(ascii_strtod(buffer, NULL)) :
> +					ascii_strtod(buffer, NULL) * 1000;

Ditto

> @@ -327,7 +327,7 @@ static char *next_segment(char *buf, int *offset, int size)
>  	while (!done) {
>  		if (i < size) {
>  			if (i < size - 1 && buf[i] == '\\' &&
> -			    (buf[i + 1] == '\\' || buf[i + 1] == '{'))
> +				(buf[i + 1] == '\\' || buf[i + 1] == '{'))
>  				memcpy(buf + i, buf + i + 1, size - i - 1);

This is the reason why... in your version it's much harder to see that
(buf[i + 1]... is part of the condition.

> @@ -445,7 +445,7 @@ static void uemis_increased_timeout(int *timeout)
>  
>  /* send a request to the dive computer and collect the answer */
>  static bool uemis_get_answer(const char *path, char *request, int n_param_in,
> -			     int n_param_out, const char **error_text)
> +				int n_param_out, const char **error_text)

This one looks valid

> @@ -475,7 +475,7 @@ static bool uemis_get_answer(const char *path, char *request, int n_param_in,
>  	for (i = 0; i < n_param_in; i++)
>  		str_append_with_delim(sb, param_buff[i]);
>  	if (!strcmp(request, "getDivelogs") || !strcmp(request, "getDeviceData") || !strcmp(request, "getDirectory") ||
> -	    !strcmp(request, "getDivespot") || !strcmp(request, "getDive")) {
> +		!strcmp(request, "getDivespot") || !strcmp(request, "getDive")) {

See above - harder to read.

> @@ -939,8 +939,8 @@ static char *uemis_get_divenr(char *deviceidstr)
>  		struct divecomputer *dc;
>  		for_each_dc (d, dc) {
>  			if (dc->model && !strcmp(dc->model, "Uemis Zurich") &&
> -			    (dc->deviceid == 0 || dc->deviceid == 0x7fffffff || dc->deviceid == deviceid) &&
> -			    dc->diveid > maxdiveid)
> +				(dc->deviceid == 0 || dc->deviceid == 0x7fffffff || dc->deviceid == deviceid) &&
> +				dc->diveid > maxdiveid)

Ditto.

> @@ -989,13 +989,12 @@ static bool do_dump_buffer_to_file(char *buf, char *prefix, int round)
>   * filenr holds now the uemis filenr after having read several logs including the dive details,
>   * fCapacity will five us the average number of files needed for all currently loaded data
>   * remember the maximum file usage per dive
> - * return : UEMIS_MEM_OK       if there is enough memeory for a full round
> - *          UEMIS_MEM_CRITICAL if the memory is good for reading the dive logs
> - *          UEMIS_MEM_FULL     if the memory is exhaused
> + * return :	UEMIS_MEM_OK	if there is enough memeory for a full round
> + *		UEMIS_MEM_CRITICAL	if the memory is good for reading the dive logs
> + *		UEMIS_MEM_FULL	if the memory is exhaused
>   */

meh - I don't really care much about the intricate whitespace insides
comments :-)

Since you wanted a chance to play with git... can you create a new patch
that only includes the ones I didn't call out as wrong?

Thanks

/D


More information about the subsurface mailing list