equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
92 // found file, open it |
92 // found file, open it |
93 int file_handle = os::open(filename, 0, 0); |
93 int file_handle = os::open(filename, 0, 0); |
94 if (file_handle != -1) { |
94 if (file_handle != -1) { |
95 // read contents into resource array |
95 // read contents into resource array |
96 char* buffer = NEW_RESOURCE_ARRAY(char, st.st_size+1); |
96 char* buffer = NEW_RESOURCE_ARRAY(char, st.st_size+1); |
97 size_t num_read = os::read(file_handle, (char*) buffer, st.st_size); |
97 ssize_t num_read = os::read(file_handle, (char*) buffer, st.st_size); |
98 buffer[num_read] = '\0'; |
98 if (num_read >= 0) { |
99 // close file |
99 buffer[num_read] = '\0'; |
100 os::close(file_handle); |
100 // close file |
101 return parse_string(buffer, stream) > 0; |
101 os::close(file_handle); |
|
102 return parse_string(buffer, stream) > 0; |
|
103 } |
102 } |
104 } |
103 } |
105 } |
104 return false; |
106 return false; |
105 } |
107 } |
106 |
108 |