mirror of
https://github.com/corda/corda.git
synced 2025-01-05 20:54:13 +00:00
use size_t instead of unsigned in a bunch of appropriate places
This would theoretically break compatibility with apps using embedded classpaths, on big-endian architectures - because of the size type extension. However, we don't currently support any big-endian architectures, so it shouldn't be a problem.
This commit is contained in:
parent
d9650be570
commit
1fcc097344
@ -454,7 +454,7 @@ setting the boot classpath to "[bootJar]".
|
|||||||
extern const uint8_t SYMBOL(end)[];
|
extern const uint8_t SYMBOL(end)[];
|
||||||
|
|
||||||
EXPORT const uint8_t*
|
EXPORT const uint8_t*
|
||||||
bootJar(unsigned* size)
|
bootJar(size_t* size)
|
||||||
{
|
{
|
||||||
*size = SYMBOL(end) - SYMBOL(start);
|
*size = SYMBOL(end) - SYMBOL(start);
|
||||||
return SYMBOL(start);
|
return SYMBOL(start);
|
||||||
@ -682,7 +682,7 @@ containing them. See the previous example for instructions.
|
|||||||
extern const uint8_t BOOTIMAGE_BIN(end)[];
|
extern const uint8_t BOOTIMAGE_BIN(end)[];
|
||||||
|
|
||||||
EXPORT const uint8_t*
|
EXPORT const uint8_t*
|
||||||
bootimageBin(unsigned* size)
|
bootimageBin(size_t* size)
|
||||||
{
|
{
|
||||||
*size = BOOTIMAGE_BIN(end) - BOOTIMAGE_BIN(start);
|
*size = BOOTIMAGE_BIN(end) - BOOTIMAGE_BIN(start);
|
||||||
return BOOTIMAGE_BIN(start);
|
return BOOTIMAGE_BIN(start);
|
||||||
@ -692,7 +692,7 @@ containing them. See the previous example for instructions.
|
|||||||
extern const uint8_t CODEIMAGE_BIN(end)[];
|
extern const uint8_t CODEIMAGE_BIN(end)[];
|
||||||
|
|
||||||
EXPORT const uint8_t*
|
EXPORT const uint8_t*
|
||||||
codeimageBin(unsigned* size)
|
codeimageBin(size_t* size)
|
||||||
{
|
{
|
||||||
*size = CODEIMAGE_BIN(end) - CODEIMAGE_BIN(start);
|
*size = CODEIMAGE_BIN(end) - CODEIMAGE_BIN(start);
|
||||||
return CODEIMAGE_BIN(start);
|
return CODEIMAGE_BIN(start);
|
||||||
|
@ -111,7 +111,7 @@ class System : public avian::util::Aborter {
|
|||||||
};
|
};
|
||||||
|
|
||||||
virtual bool success(Status) = 0;
|
virtual bool success(Status) = 0;
|
||||||
virtual void* tryAllocate(unsigned sizeInBytes) = 0;
|
virtual void* tryAllocate(size_t sizeInBytes) = 0;
|
||||||
virtual void free(const void* p) = 0;
|
virtual void free(const void* p) = 0;
|
||||||
virtual Status attach(Runnable*) = 0;
|
virtual Status attach(Runnable*) = 0;
|
||||||
virtual Status start(Runnable*) = 0;
|
virtual Status start(Runnable*) = 0;
|
||||||
@ -123,7 +123,7 @@ class System : public avian::util::Aborter {
|
|||||||
= 0;
|
= 0;
|
||||||
|
|
||||||
virtual Status map(Region**, const char* name) = 0;
|
virtual Status map(Region**, const char* name) = 0;
|
||||||
virtual FileType stat(const char* name, unsigned* length) = 0;
|
virtual FileType stat(const char* name, size_t* length) = 0;
|
||||||
virtual Status open(Directory**, const char* name) = 0;
|
virtual Status open(Directory**, const char* name) = 0;
|
||||||
virtual const char* libraryPrefix() = 0;
|
virtual const char* libraryPrefix() = 0;
|
||||||
virtual const char* librarySuffix() = 0;
|
virtual const char* librarySuffix() = 0;
|
||||||
@ -138,7 +138,7 @@ class System : public avian::util::Aborter {
|
|||||||
virtual void dispose() = 0;
|
virtual void dispose() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void* allocate(System* s, unsigned size)
|
inline void* allocate(System* s, size_t size)
|
||||||
{
|
{
|
||||||
void* p = s->tryAllocate(size);
|
void* p = s->tryAllocate(size);
|
||||||
if (p == 0)
|
if (p == 0)
|
||||||
|
@ -648,7 +648,7 @@ void intercept(Thread* t,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Finder* getFinder(Thread* t, const char* name, unsigned nameLength)
|
Finder* getFinder(Thread* t, const char* name, size_t nameLength)
|
||||||
{
|
{
|
||||||
ACQUIRE(t, t->m->referenceLock);
|
ACQUIRE(t, t->m->referenceLock);
|
||||||
|
|
||||||
@ -668,10 +668,10 @@ Finder* getFinder(Thread* t, const char* name, unsigned nameLength)
|
|||||||
reinterpret_cast<const char*>(n->body().begin()));
|
reinterpret_cast<const char*>(n->body().begin()));
|
||||||
|
|
||||||
if (p) {
|
if (p) {
|
||||||
uint8_t* (*function)(unsigned*);
|
uint8_t* (*function)(size_t*);
|
||||||
memcpy(&function, &p, BytesPerWord);
|
memcpy(&function, &p, BytesPerWord);
|
||||||
|
|
||||||
unsigned size;
|
size_t size = 0;
|
||||||
uint8_t* data = function(&size);
|
uint8_t* data = function(&size);
|
||||||
if (data) {
|
if (data) {
|
||||||
Finder* f = makeFinder(t->m->system, t->m->heap, data, size);
|
Finder* f = makeFinder(t->m->system, t->m->heap, data, size);
|
||||||
|
@ -126,8 +126,8 @@ inline const uint8_t* endOfEntry(const uint8_t* p)
|
|||||||
|
|
||||||
inline bool readLine(const uint8_t* base,
|
inline bool readLine(const uint8_t* base,
|
||||||
unsigned total,
|
unsigned total,
|
||||||
unsigned* start,
|
size_t* start,
|
||||||
unsigned* length)
|
size_t* length)
|
||||||
{
|
{
|
||||||
const uint8_t* p = base + *start;
|
const uint8_t* p = base + *start;
|
||||||
const uint8_t* end = base + total;
|
const uint8_t* end = base + total;
|
||||||
@ -147,7 +147,7 @@ class Finder {
|
|||||||
public:
|
public:
|
||||||
class IteratorImp {
|
class IteratorImp {
|
||||||
public:
|
public:
|
||||||
virtual const char* next(unsigned* size) = 0;
|
virtual const char* next(size_t* size) = 0;
|
||||||
virtual void dispose() = 0;
|
virtual void dispose() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -171,7 +171,7 @@ class Finder {
|
|||||||
return current != 0;
|
return current != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* next(unsigned* size)
|
const char* next(size_t* size)
|
||||||
{
|
{
|
||||||
if (hasMore()) {
|
if (hasMore()) {
|
||||||
*size = currentSize;
|
*size = currentSize;
|
||||||
@ -185,13 +185,13 @@ class Finder {
|
|||||||
|
|
||||||
IteratorImp* it;
|
IteratorImp* it;
|
||||||
const char* current;
|
const char* current;
|
||||||
unsigned currentSize;
|
size_t currentSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual IteratorImp* iterator() = 0;
|
virtual IteratorImp* iterator() = 0;
|
||||||
virtual System::Region* find(const char* name) = 0;
|
virtual System::Region* find(const char* name) = 0;
|
||||||
virtual System::FileType stat(const char* name,
|
virtual System::FileType stat(const char* name,
|
||||||
unsigned* length,
|
size_t* length,
|
||||||
bool tryDirectory = false) = 0;
|
bool tryDirectory = false) = 0;
|
||||||
virtual const char* urlPrefix(const char* name) = 0;
|
virtual const char* urlPrefix(const char* name) = 0;
|
||||||
virtual const char* nextUrlPrefix(const char* name, void*& finderElementPtr)
|
virtual const char* nextUrlPrefix(const char* name, void*& finderElementPtr)
|
||||||
@ -209,7 +209,7 @@ AVIAN_EXPORT Finder* makeFinder(System* s,
|
|||||||
Finder* makeFinder(System* s,
|
Finder* makeFinder(System* s,
|
||||||
avian::util::Alloc* a,
|
avian::util::Alloc* a,
|
||||||
const uint8_t* jarData,
|
const uint8_t* jarData,
|
||||||
unsigned jarLength);
|
size_t jarLength);
|
||||||
|
|
||||||
} // namespace vm
|
} // namespace vm
|
||||||
|
|
||||||
|
@ -24,14 +24,14 @@ namespace vm {
|
|||||||
uint8_t* decodeLZMA(System* s,
|
uint8_t* decodeLZMA(System* s,
|
||||||
avian::util::Alloc* a,
|
avian::util::Alloc* a,
|
||||||
uint8_t* in,
|
uint8_t* in,
|
||||||
unsigned inSize,
|
size_t inSize,
|
||||||
unsigned* outSize);
|
size_t* outSize);
|
||||||
|
|
||||||
uint8_t* encodeLZMA(System* s,
|
uint8_t* encodeLZMA(System* s,
|
||||||
avian::util::Alloc* a,
|
avian::util::Alloc* a,
|
||||||
uint8_t* in,
|
uint8_t* in,
|
||||||
unsigned inSize,
|
size_t inSize,
|
||||||
unsigned* outSize);
|
size_t* outSize);
|
||||||
|
|
||||||
} // namespace vm
|
} // namespace vm
|
||||||
|
|
||||||
|
@ -1062,7 +1062,7 @@ class Machine {
|
|||||||
JNIEnvVTable jniEnvVTable;
|
JNIEnvVTable jniEnvVTable;
|
||||||
uintptr_t* heapPool[ThreadHeapPoolSize];
|
uintptr_t* heapPool[ThreadHeapPoolSize];
|
||||||
unsigned heapPoolIndex;
|
unsigned heapPoolIndex;
|
||||||
unsigned bootimageSize;
|
size_t bootimageSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
void printTrace(Thread* t, GcThrowable* exception);
|
void printTrace(Thread* t, GcThrowable* exception);
|
||||||
|
@ -22,7 +22,7 @@ extern "C" {
|
|||||||
extern const uint8_t SYMBOL(start)[];
|
extern const uint8_t SYMBOL(start)[];
|
||||||
extern const uint8_t SYMBOL(end)[];
|
extern const uint8_t SYMBOL(end)[];
|
||||||
|
|
||||||
AVIAN_EXPORT const uint8_t* javahomeJar(unsigned* size)
|
AVIAN_EXPORT const uint8_t* javahomeJar(size_t* size)
|
||||||
{
|
{
|
||||||
*size = SYMBOL(end) - SYMBOL(start);
|
*size = SYMBOL(end) - SYMBOL(start);
|
||||||
return SYMBOL(start);
|
return SYMBOL(start);
|
||||||
|
@ -33,7 +33,7 @@ extern "C" {
|
|||||||
extern const uint8_t BOOTIMAGE_SYMBOL(start)[];
|
extern const uint8_t BOOTIMAGE_SYMBOL(start)[];
|
||||||
extern const uint8_t BOOTIMAGE_SYMBOL(end)[];
|
extern const uint8_t BOOTIMAGE_SYMBOL(end)[];
|
||||||
|
|
||||||
AVIAN_EXPORT const uint8_t* bootimageBin(unsigned* size)
|
AVIAN_EXPORT const uint8_t* bootimageBin(size_t* size)
|
||||||
{
|
{
|
||||||
*size = BOOTIMAGE_SYMBOL(end) - BOOTIMAGE_SYMBOL(start);
|
*size = BOOTIMAGE_SYMBOL(end) - BOOTIMAGE_SYMBOL(start);
|
||||||
return BOOTIMAGE_SYMBOL(start);
|
return BOOTIMAGE_SYMBOL(start);
|
||||||
@ -42,7 +42,7 @@ AVIAN_EXPORT const uint8_t* bootimageBin(unsigned* size)
|
|||||||
extern const uint8_t CODEIMAGE_SYMBOL(start)[];
|
extern const uint8_t CODEIMAGE_SYMBOL(start)[];
|
||||||
extern const uint8_t CODEIMAGE_SYMBOL(end)[];
|
extern const uint8_t CODEIMAGE_SYMBOL(end)[];
|
||||||
|
|
||||||
AVIAN_EXPORT const uint8_t* codeimageBin(unsigned* size)
|
AVIAN_EXPORT const uint8_t* codeimageBin(size_t* size)
|
||||||
{
|
{
|
||||||
*size = CODEIMAGE_SYMBOL(end) - CODEIMAGE_SYMBOL(start);
|
*size = CODEIMAGE_SYMBOL(end) - CODEIMAGE_SYMBOL(start);
|
||||||
return CODEIMAGE_SYMBOL(start);
|
return CODEIMAGE_SYMBOL(start);
|
||||||
@ -65,7 +65,7 @@ extern "C" {
|
|||||||
extern const uint8_t SYMBOL(start)[];
|
extern const uint8_t SYMBOL(start)[];
|
||||||
extern const uint8_t SYMBOL(end)[];
|
extern const uint8_t SYMBOL(end)[];
|
||||||
|
|
||||||
AVIAN_EXPORT const uint8_t* classpathJar(unsigned* size)
|
AVIAN_EXPORT const uint8_t* classpathJar(size_t* size)
|
||||||
{
|
{
|
||||||
*size = SYMBOL(end) - SYMBOL(start);
|
*size = SYMBOL(end) - SYMBOL(start);
|
||||||
return SYMBOL(start);
|
return SYMBOL(start);
|
||||||
|
@ -32,7 +32,7 @@ class Element {
|
|||||||
public:
|
public:
|
||||||
class Iterator {
|
class Iterator {
|
||||||
public:
|
public:
|
||||||
virtual const char* next(unsigned* size) = 0;
|
virtual const char* next(size_t* size) = 0;
|
||||||
virtual void dispose() = 0;
|
virtual void dispose() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ class Element {
|
|||||||
virtual Iterator* iterator() = 0;
|
virtual Iterator* iterator() = 0;
|
||||||
virtual System::Region* find(const char* name) = 0;
|
virtual System::Region* find(const char* name) = 0;
|
||||||
virtual System::FileType stat(const char* name,
|
virtual System::FileType stat(const char* name,
|
||||||
unsigned* length,
|
size_t* length,
|
||||||
bool tryDirectory) = 0;
|
bool tryDirectory) = 0;
|
||||||
virtual const char* urlPrefix() = 0;
|
virtual const char* urlPrefix() = 0;
|
||||||
virtual const char* sourceUrl() = 0;
|
virtual const char* sourceUrl() = 0;
|
||||||
@ -70,7 +70,7 @@ class DirectoryElement : public Element {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual const char* next(unsigned* size)
|
virtual const char* next(size_t* size)
|
||||||
{
|
{
|
||||||
if (it) {
|
if (it) {
|
||||||
const char* v = it->next(size);
|
const char* v = it->next(size);
|
||||||
@ -90,7 +90,7 @@ class DirectoryElement : public Element {
|
|||||||
for (const char* v = directory->next(); v; v = directory->next()) {
|
for (const char* v = directory->next(); v; v = directory->next()) {
|
||||||
if (v[0] != '.') {
|
if (v[0] != '.') {
|
||||||
last = append(allocator, name, "/", v);
|
last = append(allocator, name, "/", v);
|
||||||
unsigned length;
|
size_t length;
|
||||||
if (s->stat(last, &length) == System::TypeDirectory) {
|
if (s->stat(last, &length) == System::TypeDirectory) {
|
||||||
it = new (allocator->allocate(sizeof(Iterator)))
|
it = new (allocator->allocate(sizeof(Iterator)))
|
||||||
Iterator(s, allocator, last, skip);
|
Iterator(s, allocator, last, skip);
|
||||||
@ -157,7 +157,7 @@ class DirectoryElement : public Element {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual System::FileType stat(const char* name, unsigned* length, bool)
|
virtual System::FileType stat(const char* name, size_t* length, bool)
|
||||||
{
|
{
|
||||||
const char* file = append(allocator, this->name, "/", name);
|
const char* file = append(allocator, this->name, "/", name);
|
||||||
System::FileType type = s->stat(file, length);
|
System::FileType type = s->stat(file, length);
|
||||||
@ -344,7 +344,7 @@ class JarIndex {
|
|||||||
|
|
||||||
List<Entry>* findNode(const char* name)
|
List<Entry>* findNode(const char* name)
|
||||||
{
|
{
|
||||||
unsigned length = strlen(name);
|
size_t length = strlen(name);
|
||||||
unsigned i = hash(name) & (capacity - 1);
|
unsigned i = hash(name) & (capacity - 1);
|
||||||
for (List<Entry>* n = table[i]; n; n = n->next) {
|
for (List<Entry>* n = table[i]; n; n = n->next) {
|
||||||
const uint8_t* p = n->item.entry;
|
const uint8_t* p = n->item.entry;
|
||||||
@ -403,7 +403,7 @@ class JarIndex {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
System::FileType stat(const char* name, unsigned* length, bool tryDirectory)
|
System::FileType stat(const char* name, size_t* length, bool tryDirectory)
|
||||||
{
|
{
|
||||||
List<Entry>* node = findNode(name);
|
List<Entry>* node = findNode(name);
|
||||||
if (node) {
|
if (node) {
|
||||||
@ -413,7 +413,7 @@ class JarIndex {
|
|||||||
*length = 0;
|
*length = 0;
|
||||||
|
|
||||||
// try again with '/' appended
|
// try again with '/' appended
|
||||||
unsigned length = strlen(name);
|
size_t length = strlen(name);
|
||||||
RUNTIME_ARRAY(char, n, length + 2);
|
RUNTIME_ARRAY(char, n, length + 2);
|
||||||
memcpy(RUNTIME_ARRAY_BODY(n), name, length);
|
memcpy(RUNTIME_ARRAY_BODY(n), name, length);
|
||||||
RUNTIME_ARRAY_BODY(n)[length] = '/';
|
RUNTIME_ARRAY_BODY(n)[length] = '/';
|
||||||
@ -455,7 +455,7 @@ class JarElement : public Element {
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual const char* next(unsigned* size)
|
virtual const char* next(size_t* size)
|
||||||
{
|
{
|
||||||
if (position < index->position) {
|
if (position < index->position) {
|
||||||
List<JarIndex::Entry>* n = index->nodes + (position++);
|
List<JarIndex::Entry>* n = index->nodes + (position++);
|
||||||
@ -548,7 +548,7 @@ class JarElement : public Element {
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual System::FileType stat(const char* name,
|
virtual System::FileType stat(const char* name,
|
||||||
unsigned* length,
|
size_t* length,
|
||||||
bool tryDirectory)
|
bool tryDirectory)
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
@ -629,16 +629,16 @@ class BuiltinElement : public JarElement {
|
|||||||
|
|
||||||
void* p = library->resolve(symbolName);
|
void* p = library->resolve(symbolName);
|
||||||
if (p) {
|
if (p) {
|
||||||
uint8_t* (*function)(unsigned*);
|
uint8_t* (*function)(size_t*);
|
||||||
memcpy(&function, &p, BytesPerWord);
|
memcpy(&function, &p, BytesPerWord);
|
||||||
|
|
||||||
unsigned size;
|
size_t size = 0;
|
||||||
uint8_t* data = function(&size);
|
uint8_t* data = function(&size);
|
||||||
if (data) {
|
if (data) {
|
||||||
bool freePointer;
|
bool freePointer;
|
||||||
if (lzma) {
|
if (lzma) {
|
||||||
#ifdef AVIAN_USE_LZMA
|
#ifdef AVIAN_USE_LZMA
|
||||||
unsigned outSize;
|
size_t outSize;
|
||||||
data = decodeLZMA(s, allocator, data, size, &outSize);
|
data = decodeLZMA(s, allocator, data, size, &outSize);
|
||||||
size = outSize;
|
size = outSize;
|
||||||
freePointer = true;
|
freePointer = true;
|
||||||
@ -751,8 +751,8 @@ void addTokens(System* s,
|
|||||||
|
|
||||||
bool continuationLine(const uint8_t* base,
|
bool continuationLine(const uint8_t* base,
|
||||||
unsigned total,
|
unsigned total,
|
||||||
unsigned* start,
|
size_t* start,
|
||||||
unsigned* length)
|
size_t* length)
|
||||||
{
|
{
|
||||||
return readLine(base, total, start, length) and *length > 0
|
return readLine(base, total, start, length) and *length > 0
|
||||||
and base[*start] == ' ';
|
and base[*start] == ' ';
|
||||||
@ -778,8 +778,8 @@ void addJar(System* s,
|
|||||||
|
|
||||||
System::Region* region = e->find("META-INF/MANIFEST.MF");
|
System::Region* region = e->find("META-INF/MANIFEST.MF");
|
||||||
if (region) {
|
if (region) {
|
||||||
unsigned start = 0;
|
size_t start = 0;
|
||||||
unsigned length;
|
size_t length;
|
||||||
while (readLine(region->start(), region->length(), &start, &length)) {
|
while (readLine(region->start(), region->length(), &start, &length)) {
|
||||||
unsigned multilineTotal = 0;
|
unsigned multilineTotal = 0;
|
||||||
|
|
||||||
@ -789,8 +789,8 @@ void addJar(System* s,
|
|||||||
reinterpret_cast<const char*>(region->start() + start),
|
reinterpret_cast<const char*>(region->start() + start),
|
||||||
PrefixLength) == 0) {
|
PrefixLength) == 0) {
|
||||||
{
|
{
|
||||||
unsigned nextStart = start + length;
|
size_t nextStart = start + length;
|
||||||
unsigned nextLength;
|
size_t nextLength;
|
||||||
while (continuationLine(
|
while (continuationLine(
|
||||||
region->start(), region->length(), &nextStart, &nextLength)) {
|
region->start(), region->length(), &nextStart, &nextLength)) {
|
||||||
multilineTotal += nextLength;
|
multilineTotal += nextLength;
|
||||||
@ -810,8 +810,8 @@ void addJar(System* s,
|
|||||||
|
|
||||||
unsigned offset = lineLength;
|
unsigned offset = lineLength;
|
||||||
{
|
{
|
||||||
unsigned nextStart = start + length;
|
size_t nextStart = start + length;
|
||||||
unsigned nextLength;
|
size_t nextLength;
|
||||||
while (continuationLine(
|
while (continuationLine(
|
||||||
region->start(), region->length(), &nextStart, &nextLength)) {
|
region->start(), region->length(), &nextStart, &nextLength)) {
|
||||||
unsigned continuationLength = nextLength - 1;
|
unsigned continuationLength = nextLength - 1;
|
||||||
@ -880,7 +880,7 @@ void add(System* s,
|
|||||||
memcpy(name, token, tokenLength);
|
memcpy(name, token, tokenLength);
|
||||||
name[tokenLength] = 0;
|
name[tokenLength] = 0;
|
||||||
|
|
||||||
unsigned length;
|
size_t length;
|
||||||
switch (s->stat(name, &length)) {
|
switch (s->stat(name, &length)) {
|
||||||
case System::TypeFile: {
|
case System::TypeFile: {
|
||||||
addJar(s, first, last, allocator, name, bootLibrary);
|
addJar(s, first, last, allocator, name, bootLibrary);
|
||||||
@ -934,7 +934,7 @@ class MyIterator : public Finder::IteratorImp {
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual const char* next(unsigned* size)
|
virtual const char* next(size_t* size)
|
||||||
{
|
{
|
||||||
while (it) {
|
while (it) {
|
||||||
const char* v = it->next(size);
|
const char* v = it->next(size);
|
||||||
@ -1010,7 +1010,7 @@ class MyFinder : public Finder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual System::FileType stat(const char* name,
|
virtual System::FileType stat(const char* name,
|
||||||
unsigned* length,
|
size_t* length,
|
||||||
bool tryDirectory)
|
bool tryDirectory)
|
||||||
{
|
{
|
||||||
for (Element* e = path_; e; e = e->next) {
|
for (Element* e = path_; e; e = e->next) {
|
||||||
@ -1034,7 +1034,7 @@ class MyFinder : public Finder {
|
|||||||
Element*& e = reinterpret_cast<Element*&>(finderElementPtr);
|
Element*& e = reinterpret_cast<Element*&>(finderElementPtr);
|
||||||
e = e ? e->next : path_;
|
e = e ? e->next : path_;
|
||||||
for (; e; e = e->next) {
|
for (; e; e = e->next) {
|
||||||
unsigned length;
|
size_t length;
|
||||||
System::FileType type = e->stat(name, &length, true);
|
System::FileType type = e->stat(name, &length, true);
|
||||||
if (type != System::TypeDoesNotExist) {
|
if (type != System::TypeDoesNotExist) {
|
||||||
return e->urlPrefix();
|
return e->urlPrefix();
|
||||||
@ -1047,7 +1047,7 @@ class MyFinder : public Finder {
|
|||||||
virtual const char* sourceUrl(const char* name)
|
virtual const char* sourceUrl(const char* name)
|
||||||
{
|
{
|
||||||
for (Element* e = path_; e; e = e->next) {
|
for (Element* e = path_; e; e = e->next) {
|
||||||
unsigned length;
|
size_t length;
|
||||||
System::FileType type = e->stat(name, &length, true);
|
System::FileType type = e->stat(name, &length, true);
|
||||||
if (type != System::TypeDoesNotExist) {
|
if (type != System::TypeDoesNotExist) {
|
||||||
return e->sourceUrl();
|
return e->sourceUrl();
|
||||||
@ -1096,7 +1096,7 @@ AVIAN_EXPORT Finder* makeFinder(System* s,
|
|||||||
Finder* makeFinder(System* s,
|
Finder* makeFinder(System* s,
|
||||||
Alloc* a,
|
Alloc* a,
|
||||||
const uint8_t* jarData,
|
const uint8_t* jarData,
|
||||||
unsigned jarLength)
|
size_t jarLength)
|
||||||
{
|
{
|
||||||
return new (a->allocate(sizeof(MyFinder))) MyFinder(s, a, jarData, jarLength);
|
return new (a->allocate(sizeof(MyFinder))) MyFinder(s, a, jarData, jarLength);
|
||||||
}
|
}
|
||||||
|
@ -29,11 +29,11 @@ namespace vm {
|
|||||||
uint8_t* decodeLZMA(System* s,
|
uint8_t* decodeLZMA(System* s,
|
||||||
avian::util::Alloc* a,
|
avian::util::Alloc* a,
|
||||||
uint8_t* in,
|
uint8_t* in,
|
||||||
unsigned inSize,
|
size_t inSize,
|
||||||
unsigned* outSize)
|
size_t* outSize)
|
||||||
{
|
{
|
||||||
const unsigned PropHeaderSize = 5;
|
const size_t PropHeaderSize = 5;
|
||||||
const unsigned HeaderSize = 13;
|
const size_t HeaderSize = 13;
|
||||||
|
|
||||||
int32_t outSize32 = read4(in + PropHeaderSize);
|
int32_t outSize32 = read4(in + PropHeaderSize);
|
||||||
expect(s, outSize32 >= 0);
|
expect(s, outSize32 >= 0);
|
||||||
|
@ -3810,10 +3810,10 @@ void Thread::init()
|
|||||||
|
|
||||||
void* imagep = m->libraries->resolve(symbolName);
|
void* imagep = m->libraries->resolve(symbolName);
|
||||||
if (imagep) {
|
if (imagep) {
|
||||||
uint8_t* (*imageFunction)(unsigned*);
|
uint8_t* (*imageFunction)(size_t*);
|
||||||
memcpy(&imageFunction, &imagep, BytesPerWord);
|
memcpy(&imageFunction, &imagep, BytesPerWord);
|
||||||
|
|
||||||
unsigned size;
|
size_t size = 0;
|
||||||
uint8_t* imageBytes = imageFunction(&size);
|
uint8_t* imageBytes = imageFunction(&size);
|
||||||
if (lzma) {
|
if (lzma) {
|
||||||
#ifdef AVIAN_USE_LZMA
|
#ifdef AVIAN_USE_LZMA
|
||||||
@ -3830,7 +3830,7 @@ void Thread::init()
|
|||||||
if (codeFunctionName) {
|
if (codeFunctionName) {
|
||||||
void* codep = m->libraries->resolve(codeFunctionName);
|
void* codep = m->libraries->resolve(codeFunctionName);
|
||||||
if (codep) {
|
if (codep) {
|
||||||
uint8_t* (*codeFunction)(unsigned*);
|
uint8_t* (*codeFunction)(size_t*);
|
||||||
memcpy(&codeFunction, &codep, BytesPerWord);
|
memcpy(&codeFunction, &codep, BytesPerWord);
|
||||||
|
|
||||||
code = codeFunction(&size);
|
code = codeFunction(&size);
|
||||||
|
@ -91,8 +91,8 @@ const char* mainClass(const char* jar)
|
|||||||
|
|
||||||
System::Region* region = finder->find("META-INF/MANIFEST.MF");
|
System::Region* region = finder->find("META-INF/MANIFEST.MF");
|
||||||
if (region) {
|
if (region) {
|
||||||
unsigned start = 0;
|
size_t start = 0;
|
||||||
unsigned length;
|
size_t length;
|
||||||
while (readLine(region->start(), region->length(), &start, &length)) {
|
while (readLine(region->start(), region->length(), &start, &length)) {
|
||||||
const unsigned PrefixLength = 12;
|
const unsigned PrefixLength = 12;
|
||||||
if (strncasecmp("Main-Class: ",
|
if (strncasecmp("Main-Class: ",
|
||||||
@ -226,8 +226,8 @@ int main(int ac, const char** av)
|
|||||||
|
|
||||||
#define CLASSPATH_PROPERTY "-Djava.class.path="
|
#define CLASSPATH_PROPERTY "-Djava.class.path="
|
||||||
|
|
||||||
unsigned classpathSize = strlen(classpath);
|
size_t classpathSize = strlen(classpath);
|
||||||
unsigned classpathPropertyBufferSize = sizeof(CLASSPATH_PROPERTY)
|
size_t classpathPropertyBufferSize = sizeof(CLASSPATH_PROPERTY)
|
||||||
+ classpathSize;
|
+ classpathSize;
|
||||||
|
|
||||||
RUNTIME_ARRAY(char, classpathPropertyBuffer, classpathPropertyBufferSize);
|
RUNTIME_ARRAY(char, classpathPropertyBuffer, classpathPropertyBufferSize);
|
||||||
|
@ -654,7 +654,7 @@ class MySystem : public System {
|
|||||||
return sigaction(signals[index], &sa, oldHandlers + index) == 0;
|
return sigaction(signals[index], &sa, oldHandlers + index) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void* tryAllocate(unsigned sizeInBytes)
|
virtual void* tryAllocate(size_t sizeInBytes)
|
||||||
{
|
{
|
||||||
return malloc(sizeInBytes);
|
return malloc(sizeInBytes);
|
||||||
}
|
}
|
||||||
@ -808,7 +808,7 @@ class MySystem : public System {
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual FileType stat(const char* name, unsigned* length)
|
virtual FileType stat(const char* name, size_t* length)
|
||||||
{
|
{
|
||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
// Now the hack below causes the error "Dereferencing type-punned
|
// Now the hack below causes the error "Dereferencing type-punned
|
||||||
|
@ -664,7 +664,7 @@ class MySystem : public System {
|
|||||||
assertT(this, mutex);
|
assertT(this, mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void* tryAllocate(unsigned sizeInBytes)
|
virtual void* tryAllocate(size_t sizeInBytes)
|
||||||
{
|
{
|
||||||
return malloc(sizeInBytes);
|
return malloc(sizeInBytes);
|
||||||
}
|
}
|
||||||
@ -862,7 +862,7 @@ class MySystem : public System {
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual FileType stat(const char* name, unsigned* length)
|
virtual FileType stat(const char* name, size_t* length)
|
||||||
{
|
{
|
||||||
size_t nameLen = strlen(name) * 2;
|
size_t nameLen = strlen(name) * 2;
|
||||||
RUNTIME_ARRAY(wchar_t, wideName, nameLen + 1);
|
RUNTIME_ARRAY(wchar_t, wideName, nameLen + 1);
|
||||||
|
@ -348,13 +348,13 @@ GcTriple* makeCodeImage(Thread* t,
|
|||||||
roots(t)->bootLoader()->as<GcSystemClassLoader>(t)->finder());
|
roots(t)->bootLoader()->as<GcSystemClassLoader>(t)->finder());
|
||||||
|
|
||||||
for (Finder::Iterator it(finder); it.hasMore();) {
|
for (Finder::Iterator it(finder); it.hasMore();) {
|
||||||
unsigned nameSize = 0;
|
size_t nameSize = 0;
|
||||||
const char* name = it.next(&nameSize);
|
const char* name = it.next(&nameSize);
|
||||||
|
|
||||||
if (endsWith(".class", name, nameSize)
|
if (endsWith(".class", name, nameSize)
|
||||||
and (className == 0 or strncmp(name, className, nameSize - 6) == 0)) {
|
and (className == 0 or strncmp(name, className, nameSize - 6) == 0)) {
|
||||||
if (false) {
|
if (false) {
|
||||||
fprintf(stderr, "pass 1 %.*s\n", nameSize - 6, name);
|
fprintf(stderr, "pass 1 %.*s\n", (int)nameSize - 6, name);
|
||||||
}
|
}
|
||||||
GcClass* c
|
GcClass* c
|
||||||
= resolveSystemClass(t,
|
= resolveSystemClass(t,
|
||||||
@ -686,13 +686,13 @@ GcTriple* makeCodeImage(Thread* t,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (Finder::Iterator it(finder); it.hasMore();) {
|
for (Finder::Iterator it(finder); it.hasMore();) {
|
||||||
unsigned nameSize = 0;
|
size_t nameSize = 0;
|
||||||
const char* name = it.next(&nameSize);
|
const char* name = it.next(&nameSize);
|
||||||
|
|
||||||
if (endsWith(".class", name, nameSize)
|
if (endsWith(".class", name, nameSize)
|
||||||
and (className == 0 or strncmp(name, className, nameSize - 6) == 0)) {
|
and (className == 0 or strncmp(name, className, nameSize - 6) == 0)) {
|
||||||
if (false) {
|
if (false) {
|
||||||
fprintf(stderr, "pass 2 %.*s\n", nameSize - 6, name);
|
fprintf(stderr, "pass 2 %.*s\n", (int)nameSize - 6, name);
|
||||||
}
|
}
|
||||||
GcClass* c = 0;
|
GcClass* c = 0;
|
||||||
PROTECT(t, c);
|
PROTECT(t, c);
|
||||||
|
Loading…
Reference in New Issue
Block a user