Commit 4d45994a authored by Oliver Heidmann's avatar Oliver Heidmann
Browse files

refactored c array containing LUT to std:vector, removed include of dmemory

parent 9d198013
......@@ -19,7 +19,6 @@
#include <cstring>
#include <cmath>
#include "dmemory.h"
#include "color.h"
#define RGB 0
......@@ -208,7 +207,7 @@ cptRead(FILE *fp, CPT *cpt)
cptInit(cpt);
cpt->lut = (LUT *) Calloc(1, n_alloc * sizeof(LUT));
cpt->lut = std::vector<LUT>(1);
/* Save the original setting since it may be modified by settings in the CPT
* file */
......@@ -369,7 +368,7 @@ cptRead(FILE *fp, CPT *cpt)
{
i = n_alloc;
n_alloc += small_chunk;
cpt->lut = (LUT *) Realloc((void *) cpt->lut, (size_t) n_alloc * sizeof(LUT));
cpt->lut.resize(n_alloc);
memset((void *) &cpt->lut[i], 0, (size_t)(small_chunk * sizeof(LUT))); /* Initialize new structs to zero */
}
}
......@@ -388,7 +387,7 @@ cptRead(FILE *fp, CPT *cpt)
return (READERR);
}
cpt->lut = (LUT *) Realloc((void *) cpt->lut, (size_t) n * sizeof(LUT));
cpt->lut.resize(n);
ncolors = n;
for (i = annot = 0, gap = false; i < ncolors - 1; i++)
{
......
......@@ -18,6 +18,7 @@
#define COLOR_H
#include <cstdio>
#include <vector>
struct LUT
{
......@@ -36,7 +37,7 @@ struct BFN_COLOR
struct CPT
{
int ncolors;
LUT *lut;
std::vector<LUT> lut;
BFN_COLOR bfn[3];
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment