@@ -33,86 +33,10 @@ uint256 BitcoinGetProofMerkleRoot(const std::vector<uint8_t> &proofData, std::ve
|
|||||||
uint256 GatewaysReverseScan(uint256 &txid, int32_t height, uint256 reforacletxid, uint256 batontxid);
|
uint256 GatewaysReverseScan(uint256 &txid, int32_t height, uint256 reforacletxid, uint256 batontxid);
|
||||||
int32_t GatewaysCointxidExists(struct CCcontract_info *cp, uint256 cointxid);
|
int32_t GatewaysCointxidExists(struct CCcontract_info *cp, uint256 cointxid);
|
||||||
uint8_t DecodeGatewaysBindOpRet(char *depositaddr,const CScript &scriptPubKey,uint256 &tokenid,std::string &coin,int64_t &totalsupply,uint256 &oracletxid,uint8_t &M,uint8_t &N,std::vector<CPubKey> &gatewaypubkeys,uint8_t &taddr,uint8_t &prefix,uint8_t &prefix2,uint8_t &wiftype);
|
uint8_t DecodeGatewaysBindOpRet(char *depositaddr,const CScript &scriptPubKey,uint256 &tokenid,std::string &coin,int64_t &totalsupply,uint256 &oracletxid,uint8_t &M,uint8_t &N,std::vector<CPubKey> &gatewaypubkeys,uint8_t &taddr,uint8_t &prefix,uint8_t &prefix2,uint8_t &wiftype);
|
||||||
|
char *nonportable_path(char *str);
|
||||||
char *nonportable_path(char *str)
|
char *portable_path(char *str);
|
||||||
{
|
void *loadfile(char *fname,uint8_t **bufp,long *lenp,long *allocsizep);
|
||||||
int32_t i;
|
void *filestr(long *allocsizep,char *_fname);
|
||||||
for (i=0; str[i]!=0; i++)
|
|
||||||
if ( str[i] == '/' )
|
|
||||||
str[i] = '\\';
|
|
||||||
return(str);
|
|
||||||
}
|
|
||||||
|
|
||||||
char *portable_path(char *str)
|
|
||||||
{
|
|
||||||
#ifdef _WIN32
|
|
||||||
return(nonportable_path(str));
|
|
||||||
#else
|
|
||||||
#ifdef __PNACL
|
|
||||||
/*int32_t i,n;
|
|
||||||
if ( str[0] == '/' )
|
|
||||||
return(str);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
n = (int32_t)strlen(str);
|
|
||||||
for (i=n; i>0; i--)
|
|
||||||
str[i] = str[i-1];
|
|
||||||
str[0] = '/';
|
|
||||||
str[n+1] = 0;
|
|
||||||
}*/
|
|
||||||
#endif
|
|
||||||
return(str);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void *loadfile(char *fname,uint8_t **bufp,long *lenp,long *allocsizep)
|
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
long filesize,buflen = *allocsizep;
|
|
||||||
uint8_t *buf = *bufp;
|
|
||||||
*lenp = 0;
|
|
||||||
if ( (fp= fopen(portable_path(fname),"rb")) != 0 )
|
|
||||||
{
|
|
||||||
fseek(fp,0,SEEK_END);
|
|
||||||
filesize = ftell(fp);
|
|
||||||
if ( filesize == 0 )
|
|
||||||
{
|
|
||||||
fclose(fp);
|
|
||||||
*lenp = 0;
|
|
||||||
//printf("loadfile null size.(%s)\n",fname);
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
if ( filesize > buflen )
|
|
||||||
{
|
|
||||||
*allocsizep = filesize;
|
|
||||||
*bufp = buf = (uint8_t *)realloc(buf,(long)*allocsizep+64);
|
|
||||||
}
|
|
||||||
rewind(fp);
|
|
||||||
if ( buf == 0 )
|
|
||||||
printf("Null buf ???\n");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ( fread(buf,1,(long)filesize,fp) != (unsigned long)filesize )
|
|
||||||
printf("error reading filesize.%ld\n",(long)filesize);
|
|
||||||
buf[filesize] = 0;
|
|
||||||
}
|
|
||||||
fclose(fp);
|
|
||||||
*lenp = filesize;
|
|
||||||
//printf("loaded.(%s)\n",buf);
|
|
||||||
} //else printf("OS_loadfile couldnt load.(%s)\n",fname);
|
|
||||||
return(buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
void *filestr(long *allocsizep,char *_fname)
|
|
||||||
{
|
|
||||||
long filesize = 0; char *fname,*buf = 0; void *retptr;
|
|
||||||
*allocsizep = 0;
|
|
||||||
fname = (char *)malloc(strlen(_fname)+1);
|
|
||||||
strcpy(fname,_fname);
|
|
||||||
retptr = loadfile(fname,(uint8_t **)&buf,&filesize,allocsizep);
|
|
||||||
free(fname);
|
|
||||||
return(retptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ac_import=chain support:
|
// ac_import=chain support:
|
||||||
// encode opret for gateways import
|
// encode opret for gateways import
|
||||||
|
|||||||
Reference in New Issue
Block a user