Skip to content

Commit

Permalink
Windows fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Feb 2, 2008
1 parent a196f3d commit 38b25e1
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 12 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Expand Up @@ -59,6 +59,7 @@ IF(WINDOWS)
ADD_DEFINITIONS(-DPLATFORM_WINDOWS=1)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS=1)
SET(USES_WINMAIN WIN32)
SET(OPTIONAL_LIBS ${OPTIONAL_LIBS} shell32)
ENDIF(WINDOWS)

IF(MACOSX)
Expand Down
2 changes: 1 addition & 1 deletion fileio.c
Expand Up @@ -149,7 +149,7 @@ boolean MojoInput_toPhysicalFile(MojoInput *in, const char *fname, uint16 perms,
MojoPlatform_sleep(100);
else
{
br = in->read(in, scratchbuf_128k, maxread);
br = in->read(in, scratchbuf_128k, (uint32) maxread);
if (br == 0) // we're done!
break;
else if (br < 0)
Expand Down
7 changes: 7 additions & 0 deletions gui.h
Expand Up @@ -115,6 +115,13 @@ const MojoGui *MojoGui_initGuiPlugin(void);
void MojoGui_deinitGuiPlugin(void);
#else

// can't use normal STUBBED in gui plugins, since it references logDebug
// without entry-> ...
#ifndef DOXYGEN_SHOULD_IGNORE_THIS
#undef STUBBED
#define STUBBED(x) STUBBED2(entry->,x)
#endif

__EXPORT__ const MojoGui *MOJOGUI_ENTRY_POINT(int revision,
const MojoSetupEntryPoints *e);

Expand Down
1 change: 1 addition & 0 deletions gui_www.c
Expand Up @@ -43,6 +43,7 @@ CREATE_MOJOGUI_ENTRY_POINT(www)
static const char *sockStrErrVal(int val)
{
STUBBED("Windows strerror");
return "sockStrErrVal() is unimplemented.";
} // sockStrErrVal


Expand Down
6 changes: 3 additions & 3 deletions lua_glue.c
Expand Up @@ -1567,9 +1567,9 @@ boolean MojoLua_initLua(void)
char *locale = (envr != NULL) ? xstrdup(envr) : MojoPlatform_locale();
char *ostype = MojoPlatform_osType();
char *osversion = MojoPlatform_osVersion();
lua_Integer uid = MojoPlatform_getuid();
lua_Integer euid = MojoPlatform_geteuid();
lua_Integer gid = MojoPlatform_getgid();
lua_Integer uid = (lua_Integer) MojoPlatform_getuid();
lua_Integer euid = (lua_Integer) MojoPlatform_geteuid();
lua_Integer gid = (lua_Integer) MojoPlatform_getgid();

#if DISABLE_LUA_PARSER
const boolean luaparser = false;
Expand Down
2 changes: 1 addition & 1 deletion mojosetup.c
Expand Up @@ -675,7 +675,7 @@ char *xstrdup(const char *str)
#if MOJOSETUP_INTERNAL_BZLIB && BZ_NO_STDIO
void bz_internal_error(int errcode)
{
fatal(_("bzlib triggered an internal error: %0"), numstr(numbuf));
fatal(_("bzlib triggered an internal error: %0"), numstr(errcode));
} // bz_internal_error
#endif

Expand Down
10 changes: 6 additions & 4 deletions platform_windows.c
Expand Up @@ -20,7 +20,9 @@
#undef UNICODE
#endif

#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
#include <shellapi.h>

// is Win95/Win98/WinME? (no Unicode, etc)
static boolean osIsWin9x = false;
Expand Down Expand Up @@ -640,7 +642,7 @@ boolean MojoPlatform_launchBrowser(const char *url)
// msdn says:
// "Returns a value greater than 32 if successful, or an error value that
// is less than or equal to 32 otherwise."
return (ShellExecuteA(NULL, "open", url, NULL, NULL, SW_SHOWNORMAL) > 32);
return (((int) ShellExecuteA(NULL, "open", url, NULL, NULL, SW_SHOWNORMAL)) > 32);
} // MojoPlatform_launchBrowser


Expand Down Expand Up @@ -968,9 +970,9 @@ char *MojoPlatform_osType(void)
char *MojoPlatform_osVersion(void)
{
return format("%0.%1.%2",
numStr(osMajorVer),
numStr(osMinorVer),
numStr(osBuildVer));
numstr(osMajorVer),
numstr(osMinorVer),
numstr(osBuildVer));
} // MojoPlatform_osversion


Expand Down
7 changes: 4 additions & 3 deletions universal.h
Expand Up @@ -365,16 +365,17 @@ extern MojoSetupEntryPoints GEntryPoints;
#define DEFINE_TO_STR(x) DEFINE_TO_STR2(x)

#ifndef DOXYGEN_SHOULD_IGNORE_THIS
#define STUBBED(x) \
#define STUBBED2(prelog, x) \
do { \
static boolean seen_this = false; \
if (!seen_this) \
{ \
seen_this = true; \
logDebug("STUBBED: %0 at %1 (%2:%3)\n", x, __FUNCTION__, \
__FILE__, DEFINE_TO_STR(__LINE__)); \
prelog logDebug("STUBBED: %0 at %1 (%2:%3)\n", x, __FUNCTION__, \
__FILE__, DEFINE_TO_STR(__LINE__)); \
} \
} while (false)
#define STUBBED(x) STUBBED2(,x)
#endif

#define STATICARRAYLEN(x) ( (sizeof ((x))) / (sizeof ((x)[0])) )
Expand Down

0 comments on commit 38b25e1

Please sign in to comment.