jdk/src/java.desktop/unix/native/common/awt/CUPSfuncs.c
author aghaisas
Fri, 03 Jun 2016 11:37:45 +0530
changeset 39025 bbc996c042d3
parent 36470 d5a6c81c5254
permissions -rw-r--r--
8074829: Resolve disabled warnings for libawt_headless Reviewed-by: prr, erikj, serb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
24130
db72fc72f87b 8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents: 23010
diff changeset
     2
 * Copyright (c) 2003, 2014, 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 <jni.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#include <jni_util.h>
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 5506
diff changeset
    28
#include <jvm_md.h>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
#include <dlfcn.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
#include <cups/cups.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
#include <cups/ppd.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
//#define CUPS_DEBUG
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
#ifdef CUPS_DEBUG
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
#define DPRINTF(x, y) fprintf(stderr, x, y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
#else
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
#define DPRINTF(x, y)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
typedef const char* (*fn_cupsServer)(void);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
typedef int (*fn_ippPort)(void);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
typedef http_t* (*fn_httpConnect)(const char *, int);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
typedef void (*fn_httpClose)(http_t *);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
typedef char* (*fn_cupsGetPPD)(const char *);
36470
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
    46
typedef cups_dest_t* (*fn_cupsGetDest)(const char *name,
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
    47
    const char *instance, int num_dests, cups_dest_t *dests);
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
    48
typedef int (*fn_cupsGetDests)(cups_dest_t **dests);
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
    49
typedef void (*fn_cupsFreeDests)(int num_dests, cups_dest_t *dests);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
typedef ppd_file_t* (*fn_ppdOpenFile)(const char *);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
typedef void (*fn_ppdClose)(ppd_file_t *);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
typedef ppd_option_t* (*fn_ppdFindOption)(ppd_file_t *, const char *);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
typedef ppd_size_t* (*fn_ppdPageSize)(ppd_file_t *, char *);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
fn_cupsServer j2d_cupsServer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
fn_ippPort j2d_ippPort;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
fn_httpConnect j2d_httpConnect;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
fn_httpClose j2d_httpClose;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
fn_cupsGetPPD j2d_cupsGetPPD;
36470
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
    60
fn_cupsGetDest j2d_cupsGetDest;
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
    61
fn_cupsGetDests j2d_cupsGetDests;
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
    62
fn_cupsFreeDests j2d_cupsFreeDests;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
fn_ppdOpenFile j2d_ppdOpenFile;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
fn_ppdClose j2d_ppdClose;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
fn_ppdFindOption j2d_ppdFindOption;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
fn_ppdPageSize j2d_ppdPageSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 * Initialize library functions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 * // REMIND : move tab , add dlClose before return
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
JNIEXPORT jboolean JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
Java_sun_print_CUPSPrinter_initIDs(JNIEnv *env,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
                                         jobject printObj) {
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 5506
diff changeset
    76
  void *handle = dlopen(VERSIONED_JNI_LIB_NAME("cups", "2"),
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 5506
diff changeset
    77
                        RTLD_LAZY | RTLD_GLOBAL);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
  if (handle == NULL) {
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 5506
diff changeset
    80
    handle = dlopen(JNI_LIB_NAME("cups"), RTLD_LAZY | RTLD_GLOBAL);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    if (handle == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
      return JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
  j2d_cupsServer = (fn_cupsServer)dlsym(handle, "cupsServer");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
  if (j2d_cupsServer == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    dlclose(handle);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    return JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
  j2d_ippPort = (fn_ippPort)dlsym(handle, "ippPort");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
  if (j2d_ippPort == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    dlclose(handle);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    return JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
  j2d_httpConnect = (fn_httpConnect)dlsym(handle, "httpConnect");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
  if (j2d_httpConnect == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    dlclose(handle);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    return JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
  j2d_httpClose = (fn_httpClose)dlsym(handle, "httpClose");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
  if (j2d_httpClose == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    dlclose(handle);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    return JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
  j2d_cupsGetPPD = (fn_cupsGetPPD)dlsym(handle, "cupsGetPPD");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
  if (j2d_cupsGetPPD == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    dlclose(handle);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    return JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
36470
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   116
  j2d_cupsGetDest = (fn_cupsGetDest)dlsym(handle, "cupsGetDest");
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   117
  if (j2d_cupsGetDest == NULL) {
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   118
    dlclose(handle);
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   119
    return JNI_FALSE;
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   120
  }
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   121
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   122
  j2d_cupsGetDests = (fn_cupsGetDests)dlsym(handle, "cupsGetDests");
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   123
  if (j2d_cupsGetDests == NULL) {
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   124
    dlclose(handle);
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   125
    return JNI_FALSE;
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   126
  }
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   127
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   128
  j2d_cupsFreeDests = (fn_cupsFreeDests)dlsym(handle, "cupsFreeDests");
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   129
  if (j2d_cupsFreeDests == NULL) {
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   130
    dlclose(handle);
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   131
    return JNI_FALSE;
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   132
  }
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   133
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
  j2d_ppdOpenFile = (fn_ppdOpenFile)dlsym(handle, "ppdOpenFile");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
  if (j2d_ppdOpenFile == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
    dlclose(handle);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    return JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
  j2d_ppdClose = (fn_ppdClose)dlsym(handle, "ppdClose");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
  if (j2d_ppdClose == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
    dlclose(handle);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    return JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
  j2d_ppdFindOption = (fn_ppdFindOption)dlsym(handle, "ppdFindOption");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
  if (j2d_ppdFindOption == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    dlclose(handle);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    return JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
  j2d_ppdPageSize = (fn_ppdPageSize)dlsym(handle, "ppdPageSize");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
  if (j2d_ppdPageSize == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    dlclose(handle);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    return JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
  return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
 * Gets CUPS server name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
JNIEXPORT jstring JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
Java_sun_print_CUPSPrinter_getCupsServer(JNIEnv *env,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
                                         jobject printObj)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    jstring cServer = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
    const char* server = j2d_cupsServer();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
    if (server != NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
        // Is this a local domain socket?
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
        if (strncmp(server, "/", 1) == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
            cServer = JNU_NewStringPlatform(env, "localhost");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
            cServer = JNU_NewStringPlatform(env, server);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    return cServer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
 * Gets CUPS port name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
JNIEXPORT jint JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
Java_sun_print_CUPSPrinter_getCupsPort(JNIEnv *env,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
                                         jobject printObj)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    int port = j2d_ippPort();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    return (jint) port;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
/*
36470
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   198
 * Gets CUPS default printer name.
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   199
 *
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   200
 */
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   201
JNIEXPORT jstring JNICALL
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   202
Java_sun_print_CUPSPrinter_getCupsDefaultPrinter(JNIEnv *env,
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   203
                                                  jobject printObj)
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   204
{
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   205
    jstring cDefPrinter = NULL;
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   206
    cups_dest_t *dests;
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   207
    char *defaultPrinter = NULL;
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   208
    int num_dests = j2d_cupsGetDests(&dests);
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   209
    int i = 0;
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   210
    cups_dest_t *dest = j2d_cupsGetDest(NULL, NULL, num_dests, dests);
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   211
    if (dest != NULL) {
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   212
        defaultPrinter = dest->name;
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   213
        if (defaultPrinter != NULL) {
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   214
            cDefPrinter = JNU_NewStringPlatform(env, defaultPrinter);
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   215
        }
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   216
    }
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   217
    j2d_cupsFreeDests(num_dests, dests);
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   218
    return cDefPrinter;
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   219
}
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   220
d5a6c81c5254 8058316: lookupDefaultPrintService returns null on Solaris 11
psadhukhan
parents: 26751
diff changeset
   221
/*
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
 * Checks if connection can be made to the server.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
JNIEXPORT jboolean JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
Java_sun_print_CUPSPrinter_canConnect(JNIEnv *env,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
                                      jobject printObj,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
                                      jstring server,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
                                      jint port)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    const char *serverName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
    serverName = (*env)->GetStringUTFChars(env, server, NULL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
    if (serverName != NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
        http_t *http = j2d_httpConnect(serverName, (int)port);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
        (*env)->ReleaseStringUTFChars(env, server, serverName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
        if (http != NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
            j2d_httpClose(http);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
            return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
    return JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
 * Returns list of media: pages + trays
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
JNIEXPORT jobjectArray JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
Java_sun_print_CUPSPrinter_getMedia(JNIEnv *env,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
                                         jobject printObj,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
                                         jstring printer)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
    ppd_file_t *ppd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    ppd_option_t *optionTray, *optionPage;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
    ppd_choice_t *choice;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
    const char *name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
    const char *filename;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
    int i, nTrays=0, nPages=0, nTotal=0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
    jstring utf_str;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
    jclass cls;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
    jobjectArray nameArray = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
    name = (*env)->GetStringUTFChars(env, printer, NULL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    if (name == NULL) {
24130
db72fc72f87b 8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents: 23010
diff changeset
   265
        (*env)->ExceptionClear(env);
db72fc72f87b 8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents: 23010
diff changeset
   266
        JNU_ThrowOutOfMemoryError(env, "Could not create printer name");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
        return NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
    // NOTE: cupsGetPPD returns a pointer to a filename of a temporary file.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
    // unlink() must be caled to remove the file when finished using it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
    filename = j2d_cupsGetPPD(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
    (*env)->ReleaseStringUTFChars(env, printer, name);
24130
db72fc72f87b 8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents: 23010
diff changeset
   274
    CHECK_NULL_RETURN(filename, NULL);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
    cls = (*env)->FindClass(env, "java/lang/String");
24130
db72fc72f87b 8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents: 23010
diff changeset
   277
    CHECK_NULL_RETURN(cls, NULL);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
    if ((ppd = j2d_ppdOpenFile(filename)) == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
        unlink(filename);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
        DPRINTF("CUPSfuncs::unable to open PPD  %s\n", filename);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
        return NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
    optionPage = j2d_ppdFindOption(ppd, "PageSize");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
    if (optionPage != NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
        nPages = optionPage->num_choices;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
    optionTray = j2d_ppdFindOption(ppd, "InputSlot");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
    if (optionTray != NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
        nTrays = optionTray->num_choices;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
    if ((nTotal = (nPages+nTrays) *2) > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
        nameArray = (*env)->NewObjectArray(env, nTotal, cls, NULL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
        if (nameArray == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
            unlink(filename);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
            j2d_ppdClose(ppd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
            DPRINTF("CUPSfuncs::bad alloc new array\n", "")
24130
db72fc72f87b 8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents: 23010
diff changeset
   301
            (*env)->ExceptionClear(env);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
            JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
            return NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
        for (i = 0; optionPage!=NULL && i<nPages; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
            choice = (optionPage->choices)+i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
            utf_str = JNU_NewStringPlatform(env, choice->text);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
            if (utf_str == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
                unlink(filename);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
                j2d_ppdClose(ppd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
                DPRINTF("CUPSfuncs::bad alloc new string ->text\n", "")
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
                JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
                return NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
            (*env)->SetObjectArrayElement(env, nameArray, i*2, utf_str);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
            (*env)->DeleteLocalRef(env, utf_str);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
            utf_str = JNU_NewStringPlatform(env, choice->choice);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
            if (utf_str == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
                unlink(filename);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
                j2d_ppdClose(ppd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
                DPRINTF("CUPSfuncs::bad alloc new string ->choice\n", "")
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
                JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
                return NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
            (*env)->SetObjectArrayElement(env, nameArray, i*2+1, utf_str);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
            (*env)->DeleteLocalRef(env, utf_str);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
        for (i = 0; optionTray!=NULL && i<nTrays; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
            choice = (optionTray->choices)+i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
            utf_str = JNU_NewStringPlatform(env, choice->text);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
            if (utf_str == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
                unlink(filename);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
                j2d_ppdClose(ppd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
                DPRINTF("CUPSfuncs::bad alloc new string text\n", "")
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
                JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
                return NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
            (*env)->SetObjectArrayElement(env, nameArray,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
                                          (nPages+i)*2, utf_str);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
            (*env)->DeleteLocalRef(env, utf_str);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
            utf_str = JNU_NewStringPlatform(env, choice->choice);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
            if (utf_str == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
                unlink(filename);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
                j2d_ppdClose(ppd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
                DPRINTF("CUPSfuncs::bad alloc new string choice\n", "")
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
                JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
                return NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
            (*env)->SetObjectArrayElement(env, nameArray,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
                                          (nPages+i)*2+1, utf_str);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
            (*env)->DeleteLocalRef(env, utf_str);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
    j2d_ppdClose(ppd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
    unlink(filename);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
    return nameArray;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
 * Returns list of page sizes and imageable area.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
JNIEXPORT jfloatArray JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
Java_sun_print_CUPSPrinter_getPageSizes(JNIEnv *env,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
                                         jobject printObj,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
                                         jstring printer)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
    ppd_file_t *ppd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
    ppd_option_t *option;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
    ppd_choice_t *choice;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
    ppd_size_t *size;
39025
bbc996c042d3 8074829: Resolve disabled warnings for libawt_headless
aghaisas
parents: 36470
diff changeset
   374
    const char *filename = NULL;
bbc996c042d3 8074829: Resolve disabled warnings for libawt_headless
aghaisas
parents: 36470
diff changeset
   375
    int i;
bbc996c042d3 8074829: Resolve disabled warnings for libawt_headless
aghaisas
parents: 36470
diff changeset
   376
    jobjectArray sizeArray = NULL;
bbc996c042d3 8074829: Resolve disabled warnings for libawt_headless
aghaisas
parents: 36470
diff changeset
   377
    jfloat *dims;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
    const char *name = (*env)->GetStringUTFChars(env, printer, NULL);
24130
db72fc72f87b 8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents: 23010
diff changeset
   380
    if (name == NULL) {
db72fc72f87b 8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents: 23010
diff changeset
   381
        (*env)->ExceptionClear(env);
db72fc72f87b 8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents: 23010
diff changeset
   382
        JNU_ThrowOutOfMemoryError(env, "Could not create printer name");
db72fc72f87b 8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents: 23010
diff changeset
   383
        return NULL;
db72fc72f87b 8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents: 23010
diff changeset
   384
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
    // NOTE: cupsGetPPD returns a pointer to a filename of a temporary file.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
    // unlink() must be called to remove the file after using it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
    filename = j2d_cupsGetPPD(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
    (*env)->ReleaseStringUTFChars(env, printer, name);
24130
db72fc72f87b 8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents: 23010
diff changeset
   390
    CHECK_NULL_RETURN(filename, NULL);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
    if ((ppd = j2d_ppdOpenFile(filename)) == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
        unlink(filename);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
        DPRINTF("unable to open PPD  %s\n", filename)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
        return NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
    option = j2d_ppdFindOption(ppd, "PageSize");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
    if (option != NULL && option->num_choices > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
        // create array of dimensions - (num_choices * 6)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
        //to cover length & height
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
        DPRINTF( "CUPSfuncs::option->num_choices %d\n", option->num_choices)
25555
b70a66b5b942 7067052: Default printer media is ignored
jgodinez
parents: 24130
diff changeset
   401
        // +1 is for storing the default media index
b70a66b5b942 7067052: Default printer media is ignored
jgodinez
parents: 24130
diff changeset
   402
        sizeArray = (*env)->NewFloatArray(env, option->num_choices*6+1);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
        if (sizeArray == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
            unlink(filename);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
            j2d_ppdClose(ppd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
            DPRINTF("CUPSfuncs::bad alloc new float array\n", "")
24130
db72fc72f87b 8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents: 23010
diff changeset
   407
            (*env)->ExceptionClear(env);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
            JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
            return NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
        dims = (*env)->GetFloatArrayElements(env, sizeArray, NULL);
24130
db72fc72f87b 8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents: 23010
diff changeset
   413
        if (dims == NULL) {
db72fc72f87b 8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents: 23010
diff changeset
   414
            unlink(filename);
db72fc72f87b 8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents: 23010
diff changeset
   415
            j2d_ppdClose(ppd);
db72fc72f87b 8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents: 23010
diff changeset
   416
            (*env)->ExceptionClear(env);
db72fc72f87b 8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents: 23010
diff changeset
   417
            JNU_ThrowOutOfMemoryError(env, "Could not create printer name");
db72fc72f87b 8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents: 23010
diff changeset
   418
            return NULL;
db72fc72f87b 8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents: 23010
diff changeset
   419
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
        for (i = 0; i<option->num_choices; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
            choice = (option->choices)+i;
25555
b70a66b5b942 7067052: Default printer media is ignored
jgodinez
parents: 24130
diff changeset
   422
            // get the index of the default page
b70a66b5b942 7067052: Default printer media is ignored
jgodinez
parents: 24130
diff changeset
   423
            if (!strcmp(choice->choice, option->defchoice)) {
b70a66b5b942 7067052: Default printer media is ignored
jgodinez
parents: 24130
diff changeset
   424
                dims[option->num_choices*6] = (float)i;
b70a66b5b942 7067052: Default printer media is ignored
jgodinez
parents: 24130
diff changeset
   425
            }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
            size = j2d_ppdPageSize(ppd, choice->choice);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
            if (size != NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
                // paper width and height
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
                dims[i*6] = size->width;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
                dims[(i*6)+1] = size->length;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
                // paper printable area
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
                dims[(i*6)+2] = size->left;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
                dims[(i*6)+3] = size->top;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
                dims[(i*6)+4] = size->right;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
                dims[(i*6)+5] = size->bottom;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
        (*env)->ReleaseFloatArrayElements(env, sizeArray, dims, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
    j2d_ppdClose(ppd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
    unlink(filename);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
    return sizeArray;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
}
25774
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   446
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   447
/*
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   448
 * Populates the supplied ArrayList<Integer> with resolutions.
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   449
 * The first pair of elements will be the default resolution.
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   450
 * If resolution isn't supported the list will be empty.
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   451
 * If needed we can add a 2nd ArrayList<String> which would
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   452
 * be populated with the corresponding UI name.
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   453
 * PPD specifies the syntax for resolution as either "Ndpi" or "MxNdpi",
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   454
 * eg 300dpi or 600x600dpi. The former is a shorthand where xres==yres.
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   455
 * We will always expand to the latter as we use a single array list.
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   456
 * Note: getMedia() and getPageSizes() both open the ppd file
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   457
 * This is not going to scale forever so if we add anymore we
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   458
 * should look to consolidate this.
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   459
 */
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   460
JNIEXPORT void JNICALL
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   461
Java_sun_print_CUPSPrinter_getResolutions(JNIEnv *env,
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   462
                                          jobject printObj,
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   463
                                          jstring printer,
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   464
                                          jobject arrayList)
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   465
{
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   466
    ppd_file_t *ppd = NULL;
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   467
    ppd_option_t *resolution;
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   468
    int defx = 0, defy = 0;
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   469
    int resx = 0, resy = 0;
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   470
    jclass intCls, cls;
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   471
    jmethodID intCtr, arrListAddMID;
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   472
    int i;
39025
bbc996c042d3 8074829: Resolve disabled warnings for libawt_headless
aghaisas
parents: 36470
diff changeset
   473
    const char *name = NULL;
bbc996c042d3 8074829: Resolve disabled warnings for libawt_headless
aghaisas
parents: 36470
diff changeset
   474
    const char *filename = NULL;
25774
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   475
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   476
    intCls = (*env)->FindClass(env, "java/lang/Integer");
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   477
    CHECK_NULL(intCls);
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   478
    intCtr = (*env)->GetMethodID(env, intCls, "<init>", "(I)V");
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   479
    CHECK_NULL(intCtr);
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   480
    cls = (*env)->FindClass(env, "java/util/ArrayList");
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   481
    CHECK_NULL(cls);
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   482
    arrListAddMID =
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   483
        (*env)->GetMethodID(env, cls, "add", "(Ljava/lang/Object;)Z");
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   484
    CHECK_NULL(arrListAddMID);
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   485
39025
bbc996c042d3 8074829: Resolve disabled warnings for libawt_headless
aghaisas
parents: 36470
diff changeset
   486
    name = (*env)->GetStringUTFChars(env, printer, NULL);
25774
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   487
    if (name == NULL) {
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   488
        (*env)->ExceptionClear(env);
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   489
        JNU_ThrowOutOfMemoryError(env, "Could not create printer name");
26354
2d04e6c7ed68 8055201: JNI exception pending in jdk/src/solaris/native/sun/awt/CUPSfuncs.c
prr
parents: 25859
diff changeset
   490
        return;
25774
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   491
    }
39025
bbc996c042d3 8074829: Resolve disabled warnings for libawt_headless
aghaisas
parents: 36470
diff changeset
   492
25774
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   493
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   494
    // NOTE: cupsGetPPD returns a pointer to a filename of a temporary file.
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   495
    // unlink() must be called to remove the file after using it.
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   496
    filename = j2d_cupsGetPPD(name);
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   497
    (*env)->ReleaseStringUTFChars(env, printer, name);
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   498
    CHECK_NULL(filename);
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   499
    if ((ppd = j2d_ppdOpenFile(filename)) == NULL) {
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   500
        unlink(filename);
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   501
        DPRINTF("unable to open PPD  %s\n", filename)
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   502
    }
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   503
    resolution = j2d_ppdFindOption(ppd, "Resolution");
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   504
    if (resolution != NULL) {
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   505
        int matches = sscanf(resolution->defchoice, "%dx%ddpi", &defx, &defy);
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   506
        if (matches == 2) {
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   507
           if (defx <= 0 || defy <= 0) {
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   508
              defx = 0;
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   509
              defy = 0;
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   510
           }
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   511
        } else {
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   512
            matches = sscanf(resolution->defchoice, "%ddpi", &defx);
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   513
            if (matches == 1) {
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   514
                if (defx <= 0) {
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   515
                   defx = 0;
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   516
                } else {
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   517
                   defy = defx;
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   518
                }
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   519
            }
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   520
        }
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   521
        if (defx > 0) {
26354
2d04e6c7ed68 8055201: JNI exception pending in jdk/src/solaris/native/sun/awt/CUPSfuncs.c
prr
parents: 25859
diff changeset
   522
          jobject rxObj, ryObj;
2d04e6c7ed68 8055201: JNI exception pending in jdk/src/solaris/native/sun/awt/CUPSfuncs.c
prr
parents: 25859
diff changeset
   523
          rxObj = (*env)->NewObject(env, intCls, intCtr, defx);
2d04e6c7ed68 8055201: JNI exception pending in jdk/src/solaris/native/sun/awt/CUPSfuncs.c
prr
parents: 25859
diff changeset
   524
          CHECK_NULL(rxObj);
2d04e6c7ed68 8055201: JNI exception pending in jdk/src/solaris/native/sun/awt/CUPSfuncs.c
prr
parents: 25859
diff changeset
   525
          ryObj = (*env)->NewObject(env, intCls, intCtr, defy);
2d04e6c7ed68 8055201: JNI exception pending in jdk/src/solaris/native/sun/awt/CUPSfuncs.c
prr
parents: 25859
diff changeset
   526
          CHECK_NULL(ryObj);
25774
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   527
          (*env)->CallBooleanMethod(env, arrayList, arrListAddMID, rxObj);
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   528
          (*env)->CallBooleanMethod(env, arrayList, arrListAddMID, ryObj);
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   529
        }
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   530
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   531
        for (i = 0; i < resolution->num_choices; i++) {
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   532
            char *resStr = resolution->choices[i].choice;
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   533
            int matches = sscanf(resStr, "%dx%ddpi", &resx, &resy);
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   534
            if (matches == 2) {
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   535
               if (resx <= 0 || resy <= 0) {
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   536
                  resx = 0;
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   537
                  resy = 0;
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   538
               }
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   539
            } else {
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   540
                matches = sscanf(resStr, "%ddpi", &resx);
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   541
                if (matches == 1) {
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   542
                    if (resx <= 0) {
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   543
                       resx = 0;
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   544
                    } else {
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   545
                       resy = resx;
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   546
                    }
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   547
                }
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   548
            }
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   549
            if (resx > 0 && (resx != defx || resy != defy )) {
26354
2d04e6c7ed68 8055201: JNI exception pending in jdk/src/solaris/native/sun/awt/CUPSfuncs.c
prr
parents: 25859
diff changeset
   550
              jobject rxObj, ryObj;
2d04e6c7ed68 8055201: JNI exception pending in jdk/src/solaris/native/sun/awt/CUPSfuncs.c
prr
parents: 25859
diff changeset
   551
              rxObj = (*env)->NewObject(env, intCls, intCtr, resx);
2d04e6c7ed68 8055201: JNI exception pending in jdk/src/solaris/native/sun/awt/CUPSfuncs.c
prr
parents: 25859
diff changeset
   552
              CHECK_NULL(rxObj);
2d04e6c7ed68 8055201: JNI exception pending in jdk/src/solaris/native/sun/awt/CUPSfuncs.c
prr
parents: 25859
diff changeset
   553
              ryObj = (*env)->NewObject(env, intCls, intCtr, resy);
2d04e6c7ed68 8055201: JNI exception pending in jdk/src/solaris/native/sun/awt/CUPSfuncs.c
prr
parents: 25859
diff changeset
   554
              CHECK_NULL(ryObj);
25774
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   555
              (*env)->CallBooleanMethod(env, arrayList, arrListAddMID, rxObj);
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   556
              (*env)->CallBooleanMethod(env, arrayList, arrListAddMID, ryObj);
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   557
            }
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   558
        }
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   559
    }
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   560
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   561
    j2d_ppdClose(ppd);
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   562
    unlink(filename);
21b78da4b2df 8048328: CUPS Printing does not report supported printer resolutions.
prr
parents: 25555
diff changeset
   563
}