@@ -285,7 +285,7 @@ static std::string canonicalize(std::string path) {
285
285
* system JRE and fail if none is installed
286
286
*/
287
287
static void *load_jli_lib (std::string exeDir) {
288
- std::stringstream libjliPath;
288
+ std::ostringstream libjliPath;
289
289
libjliPath << exeDir << DIR_SEP_STR << LIBJLI_RELPATH_STR;
290
290
return dlopen (libjliPath.str ().c_str (), RTLD_NOW);
291
291
}
@@ -330,7 +330,7 @@ void* get_function(void* library, const char* function_name) {
330
330
}
331
331
332
332
static std::string vm_path (std::string exeDir, bool jvmMode) {
333
- std::stringstream liblangPath;
333
+ std::ostringstream liblangPath;
334
334
if (jvmMode) {
335
335
liblangPath << exeDir << DIR_SEP_STR << LIBJVM_RELPATH_STR;
336
336
} else {
@@ -348,9 +348,9 @@ static size_t parse_size(std::string_view str);
348
348
349
349
static void parse_vm_option (
350
350
std::vector<std::string> *vmArgs,
351
- std::stringstream *cp,
352
- std::stringstream *modulePath,
353
- std::stringstream *libraryPath,
351
+ std::ostringstream *cp,
352
+ std::ostringstream *modulePath,
353
+ std::ostringstream *libraryPath,
354
354
size_t * stack_size,
355
355
std::string_view option) {
356
356
if (IS_VM_CP_ARG (option)) {
@@ -367,7 +367,7 @@ static void parse_vm_option(
367
367
if (IS_VM_STACK_SIZE_ARG (option)) {
368
368
*stack_size = parse_size (option.substr (VM_STACK_SIZE_ARG_OFFSET));
369
369
}
370
- std::stringstream opt;
370
+ std::ostringstream opt;
371
371
opt << ' -' << option.substr (VM_ARG_OFFSET);
372
372
vmArgs->push_back (opt.str ());
373
373
} else if (option == " --jvm" ) {
@@ -412,7 +412,7 @@ static void parse_vm_options(struct MainThreadArgs& parsedArgs) {
412
412
}
413
413
vmArgs.push_back (" -Dorg.graalvm.version=" GRAALVM_VERSION_STR);
414
414
415
- std::stringstream executablename;
415
+ std::ostringstream executablename;
416
416
executablename << " -Dorg.graalvm.launcher.executablename=" ;
417
417
char *executablenameEnv = getenv (" GRAALVM_LAUNCHER_EXECUTABLE_NAME" );
418
418
if (executablenameEnv) {
@@ -427,18 +427,18 @@ static void parse_vm_options(struct MainThreadArgs& parsedArgs) {
427
427
}
428
428
429
429
/* construct classpath - only needed for jvm mode */
430
- std::stringstream cp;
430
+ std::ostringstream cp;
431
431
432
432
/* construct module path - only needed for jvm mode */
433
- std::stringstream modulePath;
433
+ std::ostringstream modulePath;
434
434
modulePath << " --module-path=" ;
435
435
#ifdef LAUNCHER_MODULE_PATH
436
436
if (jvmMode) {
437
437
/* add the launcher module path */
438
438
const char *launcherModulePathEntries[] = LAUNCHER_MODULE_PATH;
439
439
int launcherModulePathCnt = sizeof (launcherModulePathEntries) / sizeof (*launcherModulePathEntries);
440
440
for (int i = 0 ; i < launcherModulePathCnt; i++) {
441
- std::stringstream entry;
441
+ std::ostringstream entry;
442
442
entry << exeDir << DIR_SEP_STR << launcherModulePathEntries[i];
443
443
modulePath << canonicalize (entry.str ());
444
444
if (i < launcherModulePathCnt-1 ) {
@@ -455,7 +455,7 @@ static void parse_vm_options(struct MainThreadArgs& parsedArgs) {
455
455
const char * dirs[] = { LANGUAGES_DIR_STR, TOOLS_DIR_STR };
456
456
for (int i = 0 ; i < 2 ; i++) {
457
457
const char * relativeDir = dirs[i];
458
- std::stringstream absoluteDirStream;
458
+ std::ostringstream absoluteDirStream;
459
459
absoluteDirStream << exeDir << DIR_SEP_STR << relativeDir;
460
460
std::string absoluteDir = absoluteDirStream.str ();
461
461
@@ -476,7 +476,7 @@ static void parse_vm_options(struct MainThreadArgs& parsedArgs) {
476
476
// From https://learn.microsoft.com/en-us/windows/win32/fileio/listing-the-files-in-a-directory
477
477
// and https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-findfirstfilea
478
478
WIN32_FIND_DATAA entry;
479
- std::stringstream searchDir;
479
+ std::ostringstream searchDir;
480
480
searchDir << absoluteDir << " \\ *" ;
481
481
HANDLE dir = FindFirstFileA (searchDir.str ().c_str (), &entry);
482
482
if (dir != INVALID_HANDLE_VALUE) {
@@ -495,7 +495,7 @@ static void parse_vm_options(struct MainThreadArgs& parsedArgs) {
495
495
#endif
496
496
497
497
/* construct java.library.path - only needed for jvm mode */
498
- std::stringstream libraryPath;
498
+ std::ostringstream libraryPath;
499
499
#ifdef LAUNCHER_LIBRARY_PATH
500
500
if (jvmMode) {
501
501
/* add the library path */
@@ -512,8 +512,8 @@ static void parse_vm_options(struct MainThreadArgs& parsedArgs) {
512
512
const char *launcherLangHomePaths[] = LAUNCHER_LANG_HOME_PATHS;
513
513
int launcherLangHomeNamesCnt = sizeof (launcherLangHomeNames) / sizeof (*launcherLangHomeNames);
514
514
for (int i = 0 ; i < launcherLangHomeNamesCnt; i++) {
515
- std::stringstream ss;
516
- std::stringstream relativeHome;
515
+ std::ostringstream ss;
516
+ std::ostringstream relativeHome;
517
517
relativeHome << exeDir << DIR_SEP_STR << launcherLangHomePaths[i];
518
518
ss << " -Dorg.graalvm.language." << launcherLangHomeNames[i] << " .home=" << canonicalize (relativeHome.str ());
519
519
vmArgs.push_back (ss.str ());
@@ -526,8 +526,8 @@ static void parse_vm_options(struct MainThreadArgs& parsedArgs) {
526
526
const char *extractedLibPaths[] = LAUNCHER_EXTRACTED_LIB_PATHS;
527
527
int extractedLibCnt = sizeof (extractedLibNames) / sizeof (*extractedLibNames);
528
528
for (int i = 0 ; i < extractedLibCnt; i++) {
529
- std::stringstream ss;
530
- std::stringstream relativePath;
529
+ std::ostringstream ss;
530
+ std::ostringstream relativePath;
531
531
relativePath << exeDir << DIR_SEP_STR << extractedLibPaths[i];
532
532
ss << " -D" << extractedLibNames[i] << " =" << canonicalize (relativePath.str ());
533
533
vmArgs.push_back (ss.str ());
@@ -588,7 +588,7 @@ static void parse_vm_options(struct MainThreadArgs& parsedArgs) {
588
588
std::cout << " Relaunch environment variable detected" << std::endl;
589
589
}
590
590
for (int i = 0 ; i < vmArgCount; i++) {
591
- std::stringstream ss;
591
+ std::ostringstream ss;
592
592
ss << " GRAALVM_LANGUAGE_LAUNCHER_VMARGS_" << i;
593
593
std::string envKey = ss.str ();
594
594
char *cur = getenv (envKey.c_str ());
@@ -996,7 +996,7 @@ static int jvm_main_thread(struct MainThreadArgs& parsedArgs) {
996
996
if (debug) {
997
997
std::cout << " Relaunch VM arguments read: " << vmArgCount << std::endl;
998
998
}
999
- std::stringstream ss;
999
+ std::ostringstream ss;
1000
1000
ss << vmArgCount;
1001
1001
if (setenv (" GRAALVM_LANGUAGE_LAUNCHER_VMARGS" , ss.str ()) == -1 ) {
1002
1002
return -1 ;
@@ -1015,7 +1015,7 @@ static int jvm_main_thread(struct MainThreadArgs& parsedArgs) {
1015
1015
return -1 ;
1016
1016
}
1017
1017
/* set environment variables for relaunch vm arguments */
1018
- std::stringstream key;
1018
+ std::ostringstream key;
1019
1019
key << " GRAALVM_LANGUAGE_LAUNCHER_VMARGS_" << i;
1020
1020
std::string arg (vmArg);
1021
1021
if (setenv (key.str (), arg) == -1 ) {
0 commit comments