[gtk/wip/baedert/for-master: 12/12] Build print backends with common_cflags
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/baedert/for-master: 12/12] Build print backends with common_cflags
- Date: Mon, 18 May 2020 11:44:53 +0000 (UTC)
commit d4cfb91bbd4972238bae666c8fd6f82e56b11b21
Author: Timm Bäder <mail baedert org>
Date: Mon May 18 13:41:19 2020 +0200
Build print backends with common_cflags
gtk/gtkprinteroption.c | 4 +--
gtk/gtkprinteroption.h | 12 +++----
modules/printbackends/gtkcupssecretsutils.c | 18 ++++++++---
modules/printbackends/gtkcupsutils.c | 13 ++++----
modules/printbackends/gtkprintbackendcups.c | 50 ++++++++++++++---------------
modules/printbackends/gtkprintbackendfile.c | 26 ++++++++-------
testsuite/gtk/treeview.c | 2 +-
7 files changed, 68 insertions(+), 57 deletions(-)
---
diff --git a/gtk/gtkprinteroption.c b/gtk/gtkprinteroption.c
index a2be4402df..3844fad593 100644
--- a/gtk/gtkprinteroption.c
+++ b/gtk/gtkprinteroption.c
@@ -248,8 +248,8 @@ gtk_printer_option_allocate_choices (GtkPrinterOption *option,
void
gtk_printer_option_choices_from_array (GtkPrinterOption *option,
int num_choices,
- char *choices[],
- char *choices_display[])
+ const char **choices,
+ const char **choices_display)
{
int i;
diff --git a/gtk/gtkprinteroption.h b/gtk/gtkprinteroption.h
index 4ffaff2f33..8a1111e503 100644
--- a/gtk/gtkprinteroption.h
+++ b/gtk/gtkprinteroption.h
@@ -20,7 +20,7 @@
#define __GTK_PRINTER_OPTION_H__
/* This is a "semi-private" header; it is meant only for
- * alternate GtkPrintDialog backend modules; no stability guarantees
+ * alternate GtkPrintDialog backend modules; no stability guarantees
* are made at this point
*/
#ifndef GTK_PRINT_BACKEND_ENABLE_UNSUPPORTED
@@ -64,11 +64,11 @@ struct _GtkPrinterOption
GtkPrinterOptionType type;
char *value;
-
+
int num_choices;
char **choices;
char **choices_display;
-
+
gboolean activates_default;
gboolean has_conflict;
@@ -111,9 +111,9 @@ void gtk_printer_option_allocate_choices (GtkPrinterOption
int num);
GDK_AVAILABLE_IN_ALL
void gtk_printer_option_choices_from_array (GtkPrinterOption *option,
- int num_choices,
- char *choices[],
- char *choices_display[]);
+ int num_choices,
+ const char **choices,
+ const char **choices_display);
GDK_AVAILABLE_IN_ALL
gboolean gtk_printer_option_has_choice (GtkPrinterOption *option,
const char *choice);
diff --git a/modules/printbackends/gtkcupssecretsutils.c b/modules/printbackends/gtkcupssecretsutils.c
index a25285a25d..4a9b447bd9 100644
--- a/modules/printbackends/gtkcupssecretsutils.c
+++ b/modules/printbackends/gtkcupssecretsutils.c
@@ -61,8 +61,8 @@ typedef struct
*/
static GVariant *
create_attributes (const gchar *printer_uri,
- gchar **additional_attrs,
- gchar **additional_labels)
+ const char **additional_attrs,
+ const char **additional_labels)
{
GVariantBuilder *attr_builder = NULL;
GVariant *ret = NULL;
@@ -276,7 +276,7 @@ do_store_auth_info (GTask *task)
GVariant *attributes = NULL,
*properties = NULL,
*secret = NULL;
- gchar **additional_attrs = NULL,
+ const char **additional_attrs = NULL,
**additional_labels = NULL,
*password = NULL;
SecretsServiceData *task_data = g_task_get_task_data (task);
@@ -287,8 +287,8 @@ do_store_auth_info (GTask *task)
length = g_strv_length (task_data->auth_info_labels);
- additional_attrs = g_new0 (gchar *, length + 1);
- additional_labels = g_new0 (gchar *, length + 1);
+ additional_attrs = g_new0 (const char *, length + 1);
+ additional_labels = g_new0 (const char *, length + 1);
/* The labels user and server are chosen to be compatible with
the attributes used by system-config-printer */
for (i = 0; task_data->auth_info_labels[i] != NULL; i++)
@@ -420,6 +420,8 @@ prompt_completed_cb (GDBusConnection *connection,
get_secret_cb,
task);
break;
+ default:
+ ;
}
}
@@ -521,6 +523,8 @@ unlock_collection_cb (GObject *source_object,
get_secret_cb,
task);
break;
+ default:
+ ;
}
}
g_variant_unref (output);
@@ -656,6 +660,8 @@ item_proxy_cb (GObject *source_object,
get_secret_cb,
task);
break;
+ default:
+ ;
}
}
@@ -826,6 +832,8 @@ open_session_cb (GObject *source_object,
task);
break;
}
+ default:
+ ;
}
}
diff --git a/modules/printbackends/gtkcupsutils.c b/modules/printbackends/gtkcupsutils.c
index 723923b10a..f5a7f8dd59 100644
--- a/modules/printbackends/gtkcupsutils.c
+++ b/modules/printbackends/gtkcupsutils.c
@@ -81,13 +81,13 @@ static GtkCupsRequestStateFunc get_states[] = {
_get_read_data
};
-static void
+static void G_GNUC_PRINTF (5, 6)
gtk_cups_result_set_error (GtkCupsResult *result,
GtkCupsErrorType error_type,
int error_status,
- int error_code,
+ int error_code,
const char *error_msg,
- ...)
+ ...)
{
va_list args;
@@ -476,7 +476,7 @@ gtk_cups_request_encode_option (GtkCupsRequest *request,
}
}
- switch (option_tag)
+ switch ((guint)option_tag)
{
case IPP_TAG_INTEGER:
case IPP_TAG_ENUM:
@@ -1430,11 +1430,12 @@ _get_read_data (GtkCupsRequest *request)
{
request->state = GTK_CUPS_GET_DONE;
request->poll_state = GTK_CUPS_HTTP_IDLE;
-
+
gtk_cups_result_set_error (request->result,
GTK_CUPS_ERROR_IO,
io_status,
- error->code,
+ error->code,
+ "%s",
error->message);
g_error_free (error);
}
diff --git a/modules/printbackends/gtkprintbackendcups.c b/modules/printbackends/gtkprintbackendcups.c
index 110658fe31..fe6150e165 100644
--- a/modules/printbackends/gtkprintbackendcups.c
+++ b/modules/printbackends/gtkprintbackendcups.c
@@ -156,8 +156,6 @@ struct _GtkPrintBackendCups
static GObjectClass *backend_parent_class;
-static void gtk_print_backend_cups_class_init (GtkPrintBackendCupsClass
*class);
-static void gtk_print_backend_cups_init (GtkPrintBackendCups *impl);
static void gtk_print_backend_cups_finalize (GObject
*object);
static void gtk_print_backend_cups_dispose (GObject
*object);
static void cups_get_printer_list (GtkPrintBackend
*print_backend);
@@ -261,7 +259,7 @@ char **
g_io_module_query (void)
{
char *eps[] = {
- GTK_PRINT_BACKEND_EXTENSION_POINT_NAME,
+ (char *)GTK_PRINT_BACKEND_EXTENSION_POINT_NAME,
NULL
};
@@ -5363,8 +5361,8 @@ format_ipp_choice (const gchar *ipp_choice)
* if available.
*/
static GtkPrinterOption *
-setup_ipp_option (gchar *ipp_option_name,
- gchar *ipp_choice_default,
+setup_ipp_option (const char *ipp_option_name,
+ const char *ipp_choice_default,
GList *ipp_choices,
GtkPrinterOptionSet *set)
{
@@ -5422,16 +5420,16 @@ setup_ipp_option (gchar *ipp_option_name,
{
gtk_printer_option_choices_from_array (option,
length,
- choices,
- choices_display);
+ (const char **)choices,
+ (const char **)choices_display);
}
option_set_is_ipp_option (option, TRUE);
gtk_printer_option_set_add (set, option);
- g_free (choices);
- g_free (choices_display);
+ g_strfreev (choices);
+ g_strfreev (choices_display);
}
/* The option exists. Set its default value if available. */
@@ -5454,21 +5452,21 @@ cups_printer_get_options (GtkPrinter *printer,
GtkPrinterOption *option;
ppd_file_t *ppd_file;
int i;
- char *print_at[] = { "now", "at", "on-hold" };
- char *n_up[] = {"1", "2", "4", "6", "9", "16" };
- char *prio[] = {"100", "80", "50", "30" };
+ const char *print_at[] = { "now", "at", "on-hold" };
+ const char *n_up[] = {"1", "2", "4", "6", "9", "16" };
+ const char *prio[] = {"100", "80", "50", "30" };
/* Translators: These strings name the possible values of the
* job priority option in the print dialog
*/
- char *prio_display[] = {N_("Urgent"), N_("High"), N_("Medium"), N_("Low") };
- char *n_up_layout[] = { "lrtb", "lrbt", "rltb", "rlbt", "tblr", "tbrl", "btlr", "btrl" };
+ const char *prio_display[] = {N_("Urgent"), N_("High"), N_("Medium"), N_("Low") };
+ const char *n_up_layout[] = { "lrtb", "lrbt", "rltb", "rlbt", "tblr", "tbrl", "btlr", "btrl" };
/* Translators: These strings name the possible arrangements of
* multiple pages on a sheet when printing
*/
- char *n_up_layout_display[] = { N_("Left to right, top to bottom"), N_("Left to right, bottom to top"),
- N_("Right to left, top to bottom"), N_("Right to left, bottom to top"),
- N_("Top to bottom, left to right"), N_("Top to bottom, right to left"),
- N_("Bottom to top, left to right"), N_("Bottom to top, right to left") };
+ const char *n_up_layout_display[] = { N_("Left to right, top to bottom"), N_("Left to right, bottom to
top"),
+ N_("Right to left, top to bottom"), N_("Right to left, bottom to
top"),
+ N_("Top to bottom, left to right"), N_("Top to bottom, right to
left"),
+ N_("Bottom to top, left to right"), N_("Bottom to top, right to
left") };
char *name;
int num_opts;
cups_option_t *opts = NULL;
@@ -5512,7 +5510,7 @@ cups_printer_get_options (GtkPrinter *printer,
if (backend != NULL && printer != NULL)
{
- char *cover_default[] = {
+ const char *cover_default[] = {
"none",
"classified",
"confidential",
@@ -5521,7 +5519,7 @@ cups_printer_get_options (GtkPrinter *printer,
"topsecret",
"unclassified"
};
- char *cover_display_default[] = {
+ const char *cover_display_default[] = {
/* Translators, these strings are names for various 'standard' cover
* pages that the printing system may support.
*/
@@ -5537,7 +5535,7 @@ cups_printer_get_options (GtkPrinter *printer,
char **cover_display = NULL;
char **cover_display_translated = NULL;
gint num_of_covers = 0;
- gpointer value;
+ gconstpointer value;
gint j;
/* Translators, this string is used to label the pages-per-sheet option
@@ -5604,7 +5602,7 @@ cups_printer_get_options (GtkPrinter *printer,
*/
option = gtk_printer_option_new ("gtk-cover-before", C_("printer option", "Before"),
GTK_PRINTER_OPTION_TYPE_PICKONE);
gtk_printer_option_choices_from_array (option, num_of_covers,
- cover, cover_display_translated);
+ (const char **)cover, (const char **)cover_display_translated);
if (cups_printer->default_cover_before != NULL)
gtk_printer_option_set (option, cups_printer->default_cover_before);
@@ -5619,7 +5617,7 @@ cups_printer_get_options (GtkPrinter *printer,
*/
option = gtk_printer_option_new ("gtk-cover-after", C_("printer option", "After"),
GTK_PRINTER_OPTION_TYPE_PICKONE);
gtk_printer_option_choices_from_array (option, num_of_covers,
- cover, cover_display_translated);
+ (const char **)cover, (const char **)cover_display_translated);
if (cups_printer->default_cover_after != NULL)
gtk_printer_option_set (option, cups_printer->default_cover_after);
else
@@ -6538,8 +6536,6 @@ cups_printer_prepare_for_print (GtkPrinter *printer,
switch (gtk_page_setup_get_orientation (page_setup))
{
- case GTK_PAGE_ORIENTATION_PORTRAIT:
- break;
case GTK_PAGE_ORIENTATION_LANDSCAPE:
if (layout < 4)
layout = layout + 2 + 4 * (1 - layout / 2);
@@ -6555,6 +6551,10 @@ cups_printer_prepare_for_print (GtkPrinter *printer,
else
layout = layout - 6 + 4 * (1 - (layout - 4) / 2);
break;
+
+ case GTK_PAGE_ORIENTATION_PORTRAIT:
+ default:
+ break;
}
enum_class = g_type_class_ref (GTK_TYPE_NUMBER_UP_LAYOUT);
diff --git a/modules/printbackends/gtkprintbackendfile.c b/modules/printbackends/gtkprintbackendfile.c
index 3f0b18c252..071ebec359 100644
--- a/modules/printbackends/gtkprintbackendfile.c
+++ b/modules/printbackends/gtkprintbackendfile.c
@@ -74,8 +74,6 @@ static const gchar* formats[N_FORMATS] =
static GObjectClass *backend_parent_class;
-static void gtk_print_backend_file_class_init (GtkPrintBackendFileClass *class);
-static void gtk_print_backend_file_init (GtkPrintBackendFile *impl);
static void file_printer_get_settings_from_options (GtkPrinter *printer,
GtkPrinterOptionSet *options,
GtkPrintSettings *settings);
@@ -126,7 +124,7 @@ char **
g_io_module_query (void)
{
char *eps[] = {
- GTK_PRINT_BACKEND_EXTENSION_POINT_NAME,
+ (char *)GTK_PRINT_BACKEND_EXTENSION_POINT_NAME,
NULL
};
@@ -217,6 +215,7 @@ output_file_from_settings (GtkPrintSettings *settings,
switch (format)
{
default:
+ case N_FORMATS:
case FORMAT_PDF:
extension = "pdf";
break;
@@ -333,6 +332,7 @@ file_printer_create_cairo_surface (GtkPrinter *printer,
switch (format)
{
default:
+ case N_FORMATS:
case FORMAT_PDF:
surface = cairo_pdf_surface_create_for_stream (_cairo_write, cache_io, width, height);
break;
@@ -632,14 +632,14 @@ file_printer_get_options (GtkPrinter *printer,
{
GtkPrinterOptionSet *set;
GtkPrinterOption *option;
- const gchar *n_up[] = {"1", "2", "4", "6", "9", "16" };
- const gchar *pages_per_sheet = NULL;
- const gchar *format_names[N_FORMATS] = { N_("PDF"), N_("PostScript"), N_("SVG") };
- const gchar *supported_formats[N_FORMATS];
- gchar *display_format_names[N_FORMATS];
+ const char *n_up[] = {"1", "2", "4", "6", "9", "16" };
+ const char *pages_per_sheet = NULL;
+ const char *format_names[N_FORMATS] = { N_("PDF"), N_("PostScript"), N_("SVG") };
+ const char *supported_formats[N_FORMATS];
+ const char *display_format_names[N_FORMATS];
gint n_formats = 0;
OutputFormat format;
- gchar *uri;
+ char *uri;
gint current_format = 0;
_OutputFormatChangedData *format_changed_data;
@@ -649,7 +649,7 @@ file_printer_get_options (GtkPrinter *printer,
option = gtk_printer_option_new ("gtk-n-up", _("Pages per _sheet:"), GTK_PRINTER_OPTION_TYPE_PICKONE);
gtk_printer_option_choices_from_array (option, G_N_ELEMENTS (n_up),
- (char **) n_up, (char **) n_up /* FIXME i18n (localised digits)! */);
+ n_up, n_up /* FIXME i18n (localised digits)! */);
if (settings)
pages_per_sheet = gtk_print_settings_get (settings, GTK_PRINT_SETTINGS_NUMBER_UP);
if (pages_per_sheet)
@@ -686,6 +686,7 @@ file_printer_get_options (GtkPrinter *printer,
switch (format)
{
default:
+ case N_FORMATS:
case FORMAT_PDF:
current_format = FORMAT_PDF;
break;
@@ -721,8 +722,8 @@ file_printer_get_options (GtkPrinter *printer,
option->group = g_strdup ("GtkPrintDialogExtension");
gtk_printer_option_choices_from_array (option, n_formats,
- (char **) supported_formats,
- display_format_names);
+ supported_formats,
+ display_format_names);
gtk_printer_option_set (option, supported_formats[current_format]);
gtk_printer_option_set_add (set, option);
@@ -803,6 +804,7 @@ file_printer_prepare_for_print (GtkPrinter *printer,
switch (format)
{
case FORMAT_PDF:
+ case N_FORMATS:
gtk_print_job_set_rotate (print_job, FALSE);
break;
default:
diff --git a/testsuite/gtk/treeview.c b/testsuite/gtk/treeview.c
index c8b0a5fe14..dd36ec7eb1 100644
--- a/testsuite/gtk/treeview.c
+++ b/testsuite/gtk/treeview.c
@@ -280,7 +280,7 @@ test_selection_count (void)
g_object_unref (g_object_ref_sink (view));
}
-static void
+static void G_GNUC_NORETURN
abort_cb (GtkTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]