Fixed path/path compilation.
This commit is contained in:
parent
1535273259
commit
cd09930077
2 changed files with 13 additions and 3 deletions
8
Makefile
8
Makefile
|
@ -20,6 +20,10 @@ all:
|
||||||
cd unixfs; make all;
|
cd unixfs; make all;
|
||||||
cd main; make all;
|
cd main; make all;
|
||||||
cd routing; make all;
|
cd routing; make all;
|
||||||
|
cd dnslink; make all;
|
||||||
|
cd namesys; make all;
|
||||||
|
cd path; make all;
|
||||||
|
cd util; make all;
|
||||||
cd test; make all;
|
cd test; make all;
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
@ -40,6 +44,10 @@ clean:
|
||||||
cd unixfs; make clean;
|
cd unixfs; make clean;
|
||||||
cd main; make clean;
|
cd main; make clean;
|
||||||
cd routing; make clean;
|
cd routing; make clean;
|
||||||
|
cd dnslink; make clean;
|
||||||
|
cd namesys; make clean;
|
||||||
|
cd path; make clean;
|
||||||
|
cd util; make clean;
|
||||||
cd test; make clean;
|
cd test; make clean;
|
||||||
|
|
||||||
rebuild: clean all
|
rebuild: clean all
|
||||||
|
|
|
@ -3,11 +3,13 @@
|
||||||
#include <ipfs/cid/cid.h>
|
#include <ipfs/cid/cid.h>
|
||||||
#include <ipfs/path/path.h>
|
#include <ipfs/path/path.h>
|
||||||
|
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
// FromCid safely converts a cid.Cid type to a Path type
|
// FromCid safely converts a cid.Cid type to a Path type
|
||||||
char* ipfs_path_from_cid (struct Cid *c)
|
char* ipfs_path_from_cid (struct Cid *c)
|
||||||
{
|
{
|
||||||
const char prefix[] = "/ipfs/";
|
const char prefix[] = "/ipfs/";
|
||||||
char *rpath, *cidstr;// = CidString(c);
|
char *rpath, *cidstr = (char*)c->hash;
|
||||||
int l;
|
int l;
|
||||||
|
|
||||||
l = sizeof(prefix) + strlen(cidstr);
|
l = sizeof(prefix) + strlen(cidstr);
|
||||||
|
@ -189,7 +191,7 @@ int ipfs_path_pop_last_segment (char **str, char *p)
|
||||||
*str = strrchr(p, '/');
|
*str = strrchr(p, '/');
|
||||||
if (!*str) return ErrBadPath; // error
|
if (!*str) return ErrBadPath; // error
|
||||||
**str = '\0';
|
**str = '\0';
|
||||||
*str++;
|
(*str)++;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,7 +221,7 @@ char *ipfs_path_from_segments(char *prefix, char **seg)
|
||||||
|
|
||||||
int ipfs_path_parse_from_cid (char *dst, char *txt)
|
int ipfs_path_parse_from_cid (char *dst, char *txt)
|
||||||
{
|
{
|
||||||
struct Cid *c;
|
struct Cid *c = NULL;
|
||||||
char *r;
|
char *r;
|
||||||
|
|
||||||
if (!txt || txt[0] == '\0') return ErrNoComponents;
|
if (!txt || txt[0] == '\0') return ErrNoComponents;
|
||||||
|
|
Loading…
Reference in a new issue