< 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         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 


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





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


2268         }
2269     } else {
2270         DoSplashInit();
2271         if (isImageScaled) {
2272             DoSplashSetScaleFactor(scale_factor);
2273             DoSplashLoadFile(scaled_splash_name);
2274         } else {
2275             DoSplashLoadFile(file_name);
2276         }
2277     }
2278     JLI_MemFree(scaled_splash_name);
2279 
2280     DoSplashSetFileJarName(file_name, jar_name);
2281 

2282     /*
2283      * Done with all command line processing and potential re-execs so
2284      * clean up the environment.
2285      */
2286     (void)UnsetEnv(ENV_ENTRY);
2287     (void)UnsetEnv(SPLASH_FILE_ENV_ENTRY);
2288     (void)UnsetEnv(SPLASH_JAR_ENV_ENTRY);
2289 
2290     JLI_MemFree(splash_jar_entry);
2291     JLI_MemFree(splash_file_entry);
2292 
2293 }
2294 
2295 const char*
2296 GetFullVersion()
2297 {
2298     return _fVersion;
2299 }
2300 
2301 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         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 


2224 }
2225 
2226 /*
2227  * Displays the splash screen according to the jar file name
2228  * and image file names stored in environment variables
2229  */
2230 void
2231 ShowSplashScreen()
2232 {
2233     const char *jar_name = getenv(SPLASH_JAR_ENV_ENTRY);
2234     const char *file_name = getenv(SPLASH_FILE_ENV_ENTRY);
2235     int data_size;
2236     void *image_data = NULL;
2237     float scale_factor = 1;
2238     char *scaled_splash_name = NULL;
2239     jboolean isImageScaled = JNI_FALSE;
2240     size_t maxScaledImgNameLength = 0;
2241     if (file_name == NULL){
2242         return;
2243     }
2244 
2245     if (!DoSplashInit()) {
2246         goto exit;
2247     }
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             DoSplashSetScaleFactor(scale_factor);
2270             DoSplashLoadMemory(image_data, data_size);
2271             JLI_MemFree(image_data);
2272         } else {
2273             DoSplashClose();
2274         }
2275     } else {

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


< prev index next >