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 * |
3 * |
4 * Redistribution and use in source and binary forms, with or without |
4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions |
5 * modification, are permitted provided that the following conditions |
6 * are met: |
6 * are met: |
7 * |
7 * |
213 if (!(*visitor)(image, module, "9", parent, base, extension, arg)) { |
213 if (!(*visitor)(image, module, "9", parent, base, extension, arg)) { |
214 break; |
214 break; |
215 } |
215 } |
216 } |
216 } |
217 } |
217 } |
218 |
|
219 /* |
|
220 * JIMAGE_ResourcePath- Given an open image file, a location reference, a buffer |
|
221 * and a maximum buffer size, copy the path of the resource into the buffer. |
|
222 * Returns false if not a valid location reference. |
|
223 * |
|
224 * Ex. |
|
225 * JImageLocationRef location = ... |
|
226 * char path[JIMAGE_MAX_PATH]; |
|
227 * (*JImageResourcePath)(image, location, path, JIMAGE_MAX_PATH); |
|
228 */ |
|
229 extern "C" JNIEXPORT bool |
|
230 JIMAGE_ResourcePath(JImageFile* image, JImageLocationRef locationRef, |
|
231 char* path, size_t max) { |
|
232 ImageFileReader* imageFile = (ImageFileReader*) image; |
|
233 |
|
234 u4 offset = (u4) locationRef; |
|
235 if (offset >= imageFile->locations_size()) { |
|
236 return false; |
|
237 } |
|
238 |
|
239 ImageLocation location(imageFile->get_location_offset_data(offset)); |
|
240 imageFile->location_path(location, path, max); |
|
241 |
|
242 return true; |
|
243 } |
|