{"thread":{"id":"32801","subject":"[PATCH 4/5] msvc: test-svn-fe: Fix linker \"unresolved external\" error","startedAt":"2013-01-31T18:32:55Z","lastAt":"2013-01-31T18:32:55Z","messageCount":1,"participants":["Ramsay Jones"],"isPatch":true,"patchVersion":1,"patchTotal":5},"messages":[{"id":"208386","messageId":"510AB8D7.5000706@ramsay1.demon.co.uk","threadId":"32801","inReplyTo":null,"subject":"[PATCH 4/5] msvc: test-svn-fe: Fix linker \"unresolved external\" error","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2013-01-31T18:32:55Z","receivedAt":"2013-01-31T18:32:55Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"In particular, while linking test-svn-fe.exe, the linker complains\nthat the external symbol _strtoull is unresolved. A call to this\nfunction was added in commit ddcc8c5b (\"vcs-svn: skeleton of an svn\ndelta parser\", 25-12-2010).\n\nThe NO_STRTOULL build variable attempts to provide support to old\nsystems which can't even declare 'unsigned long long' variables,\nlet alone provide the strtoll() or strtoull() functions. Setting\nthis build variable does not provide an implementation of these\nfunctions. Rather, it simply allows the compat implementations\nof strto{i,u}max() to use strtol() and strtoul() instead.\n\nIn order to fix the linker error on systems with NO_STRTOULL set,\ncurrently MSVC and OSF1, we can substitute a call to strtoumax().\n\nHowever, we can easily provide support for the strtoull() and\nstrtoll() functions on MSVC, since they are essentially already\navailable as _strtoui64() and _strtoi64(). This allows us to\nremove NO_STRTOULL for MSVC.\n\nSigned-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\n---\n compat/msvc.h    | 2 ++\n config.mak.uname | 1 -\n test-svn-fe.c    | 2 +-\n 3 files changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/compat/msvc.h b/compat/msvc.h\nindex aa4b563..96b6d60 100644\n--- a/compat/msvc.h\n+++ b/compat/msvc.h\n@@ -12,6 +12,8 @@\n #define __attribute__(x)\n #define strncasecmp  _strnicmp\n #define ftruncate    _chsize\n+#define strtoull     _strtoui64\n+#define strtoll      _strtoi64\n \n static __inline int strcasecmp (const char *s1, const char *s2)\n {\ndiff --git a/config.mak.uname b/config.mak.uname\nindex 7e52f3c..bfb8a39 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -327,7 +327,6 @@ ifeq ($(uname_S),Windows)\n \t# NEEDS_LIBICONV = YesPlease\n \tNO_ICONV = YesPlease\n \tNO_STRTOUMAX = YesPlease\n-\tNO_STRTOULL = YesPlease\n \tNO_MKDTEMP = YesPlease\n \tNO_MKSTEMPS = YesPlease\n \tSNPRINTF_RETURNS_BOGUS = YesPlease\ndiff --git a/test-svn-fe.c b/test-svn-fe.c\nindex 0f2d9a4..120ec96 100644\n--- a/test-svn-fe.c\n+++ b/test-svn-fe.c\n@@ -24,7 +24,7 @@ static int apply_delta(int argc, char *argv[])\n \t\tdie_errno(\"cannot open preimage\");\n \tif (buffer_init(&delta, argv[3]))\n \t\tdie_errno(\"cannot open delta\");\n-\tif (svndiff0_apply(&delta, (off_t) strtoull(argv[4], NULL, 0),\n+\tif (svndiff0_apply(&delta, (off_t) strtoumax(argv[4], NULL, 0),\n \t\t\t\t\t&preimage_view, stdout))\n \t\treturn 1;\n \tif (buffer_deinit(&preimage))\n-- \n1.8.1\n"}]}