mirror of
https://github.com/corda/corda.git
synced 2025-01-06 21:18:46 +00:00
fix use of uninitialized values in JarElement; use system-specific path separator in finder
This commit is contained in:
parent
ea6f67a7c7
commit
394d80a07a
@ -59,6 +59,11 @@ class DirectoryElement: public Element {
|
|||||||
const char* file = append(s, this->name, "/", name);
|
const char* file = append(s, this->name, "/", name);
|
||||||
System::Region* region;
|
System::Region* region;
|
||||||
System::Status status = s->map(®ion, file);
|
System::Status status = s->map(®ion, file);
|
||||||
|
|
||||||
|
if (status) {
|
||||||
|
fprintf(stderr, "%s not found\n", file);
|
||||||
|
}
|
||||||
|
|
||||||
s->free(file);
|
s->free(file);
|
||||||
|
|
||||||
if (s->success(status)) {
|
if (s->success(status)) {
|
||||||
@ -325,7 +330,7 @@ class JarIndex {
|
|||||||
class JarElement: public Element {
|
class JarElement: public Element {
|
||||||
public:
|
public:
|
||||||
JarElement(System* s, const char* name):
|
JarElement(System* s, const char* name):
|
||||||
s(s), name(name)
|
s(s), name(name), region(0), index(0)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
void init() {
|
void init() {
|
||||||
@ -401,12 +406,14 @@ parsePath(System* s, const char* path)
|
|||||||
|
|
||||||
Element* first = 0;
|
Element* first = 0;
|
||||||
Element* prev = 0;
|
Element* prev = 0;
|
||||||
for (Tokenizer t(path, ':'); t.hasMore();) {
|
for (Tokenizer t(path, s->pathSeparator()); t.hasMore();) {
|
||||||
Tokenizer::Token token(t.next());
|
Tokenizer::Token token(t.next());
|
||||||
char* name = static_cast<char*>(s->allocate(token.length + 1));
|
char* name = static_cast<char*>(s->allocate(token.length + 1));
|
||||||
memcpy(name, token.s, token.length);
|
memcpy(name, token.s, token.length);
|
||||||
name[token.length] = 0;
|
name[token.length] = 0;
|
||||||
|
|
||||||
|
fprintf(stderr, "path element: %s\n", name);
|
||||||
|
|
||||||
Element* e;
|
Element* e;
|
||||||
switch (s->identify(name)) {
|
switch (s->identify(name)) {
|
||||||
case System::File: {
|
case System::File: {
|
||||||
|
@ -550,6 +550,10 @@ class MySystem: public System {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual char pathSeparator() {
|
||||||
|
return ':';
|
||||||
|
}
|
||||||
|
|
||||||
virtual int64_t now() {
|
virtual int64_t now() {
|
||||||
timeval tv = { 0, 0 };
|
timeval tv = { 0, 0 };
|
||||||
gettimeofday(&tv, 0);
|
gettimeofday(&tv, 0);
|
||||||
|
@ -94,8 +94,9 @@ class System: public Allocator {
|
|||||||
virtual FileType identify(const char* name) = 0;
|
virtual FileType identify(const char* name) = 0;
|
||||||
virtual Status load(Library**, const char* name, bool mapName, Library* next)
|
virtual Status load(Library**, const char* name, bool mapName, Library* next)
|
||||||
= 0;
|
= 0;
|
||||||
virtual void exit(int code) = 0;
|
virtual char pathSeparator() = 0;
|
||||||
virtual int64_t now() = 0;
|
virtual int64_t now() = 0;
|
||||||
|
virtual void exit(int code) = 0;
|
||||||
virtual void abort() = 0;
|
virtual void abort() = 0;
|
||||||
virtual void dispose() = 0;
|
virtual void dispose() = 0;
|
||||||
|
|
||||||
|
@ -462,7 +462,7 @@ class MySystem: public System {
|
|||||||
|
|
||||||
virtual Status attach(Runnable* r) {
|
virtual Status attach(Runnable* r) {
|
||||||
Thread* t = new (System::allocate(sizeof(Thread))) Thread(this, r);
|
Thread* t = new (System::allocate(sizeof(Thread))) Thread(this, r);
|
||||||
bool success = DuplicateHandle
|
bool success UNUSED = DuplicateHandle
|
||||||
(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(),
|
(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(),
|
||||||
&(t->thread), 0, false, DUPLICATE_SAME_ACCESS);
|
&(t->thread), 0, false, DUPLICATE_SAME_ACCESS);
|
||||||
assert(this, success);
|
assert(this, success);
|
||||||
@ -581,6 +581,9 @@ class MySystem: public System {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual char pathSeparator() {
|
||||||
|
return ';';
|
||||||
|
}
|
||||||
|
|
||||||
virtual int64_t now() {
|
virtual int64_t now() {
|
||||||
static LARGE_INTEGER frequency;
|
static LARGE_INTEGER frequency;
|
||||||
|
Loading…
Reference in New Issue
Block a user