Skip to content

Commit

Permalink
Merge branch 'main' into gcp
Browse files Browse the repository at this point in the history
  • Loading branch information
arohanajit authored Sep 30, 2024
2 parents 8c215dd + 33d0d15 commit b82a4a0
Show file tree
Hide file tree
Showing 21 changed files with 59 additions and 36 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
if: ${{ matrix.language == 'c-cpp' }}

- name: Initialize CodeQL
uses: github/codeql-action/init@461ef6c76dfe95d5c364de2f431ddbd31a417628 # v3.26.9
uses: github/codeql-action/init@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql/codeql-config.yml
Expand All @@ -81,6 +81,6 @@ jobs:
run: .github/workflows/build_ubuntu-22.04.sh "${HOME}/install"

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@461ef6c76dfe95d5c364de2f431ddbd31a417628 # v3.26.9
uses: github/codeql-action/analyze@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10
with:
category: "/language:${{matrix.language}}"
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@32945a339266b759abcbdc89316275140b0fc960 # v6.8.0
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0
with:
push: true
pull: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ jobs:
path: bandit.sarif

- name: Upload SARIF File into Security Tab
uses: github/codeql-action/upload-sarif@461ef6c76dfe95d5c364de2f431ddbd31a417628 # v3.26.9
uses: github/codeql-action/upload-sarif@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10
with:
sarif_file: bandit.sarif

Expand Down
1 change: 1 addition & 0 deletions include/grass/defs/raster.h
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ int Rast_option_to_interp_type(const struct Option *);
/* mask_info.c */
char *Rast_mask_info(void);
int Rast__mask_info(char *, char *);
bool Rast_mask_is_present(void);

/* maskfd.c */
int Rast_maskfd(void);
Expand Down
10 changes: 10 additions & 0 deletions lib/raster/mask_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,13 @@ int Rast__mask_info(char *name, char *mapset)

return 1;
}

/**
* @brief Check presence of 2D raster mask
*
* @return true if mask is present, false otherwise
*/
bool Rast_mask_is_present(void)
{
return G_find_raster("MASK", G_mapset()) != NULL;
}
4 changes: 2 additions & 2 deletions raster/r.mfilter/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ int main(int argc, char **argv)
"threads setting."));
nprocs = 1;
#endif
if (nprocs > 1 && G_find_raster("MASK", G_mapset()) != NULL) {
G_warning(_("Parallel processing disabled due to active MASK."));
if (nprocs > 1 && Rast_mask_is_present()) {
G_warning(_("Parallel processing disabled due to active mask."));
nprocs = 1;
}
out_name = opt2->answer;
Expand Down
4 changes: 2 additions & 2 deletions raster/r.neighbors/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,8 @@ int main(int argc, char *argv[])
"threads setting."));
ncb.threads = 1;
#endif
if (ncb.threads > 1 && G_find_raster("MASK", G_mapset()) != NULL) {
G_warning(_("Parallel processing disabled due to active MASK."));
if (ncb.threads > 1 && Rast_mask_is_present()) {
G_warning(_("Parallel processing disabled due to active mask."));
ncb.threads = 1;
}
if (strcmp(parm.weighting_function->answer, "none") && flag.circle->answer)
Expand Down
4 changes: 2 additions & 2 deletions raster/r.patch/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ int main(int argc, char *argv[])
"threads setting."));
nprocs = 1;
#endif
if (nprocs > 1 && G_find_raster("MASK", G_mapset()) != NULL) {
G_warning(_("Parallel processing disabled due to active MASK."));
if (nprocs > 1 && Rast_mask_is_present()) {
G_warning(_("Parallel processing disabled due to active mask."));
nprocs = 1;
}

Expand Down
4 changes: 2 additions & 2 deletions raster/r.resamp.filter/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -494,8 +494,8 @@ int main(int argc, char *argv[])
"threads setting."));
nprocs = 1;
#endif
if (nprocs > 1 && G_find_raster("MASK", G_mapset()) != NULL) {
G_warning(_("Parallel processing disabled due to active MASK."));
if (nprocs > 1 && Rast_mask_is_present()) {
G_warning(_("Parallel processing disabled due to active make."));
nprocs = 1;
}
if (parm.radius->answer) {
Expand Down
4 changes: 2 additions & 2 deletions raster/r.resamp.interp/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ int main(int argc, char *argv[])
"threads setting."));
threads = 1;
#endif
if (threads > 1 && G_find_raster("MASK", G_mapset()) != NULL) {
G_warning(_("Parallel processing disabled due to active MASK."));
if (threads > 1 && Rast_mask_is_present()) {
G_warning(_("Parallel processing disabled due to active mask."));
threads = 1;
}
bufrows = atoi(memory->answer) * (((1 << 20) / sizeof(DCELL)) / dst_w.cols);
Expand Down
4 changes: 2 additions & 2 deletions raster/r.series/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ int main(int argc, char *argv[])
"threads setting."));
nprocs = 1;
#endif
if (nprocs > 1 && G_find_raster("MASK", G_mapset()) != NULL) {
G_warning(_("Parallel processing disabled due to active MASK."));
if (nprocs > 1 && Rast_mask_is_present()) {
G_warning(_("Parallel processing disabled due to active mask."));
nprocs = 1;
}
lo = -INFINITY;
Expand Down
4 changes: 2 additions & 2 deletions raster/r.sim/r.sim.sediment/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ PGM=r.sim.sediment

EXTRA_CLEAN_DIRS=doxygenhtml

LIBES = $(SIMLIB) $(GMATHLIB) $(GISLIB) $(OPENMP_LIBPATH) $(OPENMP_LIB)
DEPENDENCIES = $(SIMDEP) $(GMATHDEP) $(GISDEP)
LIBES = $(SIMLIB) $(GMATHLIB) $(GISLIB) $(RASTERLIB) $(OPENMP_LIBPATH) $(OPENMP_LIB)
DEPENDENCIES = $(SIMDEP) $(GMATHDEP) $(GISDEP) $(RASTERDEP)
EXTRA_INC = $(OPENMP_INCPATH) $(VECT_INC)
EXTRA_CFLAGS = -I ../simlib $(VECT_CFLAGS) $(OPENMP_CFLAGS)

Expand Down
5 changes: 3 additions & 2 deletions raster/r.sim/r.sim.sediment/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
#endif
#include <grass/gis.h>
#include <grass/vector.h>
#include <grass/raster.h>
#include <grass/linkm.h>
#include <grass/bitmap.h>
#include <grass/glocale.h>
Expand Down Expand Up @@ -380,8 +381,8 @@ int main(int argc, char *argv[])
#else
threads = 1;
#endif
if (threads > 1 && G_find_raster("MASK", G_mapset()) != NULL) {
G_warning(_("Parallel processing disabled due to active MASK."));
if (threads > 1 && Rast_mask_is_present()) {
G_warning(_("Parallel processing disabled due to active mask."));
threads = 1;
}
G_message(_("Number of threads: %d"), threads);
Expand Down
4 changes: 2 additions & 2 deletions raster/r.sim/r.sim.water/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ PGM=r.sim.water

EXTRA_CLEAN_DIRS=doxygenhtml

LIBES = $(SIMLIB) $(GMATHLIB) $(GISLIB) $(OPENMP_LIBPATH) $(OPENMP_LIB)
DEPENDENCIES = $(SIMDEP) $(GMATHDEP) $(GISDEP)
LIBES = $(SIMLIB) $(GMATHLIB) $(GISLIB) $(RASTERLIB) $(OPENMP_LIBPATH) $(OPENMP_LIB)
DEPENDENCIES = $(SIMDEP) $(GMATHDEP) $(GISDEP) $(RASTERDEP)
EXTRA_INC = $(VECT_INC) $(OPENMP_INCPATH)
EXTRA_CFLAGS = -I ../simlib $(VECT_CFLAGS) $(OPENMP_CFLAGS)

Expand Down
5 changes: 3 additions & 2 deletions raster/r.sim/r.sim.water/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
#endif
#include <grass/gis.h>
#include <grass/vector.h>
#include <grass/raster.h>
#include <grass/linkm.h>
#include <grass/bitmap.h>
#include <grass/glocale.h>
Expand Down Expand Up @@ -407,8 +408,8 @@ int main(int argc, char *argv[])
#else
threads = 1;
#endif
if (threads > 1 && G_find_raster("MASK", G_mapset()) != NULL) {
G_warning(_("Parallel processing disabled due to active MASK."));
if (threads > 1 && Rast_mask_is_present()) {
G_warning(_("Parallel processing disabled due to active mask."));
threads = 1;
}
G_message(_("Number of threads: %d"), threads);
Expand Down
4 changes: 2 additions & 2 deletions raster/r.slope.aspect/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,8 @@ int main(int argc, char *argv[])
"threads setting."));
nprocs = 1;
#endif
if (nprocs > 1 && G_find_raster("MASK", G_mapset()) != NULL) {
G_warning(_("Parallel processing disabled due to active MASK."));
if (nprocs > 1 && Rast_mask_is_present()) {
G_warning(_("Parallel processing disabled due to active mask."));
nprocs = 1;
}
radians_to_degrees = 180.0 / M_PI;
Expand Down
4 changes: 2 additions & 2 deletions raster/r.sun/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,8 +591,8 @@ int main(int argc, char *argv[])
#else
threads = 1;
#endif
if (threads > 1 && G_find_raster("MASK", G_mapset()) != NULL) {
G_warning(_("Parallel processing disabled due to active MASK."));
if (threads > 1 && Rast_mask_is_present()) {
G_warning(_("Parallel processing disabled due to active mask."));
threads = 1;
}
G_message(_("Number of threads <%d>"), threads);
Expand Down
4 changes: 2 additions & 2 deletions raster/r.univar/r.univar_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ int main(int argc, char *argv[])
sscanf(param.nprocs->answer, "%d", &nprocs);
if (nprocs < 1)
G_fatal_error(_("<%d> is not valid number of nprocs."), nprocs);
if (nprocs > 1 && G_find_raster("MASK", G_mapset()) != NULL) {
G_warning(_("Parallel processing disabled due to active MASK."));
if (nprocs > 1 && Rast_mask_is_present()) {
G_warning(_("Parallel processing disabled due to active mask."));
nprocs = 1;
}
#if defined(_OPENMP)
Expand Down
4 changes: 2 additions & 2 deletions vector/v.surf.rst/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ PGM=v.surf.rst

EXTRA_CLEAN_DIRS=doxygenhtml

LIBES = $(INTERPFLLIB) $(QTREELIB) $(INTERPDATALIB) $(GMATHLIB) $(VECTORLIB) $(DBMILIB) $(GISLIB) $(MATHLIB)
LIBES = $(INTERPFLLIB) $(QTREELIB) $(INTERPDATALIB) $(GMATHLIB) $(RASTERLIB) $(VECTORLIB) $(DBMILIB) $(GISLIB) $(MATHLIB)
EXTRA_LIBS = $(OPENMP_LIBPATH) $(OPENMP_LIB)
DEPENDENCIES = $(INTERPFLDEP) $(QTREEDEP) $(INTERPDATADEP) $(GMATHDEP) $(VECTORDEP) $(DBMIDEP) $(GISDEP)
DEPENDENCIES = $(INTERPFLDEP) $(QTREEDEP) $(INTERPDATADEP) $(GMATHDEP) $(RASTERDEP) $(VECTORDEP) $(DBMIDEP) $(GISDEP)
EXTRA_INC = $(VECT_INC) $(OPENMP_INCPATH)
EXTRA_CFLAGS = $(VECT_CFLAGS) $(OPENMP_CFLAGS)

Expand Down
5 changes: 3 additions & 2 deletions vector/v.surf.rst/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

#include <grass/gis.h>
#include <grass/vector.h>
#include <grass/raster.h>
#include <grass/dbmi.h>
#include <grass/glocale.h>
#include <grass/linkm.h>
Expand Down Expand Up @@ -419,8 +420,8 @@ int main(int argc, char *argv[])
G_warning(_("GRASS GIS is not compiled with OpenMP support, parallel "
"computation is disabled."));
#endif
if (threads > 1 && G_find_raster("MASK", G_mapset()) != NULL) {
G_warning(_("Parallel processing disabled due to active MASK."));
if (threads > 1 && Rast_mask_is_present()) {
G_warning(_("Parallel processing disabled due to active mask."));
threads = 1;
}
if (devi) {
Expand Down
13 changes: 11 additions & 2 deletions vector/v.transform/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,17 @@ int main(int argc, char *argv[])
if (G_parser(argc, argv))
exit(EXIT_FAILURE);

strcpy(Current.name, vold->answer);
strcpy(Trans.name, vnew->answer);
if (G_strlcpy(Current.name, vold->answer, sizeof(Current.name)) >=
sizeof(Current.name)) {
G_fatal_error(_("Input vector map name <%s> is too long"),
vold->answer);
}

if (G_strlcpy(Trans.name, vnew->answer, sizeof(Trans.name)) >=
sizeof(Trans.name)) {
G_fatal_error(_("Output vector map name <%s> is too long"),
vnew->answer);
}

Vect_check_input_output_name(vold->answer, vnew->answer, G_FATAL_EXIT);

Expand Down

0 comments on commit b82a4a0

Please sign in to comment.