r350 - trunk
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Tue Sep 25 05:51:03 EDT 2007
Author: icculus
Date: 2007-09-25 05:51:03 -0400 (Tue, 25 Sep 2007)
New Revision: 350
Modified:
trunk/archive_tar.c
trunk/archive_zip.c
trunk/buildver.c
trunk/checksum_crc32.c
trunk/gui_www.c
trunk/lua_glue.c
trunk/universal.h
Log:
Patched to compile (but not link!) on Windows with VS.NET 2005.
libfetch isn't ported, everything else builds.
Modified: trunk/archive_tar.c
===================================================================
--- trunk/archive_tar.c 2007-09-25 09:23:44 UTC (rev 349)
+++ trunk/archive_tar.c 2007-09-25 09:51:03 UTC (rev 350)
@@ -129,7 +129,7 @@
if (br > GZIP_READBUFSIZE)
br = GZIP_READBUFSIZE;
- br = origio->read(origio, info->buffer, br);
+ br = origio->read(origio, info->buffer, (uint32) br);
if (br <= 0)
return -1;
@@ -338,7 +338,7 @@
if (br > BZIP2_READBUFSIZE)
br = BZIP2_READBUFSIZE;
- br = origio->read(origio, info->buffer, br);
+ br = origio->read(origio, info->buffer, (uint32) br);
if (br <= 0)
return -1;
@@ -444,7 +444,7 @@
TARinput *input = (TARinput *) io->opaque;
int64 pos = io->tell(io);
if ((pos + bufsize) > input->fsize)
- bufsize = input->fsize - pos;
+ bufsize = (uint32) (input->fsize - pos);
return input->ar->io->read(input->ar->io, buf, bufsize);
} // MojoInput_tar_read
@@ -452,7 +452,7 @@
{
TARinput *input = (TARinput *) io->opaque;
boolean retval = false;
- if (pos < input->fsize)
+ if (pos < ((uint64) input->fsize))
retval = input->ar->io->seek(input->ar->io, input->offset + pos);
return retval;
} // MojoInput_tar_seek
Modified: trunk/archive_zip.c
===================================================================
--- trunk/archive_zip.c 2007-09-25 09:23:44 UTC (rev 349)
+++ trunk/archive_zip.c 2007-09-25 09:51:03 UTC (rev 350)
@@ -79,8 +79,8 @@
PHYSFS_uint32 size, PHYSFS_uint32 count)
{
MojoInput *io = (MojoInput *) opaque;
- uint32 rc = io->read(io, buffer, size * count);
- return rc / size;
+ int64 rc = io->read(io, buffer, size * count);
+ return rc / size; // !!! FIXME: what if rc == -1?
}
static int __PHYSFS_platformSeek(void *opaque, PHYSFS_uint64 pos)
Modified: trunk/buildver.c
===================================================================
--- trunk/buildver.c 2007-09-25 09:23:44 UTC (rev 349)
+++ trunk/buildver.c 2007-09-25 09:51:03 UTC (rev 350)
@@ -28,15 +28,15 @@
#endif
#ifndef __VERSION__
-#define __VERSION__ (Unknown compiler version)
+#define __VERSION__ "(Unknown compiler version)"
#endif
#ifndef __DATE__
-#define __DATE__ (Unknown build date)
+#define __DATE__ "(Unknown build date)"
#endif
#ifndef __TIME__
-#define __TIME__ (Unknown build time)
+#define __TIME__ "(Unknown build time)"
#endif
#ifndef COMPILER
Modified: trunk/checksum_crc32.c
===================================================================
--- trunk/checksum_crc32.c 2007-09-25 09:23:44 UTC (rev 349)
+++ trunk/checksum_crc32.c 2007-09-25 09:51:03 UTC (rev 350)
@@ -12,7 +12,7 @@
{
uint32 crc = (uint32) *_crc;
- int n;
+ uint32 n;
for (n = 0; n < len; n++)
{
uint32 xorval = (uint32) ((crc ^ buf[n]) & 0xFF);
Modified: trunk/gui_www.c
===================================================================
--- trunk/gui_www.c 2007-09-25 09:23:44 UTC (rev 349)
+++ trunk/gui_www.c 2007-09-25 09:51:03 UTC (rev 350)
@@ -25,11 +25,11 @@
// tapdance between things WinSock and BSD Sockets define differently...
#if PLATFORM_WINDOWS
- #define WIN32_LEAN_AND_MEAN
#include <winsock.h>
typedef int socklen_t;
+ #define setprotoent(x) assert(x == 0)
#define sockErrno() WSAGetLastError()
#define wouldBlockError(err) (err == WSAEWOULDBLOCK)
#define intrError(err) (err == WSAEINTR)
@@ -204,7 +204,7 @@
static int strAdd(char **ptr, size_t *len, size_t *alloc, const char *fmt, ...)
{
- int bw = 0;
+ size_t bw = 0;
size_t avail = *alloc - *len;
va_list ap;
va_start(ap, fmt);
@@ -567,7 +567,7 @@
#if ((!defined _NDEBUG) && (!defined NDEBUG))
{
int on = 1;
- setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on));
+ setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char*) &on, sizeof (on));
}
#endif
@@ -978,7 +978,14 @@
char *htmltext = NULL;
char *text = NULL;
size_t len = 0, alloc = 0;
+ int i, rc;
+ const char *buttons[] = { "cancel", "ok" };
+ const char *locButtons[] = {
+ htmlescape(entry->_("Cancel")),
+ htmlescape(entry->_("OK")),
+ };
+
// !!! FIXME: better text.
char *title = entry->xstrdup(entry->_("Media change"));
// !!! FIXME: better text.
@@ -987,12 +994,6 @@
htmltext = htmlescape(text);
free(text);
- int i, rc;
- const char *buttons[] = { "cancel", "ok" };
- const char *locButtons[] = {
- htmlescape(entry->_("Cancel")),
- htmlescape(entry->_("OK")),
- };
assert(STATICARRAYLEN(buttons) == STATICARRAYLEN(locButtons));
rc = doPromptPage(title, htmltext, true, "insertmedia", buttons,
Modified: trunk/lua_glue.c
===================================================================
--- trunk/lua_glue.c 2007-09-25 09:23:44 UTC (rev 349)
+++ trunk/lua_glue.c 2007-09-25 09:51:03 UTC (rev 350)
@@ -834,7 +834,7 @@
lua_newtable(L);
set_string(L, entinfo->filename, "filename");
set_string(L, entinfo->linkdest, "linkdest");
- set_number(L, entinfo->filesize, "filesize");
+ set_number(L, (lua_Number) entinfo->filesize, "filesize");
set_string(L, typestr, "type");
} // else
@@ -1257,7 +1257,7 @@
if (lua_istable(L, 1))
{
- int i;
+ size_t i;
reccount = lua_objlen(L, 1);
recommend = (char **) alloca(reccount * sizeof (char *));
Modified: trunk/universal.h
===================================================================
--- trunk/universal.h 2007-09-25 09:23:44 UTC (rev 349)
+++ trunk/universal.h 2007-09-25 09:51:03 UTC (rev 350)
@@ -20,6 +20,19 @@
#include <assert.h>
#include <time.h> // !!! FIXME: maybe use this in platform layer?
+// Windows system headers conflict with MojoSetup typedefs, so chop out
+// all the massive and unnecessary dependencies that windows.h pulls in...
+#if PLATFORM_WINDOWS
+#define WIN32_LEAN_AND_MEAN 1
+#endif
+
+#if _MSC_VER
+#include <malloc.h> // need this to get alloca() in MSVC.
+// !!! FIXME: temporary solution.
+#define snprintf _snprintf
+#define strcasecmp(x,y) _stricmp(x,y)
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
More information about the mojosetup-commits
mailing list