src/java.base/share/native/libjli/splashscreen_stubs.c
author dfuchs
Thu, 07 Nov 2019 16:18:02 +0000
changeset 58968 7f1daafda27b
parent 55189 fdaf7287ea3a
permissions -rw-r--r--
8233403: Improve verbosity of some httpclient tests Summary: improve the verbosity of some httpclient tests to help diagnosis of intermittent failures. Also fixes ShortRequestBody test. Reviewed-by: chegar
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
29742
b73f38796859 8074840: Resolve disabled warnings for libjli and libjli_static
mikael
parents: 25859
diff changeset
     2
 * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#include <stdio.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#include "splashscreen.h"
36907
c3d8383e3efb 8145173: HiDPI splash screen support on Windows
rchamyal
parents: 29742
diff changeset
    28
#include "jni.h"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
extern void* SplashProcAddress(const char* name); /* in java_md.c */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * Prototypes of pointers to functions in splashscreen shared lib
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
typedef int (*SplashLoadMemory_t)(void* pdata, int size);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
typedef int (*SplashLoadFile_t)(const char* filename);
55189
fdaf7287ea3a 8223271: SplashScreen is still shown if defaulting to headless on MacOS
prr
parents: 47216
diff changeset
    36
typedef int (*SplashInit_t)(void);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
typedef void (*SplashClose_t)(void);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
typedef void (*SplashSetFileJarName_t)(const char* fileName,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
                                       const char* jarName);
25552
96abb01815f6 8043869: [macosx] java -splash does not honor @2x hi dpi notation for retina support
alexsch
parents: 5506
diff changeset
    40
typedef void (*SplashSetScaleFactor_t)(float scaleFactor);
36907
c3d8383e3efb 8145173: HiDPI splash screen support on Windows
rchamyal
parents: 29742
diff changeset
    41
typedef jboolean (*SplashGetScaledImageName_t)(const char* fileName,
c3d8383e3efb 8145173: HiDPI splash screen support on Windows
rchamyal
parents: 29742
diff changeset
    42
                        const char* jarName, float* scaleFactor,
c3d8383e3efb 8145173: HiDPI splash screen support on Windows
rchamyal
parents: 29742
diff changeset
    43
                        char *scaleImageName, const size_t scaleImageNameLength);
c3d8383e3efb 8145173: HiDPI splash screen support on Windows
rchamyal
parents: 29742
diff changeset
    44
typedef int (*SplashGetScaledImgNameMaxPstfixLen_t)(const char* filename);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * This macro invokes a function from the shared lib.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * it locates a function with SplashProcAddress on demand.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * if SplashProcAddress fails, def value is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * it is further wrapped with INVOKEV (works with functions which return
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * void and INVOKE (for all other functions). INVOKEV looks a bit ugly,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * that's due being unable to return a value of type void in C. INVOKEV
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * works around this by using semicolon instead of return operator.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
#define _INVOKE(name,def,ret) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    static void* proc = NULL; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    if (!proc) { proc = SplashProcAddress(#name); } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    if (!proc) { return def; } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    ret ((name##_t)proc)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
#define INVOKE(name,def) _INVOKE(name,def,return)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
#define INVOKEV(name) _INVOKE(name, ,;)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
36907
c3d8383e3efb 8145173: HiDPI splash screen support on Windows
rchamyal
parents: 29742
diff changeset
    65
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
int     DoSplashLoadMemory(void* pdata, int size) {
29742
b73f38796859 8074840: Resolve disabled warnings for libjli and libjli_static
mikael
parents: 25859
diff changeset
    67
    INVOKE(SplashLoadMemory, 0)(pdata, size);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
int     DoSplashLoadFile(const char* filename) {
29742
b73f38796859 8074840: Resolve disabled warnings for libjli and libjli_static
mikael
parents: 25859
diff changeset
    71
    INVOKE(SplashLoadFile, 0)(filename);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
55189
fdaf7287ea3a 8223271: SplashScreen is still shown if defaulting to headless on MacOS
prr
parents: 47216
diff changeset
    74
int     DoSplashInit(void) {
fdaf7287ea3a 8223271: SplashScreen is still shown if defaulting to headless on MacOS
prr
parents: 47216
diff changeset
    75
    INVOKE(SplashInit, 0)();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
void    DoSplashClose(void) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    INVOKEV(SplashClose)();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
void    DoSplashSetFileJarName(const char* fileName, const char* jarName) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    INVOKEV(SplashSetFileJarName)(fileName, jarName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
}
25552
96abb01815f6 8043869: [macosx] java -splash does not honor @2x hi dpi notation for retina support
alexsch
parents: 5506
diff changeset
    85
96abb01815f6 8043869: [macosx] java -splash does not honor @2x hi dpi notation for retina support
alexsch
parents: 5506
diff changeset
    86
void    DoSplashSetScaleFactor(float scaleFactor) {
96abb01815f6 8043869: [macosx] java -splash does not honor @2x hi dpi notation for retina support
alexsch
parents: 5506
diff changeset
    87
    INVOKEV(SplashSetScaleFactor)(scaleFactor);
96abb01815f6 8043869: [macosx] java -splash does not honor @2x hi dpi notation for retina support
alexsch
parents: 5506
diff changeset
    88
}
96abb01815f6 8043869: [macosx] java -splash does not honor @2x hi dpi notation for retina support
alexsch
parents: 5506
diff changeset
    89
36907
c3d8383e3efb 8145173: HiDPI splash screen support on Windows
rchamyal
parents: 29742
diff changeset
    90
jboolean DoSplashGetScaledImageName(const char* fileName, const char* jarName,
c3d8383e3efb 8145173: HiDPI splash screen support on Windows
rchamyal
parents: 29742
diff changeset
    91
           float* scaleFactor, char *scaledImageName, const size_t scaledImageNameLength) {
c3d8383e3efb 8145173: HiDPI splash screen support on Windows
rchamyal
parents: 29742
diff changeset
    92
        INVOKE(SplashGetScaledImageName, 0)(fileName, jarName, scaleFactor,
c3d8383e3efb 8145173: HiDPI splash screen support on Windows
rchamyal
parents: 29742
diff changeset
    93
                                            scaledImageName, scaledImageNameLength);
29742
b73f38796859 8074840: Resolve disabled warnings for libjli and libjli_static
mikael
parents: 25859
diff changeset
    94
}
36907
c3d8383e3efb 8145173: HiDPI splash screen support on Windows
rchamyal
parents: 29742
diff changeset
    95
c3d8383e3efb 8145173: HiDPI splash screen support on Windows
rchamyal
parents: 29742
diff changeset
    96
int     DoSplashGetScaledImgNameMaxPstfixLen(const char *fileName) {
c3d8383e3efb 8145173: HiDPI splash screen support on Windows
rchamyal
parents: 29742
diff changeset
    97
    INVOKE(SplashGetScaledImgNameMaxPstfixLen, 0)(fileName);
c3d8383e3efb 8145173: HiDPI splash screen support on Windows
rchamyal
parents: 29742
diff changeset
    98
}
c3d8383e3efb 8145173: HiDPI splash screen support on Windows
rchamyal
parents: 29742
diff changeset
    99