mirror of
https://github.com/corda/corda.git
synced 2025-01-23 04:48:09 +00:00
Merge branch 'wip' of oss.readytalk.com:/var/local/git/avian into wip
This commit is contained in:
commit
b33219cc7d
@ -452,11 +452,17 @@ Java_java_io_File_readDir(JNIEnv* e, jclass, jlong handle)
|
||||
{
|
||||
Directory* d = reinterpret_cast<Directory*>(handle);
|
||||
|
||||
const char* s = d->next();
|
||||
if (s) {
|
||||
return e->NewStringUTF(s);
|
||||
} else {
|
||||
return 0;
|
||||
while (true) {
|
||||
const char* s = d->next();
|
||||
if (s) {
|
||||
if (strcmp(s, ".") == 0 || strcmp(s, "..") == 0) {
|
||||
// skip . or .. and try again
|
||||
} else {
|
||||
return e->NewStringUTF(s);
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -485,13 +491,20 @@ extern "C" JNIEXPORT jstring JNICALL
|
||||
Java_java_io_File_readDir(JNIEnv* e, jclass, jlong handle)
|
||||
{
|
||||
struct dirent * directoryEntry;
|
||||
|
||||
|
||||
if (handle!=0) {
|
||||
directoryEntry = readdir(reinterpret_cast<DIR*>(handle));
|
||||
if (directoryEntry == NULL) {
|
||||
return NULL;
|
||||
while (true) {
|
||||
directoryEntry = readdir(reinterpret_cast<DIR*>(handle));
|
||||
if (directoryEntry == NULL) {
|
||||
return NULL;
|
||||
} else if (strcmp(directoryEntry->d_name, ".") == 0
|
||||
|| strcmp(directoryEntry->d_name, "..") == 0)
|
||||
{
|
||||
// skip . or .. and try again
|
||||
} else {
|
||||
return e->NewStringUTF(directoryEntry->d_name);
|
||||
}
|
||||
}
|
||||
return e->NewStringUTF(directoryEntry->d_name);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ public class BufferedInputStream extends InputStream {
|
||||
}
|
||||
|
||||
public BufferedInputStream(InputStream in) {
|
||||
this(in, 32);
|
||||
this(in, 4096);
|
||||
}
|
||||
|
||||
private void fill() throws IOException {
|
||||
|
@ -55,7 +55,9 @@ public class FileInputStream extends InputStream {
|
||||
}
|
||||
|
||||
public void close() throws IOException {
|
||||
close(fd);
|
||||
fd = -1;
|
||||
if (fd != -1) {
|
||||
close(fd);
|
||||
fd = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,9 @@ public class FileOutputStream extends OutputStream {
|
||||
}
|
||||
|
||||
public void close() throws IOException {
|
||||
close(fd);
|
||||
fd = -1;
|
||||
if (fd != -1) {
|
||||
close(fd);
|
||||
fd = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user