diff -ur luafilesystem-1.4.2/src/lfs.c luafilesystem-1.4.2-new/src/lfs.c --- luafilesystem-1.4.2/src/lfs.c 2009-02-03 17:05:48.000000000 -0500 +++ luafilesystem-1.4.2-new/src/lfs.c 2009-11-09 23:59:58.875000000 -0500 @@ -95,10 +95,12 @@ #endif #define STAT_FUNC _stati64 #else -#define _O_TEXT 0 -#define _O_BINARY 0 -#define lfs_setmode(L,file,m) ((void)((void)file,m), \ + #ifdef __CYGWIN__ + #define lfs_setmode(L,file,m) ((void)L, setmode(_fileno(file), m)) + #else + #define lfs_setmode(L,file,m) ((void)((void)file,m), \ luaL_error(L, LUA_QL("setmode") " not supported on this platform"), -1) + #endif #define STAT_STRUCT struct stat #define STAT_FUNC stat #define LSTAT_FUNC lstat @@ -205,7 +207,7 @@ return (code != -1); } -#ifdef _WIN32 +#if defined(_WIN32) || defined(__CYGWIN__) static int lfs_g_setmode (lua_State *L, FILE *f, int arg) { static const int mode[] = {_O_TEXT, _O_BINARY}; static const char *const modenames[] = {"text", "binary", NULL}; @@ -495,7 +497,7 @@ buf = NULL; else { utb.actime = (time_t)luaL_optnumber (L, 2, 0); - utb.modtime = (time_t)luaL_optnumber (L, 3, utb.actime); + utb.modtime = (time_t)luaL_optnumber (L, 3, (lua_Number)utb.actime); buf = &utb; } if (utime (file, buf)) { @@ -538,15 +540,15 @@ } /* time of last access */ static void push_st_atime (lua_State *L, STAT_STRUCT *info) { - lua_pushnumber (L, info->st_atime); + lua_pushnumber (L, (lua_Number)info->st_atime); } /* time of last data modification */ static void push_st_mtime (lua_State *L, STAT_STRUCT *info) { - lua_pushnumber (L, info->st_mtime); + lua_pushnumber (L, (lua_Number)info->st_mtime); } /* time of last file status change */ static void push_st_ctime (lua_State *L, STAT_STRUCT *info) { - lua_pushnumber (L, info->st_ctime); + lua_pushnumber (L, (lua_Number)info->st_ctime); } /* file size, in bytes */ static void push_st_size (lua_State *L, STAT_STRUCT *info) { @@ -691,7 +693,7 @@ {NULL, NULL}, }; -int luaopen_lfs (lua_State *L) { +LUAFILESYSTEM_API int luaopen_lfs (lua_State *L) { dir_create_meta (L); luaL_register (L, "lfs", fslib); set_info (L); diff -ur luafilesystem-1.4.2/src/lfs.def luafilesystem-1.4.2-new/src/lfs.def --- luafilesystem-1.4.2/src/lfs.def 2009-02-03 17:05:48.000000000 -0500 +++ luafilesystem-1.4.2-new/src/lfs.def 2009-11-09 23:20:15.718750000 -0500 @@ -1,5 +1,2 @@ -LIBRARY lfs.dll -DESCRIPTION "LuaFileSystem" -VERSION 1.4.2 EXPORTS luaopen_lfs diff -ur luafilesystem-1.4.2/src/lfs.h luafilesystem-1.4.2-new/src/lfs.h --- luafilesystem-1.4.2/src/lfs.h 2008-02-19 15:08:23.000000000 -0500 +++ luafilesystem-1.4.2-new/src/lfs.h 2009-11-09 23:59:52.000000000 -0500 @@ -13,5 +13,8 @@ #define chdir_error strerror(errno) #endif +#ifndef LUAFILESYSTEM_API +#define LUAFILESYSTEM_API extern +#endif -int luaopen_lfs (lua_State *L); +LUAFILESYSTEM int luaopen_lfs (lua_State *L); diff -ur luafilesystem-1.4.2/vc6/lfs.def luafilesystem-1.4.2-new/vc6/lfs.def --- luafilesystem-1.4.2/vc6/lfs.def 2006-03-15 14:27:13.000000000 -0400 +++ luafilesystem-1.4.2-new/vc6/lfs.def 2009-11-09 23:25:45.296875000 -0500 @@ -1,5 +1,2 @@ -LIBRARY lfs.dll -DESCRIPTION "LuaFileSystem" -VERSION 1.2 EXPORTS luaopen_lfs diff -ur luafilesystem-1.4.2/vc6/luafilesystem_dll.dsp luafilesystem-1.4.2-new/vc6/luafilesystem_dll.dsp --- luafilesystem-1.4.2/vc6/luafilesystem_dll.dsp 2006-03-07 14:08:27.000000000 -0500 +++ luafilesystem-1.4.2-new/vc6/luafilesystem_dll.dsp 2009-11-10 00:01:58.859375000 -0500 @@ -42,8 +42,8 @@ # PROP Intermediate_Dir "luafilesystem_dll/Release" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LUAFILESYSTEM_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "../../external-src/lua50/include" /I "../../compat/src" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LUAFILESYSTEM_EXPORTS" /YX /FD /c +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "../../external-src/lua51/include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x416 /d "NDEBUG" @@ -53,7 +53,7 @@ # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 lua50.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"../bin/vc6/lfs.dll" /libpath:"../../external-src/lua50/lib/dll" +# ADD LINK32 lua51.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"../bin/vc6/lfs.dll" /libpath:"../../external-src/lua51/lib/dll" # Begin Special Build Tool SOURCE="$(InputPath)" PostBuild_Cmds=cd ../bin/vc6 zip.exe luafilesystem-1.2-win32.zip lfs.dll @@ -72,8 +72,8 @@ # PROP Intermediate_Dir "luafilesystem_dll/Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LUAFILESYSTEM_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../external-src/lua50/include" /I "../../compat/src" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LUAFILESYSTEM_EXPORTS" /YX /FD /GZ /c +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../external-src/lua51/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /GZ /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x416 /d "_DEBUG" @@ -83,7 +83,7 @@ # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 lua50.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"../bin/vc6/lfsd.dll" /pdbtype:sept /libpath:"../../external-src/lua50/lib/dll" +# ADD LINK32 lua51.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"../bin/vc6/lfsd.dll" /pdbtype:sept /libpath:"../../external-src/lua51/lib/dll" !ENDIF @@ -96,10 +96,6 @@ # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File -SOURCE="..\..\compat\src\compat-5.1.c" -# End Source File -# Begin Source File - SOURCE=..\src\lfs.c # End Source File # Begin Source File @@ -112,10 +108,6 @@ # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File -SOURCE="..\..\compat\src\compat-5.1.h" -# End Source File -# Begin Source File - SOURCE=..\src\lfs.h # End Source File # End Group