Enlightenment CVS committal

Author  : doursse
Project : e17
Module  : proto/evil

Dir     : e17/proto/evil/src/lib


Modified Files:
        Evil.h evil.c 


Log Message:
* src/lib/Evil.h:
declare pid_t, ssize_t and mode_t for vc++ before flock
structure (vc++)
* src/lib/dlfcn/dlfcn.h:
include limits.h for vc++
* src/lib/evil.c: (symlink), (readlink):
use UNICODE instead of checking the OS. Use PATH_MAX instead
of MB_CUR_MAX when needed

===================================================================
RCS file: /cvs/e/e17/proto/evil/src/lib/Evil.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -3 -r1.21 -r1.22
--- Evil.h      3 Jul 2008 09:08:59 -0000       1.21
+++ Evil.h      13 Jul 2008 17:34:53 -0000      1.22
@@ -130,6 +130,14 @@
 #  define F_UNLCK     2
 # endif /* ! F_RDLCK */
 
+#ifdef _MSC_VER
+
+typedef int            pid_t;
+typedef long           ssize_t;
+typedef unsigned short mode_t;
+
+#endif /* _MSC_VER */
+
 /**
  * @struct flock
  * @brief A structure that control the lock of a file descriptor.
@@ -559,10 +567,6 @@
 #endif /* ! __CEGCC__ */
 
 #ifdef _MSC_VER
-
-typedef int            pid_t;
-typedef long           ssize_t;
-typedef unsigned short mode_t;
 
 #define F_OK 0  /* Check for file existence */
 #define X_OK 1  /* MS access() doesn't check for execute permission. */
===================================================================
RCS file: /cvs/e/e17/proto/evil/src/lib/evil.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- evil.c      29 Jun 2008 12:09:48 -0000      1.14
+++ evil.c      13 Jul 2008 17:34:53 -0000      1.15
@@ -162,7 +162,9 @@
 int
 symlink(const char *oldpath, const char *newpath)
 {
+#ifdef UNICODE
    wchar_t        new_path[MB_CUR_MAX];
+#endif /* UNICODE */
    IShellLink    *pISL;
    IShellLink   **shell_link;
    IPersistFile  *pIPF;
@@ -194,10 +196,14 @@
    if (FAILED(pISL->lpVtbl->QueryInterface(pISL, &IID_IPersistFile, (void 
**)persit_file)))
      goto no_queryinterface;
 
-   /* FIXME: is it for cegcc ??? */
+#ifdef UNICODE
    mbstowcs(new_path, newpath, MB_CUR_MAX);
    if (FAILED(pIPF->lpVtbl->Save(pIPF, new_path, FALSE)))
      goto no_save;
+#else
+   if (FAILED(pIPF->lpVtbl->Save(pIPF, newpath, FALSE)))
+     goto no_save;
+#endif /* ! UNICODE */
 
    pIPF->lpVtbl->Release(pIPF);
    pISL->lpVtbl->Release(pISL);
@@ -218,8 +224,10 @@
 ssize_t
 readlink(const char *path, char *buf, size_t bufsiz)
 {
+#ifdef UNICODE
    wchar_t        old_path[MB_CUR_MAX];
-   char           new_path[MB_CUR_MAX];
+#endif /* UNICODE */
+   char           new_path[PATH_MAX];
    IShellLink    *pISL;
    IShellLink   **shell_link;
    IPersistFile  *pIPF;
@@ -244,15 +252,20 @@
                                (void **)persit_file)))
      goto no_instance;
 
+#ifdef UNICODE
    mbstowcs(old_path, path, MB_CUR_MAX);
    if (FAILED(pIPF->lpVtbl->Load(pIPF, old_path, STGM_READWRITE)))
      goto no_load;
+#else
+   if (FAILED(pIPF->lpVtbl->Load(pIPF, path, STGM_READWRITE)))
+     goto no_load;
+#endif /* ! UNICODE */
 
    shell_link = &pISL;
    if (FAILED(pIPF->lpVtbl->QueryInterface(pIPF, &IID_IShellLink, (void 
**)shell_link)))
      goto no_queryinterface;
 
-   if (FAILED(pISL->lpVtbl->GetPath(pISL, new_path, MB_CUR_MAX, NULL, 0)))
+   if (FAILED(pISL->lpVtbl->GetPath(pISL, new_path, PATH_MAX, NULL, 0)))
      goto no_getpath;
 
    length = strlen(new_path);



-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to