In this page I have reported all changes that I have made to official SVN build 155 to pass compilation with Microsoft Visual C++ 2005 Express Edition
Compare this with official SVN build 155.
Use this as an hint.
After these modification are remained only warning about conversion from small types to bigger types. It's possible eliminate also this warnings adding 'casting' instructions.
Added definition for chdir
#ifndef _MSC_VER #include <unistd.h> /* chdir */ #else #include <direct.h> /* chdir */ #define chdir _chdir /* prevent warning about deprecation of chdir */ #endif
Added Cast operation (Uint32)
case TRANSITION_RUNNING: if (thisRedrawTime - transitionStartTime
Since Microsoft VC++ doesn't permit variables definition in the middle of a block {} (Strange..), I have moved variables definition at the beginning of block {} and removed definitions inside the block {}
static void vrotate(float vector[], int axis, float angle) { int ai,bi; float s,c,a,b; if (angle == 0.0f) return; ai = (axis+1)%3; bi = (axis+2)%3; s = sinf(angle); c = cosf(angle); a = vector[ai]; b = vector[bi]; vector[ai] = c*a - s*b; vector[bi] = s*a + c*b; }
Moved variables definition at the beginning of block {}
Removed definitions inside the block {}
static SDL_bool isInside(CNode *node, int x, int y) { int ix, iy; float h, v;
Added definition for snprintf
#ifdef _MSC_VER #define snprintf _snprintf /* because snprintf is deprecated */ #endif
Moved variables definition at the beginning of block {}
Removed definitions inside the block {}
void openFile(const char *project, const char *path) { char fullpath[1024]; int res;
Excluded checkinstanceof() that cause infinite loop...(what it serves checkinstanceof?)
static int internalPretendnodeLua(lua_State *L) { CNode *node; #ifndef _MSC_VER checkinstanceof(L, 1, "pipmak-node", "node"); #endif
Moved variables definition at the beginning of block {}
Removed definitions inside the block {}
static int internalNewprojectLua(lua_State *L) { char *path; if (screen->flags & SDL_FULLSCREEN) setwindowedLua(L); SDL_WM_GrabInput(SDL_GRAB_OFF); SDL_ShowCursor(SDL_ENABLE); path = newProjectPath();
Excluded checkinstanceof() that cause infinite loop
static int nodeCloseoverlayLua(lua_State *L) { CNode *node; #ifndef _MSC_VER checkinstanceof(L, 1, "pipmak-node", "node"); #endif
Excluded checkinstanceof() that cause infinite loop
static int nodeMessageLua(lua_State *L) { CNode *oldCNode = thisCNode; #ifndef _MSC_VER checkinstanceof(L, 1, "pipmak-node", "node"); #endif
Excluded checkinstanceof() that cause infinite loop
static int nodeSetstandardcursorLua(lua_State * L) { CNode *node; #ifndef _MSC_VER checkinstanceof(L, 1, "pipmak-node", "node"); #endif
Moved variables definition at the beginning of block {}
if (start != end) { Uint16 *c = start; Uint8 *a = advstart; /*delete selection*/ focusedTextEditor->length -= (end-start); while (1) {
Moved variables definition at the beginning of block {}
Removed definitions inside the block {}
static int texteditorTextLua(lua_State *L) { char *s; TextEditor *te = (TextEditor*)luaL_checkudata(L, 1, "pipmak-texteditor"); if (te == NULL || te->text == NULL) luaL_typerror(L, 1, "texteditor"); s = SDL_iconv_string("UTF-8", "UCS-2", (char*)(te->text), (te->length+1)*2);
Moved variables definition at the beginning of block {}
Removed definitions inside the block {}
static int texteditorPasteLua(lua_State *L) { TextEditor *te = (TextEditor*)luaL_checkudata(L, 1, "pipmak-texteditor"); Uint16 *start, *end; Uint8 *advstart, *advend; SDL_iconv_t cd; int selectionLength,tailLength,freeLength,pastedLength; const char *utf8text; char *ucs2out; size_t inbytesleft,outbytesleft; int width, prevWidth,i; Uint16 savedChar,*mstart; if (te == NULL || te->text == NULL) luaL_typerror(L, 1, "texteditor"); cd = SDL_iconv_open("UCS-2", "UTF-8"); if (cd == (SDL_iconv_t)-1) luaL_error(L, "UTF-8 to UCS-2 conversion failed"); /*divide the buffer into these parts: head, selection, tail (including terminating zero), free*/ selectionLength = te->selectionAnchor - te->selectionHead; if (selectionLength >= 0) { start = te->text + te->selectionHead; end = te->text + te->selectionAnchor; advstart = te->advance + te->selectionHead; advend = te->advance + te->selectionAnchor; } else { selectionLength = -selectionLength; start = te->text + te->selectionAnchor; end = te->text + te->selectionHead; advstart = te->advance + te->selectionAnchor; advend = te->advance + te->selectionHead; } tailLength = te->text + te->length + 1 - end; freeLength = te->maxlength - te->length; /*move the tail out of the way to the end of the buffer*/ if (freeLength != 0) { SDL_memmove(end + freeLength, end, 2*tailLength); SDL_memmove(advend + freeLength, advend, tailLength); } /*convert the text into where the selection was*/ utf8text = luaL_checkstring(L, 2); ucs2out = (char*)start; inbytesleft = lua_strlen(L, 2); outbytesleft = 2*(selectionLength + freeLength); SDL_iconv(cd, (char**)&utf8text, &inbytesleft, &ucs2out, &outbytesleft); /*why is inbuf not const??*/ pastedLength = (Uint16*)ucs2out - start; SDL_iconv_close(cd); /*move the tail back*/ if (pastedLength != selectionLength + freeLength) { SDL_memmove(ucs2out, end + freeLength, 2*tailLength); SDL_memmove(advstart + pastedLength, advend + freeLength, tailLength); } /*measure the advance widths of the pasted text (plus one character, due to kerning)*/ mstart = (start == te->text) ? start : start-1; savedChar = start[0]; start[0] = 0; TTF_SizeUNICODE(verafont, mstart, &prevWidth, NULL); start[0] = savedChar; for (i = 0; i