compface/debian.patch
Jan Engelhardt f76bbdc502 - Update to use Debian patches directly, add debian.patch
- Rename compface-1.5.2-destdir.diff to Makefile.patch
- Fix build with GCC 14, add patch config.patch

OBS-URL: https://build.opensuse.org/package/show/server:mail/compface?expand=0&rev=14
2024-12-28 02:59:23 +00:00

126 lines
3.8 KiB
Diff

--- libcompface-1.5.2.orig/compface.1
+++ libcompface-1.5.2/compface.1
@@ -51,8 +51,9 @@ characters (in the range ``!'' to ``~''
The first line contains 72 characters and following lines contain
79 characters except that the last line may be short.
.LP
-If the -X option is given to uncompface, it generates XBM format
-directly.
+This version of compface has been patched to also be able to handle
+normal XBM images. uncompface will produce XBM output only if the -X
+switch is applied.
.LP
The amount of compression obtained varies between face image files but
the output of
--- libcompface-1.5.2.orig/compface.3
+++ libcompface-1.5.2/compface.3
@@ -39,6 +39,10 @@ characters (in the range ``!'' to ``~''
The first line contains 72 characters and following lines contain
79 characters except that the last line may be short.
.LP
+This version of compface has been patched to also be able to handle
+normal XBM images. uncompface will produce XBM output only if the -X
+switch is applied.
+.LP
The amount of compression obtained varies between face image files but
the output of
.I compface
--- libcompface-1.5.2.orig/compface.c
+++ libcompface-1.5.2/compface.c
@@ -19,7 +19,7 @@
#include "config.h"
#endif
-#include "compface_private.h"
+#include "compface.h"
int
compface(fbuf)
--- libcompface-1.5.2.orig/compface.h
+++ libcompface-1.5.2/compface.h
@@ -143,7 +143,6 @@ int AllBlack P((char *, int, int)) ;
int AllWhite P((char *, int, int)) ;
int BigPop P((Prob *)) ;
int compface P((char *)) ;
-int main P((int, char *[])) ;
int ReadBuf P(()) ;
int Same P((char *, int, int)) ;
int uncompface P((char *)) ;
--- libcompface-1.5.2.orig/file.c
+++ libcompface-1.5.2/file.c
@@ -77,8 +77,42 @@ char *fbuf;
{
register int c, i;
register char *s, *t;
+ static char table_inv[] = { 0,8,4,12,2,10,6,14,1,9, 5,13, 3,11, 7,15 };
+ static char table_nop[] = { 0,1,2, 3,4, 5,6, 7,8,9,10,11,12,13,14,15 };
+ char *table = table_nop; /* optionally invert bits in nibble */
+ register int inc = 0; /* optionally swap nimmles */
+ int bits;
+ int len;
t = s = fbuf;
+
+ /* Does this look like an X bitmap ? */
+ if (sscanf(s, "#define %*s %d", &bits) == 1) {
+ if (bits == 48) {
+ char type1[256];
+ char type2[256];
+ while (*s && *s++ != '\n');
+ if (sscanf(s, "#define %*s %d", &bits) == 1) if (bits == 48) {
+ while (*s && *s++ != '\n');
+ for (len=0; s[len] && s[len]!='\n'; len++);
+ if (len<255) {
+ if (sscanf(s, "static %s %s", type1,type2)==2 &&
+ (!strcmp(type1, "char") ||
+ !strcmp(type2, "char"))) {
+ while (*s && *s++ != '\n');
+ inc = 1;
+ table = table_inv;
+ }
+ else fprintf(stderr, "warning: xbitmap line 3 not static [unsigned] short ...\n");
+ } else fprintf(stderr, "warning: xbitmap line 3 too long\n");
+ }
+ else fprintf(stderr, "warning: xbitmaps must be 48x48\n");
+ }
+ else fprintf(stderr, "warning: xbitmaps must be 48x48\n");
+ }
+ /* Ensure s is reset if it was not an X bitmap ... */
+ if (! inc) s = fbuf;
+
for(i = strlen(s); i > 0; i--)
{
c = (int)*(s++);
@@ -89,7 +123,7 @@ char *fbuf;
status = ERR_EXCESS;
break;
}
- *(t++) = c - '0';
+ (t++)[inc] = table[c - '0']; inc = - inc;
}
else if ((c >= 'A') && (c <= 'F'))
{
@@ -98,7 +132,7 @@ char *fbuf;
status = ERR_EXCESS;
break;
}
- *(t++) = c - 'A' + 10;
+ (t++)[inc] = table[c - 'A' + 10]; inc = - inc;
}
else if ((c >= 'a') && (c <= 'f'))
{
@@ -107,10 +141,10 @@ char *fbuf;
status = ERR_EXCESS;
break;
}
- *(t++) = c - 'a' + 10;
+ (t++)[inc] = table[c - 'a' + 10]; inc = - inc;
}
- else if (((c == 'x') || (c == 'X')) && (t > fbuf) && (*(t-1) == 0))
- t--;
+ else if (((c == 'x') || (c == 'X')) && (t > fbuf) &&
+ ((t-1)[-inc] == table[0])) { t--; inc = -inc; }
}
if (t < fbuf + DIGITS)
longjmp(comp_env, ERR_INSUFF);