indent
This commit is contained in:
parent
24b947500f
commit
8faababeb3
44
src/testmains/trfileudi.cpp
Normal file
44
src/testmains/trfileudi.cpp
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/* Copyright (C) 2017-2019 J.F.Dockes
|
||||||
|
*
|
||||||
|
* License: GPL 2.1
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2.1 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this program; if not, write to the
|
||||||
|
* Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "fileudi.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
string path="/usr/lib/toto.cpp";
|
||||||
|
string ipath = "1:2:3:4:5:10";
|
||||||
|
string udi;
|
||||||
|
make_udi(path, ipath, udi);
|
||||||
|
printf("udi [%s]\n", udi.c_str());
|
||||||
|
path = "/some/much/too/looooooooooooooong/path/bla/bla/bla"
|
||||||
|
"/looooooooooooooong/path/bla/bla/bla/llllllllllllllllll"
|
||||||
|
"/looooooooooooooong/path/bla/bla/bla/llllllllllllllllll";
|
||||||
|
ipath = "1:2:3:4:5:10"
|
||||||
|
"1:2:3:4:5:10"
|
||||||
|
"1:2:3:4:5:10";
|
||||||
|
make_udi(path, ipath, udi);
|
||||||
|
printf("udi [%s]\n", udi.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 2005 J.F.Dockes
|
/* Copyright (C) 2005-2020 J.F.Dockes
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
@ -14,7 +14,6 @@
|
|||||||
* Free Software Foundation, Inc.,
|
* Free Software Foundation, Inc.,
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
#ifndef TEST_FILEUDI
|
|
||||||
#include "autoconfig.h"
|
#include "autoconfig.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -69,7 +68,7 @@ void pathHash(const std::string &path, std::string &phash, unsigned int maxlen)
|
|||||||
// longer paths and uniquize them by appending a hashed value. This
|
// longer paths and uniquize them by appending a hashed value. This
|
||||||
// is done to avoid xapian max term length limitations, not
|
// is done to avoid xapian max term length limitations, not
|
||||||
// to gain space (we gain very little even with very short maxlens
|
// to gain space (we gain very little even with very short maxlens
|
||||||
// like 30). The xapian max key length seems to be around 250.
|
// like 30). The xapian max key length is 245.
|
||||||
// The value for PATHHASHLEN includes the length of the hash part.
|
// The value for PATHHASHLEN includes the length of the hash part.
|
||||||
#define PATHHASHLEN 150
|
#define PATHHASHLEN 150
|
||||||
|
|
||||||
@ -84,28 +83,3 @@ void make_udi(const string& fn, const string& ipath, string &udi)
|
|||||||
pathHash(s, udi, PATHHASHLEN);
|
pathHash(s, udi, PATHHASHLEN);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else // TEST_FILEUDI
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string>
|
|
||||||
#include "fileudi.h"
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
string path="/usr/lib/toto.cpp";
|
|
||||||
string ipath = "1:2:3:4:5:10";
|
|
||||||
string udi;
|
|
||||||
make_udi(path, ipath, udi);
|
|
||||||
printf("udi [%s]\n", udi.c_str());
|
|
||||||
path = "/some/much/too/looooooooooooooong/path/bla/bla/bla"
|
|
||||||
"/looooooooooooooong/path/bla/bla/bla/llllllllllllllllll"
|
|
||||||
"/looooooooooooooong/path/bla/bla/bla/llllllllllllllllll";
|
|
||||||
ipath = "1:2:3:4:5:10"
|
|
||||||
"1:2:3:4:5:10"
|
|
||||||
"1:2:3:4:5:10";
|
|
||||||
make_udi(path, ipath, udi);
|
|
||||||
printf("udi [%s]\n", udi.c_str());
|
|
||||||
}
|
|
||||||
#endif // TEST_FILEUDI
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user