aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlan Third2021-04-04 11:25:49 +0100
committerAlan Third2021-04-04 11:27:29 +0100
commit841b11ed0d534d707f54160f8c7efe3b883eb3ed (patch)
tree09b0fdf25d4761e276c7f88e6cb0e7d0c2c3ebc0 /src
parent44ed8f6555288f00b982f21e68ac5a51372279de (diff)
downloademacs-841b11ed0d534d707f54160f8c7efe3b883eb3ed.tar.gz
emacs-841b11ed0d534d707f54160f8c7efe3b883eb3ed.zip
Fix warnings in image.c
* src/image.c (svg_load_image): Fix types and move declaration of 'css' to the top of the function.
Diffstat (limited to 'src')
-rw-r--r--src/image.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/image.c b/src/image.c
index 13bd503e535..08e937e501f 100644
--- a/src/image.c
+++ b/src/image.c
@@ -9917,6 +9917,10 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
9917 char *wrapped_contents = NULL; 9917 char *wrapped_contents = NULL;
9918 ptrdiff_t wrapped_size; 9918 ptrdiff_t wrapped_size;
9919 9919
9920#if LIBRSVG_CHECK_VERSION (2, 48, 0)
9921 char *css = NULL;
9922#endif
9923
9920#if ! GLIB_CHECK_VERSION (2, 36, 0) 9924#if ! GLIB_CHECK_VERSION (2, 36, 0)
9921 /* g_type_init is a glib function that must be called prior to 9925 /* g_type_init is a glib function that must be called prior to
9922 using gnome type library functions (obsolete since 2.36.0). */ 9926 using gnome type library functions (obsolete since 2.36.0). */
@@ -9944,16 +9948,15 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
9944 FRAME_DISPLAY_INFO (f)->resy); 9948 FRAME_DISPLAY_INFO (f)->resy);
9945 9949
9946#if LIBRSVG_CHECK_VERSION (2, 48, 0) 9950#if LIBRSVG_CHECK_VERSION (2, 48, 0)
9947 char *css;
9948 Lisp_Object lcss = image_spec_value (img->spec, QCcss, NULL); 9951 Lisp_Object lcss = image_spec_value (img->spec, QCcss, NULL);
9949 if (!STRINGP (lcss)) 9952 if (!STRINGP (lcss))
9950 { 9953 {
9951 /* Generate the CSS for the SVG image. */ 9954 /* Generate the CSS for the SVG image. */
9952 char *css_spec = "svg{font-family:\"%s\";font-size:%4dpx}"; 9955 const char *css_spec = "svg{font-family:\"%s\";font-size:%4dpx}";
9953 int css_len = strlen (css_spec) + strlen (img->face_font_family); 9956 int css_len = strlen (css_spec) + strlen (img->face_font_family);
9954 css = xmalloc (css_len); 9957 css = xmalloc (css_len);
9955 snprintf (css, css_len, css_spec, img->face_font_family, img->face_font_size); 9958 snprintf (css, css_len, css_spec, img->face_font_family, img->face_font_size);
9956 rsvg_handle_set_stylesheet (rsvg_handle, css, strlen (css), NULL); 9959 rsvg_handle_set_stylesheet (rsvg_handle, (guint8 *)css, strlen (css), NULL);
9957 } 9960 }
9958 else 9961 else
9959 { 9962 {
@@ -10141,7 +10144,7 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
10141 FRAME_DISPLAY_INFO (f)->resy); 10144 FRAME_DISPLAY_INFO (f)->resy);
10142 10145
10143#if LIBRSVG_CHECK_VERSION (2, 48, 0) 10146#if LIBRSVG_CHECK_VERSION (2, 48, 0)
10144 rsvg_handle_set_stylesheet (rsvg_handle, css, strlen (css), NULL); 10147 rsvg_handle_set_stylesheet (rsvg_handle, (guint8 *)css, strlen (css), NULL);
10145#endif 10148#endif
10146#else 10149#else
10147 /* Make a handle to a new rsvg object. */ 10150 /* Make a handle to a new rsvg object. */