Skip to content

Commit

Permalink
apply clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
lbartoletti authored and Charlie Root committed Nov 1, 2023
1 parent ff548fc commit b48aeee
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 27 deletions.
3 changes: 1 addition & 2 deletions db/drivers/ogr/describe.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ int describe_table(OGRLayerH hLayer, dbTable **table, cursor *c)
ogrType = OGR_Fld_GetType(hFieldDefn);
fieldName = OGR_Fld_GetNameRef(hFieldDefn);

if (ogrType != OFTInteger &&
ogrType != OFTInteger64 &&
if (ogrType != OFTInteger && ogrType != OFTInteger64 &&
ogrType != OFTReal && ogrType != OFTString && ogrType != OFTDate &&
ogrType != OFTTime && ogrType != OFTDateTime) {
G_warning(
Expand Down
3 changes: 1 addition & 2 deletions db/drivers/ogr/execute.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ int db__driver_execute_immediate(dbString *sql)
}
else {
if ((cols[i].type != OFTInteger ||
cols[i].type != OFTInteger64 ||
cols[i].type != OFTReal) &&
cols[i].type != OFTInteger64 || cols[i].type != OFTReal) &&
*(cols[i].value) == '\'') {
value = G_strchg(cols[i].value, '\'', ' ');
G_strip(value);
Expand Down
37 changes: 15 additions & 22 deletions vector/v.in.ogr/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ int main(int argc, char *argv[])
if (Ogr_ds == NULL)
G_fatal_error(_("Unable to open data source <%s>"), dsn);

/* driver name */
/* driver name */
ogr_driver_name = GDALGetDriverShortName(GDALGetDatasetDriver(Ogr_ds));
G_verbose_message(_("Using OGR driver '%s/%s'"), ogr_driver_name,
GDALGetDriverLongName(GDALGetDatasetDriver(Ogr_ds)));
Expand Down Expand Up @@ -812,7 +812,7 @@ int main(int argc, char *argv[])
if (ogr_feature_count <= 0)
n_features[layer]++;

/* Geometry */
/* Geometry */
Ogr_featuredefn = OGR_iter.Ogr_featuredefn;
for (i = 0; i < OGR_FD_GetGeomFieldCount(Ogr_featuredefn); i++) {
if (igeom > -1 && i != igeom)
Expand Down Expand Up @@ -934,9 +934,7 @@ int main(int argc, char *argv[])
Ogr_field =
OGR_FD_GetFieldDefn(Ogr_featuredefn, key_idx[layer]);
Ogr_ftype = OGR_Fld_GetType(Ogr_field);
if (!(Ogr_ftype == OFTInteger
|| Ogr_ftype == OFTInteger64
)) {
if (!(Ogr_ftype == OFTInteger || Ogr_ftype == OFTInteger64)) {
G_fatal_error(
_("Key column '%s' in input layer <%s> is not integer"),
param.key->answer, layer_names[layer]);
Expand Down Expand Up @@ -1054,9 +1052,8 @@ int main(int argc, char *argv[])
Ogr_fieldname);
}
}
else if (Ogr_ftype == OFTIntegerList
|| Ogr_ftype == OFTInteger64List
) {
else if (Ogr_ftype == OFTIntegerList ||
Ogr_ftype == OFTInteger64List) {
/* hack: treat as string */
sprintf(buf, "varchar ( %d )", OFTIntegerListlength);
col_info[i_out].type = G_store(buf);
Expand Down Expand Up @@ -1252,7 +1249,7 @@ int main(int argc, char *argv[])
/* Ogr_geometry from OGR_F_GetGeomFieldRef() should not be
* modified. */
Ogr_geometry = OGR_F_GetGeomFieldRef(Ogr_feature, i);
Ogr_geometry = OGR_F_GetGeometryRef(Ogr_feature);
Ogr_geometry = OGR_F_GetGeometryRef(Ogr_feature);
if (Ogr_geometry == NULL) {
nogeom++;
}
Expand Down Expand Up @@ -1285,8 +1282,7 @@ int main(int argc, char *argv[])
Ogr_fstring = OGR_F_GetFieldAsString(Ogr_feature, i);
if (Ogr_fstring && *Ogr_fstring) {
if (Ogr_ftype == OFTInteger ||
Ogr_ftype == OFTInteger64 ||
Ogr_ftype == OFTReal) {
Ogr_ftype == OFTInteger64 || Ogr_ftype == OFTReal) {
G_rasprintf(&sqlbuf, &sqlbufsize, ", %s",
Ogr_fstring);
}
Expand All @@ -1307,9 +1303,8 @@ int main(int argc, char *argv[])
}
else if (Ogr_ftype == OFTString ||
Ogr_ftype == OFTStringList ||
Ogr_ftype == OFTIntegerList
|| Ogr_ftype == OFTInteger64List
) {
Ogr_ftype == OFTIntegerList ||
Ogr_ftype == OFTInteger64List) {
db_set_string(&strval, (char *)Ogr_fstring);
db_double_quote_string(&strval);
G_rasprintf(&sqlbuf, &sqlbufsize, ", '%s'",
Expand All @@ -1324,8 +1319,7 @@ int main(int argc, char *argv[])
else {
/* G_warning (_("Column value not set" )); */
if (Ogr_ftype == OFTInteger ||
Ogr_ftype == OFTInteger64 ||
Ogr_ftype == OFTReal) {
Ogr_ftype == OFTInteger64 || Ogr_ftype == OFTReal) {
G_rasprintf(&sqlbuf, &sqlbufsize, ", NULL");
}
else if (Ogr_ftype == OFTDate || Ogr_ftype == OFTTime ||
Expand All @@ -1334,9 +1328,8 @@ int main(int argc, char *argv[])
}
else if (Ogr_ftype == OFTString ||
Ogr_ftype == OFTStringList ||
Ogr_ftype == OFTIntegerList
|| Ogr_ftype == OFTInteger64List
) {
Ogr_ftype == OFTIntegerList ||
Ogr_ftype == OFTInteger64List) {
G_rasprintf(&sqlbuf, &sqlbufsize, ", NULL");
}
else {
Expand Down Expand Up @@ -1565,8 +1558,8 @@ int main(int argc, char *argv[])
Ogr_featuredefn = OGR_L_GetLayerDefn(Ogr_layer);

igeom = -1;
igeom = OGR_FD_GetGeomFieldIndex(Ogr_featuredefn,
param.geom->answer);
igeom =
OGR_FD_GetGeomFieldIndex(Ogr_featuredefn, param.geom->answer);

cat = 0; /* field = layer + 1 */
feature_count = 0;
Expand Down Expand Up @@ -1613,7 +1606,7 @@ int main(int argc, char *argv[])
continue; /* use only geometry defined via param.geom */

Ogr_geometry = OGR_F_GetGeomFieldRef(Ogr_feature, i);
Ogr_geometry = OGR_F_GetGeometryRef(Ogr_feature);
Ogr_geometry = OGR_F_GetGeometryRef(Ogr_feature);
if (Ogr_geometry != NULL) {
centroid(Ogr_geometry, Centr, &si, layer + 1, area_cat,
min_area, type);
Expand Down
2 changes: 1 addition & 1 deletion vector/v.out.ogr/local_proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ typedef GDALDriverH dr_t;
#define ds_close(ds) GDALClose(ds)

/* some hard limits */
#define SQL_BUFFER_SIZE 2000
#define SQL_BUFFER_SIZE 2000

struct Options {
struct Option *input, *dsn, *layer, *type, *format, *field, *dsco, *lco,
Expand Down

0 comments on commit b48aeee

Please sign in to comment.