Posted: Sun 15 Nov 2009, 23:17
wjaguar has added many features - here is a build for testing
(no external images in this one - just the default builtins)
(no external images in this one - just the default builtins)
READ-ONLY Archive
https://oldforum.puppylinux.com/
Code: Select all
--- src/png.c~ 2012-03-01 06:33:16.000000000 +0800
+++ src/png.c 2012-06-01 17:30:10.950797471 +0800
@@ -3925,8 +3925,8 @@ fail: fclose(fp);
return (res);
}
-static const char base64[] =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
+static const char ascii[] =
+ "!#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~",
hex[] = "0123456789ABCDEF";
/* Extract valid C identifier from filename */
@@ -3947,7 +3947,7 @@ static int save_xpm(char *file_name, ls_
{
unsigned char rgbmem[XPM_MAXCOL * 4], *src;
const char *ctb;
- char ws[3], *buf, *tmp;
+ char ws[4], *buf, *tmp;
str_hash cuckoo;
FILE *fp;
int bpp = settings->bpp, w = settings->width, h = settings->height;
@@ -4001,7 +4001,8 @@ static int save_xpm(char *file_name, ls_
trans = settings->xpm_trans;
}
- cpp = cols > 64 ? 2 : 1;
+ cpp = cols > (strlen(ascii)+1) ? 2 : 1;
+ /* cpp = cols > ((strlen(ascii)+1)*(strlen(ascii)+1)) ? 3 : cpp; */
buf = malloc(w * cpp + 16);
if (!buf) return -1;
@@ -4022,19 +4023,21 @@ static int save_xpm(char *file_name, ls_
else fprintf(fp, "\"%d %d %d %d\",\n", w, h, cols, cpp);
/* Create colortable */
- ctb = cols > 16 ? base64 : hex;
- ws[1] = ws[2] = '\0';
+ ctb = cols > 16 ? ascii : hex;
+ ws[1] = ws[2] = '\0'; /* ws[3]='\0'; */
for (i = 0; i < cols; i++)
{
if (i == trans)
{
ws[0] = ' ';
if (cpp > 1) ws[1] = ' ';
+ /* if (cpp > 2) ws[2] = ' '; */
fprintf(fp, "\"%s\tc None\",\n", ws);
continue;
}
- ws[0] = ctb[i & 63];
- if (cpp > 1) ws[1] = ctb[i >> 6];
+ ws[0] = ctb[i % strlen(ascii)];
+ if (cpp > 1) ws[1] = ctb[i / strlen(ascii)];
+ /* if (cpp > 2) ws[2] = ctb[i / (strlen(ascii)*strlen(ascii))]; */
src = rgbmem + i * 4;
fprintf(fp, "\"%s\tc #%02X%02X%02X\",\n", ws,
src[0], src[1], src[2]);
@@ -4052,8 +4055,10 @@ static int save_xpm(char *file_name, ls_
if (k == trans) tmp[0] = tmp[1] = ' ';
else
{
- tmp[0] = ctb[k & 63];
- tmp[1] = ctb[k >> 6];
+
+ tmp[0] = ctb[k % strlen(ascii)];
+ tmp[1] = ctb[k / strlen(ascii)];
+ /* tmp[2] = ctb[k / (strlen(ascii)*strlen(ascii))]; */
}
}
strcpy(tmp, i < h - 1 ? "\",\n" : "\"\n};\n");