Package list unrtf / debian/0.21.5-3 debian / patches / 0007-Improved-image-file-handling.patch
debian/0.21.5-3

Tree @debian/0.21.5-3 (Download .tar.gz)

0007-Improved-image-file-handling.patch @debian/0.21.5-3raw · history · blame

Description: Improved image file handling
 Improved code for creation of image files when RTF files containing
 images processed
Origin: backport, http://hg.savannah.gnu.org/hgweb/unrtf/raw-rev/ba40e844a32a,
 http://hg.savannah.gnu.org/hgweb/unrtf/raw-rev/0f3b6a2cc680
Forwarded: not-needed
Author: Salvatore Bonaccorso <carnil@debian.org>
Last-Update: 2015-01-26
Applied-Upstream: 0.21.7

--- a/src/convert.c
+++ b/src/convert.c
@@ -1876,6 +1876,17 @@ static int cmd_rtf (Word *w, int align,
 	return FALSE;
 }
 
+/*========================================================================
+ * Name:	cmd_shppict
+ * Purpose:	Executes the \shppict command.
+ * Args:	Word, paragraph align info, and numeric param if any.
+ * Returns:	Flag, true only if rest of Words on line should be ignored.
+ *=======================================================================*/
+
+static int cmd_shppict (Word *w, int align, char has_param, int param)
+{
+	return FALSE;
+}
 
 /*========================================================================
  * Name:	cmd_up
@@ -2311,7 +2322,28 @@ static int cmd_footerf (Word *w, int ali
  * Returns:	Flag, true only if rest of Words on line should be ignored.
  *=======================================================================*/
 
-static int cmd_ignore (Word *w, int align, char has_param, int param) {
+static int cmd_ignore (Word *w, int align, char has_param, int param)
+{
+	return TRUE;
+}
+
+/*========================================================================
+ * Name:	cmd_maybe_ignore
+ * Purpose:	Dummy function to get rid of subgroups in most cases
+ * Args:	Word, paragraph align info, and numeric param if any.
+ * Returns:	Flag, true only if rest of Words on line should be ignored.
+ *=======================================================================*/
+
+static int cmd_maybe_ignore (Word *w, int align, char has_param, int param)
+{
+	char *s = NULL;
+	if(w->next)
+	{
+		s = word_string(w->next);
+		if(s && strcmp(s, "\\shppict") == 0)
+			return(FALSE);
+	}
+	
 	return TRUE;
 }
 
@@ -2334,7 +2366,8 @@ static int cmd_info (Word *w, int align,
  * Returns:	Flag, true only if rest of Words on line should be ignored.
  *=======================================================================*/
 
-static int cmd_pict (Word *w, int align, char has_param, int param) {
+static int cmd_pict (Word *w, int align, char has_param, int param)
+{
 	within_picture=TRUE;
 	picture_width = picture_height = 0;
 	picture_type = PICT_WB;
@@ -2513,7 +2546,18 @@ typedef struct {
 
 /* All of the possible commands that RTF might recognize. */
 static HashItem hashArray_other [] = {
+/* 0.21.7
+ *	the "*" command was ignored in earlier versions, but included pictures
+ *	seem to often start with \*\shppict{\pict so if "*" is ignored, so is
+ *	the picture, so I have defined a new function "cmd_maybe_ignore" which
+ *	tests whether the next word is shppict and if so does not ignore what
+ *	follows.  On simple tests this seems to work.  - daved
+ */
+#if 0
 	{ "*", cmd_ignore, NULL },
+#else
+	{ "*", cmd_maybe_ignore, NULL },
+#endif
 	{ "-", cmd_optional_hyphen, "optional hyphen" },
 	{ "_", cmd_nonbreaking_hyphen, "nonbreaking hyphen" },
 	{ "~", cmd_nonbreaking_space, NULL },
@@ -2704,6 +2748,7 @@ static HashItem hashArray_s [] = {
 	{ "strikedl", &cmd_strikedl, NULL },
 	{ "stylesheet", &cmd_ignore, "style sheet" },
 	{ "shp", cmd_shp, "drawn shape" },
+	{ "shppict", &cmd_shppict, "shppict wrapper" },
 #if 0
 	{ "shading", NULL, NULL },
 #endif