On Tue, 14 Jun 2011, Enlightenment SVN wrote:
> Log: > From: Vincent Torri <vto...@univ-evry.fr> > Subject: [E-devel] Edje: using fdopen instead of fopen in edje_cc > > On windows, using open() followed by fopen() does not work. Hence, in > edje_cc, where mkstemp (which uses open) is followed by fopen, edje_cc > fails. > > Instead of fopen, we can use fdopen. I pasted a patch below. Can you > comment it (like, instead of keeping the filename in the function that > i modified, why not using it for the fd? > > (changes - closefd) removed from data_write_scripts() as fclose() > handles that) i'll check if it's sufficient on Windows. Otherwise, we can do everything in the 2 functions create_script_file() and compile_script_file(), we pass ef and the template (and output for compile). In them, we call mkstemp, fdopen, etc... Vincent > Author: raster > Date: 2011-06-14 00:02:14 -0700 (Tue, 14 Jun 2011) > New Revision: 60299 > Trac: http://trac.enlightenment.org/e/changeset/60299 > > Modified: > trunk/edje/src/bin/edje_cc_out.c > > Modified: trunk/edje/src/bin/edje_cc_out.c > =================================================================== > --- trunk/edje/src/bin/edje_cc_out.c 2011-06-14 05:19:19 UTC (rev 60298) > +++ trunk/edje/src/bin/edje_cc_out.c 2011-06-14 07:02:14 UTC (rev 60299) > @@ -708,9 +708,9 @@ > } > > static void > -create_script_file(Eet_File *ef, const char *filename, const Code *cd) > +create_script_file(Eet_File *ef, const char *filename, const Code *cd, int > fd) > { > - FILE *f = fopen(filename, "wb"); > + FILE *f = fdopen(fd, "wb"); > if (!f) > error_and_abort(ef, "Unable to open temp file \"%s\" for script " > "compilation.\n", filename); > @@ -787,7 +787,7 @@ > > static void > compile_script_file(Eet_File *ef, const char *source, const char *output, > - int script_num) > + int script_num, int fd) > { > FILE *f; > char buf[4096]; > @@ -802,7 +802,7 @@ > if (ret < 0 || ret > 1) > error_and_abort(ef, "Compiling script code not clean.\n"); > > - f = fopen(output, "rb"); > + f = fdopen(fd, "rb"); > if (!f) > error_and_abort(ef, "Unable to open script object \"%s\" for reading.\n", > output); > @@ -864,8 +864,7 @@ > error_and_abort(ef, "Unable to open temp file \"%s\" for script " > "compilation.\n", tmpn); > > - create_script_file(ef, tmpn, cd); > - close(fd); > + create_script_file(ef, tmpn, cd, fd); > > snprintf(tmpo, PATH_MAX, "%s/edje_cc.amx-tmp-XXXXXX", tmp_dir); > fd = mkstemp(tmpo); > @@ -875,10 +874,8 @@ > error_and_abort(ef, "Unable to open temp file \"%s\" for script " > "compilation.\n", tmpn); > } > + compile_script_file(ef, tmpn, tmpo, i, fd); > > - compile_script_file(ef, tmpn, tmpo, i); > - close(fd); > - > unlink(tmpn); > unlink(tmpo); > > > > ------------------------------------------------------------------------------ > EditLive Enterprise is the world's most technically advanced content > authoring tool. Experience the power of Track Changes, Inline Image > Editing and ensure content is compliant with Accessibility Checking. > http://p.sf.net/sfu/ephox-dev2dev > _______________________________________________ > enlightenment-svn mailing list > enlightenment-...@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/enlightenment-svn > > ------------------------------------------------------------------------------ EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel