Skip to content

Commit

Permalink
Small change to prevent line wrap
Browse files Browse the repository at this point in the history
* also fix potential leak in pixFewColorsOctcubeQuant2()
  • Loading branch information
DanBloomberg committed Aug 26, 2023
1 parent d819f01 commit 776cd4e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/baseline.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
#include <math.h>
#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 */
Expand All @@ -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;
Expand Down
10 changes: 6 additions & 4 deletions src/colorquant1.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -3110,8 +3110,10 @@ PIXCMAP *cmap;
makeRGBToIndexTables(level, &rtab, &gtab, &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
Expand Down
2 changes: 1 addition & 1 deletion src/environ.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 776cd4e

Please sign in to comment.