Skip to content

Commit

Permalink
static analysis clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
jpswinski committed Oct 11, 2024
1 parent ca00b48 commit e08fc95
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 19 deletions.
2 changes: 1 addition & 1 deletion datasets/bathy/package/BathyFields.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ int BathyFields::luaCreate (lua_State* L)

try
{
long key_space = LuaObject::getLuaInteger(L, 2, true, 0);
const long key_space = LuaObject::getLuaInteger(L, 2, true, 0);
const char* default_asset_name = LuaObject::getLuaString(L, 3, true, "icesat2");
const char* default_resource = LuaObject::getLuaString(L, 4, true, NULL);

Expand Down
2 changes: 1 addition & 1 deletion datasets/icesat2/package/Icesat2Fields.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ int Icesat2Fields::luaCreate (lua_State* L)

try
{
uint64_t key_space = LuaObject::getLuaInteger(L, 2, true, 0);
const uint64_t key_space = LuaObject::getLuaInteger(L, 2, true, 0);
const char* default_asset_name = LuaObject::getLuaString(L, 3, true, "icesat2");
const char* default_resource = LuaObject::getLuaString(L, 4, true, NULL);

Expand Down
4 changes: 2 additions & 2 deletions datasets/landsat/package/LandsatHlsRaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ LandsatHlsRaster::LandsatHlsRaster(lua_State *L, RequestFields* rqst_parms, cons
/* Create dictionary of bands and algo names to process */
for(int i = 0; i < parms->bands.length(); i++)
{
const char* name = parms->bands[i].c_str();
if( isValidL8Band(name) || isValidS2Band(name) || isValidAlgoName(name))
const string& name = parms->bands[i];
if( isValidL8Band(name.c_str()) || isValidS2Band(name.c_str()) || isValidAlgoName(name.c_str()))
{
/* Add band to dictionary of bands but don't override if already there */
auto it = bandsDict.find(name);
Expand Down
2 changes: 1 addition & 1 deletion datasets/swot/package/SwotFields.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ int SwotFields::luaCreate (lua_State* L)

try
{
uint64_t key_space = LuaObject::getLuaInteger(L, 1, true, 0);
const uint64_t key_space = LuaObject::getLuaInteger(L, 1, true, 0);

swot_fields = new SwotFields(L, key_space);
swot_fields->fromLua(L, 1);
Expand Down
14 changes: 7 additions & 7 deletions packages/geo/GdalRaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,19 +675,19 @@ void GdalRaster::resamplePixel(const OGRPoint* poi, RasterSample* sample)
{
int kernel = 0;

if (parms->sampling_algo == GRIORA_Bilinear)
if (parms->sampling_algo == GeoFields::BILINEAR_ALGO)
kernel = 2; /* 2x2 kernel */
else if (parms->sampling_algo == GRIORA_Cubic)
else if (parms->sampling_algo == GeoFields::CUBIC_ALGO)
kernel = 4; /* 4x4 kernel */
else if (parms->sampling_algo == GRIORA_CubicSpline)
else if (parms->sampling_algo == GeoFields::CUBICSPLINE_ALGO)
kernel = 4; /* 4x4 kernel */
else if (parms->sampling_algo == GRIORA_Lanczos)
else if (parms->sampling_algo == GeoFields::LANCZOS_ALGO)
kernel = 6; /* 6x6 kernel */
else if (parms->sampling_algo == GRIORA_Average)
else if (parms->sampling_algo == GeoFields::AVERAGE_ALGO)
kernel = 6; /* No default kernel, pick something */
else if (parms->sampling_algo == GRIORA_Mode)
else if (parms->sampling_algo == GeoFields::MODE_ALGO)
kernel = 6; /* No default kernel, pick something */
else if (parms->sampling_algo == GRIORA_Gauss)
else if (parms->sampling_algo == GeoFields::GAUSS_ALGO)
kernel = 6; /* No default kernel, pick something */

windowSize = kernel + 1; // Odd window size around pixel
Expand Down
2 changes: 1 addition & 1 deletion packages/geo/GeoFields.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ void convertFromLua(lua_State* L, int index, GeoFields::sampling_algo_t& v)
}
else
{
long n = LuaObject::getLuaInteger(L, index);
const long n = LuaObject::getLuaInteger(L, index);
switch(static_cast<GeoFields::sampling_algo_t>(n))
{
case GeoFields::NEARESTNEIGHBOUR_ALGO: break; // valid value
Expand Down
2 changes: 1 addition & 1 deletion packages/geo/GeoFields.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class GeoFields: public FieldDictionary
* Typedefs
*--------------------------------------------------------------------*/

typedef struct {
typedef struct GeoBBox {
double lon_min {0.0};
double lat_min {0.0};
double lon_max {0.0};
Expand Down
9 changes: 4 additions & 5 deletions packages/geo/geo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@

#include "geo.h"

#ifdef __unittesting__
#include "UT_RasterSubset.h"
#include "UT_RasterSample.h"
#endif

#include "GeoRaster.h"
#include "GeoIndexedRaster.h"
#include "GeoJsonRaster.h"
Expand All @@ -48,6 +43,10 @@
#include "GeoFields.h"
#include "GeoLib.h"
#include "RasterSampler.h"
#ifdef __unittesting__
#include "UT_RasterSubset.h"
#include "UT_RasterSample.h"
#endif

#include <gdal.h>
#include <cpl_conv.h>
Expand Down

0 comments on commit e08fc95

Please sign in to comment.