There are 2 problems with the use of 'stricmp()' (line 295) in tinytest.c.
1. As it is now, I'm getting an undefined reference to 'stricmp' when linking tinytest.exe and using '-nodefault:oldnames' in the link-flags. Can we please remove this lib from the requirements?
2. 'stricmp()' is used nowhere else in Tor. But rather 'strcasecmp()'. Can we use that for consistency instead? Need to include "or.h" to include src/compat.h.
Like the lines from src/compat.h says: /* Windows names string functions differently from most other platforms. */ #define strncasecmp _strnicmp #define strcasecmp _stricmp
How about this little patch:
--- ....\Git-latest\src\test\tinytest.c Wed Mar 21 10:16:58 2012 +++ tinytest.c Fri May 04 14:07:55 2012 @@ -22,6 +22,9 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + +#include "or.h" + #ifdef TINYTEST_LOCAL #include "tinytest_local.h" #endif @@ -292,7 +295,7 @@ #ifdef _WIN32 const char *sp = strrchr(v[0], '.'); const char *extension = ""; - if (!sp || stricmp(sp, ".exe")) + if (!sp || strcasecmp(sp, ".exe")) extension = ".exe"; /* Add an exe so CreateProcess will work */ snprintf(commandname, sizeof(commandname), "%s%s", v[0], extension); commandname[MAX_PATH]='\0';
-----------------
There are more MSVC-issues in other test/*.c files. I can get back to that.
--gv
On May 5, 2012, at 3:30 PM, Gisle Vanem wrote:
There are 2 problems with the use of 'stricmp()' (line 295) in tinytest.c.
As it is now, I'm getting an undefined reference to 'stricmp' when linking tinytest.exe and using '-nodefault:oldnames' in the link-flags. Can we please remove this lib from the requirements?
'stricmp()' is used nowhere else in Tor. But rather 'strcasecmp()'.
Can we use that for consistency instead? Need to include "or.h" to include src/compat.h.
Like the lines from src/compat.h says: /* Windows names string functions differently from most other platforms. */ #define strncasecmp _strnicmp #define strcasecmp _stricmp
How about this little patch:
Tinytest is supposed to be an independent library, so including a tor-specific header file doesn't work here.
There are more MSVC-issues in other test/*.c files. I can get back to that.
Please do, thanks.
"Sebastian Hahn" hahn.seb@web.de wrote:
Tinytest is supposed to be an independent library, so including a tor-specific header file doesn't work here.
Ok, I didn't know. But my patch to tinytest.c doesn't require any functions from the Tor libs. (as test*.c does).
There are more MSVC-issues in other test/*.c files. I can get back to that.
Please do, thanks.
I'll do when I have the time later next week.
--gv