[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-dev] Win32/MSVC: tinytest.c problems
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
_______________________________________________
tor-dev mailing list
tor-dev@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev