From 232c49924796e544f74ac816bb025892dc36c5bd Mon Sep 17 00:00:00 2001 From: skidau Date: Tue, 14 Apr 2015 11:29:23 +0000 Subject: [PATCH] Linux build fix --- src/gba/BreakpointStructures.cpp | 10 +++++++--- src/gba/debugger-expr-lex.cpp | 6 +++++- src/gba/remote.cpp | 3 ++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/gba/BreakpointStructures.cpp b/src/gba/BreakpointStructures.cpp index 1bcc62d9..55a92096 100644 --- a/src/gba/BreakpointStructures.cpp +++ b/src/gba/BreakpointStructures.cpp @@ -103,6 +103,10 @@ sw, sword, s32, int --> signed word #include "BreakpointStructures.h" #include "remote.h" +#if (defined __WIN32__ || defined _WIN32) +#define strdup _strdup +#endif + extern bool dexp_eval(char *, u32*); //struct intToString{ @@ -624,7 +628,7 @@ void parseAndCreateConditionalBreaks(u32 address, u8 flags, char** exp, int n){ }else{ now->exp_type_flags |= 6; //assume signed word } - now->address = _strdup(exp[i]); + now->address = strdup(exp[i]); i++; if(i >= n) goto fail; char* operandName = exp[i]; @@ -639,7 +643,7 @@ void parseAndCreateConditionalBreaks(u32 address, u8 flags, char** exp, int n){ }else{ now->exp_type_flags |= 0x60; //assume signed word } - now->value = _strdup(exp[i]); + now->value = strdup(exp[i]); i++; u32 val; if(!dexp_eval(now->value, &val) || !dexp_eval(now->address, &val)){ @@ -677,7 +681,7 @@ void parseAndCreateConditionalBreaks(u32 address, u8 flags, char** exp, int n){ u8 parseExpressionType(char* given_type){ u8 flags = 0; //for such a small string, pays off to convert first - char* type = _strdup(given_type); + char* type = strdup(given_type); for(int i = 0; type[i] != '\0'; i++){ type[i] = toupper(type[i]); } diff --git a/src/gba/debugger-expr-lex.cpp b/src/gba/debugger-expr-lex.cpp index d7abce0a..d9ec84bb 100644 --- a/src/gba/debugger-expr-lex.cpp +++ b/src/gba/debugger-expr-lex.cpp @@ -41,6 +41,10 @@ #include #include +#if (defined __WIN32__ || defined _WIN32) +#define fileno _fileno +#endif + /* end standard C headers. */ /* flex integer type definitions */ @@ -1538,7 +1542,7 @@ extern int isatty (int ); b->yy_bs_column = 0; } - b->yy_is_interactive = file ? (isatty( _fileno(file) ) > 0) : 0; + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; errno = oerrno; } diff --git a/src/gba/remote.cpp b/src/gba/remote.cpp index 47d6dde3..44f74dba 100644 --- a/src/gba/remote.cpp +++ b/src/gba/remote.cpp @@ -27,6 +27,7 @@ # define close closesocket # define read _read # define write _write +#define strdup _strdup #endif // _WIN32 #include "remote.h" @@ -2077,7 +2078,7 @@ void executeBreakCommands(int n, char** cmd){ command = breakSymbolCombo(command, &len); changed = (len == 5); }if (!changed){ - command = _strdup(replaceAlias(cmd[0], breakAliasTable)); + command = strdup(replaceAlias(cmd[0], breakAliasTable)); changed = (strcmp(cmd[0], command)); } if (!changed){