diff --git a/src/baseline.c b/src/baseline.c index 56f6c788e..cfebf7cc8 100644 --- a/src/baseline.c +++ b/src/baseline.c @@ -54,7 +54,7 @@ #include #include "allheaders.h" - /* Min to travel after finding max before abandoning peak */ + /* Minimum distance to travel after finding max before abandoning peak */ static const l_int32 MinDistInPeak = 35; /* Thresholds for peaks and zeros, relative to the max peak */ @@ -65,9 +65,9 @@ static const l_int32 ZeroThresholdRatio = 100; static const l_int32 DefaultSlices = 10; static const l_int32 DefaultSweepReduction = 2; static const l_int32 DefaultBsReduction = 1; -static const l_float32 DefaultSweepRange = 5.; /* degrees */ -static const l_float32 DefaultSweepDelta = 1.; /* degrees */ -static const l_float32 DefaultMinbsDelta = 0.01f; /* degrees */ +static const l_float32 DefaultSweepRange = 5.; /* degrees */ +static const l_float32 DefaultSweepDelta = 1.; /* degrees */ +static const l_float32 DefaultMinbsDelta = 0.01; /* degrees */ /* Overlap slice fraction added to top and bottom of each slice */ static const l_float32 OverlapFraction = 0.5; diff --git a/src/colorquant1.c b/src/colorquant1.c index 57b25e9a5..40db087ba 100644 --- a/src/colorquant1.c +++ b/src/colorquant1.c @@ -3083,11 +3083,11 @@ pixFewColorsOctcubeQuant2(PIX *pixs, l_int32 w, h, wpls, wpld, i, j, nerrors; l_int32 ncubes, depth, cindex, oval; l_int32 rval, gval, bval; -l_int32 *octarray; +l_int32 *octarray = NULL; l_uint32 octindex; l_uint32 *rtab, *gtab, *btab; l_uint32 *lines, *lined, *datas, *datad, *ppixel; -l_uint32 *colorarray; +l_uint32 *colorarray = NULL; PIX *pixd; PIXCMAP *cmap; @@ -3110,8 +3110,10 @@ PIXCMAP *cmap; makeRGBToIndexTables(level, &rtab, >ab, &btab); /* The octarray will give a ptr from the octcube to the colorarray */ - if ((ncubes = numaGetCount(na)) == 0) - return ERROR_PTR("no slots in pixel occupation histogram", __func__, NULL); + if ((ncubes = numaGetCount(na)) == 0) { + L_ERROR("no slots in pixel occupation histogram", __func__); + goto cleanup_arrays; + } octarray = (l_int32 *)LEPT_CALLOC(ncubes, sizeof(l_int32)); /* The colorarray will hold the colors of the first pixel diff --git a/src/environ.h b/src/environ.h index d69f1312a..fdf90d740 100644 --- a/src/environ.h +++ b/src/environ.h @@ -220,7 +220,7 @@ typedef uintptr_t l_uintptr_t; /*--------------------------------------------------------------------* * Built-in types * *--------------------------------------------------------------------*/ -typedef int l_ok; /*!< return type 0 if OK, 1 on error */ +typedef int l_ok; /*!< return 0 if OK, 1 on error */ typedef signed char l_int8; /*!< signed 8-bit value */ typedef unsigned char l_uint8; /*!< unsigned 8-bit value */ typedef short l_int16; /*!< signed 16-bit value */