errors
This commit is contained in:
@@ -60,15 +60,15 @@ Java_pt_up_yap_yapdroid_YAPDroid_loadAssetManager(JNIEnv *env, jclass clazz, job
|
||||
|
||||
|
||||
static void *
|
||||
open_asset(VFS_t *me, int sno, const char *fname, const char *io_mode) {
|
||||
open_asset(VFS_t *me, const char *fname, const char *io_mode, int sno) {
|
||||
int mode;
|
||||
const void *buf;
|
||||
|
||||
AAsset *am = NULL;
|
||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "open %s <%s>", fname, io_mode);
|
||||
if (strchr(io_mode, 'B'))
|
||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "open %s-%s <%s>", fname, me->prefix,io_mode);
|
||||
if (strchr(io_mode, 'B')) {
|
||||
mode = AASSET_MODE_BUFFER;
|
||||
else {
|
||||
} else {[lib]
|
||||
mode = AASSET_MODE_UNKNOWN;
|
||||
}
|
||||
GLOBAL_Stream[sno].name = Yap_LookupAtom(fname);
|
||||
@@ -78,6 +78,7 @@ open_asset(VFS_t *me, int sno, const char *fname, const char *io_mode) {
|
||||
// strcpy(dir, fname);
|
||||
// char *d = basename(dir);
|
||||
am = AAssetManager_open(Yap_assetManager(), fname, mode);
|
||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "open %s <%s>", fname, io_mode );
|
||||
// while (dp) {
|
||||
// char *f = AAssetDir_getNextFileName(dp);
|
||||
// __android_log_print(ANDROID_LOG_INFO, "YAPDroid", "open %s <%s>", f, d);
|
||||
|
||||
@@ -337,7 +337,7 @@ void Yap_DefaultStreamOps(StreamDesc *st) {
|
||||
|
||||
st->stream_wputc = put_wchar;
|
||||
st->stream_wgetc = get_wchar;
|
||||
if (st->vfs) {
|
||||
if (st->vfs && !st->file) {
|
||||
st->stream_putc = st->vfs->put_char;
|
||||
st->stream_wputc = st->vfs->put_char;
|
||||
st->stream_getc = st->vfs->get_char;
|
||||
@@ -1143,7 +1143,7 @@ bool Yap_initStream(int sno, FILE *fd, const char *name, const char *io_mode, Te
|
||||
st->status = Binary_Stream_f|flags;
|
||||
}
|
||||
|
||||
st->vfs = vfs;
|
||||
//st->vfs = vfs;
|
||||
st->buf.on = false;
|
||||
st->charcount = 0;
|
||||
st->linecount = 1;
|
||||
@@ -1598,7 +1598,7 @@ int Yap_OpenStream(const char *fname, const char* io_mode, Term user_name, encod
|
||||
// read, write, append
|
||||
user_name = st->user_name;
|
||||
} else {
|
||||
fd = fopen(fname, io_mode);
|
||||
st->file = fopen(fname, io_mode);
|
||||
if (fd == NULL) {
|
||||
if (!strchr(io_mode, 'b') && binary_file(fname)) {
|
||||
UNLOCK(st->streamlock);
|
||||
@@ -1615,7 +1615,7 @@ int Yap_OpenStream(const char *fname, const char* io_mode, Term user_name, encod
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
Yap_initStream(sno, fd, fname, io_mode, user_name, LOCAL_encoding, flags, vfsp);
|
||||
Yap_initStream(sno, st->file, fname, io_mode, user_name, LOCAL_encoding, flags, vfsp);
|
||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "exists %s <%d>", fname,
|
||||
sno);
|
||||
return sno;
|
||||
|
||||
@@ -984,7 +984,7 @@ static void CloseStream(int sno) {
|
||||
|
||||
//fflush(NULL);
|
||||
VFS_t *me;
|
||||
if ((me = GLOBAL_Stream[sno].vfs) != NULL) {
|
||||
if ((me = GLOBAL_Stream[sno].vfs) != NULL && GLOBAL_Stream[sno].file == NULL) {
|
||||
if (me->close) {
|
||||
me->close(sno);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user