cups: Add hack to work around gcc warning

gcc warns if you switch on values that are not part of the enum you're
switching on. So handle those cases in the default handler by using if
statments.

PS: Someone file a bug against cups about this?
This commit is contained in:
Benjamin Otte 2010-10-18 19:08:55 +02:00
parent 176218c5a0
commit 9e91b6557a

View File

@ -846,9 +846,6 @@ request_password (gpointer data)
switch (dispatch->request->ipp_request->request.op.operation_id) switch (dispatch->request->ipp_request->request.op.operation_id)
{ {
case 0:
prompt = g_strdup_printf ( _("Authentication is required to get a file from %s"), hostname);
break;
case IPP_PRINT_JOB: case IPP_PRINT_JOB:
if (job_title != NULL && printer_name != NULL) if (job_title != NULL && printer_name != NULL)
prompt = g_strdup_printf ( _("Authentication is required to print document '%s' on printer %s"), job_title, printer_name); prompt = g_strdup_printf ( _("Authentication is required to print document '%s' on printer %s"), job_title, printer_name);
@ -874,7 +871,11 @@ request_password (gpointer data)
prompt = g_strdup_printf ( _("Authentication is required to get printers from %s"), hostname); prompt = g_strdup_printf ( _("Authentication is required to get printers from %s"), hostname);
break; break;
default: default:
prompt = g_strdup_printf ( _("Authentication is required on %s"), hostname); /* work around gcc warning about 0 not being a value for this enum */
if (dispatch->request->ipp_request->request.op.operation_id == 0)
prompt = g_strdup_printf ( _("Authentication is required to get a file from %s"), hostname);
else
prompt = g_strdup_printf ( _("Authentication is required on %s"), hostname);
break; break;
} }