Re: [PATCH] Re: [Ltilib-devel] src/basics/ltiColors.h
Status: Beta
Brought to you by:
alvarado
From: Vincenzo Di M. <ha...@ti...> - 2006-05-04 13:49:54
|
Alle 13:27, Thursday 4 maggio 2006, Peter Doerfler ha scritto: > Hi Vincenzo. > > This change has been in CVS for quite a while as suggested. > It seems that the anon CVS is still out of sync with the devel CVS at SF. > > You can get it via the viewCVS interface though. > Thank you :-) I also have another patch to propose. This time the patch is useless, but... first look at the patch: diff --git a/src/io/ltiConfigFileHandler.cpp b/src/io/ltiConfigFileHandler.cpp index 481a7f8..54b1f45 100644 --- a/src/io/ltiConfigFileHandler.cpp +++ b/src/io/ltiConfigFileHandler.cpp @@ -519,7 +519,8 @@ namespace lti { std::string erg; if( getValue(section,key,erg,comment) ){ //convert the string erg to double - value = atof(erg.c_str()); + std::stringstream ss(erg); + ss>>value; return true; } //value = 0; //if nothing found leave unaltered @@ -534,7 +535,8 @@ namespace lti { std::string erg; if( getValue(section,key,erg,comment) ){ //convert the string erg to double - value = static_cast<float>(atof(erg.c_str())); + std::stringstream ss(erg); + ss>>value; return true; } //value = 0; //if nothing found leave unaltered @@ -549,7 +551,8 @@ namespace lti { std::string erg; if( getValue(section,key,erg,comment) ){ //convert the string erg to int - value = atoi(erg.c_str()); + std::stringstream ss(erg); + ss>>value; return true; } //value = 0; //if nothing found leave unaltered @@ -564,7 +567,8 @@ namespace lti { std::string erg; if( getValue(section,key,erg,comment) ){ //convert the string erg to int - value = static_cast<unsigned int>(atoi(erg.c_str())); + std::stringstream ss(erg); + ss>>value; return true; } //value = 0; //if nothing found leave unaltered As you can see what this patch does is ... NOTHING!!!! The reason I'm submitting it is that the current code does not work in some circimstances: on one of my machines the atof function returns rounded numbers e.g.: "0.55"->0.0, "1,1" -> 1. I don't know where the problem resides. The machine that gives the problem is 2.6GHz PIV and is using the same operating system (kubuntu dapper) other machines are using. Some weeks ago I had other problems with the configFileHandler class (on onother machine): compiling a configFileHandler subclass together with my "viewsegments" library the applications linking my library crashed. To "resolve" the bug I compiled the configFileHandler subclass into a stand alone "settings" library (I'm an hackish man). All this makes me think of some memory management problem (either im my app or in ltilib or in some of the other deps [kdelibs, fann]) but valgrind can't detect this problem (I also tried using electricfence with no luck) I don't know how to further investigate. I submit this patch to help you investigating this problem more than to propose it for inclusion (even if I find it more clean than the previous casting code). Calling for help :-) Regards Vincenzo > Here's what SF got on their status page: > ( 2006-04-14 11:18:04 - Project CVS Service ) As of 2006-04-14 we > have an estimate on when the replacement CVS hardware for the new > infrastructure will arrive. As soon as we get in into our hands, we'll > actively work on it, with a goal of having it online by the end of the > month of April. This is a best guess, and may not get hit due to the > aggressive timeline we have placed on this project. However, be assured > that recovery of this service in full is our highest priority. The sync > process between developer and anonymous CVS (ViewCVS, etc.) is disabled > now until the new infrastructure is in place, to ensure we have maximum > coverage for the small number of data corruption issues that have been > detected. We understand this is sub-optimal, but strongly believe that > the protection of the data is paramount. > > > Best, Peter > > Vincenzo Di Massa wrote: > > Alle 16:12, Tuesday 4 aprile 2006, Vincenzo Di Massa ha scritto: > >> I think the makeHTML member function should be const... > >> Are there any drawbacks? > >> > >> Vincenzo > > > > I propose this patch > > > > > > diff --git a/src/basics/ltiColors.cpp b/src/basics/ltiColors.cpp > > index 91f5e89..e5d00da 100644 > > --- a/src/basics/ltiColors.cpp > > +++ b/src/basics/ltiColors.cpp > > @@ -77,7 +77,7 @@ namespace lti { > > } > > } > > > > - std::string rgbColor::makeHTML(bool getAlpha) { > > + std::string rgbColor::makeHTML(bool getAlpha) const{ > > char buf[16]; > > > > if (getAlpha) { > > diff --git a/src/basics/ltiColors.h b/src/basics/ltiColors.h > > index f88cf93..4c5187a 100644 > > --- a/src/basics/ltiColors.h > > +++ b/src/basics/ltiColors.h > > @@ -129,7 +129,7 @@ namespace lti { > > * @param getAlpha if this is true, the returned definition > > * will also contain the alpha channel. > > */ > > - std::string makeHTML(bool getAlpha=false); > > + std::string makeHTML(bool getAlpha=false) const; > > > > /** > > * Parses a color name (which colors are defined, is > > > >> ------------------------------------------------------- > >> This SF.Net email is sponsored by xPML, a groundbreaking scripting > >> language that extends applications into web and mobile media. Attend the > >> live webcast and join the prime developer group breaking into this new > >> coding territory! > >> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 > >> _______________________________________________ > >> Ltilib-devel mailing list > >> Lti...@li... > >> https://lists.sourceforge.net/lists/listinfo/ltilib-devel > > > > ------------------------------------------------------- > > Using Tomcat but need to do more? Need to support web services, security? > > Get stuff done quickly with pre-integrated technology to make your job > > easier Download IBM WebSphere Application Server v.1.0.1 based on Apache > > Geronimo > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > _______________________________________________ > > Ltilib-devel mailing list > > Lti...@li... > > https://lists.sourceforge.net/lists/listinfo/ltilib-devel > > ------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Ltilib-devel mailing list > Lti...@li... > https://lists.sourceforge.net/lists/listinfo/ltilib-devel |