Fixed PathFromCid(), Cid is an struct, not an array.
This commit is contained in:
parent
1a8e024fb9
commit
8ed4f62526
2 changed files with 6 additions and 5 deletions
|
@ -20,7 +20,7 @@
|
|||
ErrNoLinkFmt
|
||||
} PathErrs;
|
||||
|
||||
char* PathFromCid (char *c);
|
||||
char* PathFromCid (struct Cid *c);
|
||||
char** Segments (char *p);
|
||||
int SegmentsLength (char **s);
|
||||
void FreeSegments (char ***s);
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <ipfs/cid/cid.h>
|
||||
#include <ipfs/path/path.h>
|
||||
|
||||
// FromCid safely converts a cid.Cid type to a Path type
|
||||
char* PathFromCid (char *c)
|
||||
char* PathFromCid (struct Cid *c)
|
||||
{
|
||||
char *rpath;
|
||||
char *rpath, *cidstr = CidString(c);
|
||||
|
||||
rpath = malloc(strlen(c) + 7);
|
||||
rpath = malloc(strlen(cidstr) + 7);
|
||||
if (!rpath) return NULL;
|
||||
strcpy(rpath, "/ipfs/");
|
||||
strcat(rpath, c);
|
||||
strcat(rpath, cidstr);
|
||||
return rpath;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue