Transferring loads of array variables from Stack to Heap

This commit is contained in:
Hombre
2011-01-01 03:28:27 +01:00
parent 5ee87be11b
commit 9fa432880c
26 changed files with 190 additions and 72 deletions

View File

@@ -112,9 +112,9 @@ bool BatchQueue::loadBatchQueue( )
if (f==NULL)
return false;
char buffer[1024];
char *buffer = new char[1024];
unsigned numLoaded=0;
while (fgets (buffer, sizeof(buffer), f)){
while (fgets (buffer, 1024, f)){
char *p = strchr(buffer,';' );
if( p ){
char *le = buffer + strlen(buffer);
@@ -156,6 +156,7 @@ bool BatchQueue::loadBatchQueue( )
}
}
}
delete [] buffer;
fclose(f);
arrangeFiles ();
queue_draw ();

View File

@@ -37,6 +37,8 @@ CurveEditor::CurveEditor (Glib::ustring text, CurveEditorGroup* ceGroup) {
bgHistValid = false;
selected = Linear;
histogram = new unsigned int[256]; // histogram values
group = ceGroup;
if (group && text.size())
@@ -58,11 +60,11 @@ CurveEditor::CurveEditor (Glib::ustring text, CurveEditorGroup* ceGroup) {
curveType->show();
}
/*
CurveEditor::~CurveEditor () {
delete [] histogram;
}
*/
void CurveEditor::setCurve (const std::vector<double>& p) {
tempCurve = p;

View File

@@ -43,7 +43,7 @@ private:
CurveType selected;
PopUpToggleButton* curveType;
unsigned int histogram[256]; // histogram values
unsigned int* histogram; // histogram values
bool bgHistValid;
CurveEditorGroup* group;
@@ -57,7 +57,7 @@ public:
friend class CurveEditorGroup;
CurveEditor (Glib::ustring text, CurveEditorGroup* ceGroup);
//~CurveEditor ();
~CurveEditor ();
void typeSelectionChanged (int n);
void curveTypeToggled();
void setCurve (const std::vector<double>& p);

View File

@@ -77,6 +77,11 @@ void HistogramPanel::rgbv_toggled () {
HistogramArea::HistogramArea () :
valid(false), showFull(true), oldwidth(-1), needVal(true), needRed(true), needGreen(true), needBlue(true) {
lhist = new unsigned int[256];
rhist = new unsigned int[256];
ghist = new unsigned int[256];
bhist = new unsigned int[256];
haih = new HistogramAreaIdleHelper;
haih->harea = this;
haih->destroyed = false;
@@ -91,6 +96,11 @@ HistogramArea::~HistogramArea () {
haih->destroyed = true;
else
delete haih;
delete [] lhist;
delete [] rhist;
delete [] ghist;
delete [] bhist;
}
void HistogramArea::updateOptions (bool r, bool g, bool b, bool v) {

View File

@@ -44,10 +44,10 @@ class HistogramArea : public Gtk::DrawingArea {
Gdk::Color lgray;
Gdk::Color mgray;
Gdk::Color dgray;
unsigned int lhist[256];
unsigned int rhist[256];
unsigned int ghist[256];
unsigned int bhist[256];
unsigned int* lhist;
unsigned int* rhist;
unsigned int* ghist;
unsigned int* bhist;
bool valid;
bool showFull;
int oldwidth, oldheight;

View File

@@ -124,6 +124,7 @@ int main(int argc, char **argv)
m.run(*rtWindow);
gdk_threads_leave ();
delete rtWindow;
rtengine::cleanup();
return 0;
}

View File

@@ -32,6 +32,8 @@ MyCurve::MyCurve () : listener(NULL), activeParam(-1), bghistvalid(false) {
lit_point = -1;
buttonPressed = false;
bghist = new unsigned int[256];
set_extension_events(Gdk::EXTENSION_EVENTS_ALL);
add_events(Gdk::EXPOSURE_MASK | Gdk::POINTER_MOTION_MASK | Gdk::POINTER_MOTION_HINT_MASK | Gdk::ENTER_NOTIFY_MASK | Gdk::LEAVE_NOTIFY_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::BUTTON1_MOTION_MASK);
signal_event().connect( sigc::mem_fun(*this, &MyCurve::handleEvents) );
@@ -54,8 +56,8 @@ MyCurve::~MyCurve () {
mcih->destroyed = true;
else
delete mcih;
//curve.x.clear();
//curve.y.clear();
delete [] bghist;
}
std::vector<double> MyCurve::get_vector (int veclen) {

View File

@@ -84,7 +84,7 @@ class MyCurve : public Gtk::DrawingArea {
std::vector<Gdk::Point> upoint;
std::vector<Gdk::Point> lpoint;
int activeParam;
unsigned int bghist[256]; // histogram values
unsigned int* bghist; // histogram values
bool bghistvalid;
bool buttonPressed;
MyCurveIdleHelper* mcih;