< prev index next >

src/java.base/share/native/libjli/java.c

Print this page




1152          * Command line splash screen option should have precedence
1153          * over the manifest, so the manifest data is used only if
1154          * splash_file_name has not been initialized above during command
1155          * line parsing
1156          */
1157         if (!headlessflag && !splash_file_name && info.splashscreen_image_file_name) {
1158             splash_file_name = info.splashscreen_image_file_name;
1159             splash_jar_name = operand;
1160         }
1161     } else {
1162         info.manifest_version = NULL;
1163         info.main_class = NULL;
1164         info.jre_version = NULL;
1165         info.jre_restrict_search = 0;
1166     }
1167 
1168     /*
1169      * Passing on splash screen info in environment variables
1170      */
1171     if (splash_file_name && !headlessflag) {
1172         splash_file_entry = JLI_MemAlloc(JLI_StrLen(SPLASH_FILE_ENV_ENTRY "=")+JLI_StrLen(splash_file_name)+1);
1173         JLI_StrCpy(splash_file_entry, SPLASH_FILE_ENV_ENTRY "=");
1174         JLI_StrCat(splash_file_entry, splash_file_name);
1175         putenv(splash_file_entry);
1176     }
1177     if (splash_jar_name && !headlessflag) {
1178         splash_jar_entry = JLI_MemAlloc(JLI_StrLen(SPLASH_JAR_ENV_ENTRY "=")+JLI_StrLen(splash_jar_name)+1);
1179         JLI_StrCpy(splash_jar_entry, SPLASH_JAR_ENV_ENTRY "=");
1180         JLI_StrCat(splash_jar_entry, splash_jar_name);
1181         putenv(splash_jar_entry);
1182     }
1183 
1184 
1185     /*
1186      * "Valid" returns (other than unrecoverable errors) follow.  Set
1187      * main_class as a side-effect of this routine.
1188      */
1189     if (info.main_class != NULL)
1190         *main_class = JLI_StringDup(info.main_class);
1191 
1192     if (info.jre_version == NULL) {
1193         JLI_FreeManifest();
1194         return;
1195     }
1196 
1197 }
1198 


2229 }
2230 
2231 /*
2232  * Displays the splash screen according to the jar file name
2233  * and image file names stored in environment variables
2234  */
2235 void
2236 ShowSplashScreen()
2237 {
2238     const char *jar_name = getenv(SPLASH_JAR_ENV_ENTRY);
2239     const char *file_name = getenv(SPLASH_FILE_ENV_ENTRY);
2240     int data_size;
2241     void *image_data = NULL;
2242     float scale_factor = 1;
2243     char *scaled_splash_name = NULL;
2244     jboolean isImageScaled = JNI_FALSE;
2245     size_t maxScaledImgNameLength = 0;
2246     if (file_name == NULL){
2247         return;
2248     }
2249 
2250     if (!DoSplashInit()) {
2251         goto exit;
2252     }
2253 
2254     maxScaledImgNameLength = DoSplashGetScaledImgNameMaxPstfixLen(file_name);
2255 
2256     scaled_splash_name = JLI_MemAlloc(
2257                             maxScaledImgNameLength * sizeof(char));
2258     isImageScaled = DoSplashGetScaledImageName(jar_name, file_name,
2259                             &scale_factor,
2260                             scaled_splash_name, maxScaledImgNameLength);
2261     if (jar_name) {
2262 
2263         if (isImageScaled) {
2264             image_data = JLI_JarUnpackFile(
2265                     jar_name, scaled_splash_name, &data_size);
2266         }
2267 
2268         if (!image_data) {
2269             scale_factor = 1;
2270             image_data = JLI_JarUnpackFile(
2271                             jar_name, file_name, &data_size);
2272         }
2273         if (image_data) {

2274             DoSplashSetScaleFactor(scale_factor);
2275             DoSplashLoadMemory(image_data, data_size);
2276             JLI_MemFree(image_data);
2277         } else {
2278             DoSplashClose();
2279         }
2280     } else {

2281         if (isImageScaled) {
2282             DoSplashSetScaleFactor(scale_factor);
2283             DoSplashLoadFile(scaled_splash_name);
2284         } else {
2285             DoSplashLoadFile(file_name);
2286         }
2287     }
2288     JLI_MemFree(scaled_splash_name);
2289 
2290     DoSplashSetFileJarName(file_name, jar_name);
2291 
2292     exit:
2293     /*
2294      * Done with all command line processing and potential re-execs so
2295      * clean up the environment.
2296      */
2297     (void)UnsetEnv(ENV_ENTRY);
2298     (void)UnsetEnv(SPLASH_FILE_ENV_ENTRY);
2299     (void)UnsetEnv(SPLASH_JAR_ENV_ENTRY);
2300 
2301     JLI_MemFree(splash_jar_entry);
2302     JLI_MemFree(splash_file_entry);
2303 
2304 }
2305 
2306 const char*
2307 GetFullVersion()
2308 {
2309     return _fVersion;
2310 }
2311 
2312 const char*




1152          * Command line splash screen option should have precedence
1153          * over the manifest, so the manifest data is used only if
1154          * splash_file_name has not been initialized above during command
1155          * line parsing
1156          */
1157         if (!headlessflag && !splash_file_name && info.splashscreen_image_file_name) {
1158             splash_file_name = info.splashscreen_image_file_name;
1159             splash_jar_name = operand;
1160         }
1161     } else {
1162         info.manifest_version = NULL;
1163         info.main_class = NULL;
1164         info.jre_version = NULL;
1165         info.jre_restrict_search = 0;
1166     }
1167 
1168     /*
1169      * Passing on splash screen info in environment variables
1170      */
1171     if (splash_file_name && !headlessflag) {
1172         char* splash_file_entry = JLI_MemAlloc(JLI_StrLen(SPLASH_FILE_ENV_ENTRY "=")+JLI_StrLen(splash_file_name)+1);
1173         JLI_StrCpy(splash_file_entry, SPLASH_FILE_ENV_ENTRY "=");
1174         JLI_StrCat(splash_file_entry, splash_file_name);
1175         putenv(splash_file_entry);
1176     }
1177     if (splash_jar_name && !headlessflag) {
1178         char* splash_jar_entry = JLI_MemAlloc(JLI_StrLen(SPLASH_JAR_ENV_ENTRY "=")+JLI_StrLen(splash_jar_name)+1);
1179         JLI_StrCpy(splash_jar_entry, SPLASH_JAR_ENV_ENTRY "=");
1180         JLI_StrCat(splash_jar_entry, splash_jar_name);
1181         putenv(splash_jar_entry);
1182     }
1183 
1184 
1185     /*
1186      * "Valid" returns (other than unrecoverable errors) follow.  Set
1187      * main_class as a side-effect of this routine.
1188      */
1189     if (info.main_class != NULL)
1190         *main_class = JLI_StringDup(info.main_class);
1191 
1192     if (info.jre_version == NULL) {
1193         JLI_FreeManifest();
1194         return;
1195     }
1196 
1197 }
1198 


2229 }
2230 
2231 /*
2232  * Displays the splash screen according to the jar file name
2233  * and image file names stored in environment variables
2234  */
2235 void
2236 ShowSplashScreen()
2237 {
2238     const char *jar_name = getenv(SPLASH_JAR_ENV_ENTRY);
2239     const char *file_name = getenv(SPLASH_FILE_ENV_ENTRY);
2240     int data_size;
2241     void *image_data = NULL;
2242     float scale_factor = 1;
2243     char *scaled_splash_name = NULL;
2244     jboolean isImageScaled = JNI_FALSE;
2245     size_t maxScaledImgNameLength = 0;
2246     if (file_name == NULL){
2247         return;
2248     }





2249     maxScaledImgNameLength = DoSplashGetScaledImgNameMaxPstfixLen(file_name);
2250 
2251     scaled_splash_name = JLI_MemAlloc(
2252                             maxScaledImgNameLength * sizeof(char));
2253     isImageScaled = DoSplashGetScaledImageName(jar_name, file_name,
2254                             &scale_factor,
2255                             scaled_splash_name, maxScaledImgNameLength);
2256     if (jar_name) {
2257 
2258         if (isImageScaled) {
2259             image_data = JLI_JarUnpackFile(
2260                     jar_name, scaled_splash_name, &data_size);
2261         }
2262 
2263         if (!image_data) {
2264             scale_factor = 1;
2265             image_data = JLI_JarUnpackFile(
2266                             jar_name, file_name, &data_size);
2267         }
2268         if (image_data) {
2269             DoSplashInit();
2270             DoSplashSetScaleFactor(scale_factor);
2271             DoSplashLoadMemory(image_data, data_size);
2272             JLI_MemFree(image_data);


2273         }
2274     } else {
2275         DoSplashInit();
2276         if (isImageScaled) {
2277             DoSplashSetScaleFactor(scale_factor);
2278             DoSplashLoadFile(scaled_splash_name);
2279         } else {
2280             DoSplashLoadFile(file_name);
2281         }
2282     }
2283     JLI_MemFree(scaled_splash_name);
2284 
2285     DoSplashSetFileJarName(file_name, jar_name);
2286 

2287     /*
2288      * Done with all command line processing and potential re-execs so
2289      * clean up the environment.
2290      */
2291     (void)UnsetEnv(ENV_ENTRY);
2292     (void)UnsetEnv(SPLASH_FILE_ENV_ENTRY);
2293     (void)UnsetEnv(SPLASH_JAR_ENV_ENTRY);
2294 
2295     JLI_MemFree(splash_jar_entry);
2296     JLI_MemFree(splash_file_entry);
2297 
2298 }
2299 
2300 const char*
2301 GetFullVersion()
2302 {
2303     return _fVersion;
2304 }
2305 
2306 const char*


< prev index next >