1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-26 12:12:50 +02:00

Zero-pad hex values when saving config

writeSkinConfig() had a very naughty bug when RGBA values were written
to config file unpadded. This lead to a problem that, for example,
0x00000080 was written as 0x00080 in config file (Somehow gmenu2x
reads and re-saves config on selection). This, in turn, led
to problem when reading skin config file in strtorgba function,
because it parses the color string in token of two symbols
(substr(0,2) and etc).
This commit is contained in:
kyak 2011-06-06 11:38:26 +04:00
parent 7aeb7a4f0a
commit 6646525731

View File

@ -655,9 +655,15 @@ void GMenu2X::writeSkinConfig() {
int i; int i;
for (i = 0; i < NUM_COLORS; ++i) { for (i = 0; i < NUM_COLORS; ++i) {
inf << colorToString((enum color)i) << "=#" << hex << skinConfColors[i].r << hex inf << colorToString((enum color)i) << "=#";
<< skinConfColors[i].g << hex << skinConfColors[i].b << hex inf.width(2); inf.fill('0');
<< skinConfColors[i].a << endl; inf << right << hex << skinConfColors[i].r;
inf.width(2); inf.fill('0');
inf << right << hex << skinConfColors[i].g;
inf.width(2); inf.fill('0');
inf << right << hex << skinConfColors[i].b;
inf.width(2); inf.fill('0');
inf << right << hex << skinConfColors[i].a << endl;
} }
inf.close(); inf.close();