Enlightenment CVS committal
Author : doursse
Project : e17
Module : libs/edje
Dir : e17/libs/edje/src/bin
Modified Files:
edje_cc_out.c edje_cc_sources.c
Log Message:
update win32 port : use correct temp dir value and correct open function
according to the compiler
===================================================================
RCS file: /cvs/e/e17/libs/edje/src/bin/edje_cc_out.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -3 -r1.58 -r1.59
--- edje_cc_out.c 15 Sep 2007 08:46:34 -0000 1.58
+++ edje_cc_out.c 25 Nov 2007 16:22:58 -0000 1.59
@@ -3,7 +3,8 @@
*/
#ifdef _WIN32
-# include <windows.h>
+# include <share.h>
+# include <sys/stat.h>
#endif /* _WIN32 */
@@ -590,24 +591,32 @@
cd = l->data;
if ((cd->shared) || (cd->programs))
{
+ char tmpn[4096];
int fd;
#ifdef _WIN32
- int ret;
- char path[4096];
+ char *tmpdir;
#endif /* _WIN32 */
- char tmpn[4096];
#ifdef _WIN32
- ret = GetTempPath(_MAX_PATH, path);
- if ((ret > _MAX_PATH) || (ret == 0))
- fd = -1;
- else
+ tmpdir = getenv("TMP");
+ if (!tmpdir) tmpdir = getenv("TEMP");
+ if (!tmpdir) tmpdir = getenv("USERPROFILE");
+ if (!tmpdir) tmpdir = getenv("WINDIR");
+ if (tmpdir)
{
- if (!GetTempFileName(path, "edj", 0, tmpn))
- fd = -1;
+ snprintf(tmpn, _MAX_PATH, "%s/edje_cc.sma-tmp-XXXXXX",
tmpdir);
+# ifdef __MINGW32__
+ if (_mktemp(tmpn))
+ fd = _sopen(tmpn, _O_RDWR | _O_BINARY | _O_CREAT,
_SH_DENYNO, _S_IREAD | _S_IWRITE);
+# else
+ if (!_mktemp_s(tmpn, _MAX_PATH))
+ _sopen_s(&fd, tmpn, _O_RDWR | _O_BINARY | _O_CREAT,
_SH_DENYNO, _S_IREAD | _S_IWRITE);
+# endif /* __MINGW32__ */
else
- fd = open(tmpn, _O_RDWR | _O_BINARY | _O_CREAT, 0444);
+ fd = -1;
}
+ else
+ fd= -1;
#else
strcpy(tmpn, "/tmp/edje_cc.sma-tmp-XXXXXX");
fd = mkstemp(tmpn);
@@ -693,16 +702,25 @@
}
close(fd);
#ifdef _WIN32
- ret = GetTempPath(_MAX_PATH, path);
- if ((ret > _MAX_PATH) || (ret == 0))
- fd = -1;
- else
+ tmpdir = getenv("TMP");
+ if (!tmpdir) tmpdir = getenv("TEMP");
+ if (!tmpdir) tmpdir = getenv("USERPROFILE");
+ if (!tmpdir) tmpdir = getenv("WINDIR");
+ if (tmpdir)
{
- if (!GetTempFileName(path, "edj", 0, tmpo))
- fd = -1;
+ snprintf(tmpo, _MAX_PATH, "%s/edje_cc.amx-tmp-XXXXXX",
tmpdir);
+# ifdef __MINGW32__
+ if (_mktemp(tmpo))
+ fd = _sopen(tmpo, _O_RDWR | _O_BINARY | _O_CREAT,
_SH_DENYNO, _S_IREAD | _S_IWRITE);
+# else
+ if (!_mktemp_s(tmpo, _MAX_PATH))
+ _sopen_s(&fd, tmpo, _O_RDWR | _O_BINARY | _O_CREAT,
_SH_DENYNO, _S_IREAD | _S_IWRITE);
+# endif /* __MINGW32__ */
else
- fd = open(tmpo, _O_RDWR | _O_BINARY | _O_CREAT, 0444);
+ fd = -1;
}
+ else
+ fd= -1;
#else
strcpy(tmpo, "/tmp/edje_cc.amx-tmp-XXXXXX");
fd = mkstemp(tmpo);
===================================================================
RCS file: /cvs/e/e17/libs/edje/src/bin/edje_cc_sources.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- edje_cc_sources.c 17 Jun 2007 06:51:42 -0000 1.16
+++ edje_cc_sources.c 25 Nov 2007 16:22:58 -0000 1.17
@@ -163,10 +163,10 @@
*slash = '\0';
dir_len = strlen(dir);
}
-
+
l = pp - p + dir_len + 1;
file = mem_alloc(l);
-
+
if (!dir_len)
snprintf(file, l - 1, "%s", p + 1);
else
@@ -174,7 +174,7 @@
fname = strdup(p + 1);
pp = strrchr(fname, end);
- if (pp) *pp = 0;
+ if (pp) *pp = '\0';
forgetit = 1;
}
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs