[PATCH 1/2] QML UI: Enable cylinder edit

Dirk Hohndel dirk at hohndel.org
Mon Aug 29 22:15:37 PDT 2016


On Mon, Aug 29, 2016 at 09:35:05PM +0200, Joakim Bygdell wrote:
> +	QStringList cylinders;
> +	struct dive *d;
> +	int i = 0;
> +	for_each_dive (i, d) {
> +		for (int j = 0; j < MAX_CYLINDERS; j++) {
> +			QString cyl = d->cylinder[j].type.description;
> +			if (cyl == EMPTY_DIVE_STRING)
> +				continue;
> +			cylinders << cyl;
> +		}
> +	}
> +
> +	for (i = 0; i < 100 && tank_info[i].name != NULL; i++) {

Why are we looping to 100 here. That just seems odd to me.

> +	// info for first cylinder
> +	if (myDive->getCylinder() != cylinder) {
> +		diveChanged = true;
> +		int i, size, wp;
> +		for (i = 0; i < 100 && tank_info[i].name != NULL; i++) {

Again this loop to 100

> +			if (tank_info[i].name == cylinder ) {
> +				if (tank_info[i].ml > 0){
> +					size = tank_info[i].ml;
> +					wp = tank_info[i].bar * 1000;
> +				}
> +				else {

That's not our coding style... } else {

/D


More information about the subsurface mailing list