fmemopen compat work on Unix
This commit is contained in:
parent
697f57ecef
commit
2edae59610
@ -35,6 +35,7 @@ char * Yap_blob_to_string(AtomEntry *ref, const char *s0, size_t sz)
|
|||||||
char *s = (char *)s0;
|
char *s = (char *)s0;
|
||||||
|
|
||||||
blob_type_t *type = RepBlobProp(ref->PropsOfAE)->blob_type;
|
blob_type_t *type = RepBlobProp(ref->PropsOfAE)->blob_type;
|
||||||
|
#if HAVE_FMEMOPEN
|
||||||
if (type->write) {
|
if (type->write) {
|
||||||
FILE *f = fmemopen( s, sz, "w");
|
FILE *f = fmemopen( s, sz, "w");
|
||||||
if (f == NULL){
|
if (f == NULL){
|
||||||
@ -49,6 +50,7 @@ char * Yap_blob_to_string(AtomEntry *ref, const char *s0, size_t sz)
|
|||||||
fclose(f); // return the final result.
|
fclose(f); // return the final result.
|
||||||
return s;
|
return s;
|
||||||
} else {
|
} else {
|
||||||
|
#endif
|
||||||
#if __APPLE__
|
#if __APPLE__
|
||||||
size_t sz0 = strlcpy( s, (char *)RepAtom( AtomSWIStream )->StrOfAE, sz);
|
size_t sz0 = strlcpy( s, (char *)RepAtom( AtomSWIStream )->StrOfAE, sz);
|
||||||
#else
|
#else
|
||||||
@ -65,8 +67,10 @@ char * Yap_blob_to_string(AtomEntry *ref, const char *s0, size_t sz)
|
|||||||
snprintf(s+strlen(s), sz0, "(0x%p)", ref);
|
snprintf(s+strlen(s), sz0, "(0x%p)", ref);
|
||||||
#endif
|
#endif
|
||||||
return s;
|
return s;
|
||||||
|
#if HAVE_FMEMOPEN
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int Yap_write_blob(AtomEntry *ref, FILE *stream)
|
int Yap_write_blob(AtomEntry *ref, FILE *stream)
|
||||||
|
Reference in New Issue
Block a user