On Sun, 10 Jan 2010 14:56:25 -0200 Gustavo Sverzut Barbieri <barbi...@profusion.mobi> said:
> On 1/10/10, Enlightenment SVN <no-re...@enlightenment.org> wrote: > > + data = eet_read(ef, "config", &data_len); > > + if ((data) && (data_len > 0)) > > + { > > + int ok = 1; > > + > > + for (s = data; s < (data + data_len); s++) > > + { > > + // if profile is not all ascii (valid printable ascii - no > > + // control codes etc.) or it contains a '/' (invalid as its a > > + // directory delimiter) - then it's invalid > > + if ((*s < ' ') || (*s > '~') || (*s == '/')) > > i'd strip trailing \n as peplope usint eet + echo and forget to omit > trailing newline will suffer that'd make it invalid. thus - it'd go to fallback mode. (until it hit system config). > > + { > > + ok = 0; > > + break; > > s = NULL? yeah. oops. forgot. > > + } > > + } > > + if (ok) > > + { > > + s = malloc(data_len + 1); > > + if (s) > > + { > > + memcpy(s, data, data_len); > > + s[data_len] = 0; > > + } > > + } > > or: else s = NULL > > > > + free(data); > > + } > > + return s; > > +} > > + > > /* externally accessible functions */ > > EAPI int > > e_config_init(void) > > @@ -68,7 +105,13 @@ > > /* try user profile config */ > > e_user_dir_concat_static(buf, "config/profile.cfg"); > > ef = eet_open(buf, EET_FILE_MODE_READ); > > - if (!ef) > > + if (ef) > > + { > > + _e_config_profile = _e_config_profile_name_get(ef); > > + eet_close(ef); > > + ef = NULL; > > + } > > + if (!_e_config_profile) > > { > > int i; > > > > @@ -76,36 +119,29 @@ > > { > > e_user_dir_snprintf(buf, sizeof(buf), > > "config/profile.%i.cfg", i); > > ef = eet_open(buf, EET_FILE_MODE_READ); > > - if (ef) break; > > + if (ef) > > + { > > + _e_config_profile = _e_config_profile_name_get(ef); > > + eet_close(ef); > > + ef = NULL; > > + if (_e_config_profile) break; > > + } > > } > > - if (!ef) > > + if (!_e_config_profile) > > { > > /* use system if no user profile config */ > > e_prefix_data_concat_static(buf, > > "data/config/profile.cfg"); > > ef = eet_open(buf, EET_FILE_MODE_READ); > > } > > } > > - if (ef) > > + if (ef) > > + { > > + _e_config_profile = _e_config_profile_name_get(ef); > > + eet_close(ef); > > + ef = NULL; > > + } > > + if (!_e_config_profile) > > { > > - /* profile config exists */ > > - char *data; > > - int data_len = 0; > > - > > - data = eet_read(ef, "config", &data_len); > > - if ((data) && (data_len > 0)) > > - { > > - _e_config_profile = malloc(data_len + 1); > > - if (_e_config_profile) > > - { > > - memcpy(_e_config_profile, data, data_len); > > - _e_config_profile[data_len] = 0; > > - } > > - free(data); > > - } > > - eet_close(ef); > > - } > > - else > > - { > > /* no profile config - try other means */ > > char *link = NULL; > > > > @@ -1438,7 +1474,7 @@ > > ret = ecore_file_mv(buf2, buf); > > if (!ret) > > { > > - printf("*** Error saving profile. ***"); > > + printf("*** Error saving config. ***"); > > } > > } > > ecore_file_unlink(buf2); > > > > Modified: trunk/e/x-ui.sh > > =================================================================== > > --- trunk/e/x-ui.sh 2010-01-10 06:24:30 UTC (rev 45013) > > +++ trunk/e/x-ui.sh 2010-01-10 16:25:26 UTC (rev 45014) > > @@ -6,12 +6,13 @@ > > #Xephyr :1 -noreset -ac -br -dpi 186 -screen 480x272x16 & > > #Xephyr :1 -noreset -ac -br -dpi 181 -screen 320x320x16 & > > #Xephyr :1 -noreset -ac -br -dpi 183 -screen 320x480x16 -host-cursor & > > -Xephyr :1 -noreset -ac -br -dpi 183 -screen 480x320x16 -host-cursor & > > +#Xephyr :1 -noreset -ac -br -dpi 183 -screen 480x320x16 -host-cursor & > > #Xephyr :1 -noreset -ac -br -dpi 183 -screen 480x800x16 & > > #Xephyr :1 -noreset -ac -br -dpi 183 -screen 800x480x16 & > > #Xephyr :1 -noreset -ac -br -dpi 284 -screen 480x640x16 & > > #Xephyr :1 -noreset -ac -br -dpi 284 -screen 640x480x16 -host-cursor & > > > > +Xephyr :1 -noreset -ac -br -dpi 284 -screen 480x800 -host-cursor & > > #Xephyr :1 -noreset -ac -br -dpi 284 -screen 480x640 & > > #Xephyr :1 -noreset -ac -br -dpi 284 -screen 640x480 & > > #Xephyr :1 -noreset -ac -br -dpi 181 -screen 320x320 & > > > > > > ------------------------------------------------------------------------------ > > This SF.Net email is sponsored by the Verizon Developer Community > > Take advantage of Verizon's best-in-class app development support > > A streamlined, 14 day to market process makes app distribution fast and easy > > Join now and get one step closer to millions of Verizon customers > > http://p.sf.net/sfu/verizon-dev2dev > > _______________________________________________ > > enlightenment-svn mailing list > > enlightenment-...@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/enlightenment-svn > > > > > -- > Gustavo Sverzut Barbieri > http://profusion.mobi embedded systems > -------------------------------------- > MSN: barbi...@gmail.com > Skype: gsbarbieri > Mobile: +55 (19) 9225-2202 > > ------------------------------------------------------------------------------ > This SF.Net email is sponsored by the Verizon Developer Community > Take advantage of Verizon's best-in-class app development support > A streamlined, 14 day to market process makes app distribution fast and easy > Join now and get one step closer to millions of Verizon customers > http://p.sf.net/sfu/verizon-dev2dev > _______________________________________________ > enlightenment-devel mailing list > enlightenment-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel > -- ------------- Codito, ergo sum - "I code, therefore I am" -------------- The Rasterman (Carsten Haitzler) ras...@rasterman.com ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel