chiark
/
gitweb
/
~yarrgweb
/
ypp-sc-tools.db-test.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Pack findchar's args into a struct
[ypp-sc-tools.db-test.git]
/
pctb
/
rgbimage.c
diff --git
a/pctb/rgbimage.c
b/pctb/rgbimage.c
index 798a1043decc6c8badbf5370a9b9df49ba55c5f9..d0ba6b797442ef7e7b5c64f6d6d1f557c0c9cafd 100644
(file)
--- a/
pctb/rgbimage.c
+++ b/
pctb/rgbimage.c
@@
-48,9
+48,12
@@
#include "convert.h"
#include "convert.h"
-static int identify(const RgbImage *base, Rect portion,
- char result[MAXIMGIDENT], const char *what) {
- sysassert( dbfile_open("pixmaps.txt") );
+static int identify1(const RgbImage *base, Rect portion,
+ char result[MAXIMGIDENT], const char *what,
+ const char *which) {
+ char *dbfile_name= masprintf("#%s-pixmap#.txt",which);
+ if (!dbfile_open(dbfile_name))
+ goto not_found;
#define FGETSLINE (dbfile_getsline(result,MAXIMGIDENT,__FILE__,__LINE__))
#define FGETSLINE (dbfile_getsline(result,MAXIMGIDENT,__FILE__,__LINE__))
@@
-95,13
+98,21
@@
static int identify(const RgbImage *base, Rect portion,
goto found;
}
}
goto found;
}
}
+ not_found:
result[0]= 0;
result[0]= 0;
-found:
+
found:
dbfile_close();
dbfile_close();
+ free(dbfile_name);
return !!result[0];
}
return !!result[0];
}
+static int identify(const RgbImage *base, Rect portion,
+ char result[MAXIMGIDENT], const char *what) {
+ return identify1(base,portion,result,what, "master") ||
+ identify1(base,portion,result,what, "local");
+}
+
static void fwrite_ppm(FILE *f, const RgbImage *base, Rect portion) {
int x,y,i;
fprintf(f,"P3\n%d %d\n255\n", RECT_W(portion), RECT_H(portion));
static void fwrite_ppm(FILE *f, const RgbImage *base, Rect portion) {
int x,y,i;
fprintf(f,"P3\n%d %d\n255\n", RECT_W(portion), RECT_H(portion));
@@
-119,6
+130,13
@@
static void fwrite_ppm(FILE *f, const RgbImage *base, Rect portion) {
void identify_rgbimage(const RgbImage *base, Rect portion,
char result[MAXIMGIDENT], const char *what) {
void identify_rgbimage(const RgbImage *base, Rect portion,
char result[MAXIMGIDENT], const char *what) {
+ static int synced;
+
+ if (!synced) {
+ fetch_with_rsync("pixmap");
+ synced++;
+ }
+
for (;;) {
int ok= identify(base, portion, result, what);
if (ok) return;
for (;;) {
int ok= identify(base, portion, result, what);
if (ok) return;