Use iostream operators for load palette member instead of atof.
authorCarlos Lopez <genetita@gmail.com>
Mon, 7 Jun 2010 16:14:26 +0000 (18:14 +0200)
committerCarlos Lopez <genetita@gmail.com>
Mon, 7 Jun 2010 16:14:26 +0000 (18:14 +0200)
synfig-core/src/synfig/palette.cpp

index 427c4b6..0ce2717 100644 (file)
@@ -333,25 +333,15 @@ Palette::load_from_file(const synfig::String& filename)
        while(!file.eof())
        {
                PaletteItem item;
+               String n;
+               float r, g, b, a;
                getline(file,item.name);
-               if(file.eof())break;
-
-               getline(file,line);
-               if(file.eof())break;
-               item.color.set_r(atof(line.c_str()));
-
-               getline(file,line);
-               if(file.eof())break;
-               item.color.set_g(atof(line.c_str()));
-
-               getline(file,line);
-               if(file.eof())break;
-               item.color.set_b(atof(line.c_str()));
-
-               getline(file,line);
-               if(file.eof())break;
-               item.color.set_a(atof(line.c_str()));
-
+               file>>r>>g>>b>>a;
+               item.color.set_r(r);
+               item.color.set_g(g);
+               item.color.set_b(b);
+               item.color.set_a(a);
+               if(file.eof()) break;
                ret.push_back(item);
        }