summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpixel <pixel>2003-12-26 23:51:33 +0000
committerpixel <pixel>2003-12-26 23:51:33 +0000
commit57226a57eef49204d3ca0e8b6f1dd3703e7fcf21 (patch)
treed41fd55cc758832da8fc08b2b8cab6c7e3087f20
parent12518c6705354b52a1175645ecebe5025e62beff (diff)
Fixing more bugs, and added #defines to remove the bad hFile from hell...
-rw-r--r--lib/BLua.cc10
-rw-r--r--lib/Handle.cc4
-rw-r--r--lib/Input.cc15
-rw-r--r--lib/Output.cc7
4 files changed, 22 insertions, 14 deletions
diff --git a/lib/BLua.cc b/lib/BLua.cc
index a81b688..1166915 100644
--- a/lib/BLua.cc
+++ b/lib/BLua.cc
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: BLua.cc,v 1.16 2003-12-26 21:23:35 pixel Exp $ */
+/* $Id: BLua.cc,v 1.17 2003-12-26 23:51:33 pixel Exp $ */
#include <lualib.h>
@@ -574,15 +574,13 @@ int LuaStatics::collector(lua_State * _L) {
Lua * L = Lua::find(_L);
void ** u = (void **) L->touserdata();
bool * obj = (bool *) (u + 1);
- printm(M_INFO, "From LUA: collecting object\n");
+// printm(M_INFO, "From LUA: collecting object\n");
if (*obj) {
- printm(M_INFO, "Is object at %p\n", *u);
+// printm(M_INFO, "Is object at %p\n", *u);
Base * b = (Base *) *u;
- const type_info & t = typeid(*b);
- printm(M_INFO, "Type: " + String(t.name()) + "\n");
delete b;
} else {
- printm(M_INFO, "Is struct at %p\n", *u);
+// printm(M_INFO, "Is struct at %p\n", *u);
free(*u);
}
*u = 0;
diff --git a/lib/Handle.cc b/lib/Handle.cc
index 1696a3e..6fa4e54 100644
--- a/lib/Handle.cc
+++ b/lib/Handle.cc
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: Handle.cc,v 1.65 2003-12-11 16:53:28 pixel Exp $ */
+/* $Id: Handle.cc,v 1.66 2003-12-26 23:51:33 pixel Exp $ */
#include <stdio.h>
#include <string.h>
@@ -278,7 +278,7 @@ void Handle::close() throw (GeneralException) {
}
}
}
-#ifdef _WIN32
+#if defined (_WIN32) && !defined (NO_HFILE)
if (hFile) {
CloseHandle(hFile);
hFile = 0;
diff --git a/lib/Input.cc b/lib/Input.cc
index 417ddab..c12c609 100644
--- a/lib/Input.cc
+++ b/lib/Input.cc
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: Input.cc,v 1.39 2003-12-14 21:13:33 pixel Exp $ */
+/* $Id: Input.cc,v 1.40 2003-12-26 23:51:33 pixel Exp $ */
#include <stdio.h>
#include <string.h>
@@ -183,16 +183,21 @@ int Input::wrapopen(const String & fname, openresults_t * results) {
#ifdef DEBUG
printm(M_BARE, _("Trying to open the file in archive, since it seems to be here\n"));
#endif
-#ifdef _WIN32
-// hFile = t->GetHandle()->GetHFile();
hFile = 0;
+#if defined (_WIN32) && !defined (NO_HFILE)
+// hFile = t->GetHandle()->GetHFile();
#endif
return t->open(fname, results);
}
}
results->name = "";
-#ifndef _WIN32
- return open(fname.to_charp(), O_RDONLY);
+ hFile = 0;
+#if !defined (_WIN32) || defined (NO_HFILE)
+ return open(fname.to_charp(), O_RDONLY
+#ifdef _WIN32
+ | O_BINARY
+#endif
+ );
#else
hFile = CreateFile(fname.to_charp(), GENERIC_READ, FILE_SHARE_WRITE | FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
return _open_osfhandle((INT_PTR) hFile, O_RDONLY | O_BINARY);
diff --git a/lib/Output.cc b/lib/Output.cc
index e8b7680..ed3e852 100644
--- a/lib/Output.cc
+++ b/lib/Output.cc
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: Output.cc,v 1.19 2003-12-04 04:09:02 pixel Exp $ */
+/* $Id: Output.cc,v 1.20 2003-12-26 23:51:33 pixel Exp $ */
#include <stdio.h>
#include <string.h>
@@ -59,10 +59,14 @@ Output::Output(String no, int create, int trunc) throw (GeneralException) :
}
int Output::wrapopen(const String & n, int create, int trunc) {
+ hFile = 0;
#ifndef _WIN32
return open(n.to_charp(), (create ? O_CREAT : 0) |
(trunc ? O_TRUNC : 0) | O_WRONLY, 00666);
#else
+#ifdef NO_HFILE
+ return _creat(n.to_charp(), _S_IREAD | _S_IWRITE);
+#else
DWORD dwCreationDisposition;
switch ((create ? 1 : 0) | (trunc ? 2 : 0)) {
case 0: // no creation, no trunc
@@ -88,6 +92,7 @@ int Output::wrapopen(const String & n, int create, int trunc) {
0);
return _open_osfhandle((INT_PTR) hFile, O_WRONLY | O_BINARY);
#endif
+#endif
}
Output::Output(const Output & o) : Handle(o), n(o.n) {