mirror of
https://github.com/git/git.git
synced 2024-11-27 20:14:30 +08:00
d0f9dbb9e2
In particular, while linking test-svn-fe.exe, the linker complains
that the external symbol _strtoull is unresolved. A call to this
function was added in commit ddcc8c5b
("vcs-svn: skeleton of an svn
delta parser", 25-12-2010).
The NO_STRTOULL build variable attempts to provide support to old
systems which can't even declare 'unsigned long long' variables,
let alone provide the strtoll() or strtoull() functions. Setting
this build variable does not provide an implementation of these
functions. Rather, it simply allows the compat implementations
of strto{i,u}max() to use strtol() and strtoul() instead.
In order to fix the linker error on systems with NO_STRTOULL set,
currently MSVC and OSF1, we can substitute a call to strtoumax().
However, we can easily provide support for the strtoull() and
strtoll() functions on MSVC, since they are essentially already
available as _strtoui64() and _strtoi64(). This allows us to
remove NO_STRTOULL for MSVC.
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Tested-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
53 lines
1.3 KiB
C
53 lines
1.3 KiB
C
/*
|
|
* test-svn-fe: Code to exercise the svn import lib
|
|
*/
|
|
|
|
#include "git-compat-util.h"
|
|
#include "vcs-svn/svndump.h"
|
|
#include "vcs-svn/svndiff.h"
|
|
#include "vcs-svn/sliding_window.h"
|
|
#include "vcs-svn/line_buffer.h"
|
|
|
|
static const char test_svnfe_usage[] =
|
|
"test-svn-fe (<dumpfile> | [-d] <preimage> <delta> <len>)";
|
|
|
|
static int apply_delta(int argc, char *argv[])
|
|
{
|
|
struct line_buffer preimage = LINE_BUFFER_INIT;
|
|
struct line_buffer delta = LINE_BUFFER_INIT;
|
|
struct sliding_view preimage_view = SLIDING_VIEW_INIT(&preimage, -1);
|
|
|
|
if (argc != 5)
|
|
usage(test_svnfe_usage);
|
|
|
|
if (buffer_init(&preimage, argv[2]))
|
|
die_errno("cannot open preimage");
|
|
if (buffer_init(&delta, argv[3]))
|
|
die_errno("cannot open delta");
|
|
if (svndiff0_apply(&delta, (off_t) strtoumax(argv[4], NULL, 0),
|
|
&preimage_view, stdout))
|
|
return 1;
|
|
if (buffer_deinit(&preimage))
|
|
die_errno("cannot close preimage");
|
|
if (buffer_deinit(&delta))
|
|
die_errno("cannot close delta");
|
|
strbuf_release(&preimage_view.buf);
|
|
return 0;
|
|
}
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
if (argc == 2) {
|
|
if (svndump_init(argv[1]))
|
|
return 1;
|
|
svndump_read(NULL, "refs/heads/master", "refs/notes/svn/revs");
|
|
svndump_deinit();
|
|
svndump_reset();
|
|
return 0;
|
|
}
|
|
|
|
if (argc >= 2 && !strcmp(argv[1], "-d"))
|
|
return apply_delta(argc, argv);
|
|
usage(test_svnfe_usage);
|
|
}
|