src/solaris/native/sun/awt/CUPSfuncs.c

Print this page

        

*** 347,357 **** option = j2d_ppdFindOption(ppd, "PageSize"); if (option != NULL && option->num_choices > 0) { // create array of dimensions - (num_choices * 6) //to cover length & height DPRINTF( "CUPSfuncs::option->num_choices %d\n", option->num_choices) ! sizeArray = (*env)->NewFloatArray(env, option->num_choices*6); if (sizeArray == NULL) { unlink(filename); j2d_ppdClose(ppd); DPRINTF("CUPSfuncs::bad alloc new float array\n", "") (*env)->ExceptionClear(env); --- 347,358 ---- option = j2d_ppdFindOption(ppd, "PageSize"); if (option != NULL && option->num_choices > 0) { // create array of dimensions - (num_choices * 6) //to cover length & height DPRINTF( "CUPSfuncs::option->num_choices %d\n", option->num_choices) ! // +1 is for storing the default media index ! sizeArray = (*env)->NewFloatArray(env, option->num_choices*6+1); if (sizeArray == NULL) { unlink(filename); j2d_ppdClose(ppd); DPRINTF("CUPSfuncs::bad alloc new float array\n", "") (*env)->ExceptionClear(env);
*** 367,376 **** --- 368,381 ---- JNU_ThrowOutOfMemoryError(env, "Could not create printer name"); return NULL; } for (i = 0; i<option->num_choices; i++) { choice = (option->choices)+i; + // get the index of the default page + if (!strcmp(choice->choice, option->defchoice)) { + dims[option->num_choices*6] = (float)i; + } size = j2d_ppdPageSize(ppd, choice->choice); if (size != NULL) { // paper width and height dims[i*6] = size->width; dims[(i*6)+1] = size->length;