Bug in FormulaDelegate : string copy was made in a wrong way
This commit is contained in:
		@@ -1,9 +1,11 @@
 | 
				
			|||||||
v0.7 (11/11/2016)
 | 
					v0.7 (01/01/2017)
 | 
				
			||||||
** User **
 | 
					** User **
 | 
				
			||||||
	Set background calendar color to red or yellow when one account is negative or less than 200
 | 
						Set background calendar color to red or yellow when one account is negative or less than 200€
 | 
				
			||||||
 | 
					
 | 
				
			||||||
** Dev **
 | 
					** Dev **
 | 
				
			||||||
** Bugs **
 | 
					** Bugs **
 | 
				
			||||||
 | 
						Bug in expression parser, negative mark before parenthesis considered as positive.
 | 
				
			||||||
 | 
						Bug in FormulaDelegate : string copy was made in a wrong way
 | 
				
			||||||
 | 
					
 | 
				
			||||||
v0.6 (08/10/2016)
 | 
					v0.6 (08/10/2016)
 | 
				
			||||||
** User **
 | 
					** User **
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -23,6 +23,7 @@
 | 
				
			|||||||
#include "FormulaDelegate.hpp"
 | 
					#include "FormulaDelegate.hpp"
 | 
				
			||||||
#include <ParseExp.hpp>
 | 
					#include <ParseExp.hpp>
 | 
				
			||||||
#include "../wxUI.hpp"
 | 
					#include "../wxUI.hpp"
 | 
				
			||||||
 | 
					#include <cstring>
 | 
				
			||||||
#include <iostream>
 | 
					#include <iostream>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QWidget * FormulaDelegate::createEditor (QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index ) const
 | 
					QWidget * FormulaDelegate::createEditor (QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index ) const
 | 
				
			||||||
@@ -38,17 +39,17 @@ void FormulaDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
 | 
				
			|||||||
    double res = 0.0;
 | 
					    double res = 0.0;
 | 
				
			||||||
    QString value = line->text();
 | 
					    QString value = line->text();
 | 
				
			||||||
    struct ParseExp::parse_opt opt, *r;
 | 
					    struct ParseExp::parse_opt opt, *r;
 | 
				
			||||||
    const char* c;
 | 
					 | 
				
			||||||
    char* str, *str2;
 | 
					    char* str, *str2;
 | 
				
			||||||
    bool ok;
 | 
					    bool ok;
 | 
				
			||||||
 | 
					    std::string ss;
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    value = value.trimmed();
 | 
					    value = value.trimmed();
 | 
				
			||||||
    if (value.startsWith("="))
 | 
					    if (value.startsWith("="))
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
	value = value.replace(",", ".");
 | 
						value = value.replace(",", ".");
 | 
				
			||||||
	c = value.toStdString().c_str();
 | 
						ss = value.toStdString();
 | 
				
			||||||
	str2 = str = new char[strlen(c)];
 | 
						str2 = str = new char[ss.length()];
 | 
				
			||||||
	strcpy(str, c+1);
 | 
						std::strcpy(str, ss.c_str()+1);
 | 
				
			||||||
	memset(&opt, 0, sizeof(opt));
 | 
						memset(&opt, 0, sizeof(opt));
 | 
				
			||||||
	r = &opt;
 | 
						r = &opt;
 | 
				
			||||||
	try {
 | 
						try {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user