Skip to content

Commit

Permalink
Compiler/runtime: inserted changes so that msvc can compile it
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@14931 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Christian SChubert committed Jan 25, 2013
1 parent 68218f6 commit 16f9fb7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
9 changes: 9 additions & 0 deletions Compiler/runtime/System_omc.c
Expand Up @@ -32,6 +32,11 @@
#include <Windows.h>
#endif

#ifdef __cplusplus
extern "C"
{
#endif

#include <ctype.h> /* for toupper */
#include "openmodelica.h"
#include "meta_modelica.h"
Expand Down Expand Up @@ -678,3 +683,7 @@ extern const char* System_snprintff(const char *fmt, int len, double d)
buf[1023] = 0;
return buf;
}

#ifdef __cplusplus
}
#endif
13 changes: 9 additions & 4 deletions Compiler/runtime/systemimpl.c
Expand Up @@ -95,7 +95,12 @@ typedef void* iconv_t;
#define S_IFLNK 0120000 /* symbolic link */

#include <sys/types.h>
#include <dirent.h>
#if defined(_MSC_VER)
#include <win32_dirent.h>
#define PATH_MAX MAX_PATH
#else
#include <dirent.h>
#endif

char *realpath(const char *path, char resolved_path[PATH_MAX]);

Expand Down Expand Up @@ -1892,7 +1897,7 @@ int SystemImpl__intRand(int n)

char* alloc_locale_str(const char *locale, int llen, const char *suffix, int slen)
{
char *loc = malloc(sizeof(char) * (llen + slen + 1));
char *loc = (char*)malloc(sizeof(char) * (llen + slen + 1));
assert(loc != NULL);
strncpy(loc, locale, llen);
strncpy(loc + llen, suffix, slen + 1);
Expand Down Expand Up @@ -2004,7 +2009,7 @@ char *realpath(const char *path, char resolved_path[PATH_MAX])
else
{
//Non standard extension that glibc uses
return_path = malloc(PATH_MAX);
return_path = (char*)malloc(PATH_MAX);
}

if (return_path) //Else EINVAL
Expand All @@ -2020,7 +2025,7 @@ char *realpath(const char *path, char resolved_path[PATH_MAX])
size_t new_size;

free(return_path);
return_path = malloc(size);
return_path = (char*)malloc(size);

if (return_path)
{
Expand Down

0 comments on commit 16f9fb7

Please sign in to comment.