]> saetta.ns0.it Git - reptool/libreptool/commitdiff
Use of g_strcmp0 instead of strcmp.
authorAndrea Zagli <azagli@libero.it>
Sat, 21 Jan 2017 10:56:05 +0000 (11:56 +0100)
committerAndrea Zagli <azagli@libero.it>
Sat, 21 Jan 2017 10:56:05 +0000 (11:56 +0100)
src/rptobjectellipse.c
src/rptobjectimage.c
src/rptobjectline.c
src/rptobjectrect.c
src/rptobjecttext.c
src/rptprint.c

index 42a5ebd40c222d552b8c09efab1bff2715ac3e12..63ee2b07868605164784d28f9cc9cab77096808c 100644 (file)
@@ -5,12 +5,12 @@
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
- * 
+ *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
@@ -109,7 +109,7 @@ RptObject
 
        gchar *name_ = g_strstrip (g_strdup (name));
 
-       if (strcmp (name_, "") != 0)
+       if (g_strcmp0 (name_, "") != 0)
                {
                        rpt_obj_ellipse = RPT_OBJECT (g_object_new (rpt_obj_ellipse_get_type (), NULL));
 
@@ -135,7 +135,7 @@ RptObject
        RptObject *rpt_obj_ellipse = NULL;
 
        name = g_strdup ((gchar *)xmlGetProp (xnode, "name"));
-       if (name != NULL && strcmp (g_strstrip (name), "") != 0)
+       if (name != NULL && g_strcmp0 (g_strstrip (name), "") != 0)
                {
                        RptPoint *position;
                        RptObjEllipsePrivate *priv;
index c2a3224bd3e4682b244f1cacbd9dc54c96ad7aab..3c61164a97773e1ad1d97eff8b4fe402b9b237c4 100644 (file)
@@ -5,12 +5,12 @@
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
- * 
+ *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
@@ -153,7 +153,7 @@ RptObject
 
        gchar *name_ = g_strstrip (g_strdup (name));
 
-       if (strcmp (name_, "") != 0)
+       if (g_strcmp0 (name_, "") != 0)
                {
                        rpt_obj_image = RPT_OBJECT (g_object_new (rpt_obj_image_get_type (), NULL));
 
@@ -179,7 +179,7 @@ RptObject
        RptObject *rpt_obj_image = NULL;
 
        name = g_strdup ((gchar *)xmlGetProp (xnode, "name"));
-       if (name != NULL && strcmp (g_strstrip (name), "") != 0)
+       if (name != NULL && g_strcmp0 (g_strstrip (name), "") != 0)
                {
                        RptPoint *position;
                        RptObjImagePrivate *priv;
index 86d641f50300ef02bbedbc304101b7c704bd6d33..051ed608af16c601e210385e94dd8cc65d86f68a 100644 (file)
@@ -5,12 +5,12 @@
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
- * 
+ *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
@@ -137,7 +137,7 @@ RptObject
 
        gchar *name_ = g_strstrip (g_strdup (name));
 
-       if (strcmp (name_, "") != 0)
+       if (g_strcmp0 (name_, "") != 0)
                {
                        rpt_obj_line = RPT_OBJECT (g_object_new (rpt_obj_line_get_type (), NULL));
 
@@ -163,7 +163,7 @@ RptObject
        RptObject *rpt_obj_line = NULL;
 
        name = g_strdup ((gchar *)xmlGetProp (xnode, "name"));
-       if (name != NULL && strcmp (g_strstrip (name), "") != 0)
+       if (name != NULL && g_strcmp0 (g_strstrip (name), "") != 0)
                {
                        RptPoint *position;
                        RptObjLinePrivate *priv;
index 57092170ad37cfb77c9e63ef5e9783e19a7f7b61..b8b94545b902e170186f317fc629375c04e362ff 100644 (file)
@@ -5,12 +5,12 @@
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
- * 
+ *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
@@ -118,7 +118,7 @@ RptObject
 
        gchar *name_ = g_strstrip (g_strdup (name));
 
-       if (strcmp (name_, "") != 0)
+       if (g_strcmp0 (name_, "") != 0)
                {
                        rpt_obj_rect = RPT_OBJECT (g_object_new (rpt_obj_rect_get_type (), NULL));
 
@@ -144,7 +144,7 @@ RptObject
        RptObject *rpt_obj_rect = NULL;
 
        name = g_strdup ((gchar *)xmlGetProp (xnode, "name"));
-       if (name != NULL && strcmp (g_strstrip (name), "") != 0)
+       if (name != NULL && g_strcmp0 (g_strstrip (name), "") != 0)
                {
                        RptPoint *position;
                        RptObjRectPrivate *priv;
index a56e53cbec5587c1761bcad1c29f3862abdda8aa..1eba88e3e42fcbf3a6050c45f7bb6a48e1e3f6c7 100644 (file)
@@ -5,12 +5,12 @@
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
- * 
+ *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
@@ -210,7 +210,7 @@ RptObject
 
        gchar *name_ = g_strstrip (g_strdup (name));
 
-       if (strcmp (name_, "") != 0)
+       if (g_strcmp0 (name_, "") != 0)
                {
                        rpt_obj_text = RPT_OBJECT (g_object_new (rpt_obj_text_get_type (), NULL));
 
@@ -237,7 +237,7 @@ RptObject
        RptObject *rpt_obj_text = NULL;
 
        name = (gchar *)xmlGetProp (xnode, "name");
-       if (name != NULL && strcmp (g_strstrip (name), "") != 0)
+       if (name != NULL && g_strcmp0 (g_strstrip (name), "") != 0)
                {
                        RptPoint *position;
                        RptObjTextPrivate *priv;
index 06b7b2baad0c9e184357493d98398ea9eba79be3..ab613b511ff596a08fc969b08955a76a3fd302ca 100644 (file)
@@ -5,12 +5,12 @@
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
- * 
+ *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
@@ -90,7 +90,7 @@ static void rpt_print_rotate (RptPrint *rpt_print,
                               gdouble angle);
 
 
-static void rpt_print_gtk_begin_print (GtkPrintOperation *operation, 
+static void rpt_print_gtk_begin_print (GtkPrintOperation *operation,
                                        GtkPrintContext *context,
                                        gpointer user_data);
 static void rpt_print_gtk_request_page_setup (GtkPrintOperation *operation,
@@ -228,7 +228,7 @@ RptPrint
        xmlNode *cur = xmlDocGetRootElement (xdoc);
        if (cur != NULL)
                {
-                       if (strcmp (cur->name, "reptool_report") == 0)
+                       if (g_strcmp0 (cur->name, "reptool_report") == 0)
                                {
                                        RptPrintPrivate *priv;
 
@@ -530,7 +530,7 @@ rpt_print_print (RptPrint *rpt_print, GtkWindow *transient)
                }
        else
                {
-                       if (strcmp (g_strstrip (priv->output_filename), "") == 0)
+                       if (g_strcmp0 (g_strstrip (priv->output_filename), "") == 0)
                                {
                                        switch (priv->output_type)
                                                {
@@ -562,7 +562,7 @@ rpt_print_print (RptPrint *rpt_print, GtkWindow *transient)
                        for (npage = 0; npage < priv->pages->nodeNr; npage++)
                                {
                                        cur = priv->pages->nodeTab[npage];
-                                       if (strcmp (cur->name, "page") == 0)
+                                       if (g_strcmp0 (cur->name, "page") == 0)
                                                {
                                                        rpt_print_get_xml_page_attributes (rpt_print, cur);
                                                        if (priv->width != 0 && priv->height != 0)
@@ -620,7 +620,7 @@ rpt_print_print (RptPrint *rpt_print, GtkWindow *transient)
                                                                                                        if (priv->output_type == RPT_OUTPUT_PNG)
                                                                                                                {
                                                                                                                        gchar *new_out_filename = rpt_print_new_numbered_filename (priv->output_filename, npage + 1);
-                                                                                                               
+
                                                                                                                        cairo_surface_write_to_png (priv->surface,
                                                                                                                                                    new_out_filename);
                                                                                                                        cairo_surface_destroy (priv->surface);
@@ -834,7 +834,7 @@ rpt_print_page (RptPrint *rpt_print, xmlNode *xnode)
                                {
                                        prop = (gchar *)xmlGetProp (cur, "visible");
                                        if (prop != NULL
-                                           && strcmp (g_strstrip (prop), "y") == 0)
+                                           && g_strcmp0 (g_strstrip (prop), "y") == 0)
                                                {
                                                        cairo_save (priv->cr);
                                                        if (g_strcmp0 (cur->name, "text") == 0)
@@ -997,7 +997,7 @@ rpt_print_text_xml (RptPrint *rpt_print, xmlNode *xnode)
        if (font->strike)
                {
                        PangoAttribute *pattr;
-               
+
                        pattr = pango_attr_strikethrough_new (TRUE);
                        pattr->start_index = 0;
                        pattr->end_index = text->len + 1;
@@ -1353,7 +1353,7 @@ rpt_print_ellipse_xml (RptPrint *rpt_print, xmlNode *xnode)
                     rpt_common_value_to_points (priv->unit, size->height));
        cairo_arc (priv->cr, 0., 0., 1., 0., 2. * M_PI);
        cairo_restore (priv->cr);
-       
+
        if (prop != NULL && fill_color != NULL)
                {
                        cairo_set_source_rgba (priv->cr, fill_color->r, fill_color->g, fill_color->b, fill_color->a);
@@ -1424,23 +1424,23 @@ rpt_print_image_xml (RptPrint *rpt_print, xmlNode *xnode)
                }
 
        cairo_matrix_init_identity (&matrix);
-       if (strcmp (adapt, "none") != 0)
+       if (g_strcmp0 (adapt, "none") != 0)
                {
                        w = cairo_image_surface_get_width (image);
                        h = cairo_image_surface_get_height (image);
 
-                       if (strcmp (adapt, "to-box") == 0)
+                       if (g_strcmp0 (adapt, "to-box") == 0)
                                {
                                        cairo_matrix_scale (&matrix, w / rpt_common_value_to_points (priv->unit, size->width), h / rpt_common_value_to_points (priv->unit, size->height));
                                }
-                       else if (strcmp (adapt, "to-image") == 0)
+                       else if (g_strcmp0 (adapt, "to-image") == 0)
                                {
                                        size->width = rpt_common_points_to_value (priv->unit, (gdouble)w);
                                        size->height = rpt_common_points_to_value (priv->unit, (gdouble)h);
                                }
                }
        cairo_matrix_translate (&matrix, rpt_common_value_to_points (priv->unit, -position->x), rpt_common_value_to_points (priv->unit, -position->y));
-       
+
        cairo_pattern_set_matrix (pattern, &matrix);
        cairo_set_source (priv->cr, pattern);
 
@@ -1451,7 +1451,7 @@ rpt_print_image_xml (RptPrint *rpt_print, xmlNode *xnode)
        cairo_fill (priv->cr);
 
        rpt_print_border (rpt_print, position, size, border, rotation);
-       
+
        cairo_pattern_destroy (pattern);
        cairo_surface_destroy (image);
 
@@ -1637,7 +1637,7 @@ rpt_print_rotate (RptPrint *rpt_print, const RptPoint *position, const RptSize *
 }
 
 static void
-rpt_print_gtk_begin_print (GtkPrintOperation *operation, 
+rpt_print_gtk_begin_print (GtkPrintOperation *operation,
                            GtkPrintContext *context,
                            gpointer user_data)
 {