Commit 1dba6fee authored by ager@chromium.org's avatar ager@chromium.org

Applied Rafal Krypa's patch to fix gcc 4.3.2 build problems.


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@149 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 766523b7
# Below is a list of people and organizations that have contributed
# to the v8 project. Names should be added to the list like so:
#
# Name/Organization <email address>
Google Inc.
René Rebe <rene@exactcode.de>
Rafal Krypa <rafal@krypa.net>
...@@ -256,7 +256,11 @@ OS::MemoryMappedFile* OS::MemoryMappedFile::create(const char* name, int size, ...@@ -256,7 +256,11 @@ OS::MemoryMappedFile* OS::MemoryMappedFile::create(const char* name, int size,
void* initial) { void* initial) {
FILE* file = fopen(name, "w+"); FILE* file = fopen(name, "w+");
if (file == NULL) return NULL; if (file == NULL) return NULL;
fwrite(initial, size, 1, file); int result = fwrite(initial, size, 1, file);
if (result < 1) {
fclose(file);
return NULL;
}
void* memory = void* memory =
mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fileno(file), 0); mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fileno(file), 0);
return new PosixMemoryMappedFile(file, memory, size); return new PosixMemoryMappedFile(file, memory, size);
...@@ -285,11 +289,14 @@ void OS::LogSharedLibraryAddresses() { ...@@ -285,11 +289,14 @@ void OS::LogSharedLibraryAddresses() {
addr_buffer[0] = '0'; addr_buffer[0] = '0';
addr_buffer[1] = 'x'; addr_buffer[1] = 'x';
addr_buffer[10] = 0; addr_buffer[10] = 0;
read(fd, addr_buffer + 2, 8); int result = read(fd, addr_buffer + 2, 8);
if (result < 8) break;
unsigned start = StringToLongLong(addr_buffer); unsigned start = StringToLongLong(addr_buffer);
read(fd, addr_buffer + 2, 1); result = read(fd, addr_buffer + 2, 1);
if (addr_buffer[2] != '-') return; if (result < 1) break;
read(fd, addr_buffer + 2, 8); if (addr_buffer[2] != '-') break;
result = read(fd, addr_buffer + 2, 8);
if (result < 8) break;
unsigned end = StringToLongLong(addr_buffer); unsigned end = StringToLongLong(addr_buffer);
char buffer[MAP_LENGTH]; char buffer[MAP_LENGTH];
int bytes_read = -1; int bytes_read = -1;
...@@ -297,9 +304,8 @@ void OS::LogSharedLibraryAddresses() { ...@@ -297,9 +304,8 @@ void OS::LogSharedLibraryAddresses() {
bytes_read++; bytes_read++;
if (bytes_read >= MAP_LENGTH - 1) if (bytes_read >= MAP_LENGTH - 1)
break; break;
int result = read(fd, buffer + bytes_read, 1); result = read(fd, buffer + bytes_read, 1);
// A read error means that -1 is returned. if (result < 1) break;
if (result < 1) return;
} while (buffer[bytes_read] != '\n'); } while (buffer[bytes_read] != '\n');
buffer[bytes_read] = 0; buffer[bytes_read] = 0;
// There are 56 chars to ignore at this point in the line. // There are 56 chars to ignore at this point in the line.
...@@ -309,6 +315,7 @@ void OS::LogSharedLibraryAddresses() { ...@@ -309,6 +315,7 @@ void OS::LogSharedLibraryAddresses() {
buffer[bytes_read] = 0; buffer[bytes_read] = 0;
LOG(SharedLibraryEvent(buffer + 56, start, end)); LOG(SharedLibraryEvent(buffer + 56, start, end));
} }
close(fd);
#endif #endif
} }
......
...@@ -104,7 +104,7 @@ char* ReadLine(const char* prompt) { ...@@ -104,7 +104,7 @@ char* ReadLine(const char* prompt) {
char line_buf[256]; char line_buf[256];
int offset = 0; int offset = 0;
bool keep_going = true; bool keep_going = true;
fprintf(stdout, prompt); fprintf(stdout, "%s", prompt);
fflush(stdout); fflush(stdout);
while (keep_going) { while (keep_going) {
if (fgets(line_buf, sizeof(line_buf), stdin) == NULL) { if (fgets(line_buf, sizeof(line_buf), stdin) == NULL) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment