-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDbSigs.cpp
732 lines (606 loc) · 20.1 KB
/
DbSigs.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
// JPEGsnoop - JPEG Image Decoder & Analysis Utility
// Copyright (C) 2010 - Calvin Hass
// http://www.impulseadventure.com/photo/jpeg-snoop.html
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
#include "stdafx.h"
#include "DbSigs.h"
#include "snoop.h"
#include "Signatures.inl"
// FIXME FIXME
// Want to convert this class to use CObArray for
// extra signatures. Otherwise, we are inefficient with
// memory and may run out of room.
CDbSigs::CDbSigs()
{
// Count the built-in database
bool done;
done = false;
m_nSigListNum = 0;
while (!done)
{
if (!strcmp(m_sSigList[m_nSigListNum].x_make,"*"))
done = true;
else
m_nSigListNum++;
}
// Count number of exceptions in Signatures.inl
done = false;
m_nExcMmNoMkrListNum = 0;
while (!done)
{
if (!strcmp(m_sExcMmNoMkrList[m_nExcMmNoMkrListNum].x_make,"*"))
done = true;
else
m_nExcMmNoMkrListNum++;
}
done = false;
m_nExcMmIsEditListNum = 0;
while (!done)
{
if (!strcmp(m_sExcMmIsEditList[m_nExcMmIsEditListNum].x_make,"*"))
done = true;
else
m_nExcMmIsEditListNum++;
}
done = false;
m_nSwIjgListNum = 0;
while (!done) {
if (!strcmp(m_sSwIjgList[m_nSwIjgListNum],"*"))
done = true;
else
m_nSwIjgListNum++;
}
done = false;
m_nSwLeadListNum = 0;
while (!done) {
if (!strcmp(m_sSwLeadList[m_nSwLeadListNum],"*"))
done = true;
else
m_nSwLeadListNum++;
}
done = false;
m_sXComSwListNum = 0;
while (!done) {
if (!strcmp(m_sXComSwList[m_sXComSwListNum],"*"))
done = true;
else
m_sXComSwListNum++;
}
// Reset extra database
m_nSigListExtraNum = 0;
// Default to user database dir not set yet
// This will cause a fail if database load/store
// functions are called before SetDbDir()
m_strDbDir = "";
}
CDbSigs::~CDbSigs()
{
}
unsigned CDbSigs::GetNumSigsInternal()
{
return m_nSigListNum;
}
unsigned CDbSigs::GetNumSigsExtra()
{
return m_nSigListExtraNum;
}
void CDbSigs::DatabaseExtraLoad()
{
FILE * pDB;
char ch;
CString tmpStr;
CString snoopStr;
CString verStr;
CString secStr;
bool valid = true;
bool done = false;
unsigned load_num = 0; // Number of entries to read
CompSig db_local_entry; // Temp entry for load
bool db_local_entry_found; // Temp entry already in built-in DB?
bool db_local_trimmed = false; // Did we trim down the DB?
m_nSigListExtraNum = 0;
ASSERT(m_strDbDir != "");
if (m_strDbDir == "") {
return;
}
// Retrieve from environment user profile path.
TCHAR szFilePathName[200];
wsprintf(szFilePathName,"%s\\%s", m_strDbDir,DAT_FILE);
pDB = fopen(szFilePathName,"rb");
if (pDB) {
// Read header
snoopStr = "";
while (ch=fgetc(pDB)) { snoopStr += ch; }
if (snoopStr != "JPEGsnoop") { valid = false; }
if (valid) {
// Read version string
verStr = "";
while (ch=fgetc(pDB)) { verStr += ch; }
valid = false;
//if (verStr == "00") { valid = true; }
if (verStr == "01") { valid = true; }
if (verStr == "02") { valid = true; }
}
// Should consider trimming down local database if same entry
// exists in built-in database (for example, user starts running
// new version of tool).
while (!done && valid) {
// Read section header
secStr = "";
while (ch=fgetc(pDB)) { secStr += ch; }
if (secStr == "*DB*") {
// Read DB count
fread(&load_num,sizeof(unsigned),1,pDB);
// For each entry that we read, we should double-check to see
// if we already have it in the built-in DB. If we do, then
// don't add it to the runtime DB, and mark the local DB as
// needing trimming. If so, rewrite the DB.
for (unsigned ind=0;ind<load_num;ind++) {
db_local_entry.x_make = "";
db_local_entry.x_model = "";
db_local_entry.um_qual = "";
db_local_entry.c_sig = "";
db_local_entry.c_sigrot = "";
db_local_entry.x_subsamp = "";
db_local_entry.m_swtrim = "";
db_local_entry.m_swdisp = "";
db_local_entry_found = false;
// -------------------------------------------------------
/*
// For version 00:
db_local_entry.x_make = "";
while (ch=fgetc(pDB)) { db_local_entry.x_make += ch; }
db_local_entry.x_model = "";
while (ch=fgetc(pDB)) { db_local_entry.x_model += ch; }
//fread(&m_sSigListExtra[ind].editor,sizeof(unsigned),1,pDB);
tmpStr = "";
while (ch=fgetc(pDB)) { tmpStr += ch; }
db_local_entry.m_editor = atoi(tmpStr);
db_local_entry.um_qual = "";
while (ch=fgetc(pDB)) { db_local_entry.um_qual += ch; }
db_local_entry.c_sig = "";
while (ch=fgetc(pDB)) { db_local_entry.c_sig += ch; }
// In older version of DB, these entries won't exist
db_local_entry.x_subsamp = "";
db_local_entry.m_swtrim = "";
db_local_entry.m_swdisp = "";
*/
// -------------------------------------------------------
if (verStr == "01") {
// For version 01:
while (ch=fgetc(pDB)) { db_local_entry.x_make += ch; }
while (ch=fgetc(pDB)) { db_local_entry.x_model += ch; }
tmpStr = "";
while (ch=fgetc(pDB)) { tmpStr += ch; }
db_local_entry.m_editor = atoi(tmpStr);
while (ch=fgetc(pDB)) { db_local_entry.um_qual += ch; }
while (ch=fgetc(pDB)) { db_local_entry.c_sig += ch; }
// In older version of DB, these entries won't exist
while (ch=fgetc(pDB)) { db_local_entry.x_subsamp += ch; }
while (ch=fgetc(pDB)) { db_local_entry.m_swtrim += ch; }
while (ch=fgetc(pDB)) { db_local_entry.m_swdisp += ch; }
} else if (verStr == "02") {
// For version 02:
while (ch=fgetc(pDB)) { db_local_entry.x_make += ch; }
while (ch=fgetc(pDB)) { db_local_entry.x_model += ch; }
tmpStr = "";
while (ch=fgetc(pDB)) { tmpStr += ch; }
db_local_entry.m_editor = atoi(tmpStr);
while (ch=fgetc(pDB)) { db_local_entry.um_qual += ch; }
while (ch=fgetc(pDB)) { db_local_entry.c_sig += ch; }
while (ch=fgetc(pDB)) { db_local_entry.c_sigrot += ch; }
// In older version of DB, these entries won't exist
while (ch=fgetc(pDB)) { db_local_entry.x_subsamp += ch; }
while (ch=fgetc(pDB)) { db_local_entry.m_swtrim += ch; }
while (ch=fgetc(pDB)) { db_local_entry.m_swdisp += ch; }
}
// -------------------------------------------------------
// Does the entry already exist in the internal DB?
db_local_entry_found = SearchSignatureExactInternal(db_local_entry.x_make,db_local_entry.x_model,db_local_entry.c_sig);
if (!db_local_entry_found) {
// Add it!
m_sSigListExtra[m_nSigListExtraNum].flag = 1; // OK
m_sSigListExtra[m_nSigListExtraNum].x_make = db_local_entry.x_make;
m_sSigListExtra[m_nSigListExtraNum].x_model = db_local_entry.x_model;
m_sSigListExtra[m_nSigListExtraNum].m_editor = db_local_entry.m_editor;
m_sSigListExtra[m_nSigListExtraNum].um_qual = db_local_entry.um_qual;
m_sSigListExtra[m_nSigListExtraNum].c_sig = db_local_entry.c_sig;
m_sSigListExtra[m_nSigListExtraNum].c_sigrot = db_local_entry.c_sigrot;
m_sSigListExtra[m_nSigListExtraNum].x_subsamp = db_local_entry.x_subsamp;
m_sSigListExtra[m_nSigListExtraNum].m_swtrim = db_local_entry.m_swtrim;
m_sSigListExtra[m_nSigListExtraNum].m_swdisp = db_local_entry.m_swdisp;
m_nSigListExtraNum++;
} else {
db_local_trimmed = true;
}
}
} else if (secStr == "*Z*") {
done = true;
} else {
valid = false;
} // secStr
} // while
fclose(pDB);
} // if pDB
// If we did make changes to the database (trim), then rewrite it!
if (db_local_trimmed) {
DatabaseExtraStore();
}
}
void CDbSigs::DatabaseExtraClean()
{
m_nSigListExtraNum = 0;
DatabaseExtraStore();
}
void CDbSigs::DatabaseExtraMarkDelete(unsigned ind)
{
ASSERT(ind<m_nSigListExtraNum);
m_sSigListExtra[ind].flag = 9;
}
unsigned CDbSigs::DatabaseExtraGetNum()
{
return m_nSigListExtraNum;
}
CompSig CDbSigs::DatabaseExtraGet(unsigned ind)
{
ASSERT(ind<m_nSigListExtraNum);
return m_sSigListExtra[ind];
}
void CDbSigs::DatabaseExtraStore()
{
FILE * pDB;
ASSERT(m_strDbDir != "");
if (m_strDbDir == "") {
return;
}
// Retrieve from environment user profile path.
TCHAR szFilePathName[300];
wsprintf(szFilePathName,"%s\\%s", m_strDbDir,DAT_FILE);
CString tmpStr;
CString snoopStr;
CString emptyStr = "";
pDB = fopen(szFilePathName,"wb+");
ASSERT(pDB);
if (pDB == NULL) {
tmpStr.Format("ERROR: Unable to write database [%s]",szFilePathName);
AfxMessageBox(tmpStr);
return;
}
snoopStr = "JPEGsnoop";
fwrite((LPCSTR)snoopStr,sizeof(char),strlen(snoopStr)+1,pDB);
snoopStr = DB_VER_STR;
fwrite((LPCSTR)snoopStr,sizeof(char),strlen(snoopStr)+1,pDB);
snoopStr = "*DB*";
fwrite((LPCSTR)snoopStr,sizeof(char),strlen(snoopStr)+1,pDB);
// Determine how many entries will remain (after removing marked
// deleted entries
unsigned newExtraNum = m_nSigListExtraNum;
for (unsigned ind=0;ind<m_nSigListExtraNum;ind++) {
if (m_sSigListExtra[ind].flag == 9) {
newExtraNum--;
}
}
// fwrite(&m_nSigListExtraNum,sizeof(unsigned),1,pDB);
// for (unsigned ind=0;ind<m_nSigListExtraNum;ind++) {
fwrite(&newExtraNum,sizeof(unsigned),1,pDB);
for (unsigned ind=0;ind<m_nSigListExtraNum;ind++) {
/*
fwrite((LPCSTR)m_sSigListExtra[ind].x_make,sizeof(char),strlen(m_sSigListExtra[ind].x_make)+1,pDB);
fwrite((LPCSTR)m_sSigListExtra[ind].x_model,sizeof(char),strlen(m_sSigListExtra[ind].x_model)+1,pDB);
tmpStr.Format("%u",m_sSigListExtra[ind].m_editor);
fwrite((LPCSTR)tmpStr,sizeof(char),strlen(tmpStr)+1,pDB);
fwrite((LPCSTR)m_sSigListExtra[ind].um_qual,sizeof(char),strlen(m_sSigListExtra[ind].um_qual)+1,pDB);
fwrite((LPCSTR)m_sSigListExtra[ind].c_sig,sizeof(char),strlen(m_sSigListExtra[ind].c_sig)+1,pDB);
*/
// Is it marked for deletion (from Manage dialog?)
if (m_sSigListExtra[ind].flag == 9) {
continue;
}
// For version 01:
fwrite((LPCSTR)m_sSigListExtra[ind].x_make,
sizeof(char),strlen(m_sSigListExtra[ind].x_make)+1,pDB);
fwrite((LPCSTR)m_sSigListExtra[ind].x_model,
sizeof(char),strlen(m_sSigListExtra[ind].x_model)+1,pDB);
tmpStr.Format("%u",m_sSigListExtra[ind].m_editor); // m_editor = u_source
fwrite((LPCSTR)tmpStr,sizeof(char),strlen(tmpStr)+1,pDB);
fwrite((LPCSTR)m_sSigListExtra[ind].um_qual,
sizeof(char),strlen(m_sSigListExtra[ind].um_qual)+1,pDB);
fwrite((LPCSTR)m_sSigListExtra[ind].c_sig,
sizeof(char),strlen(m_sSigListExtra[ind].c_sig)+1,pDB);
fwrite((LPCSTR)m_sSigListExtra[ind].c_sigrot,
sizeof(char),strlen(m_sSigListExtra[ind].c_sigrot)+1,pDB);
fwrite((LPCSTR)m_sSigListExtra[ind].x_subsamp,
sizeof(char),strlen(m_sSigListExtra[ind].x_subsamp)+1,pDB);
fwrite((LPCSTR)m_sSigListExtra[ind].m_swtrim, // m_swtrim = ""
sizeof(char),strlen(m_sSigListExtra[ind].m_swtrim)+1,pDB);
fwrite((LPCSTR)m_sSigListExtra[ind].m_swdisp, // m_swdisp = u_sw
sizeof(char),strlen(m_sSigListExtra[ind].m_swdisp)+1,pDB);
}
snoopStr = "*Z*";
fwrite((LPCSTR)snoopStr,sizeof(char),strlen(snoopStr)+1,pDB);
fclose(pDB);
}
//CAL! *** Need to decide if I want to include editors in this search...
bool CDbSigs::SearchSignatureExactInternal(CString make, CString model, CString sig)
{
bool found_exact = false;
bool done = false;
unsigned ind = 0;
while (!done) {
if (ind >= m_nSigListNum) {
done = true;
} else {
if ( (m_sSigList[ind].x_make == make) &&
(m_sSigList[ind].x_model == model) &&
((m_sSigList[ind].c_sig == sig) || (m_sSigList[ind].c_sigrot == sig)) )
{
found_exact = true;
done = true;
}
ind++;
}
}
return found_exact;
}
bool CDbSigs::SearchCom(CString strCom)
{
bool found = false;
bool done = false;
unsigned ind = 0;
if (strCom.GetLength() == 0) {
done = true;
}
while (!done) {
if (ind >= m_sXComSwListNum) {
done = true;
} else {
if (strCom.Find(m_sXComSwList[ind]) == -1) {
found = true;
done = true;
}
ind++;
}
}
return found;
}
// Returns total of built-in plus local DB
unsigned CDbSigs::GetDBNumEntries()
{
return (m_nSigListNum + m_nSigListExtraNum);
}
// Returns total of built-in plus local DB
unsigned CDbSigs::IsDBEntryUser(unsigned ind)
{
if (ind < m_nSigListNum) {
return false;
} else {
return true;
}
}
// Return a ptr to the struct containing the indexed entry
bool CDbSigs::GetDBEntry(unsigned ind,CompSig* pEntry)
{
unsigned ind_offset;
unsigned ind_max = GetDBNumEntries();
ASSERT(pEntry);
ASSERT(ind<ind_max);
if (ind < m_nSigListNum) {
pEntry->m_editor = m_sSigList[ind].m_editor;
pEntry->x_make = m_sSigList[ind].x_make;
pEntry->x_model = m_sSigList[ind].x_model;
pEntry->um_qual = m_sSigList[ind].um_qual;
pEntry->c_sig = m_sSigList[ind].c_sig;
pEntry->c_sigrot = m_sSigList[ind].c_sigrot;
pEntry->x_subsamp = m_sSigList[ind].x_subsamp;
pEntry->m_swtrim = m_sSigList[ind].m_swtrim;
pEntry->m_swdisp = m_sSigList[ind].m_swdisp;
return true;
} else {
ind_offset = ind-m_nSigListNum;
pEntry->m_editor = m_sSigListExtra[ind_offset].m_editor;
pEntry->x_make = m_sSigListExtra[ind_offset].x_make;
pEntry->x_model = m_sSigListExtra[ind_offset].x_model;
pEntry->um_qual = m_sSigListExtra[ind_offset].um_qual;
pEntry->c_sig = m_sSigListExtra[ind_offset].c_sig;
pEntry->c_sigrot = m_sSigListExtra[ind_offset].c_sigrot;
pEntry->x_subsamp = m_sSigListExtra[ind_offset].x_subsamp;
pEntry->m_swtrim = m_sSigListExtra[ind_offset].m_swtrim;
pEntry->m_swdisp = m_sSigListExtra[ind_offset].m_swdisp;
return true;
}
}
void CDbSigs::DatabaseExtraAdd(CString exif_make,CString exif_model,
CString qual,CString sig,CString sigrot,CString css,
unsigned user_source,CString user_software)
{
ASSERT(m_nSigListExtraNum < DBEX_ENTRIES_MAX);
if (m_nSigListExtraNum >= DBEX_ENTRIES_MAX) {
CString tmpStr;
tmpStr.Format("ERROR: Can only store maximum of %u extra signatures in local DB",DBEX_ENTRIES_MAX);
AfxMessageBox(tmpStr);
return;
}
// Now append it to the local database and resave
m_sSigListExtra[m_nSigListExtraNum].x_make = exif_make;
m_sSigListExtra[m_nSigListExtraNum].x_model = exif_model;
m_sSigListExtra[m_nSigListExtraNum].um_qual = qual;
m_sSigListExtra[m_nSigListExtraNum].c_sig = sig;
m_sSigListExtra[m_nSigListExtraNum].c_sigrot = sigrot;
m_sSigListExtra[m_nSigListExtraNum].x_subsamp = css;
if (user_source == ENUM_SOURCE_CAM) { // digicam
m_sSigListExtra[m_nSigListExtraNum].m_editor = ENUM_EDITOR_CAM;
m_sSigListExtra[m_nSigListExtraNum].m_swtrim = "";
m_sSigListExtra[m_nSigListExtraNum].m_swdisp = "";
} else if (user_source == ENUM_SOURCE_SW) { // software
m_sSigListExtra[m_nSigListExtraNum].m_editor = ENUM_EDITOR_SW;
m_sSigListExtra[m_nSigListExtraNum].m_swtrim = "";
m_sSigListExtra[m_nSigListExtraNum].m_swdisp = user_software; // Not quite right perfect
m_sSigListExtra[m_nSigListExtraNum].x_make = "";
m_sSigListExtra[m_nSigListExtraNum].x_model = "";
} else { // user didn't know
m_sSigListExtra[m_nSigListExtraNum].m_editor = ENUM_EDITOR_UNSURE;
m_sSigListExtra[m_nSigListExtraNum].m_swtrim = "";
m_sSigListExtra[m_nSigListExtraNum].m_swdisp = user_software; // Not quite right perfect
}
m_nSigListExtraNum++;
// Now resave the database
DatabaseExtraStore();
}
unsigned CDbSigs::GetIjgNum()
{
return m_nSwIjgListNum;
}
char* CDbSigs::GetIjgEntry(unsigned ind)
{
return m_sSwIjgList[ind];
}
// Update the directory used for user database
void CDbSigs::SetDbDir(CString strDbDir)
{
m_strDbDir = strDbDir;
}
// Search exceptions for Make/Model in list of ones that don't have Makernotes
bool CDbSigs::LookupExcMmNoMkr(CString strMake,CString strModel)
{
bool found = false;
bool done = false;
unsigned ind = 0;
if (strMake.GetLength() == 0) {
done = true;
}
while (!done) {
if (ind >= m_nExcMmNoMkrListNum) {
done = true;
} else {
// Perform exact match on Make, case sensitive
// Check Make field and possibly Model field (if non-empty)
if (strcmp(m_sExcMmNoMkrList[ind].x_make,strMake) != 0) {
// Make did not match
} else {
// Make matched, now check to see if we need
// to compare the Model string
if (strlen(m_sExcMmNoMkrList[ind].x_model) == 0) {
// No need to compare, we're done
found = true;
done = true;
} else {
// Need to check model as well
// Since we may like to do a substring match, support wildcards
// Find position of "*" if it exists in DB entry
char* pWildcard;
unsigned nCompareLen;
pWildcard = strchr(m_sExcMmNoMkrList[ind].x_model,'*');
if (pWildcard != NULL) {
// Wildcard present
nCompareLen = pWildcard - (m_sExcMmNoMkrList[ind].x_model);
} else {
// No wildcard, do full match
nCompareLen = strlen(m_sExcMmNoMkrList[ind].x_model);
}
if (strncmp(m_sExcMmNoMkrList[ind].x_model,strModel,nCompareLen) != 0) {
// No match
} else {
// Matched as well, we're done
found = true;
done = true;
}
}
}
ind++;
}
}
return found;
}
// Search exceptions for Make/Model in list of ones that are always edited
bool CDbSigs::LookupExcMmIsEdit(CString strMake,CString strModel)
{
bool found = false;
bool done = false;
unsigned ind = 0;
if (strMake.GetLength() == 0) {
done = true;
}
while (!done) {
if (ind >= m_nExcMmIsEditListNum) {
done = true;
} else {
// Perform exact match, case sensitive
// Check Make field and possibly Model field (if non-empty)
if (strcmp(m_sExcMmIsEditList[ind].x_make,strMake) != 0) {
// Make did not match
} else {
// Make matched, now check to see if we need
// to compare the Model string
if (strlen(m_sExcMmIsEditList[ind].x_model) == 0) {
// No need to compare, we're done
found = true;
done = true;
} else {
// Need to check model as well
if (strcmp(m_sExcMmIsEditList[ind].x_model,strModel) != 0) {
// No match
} else {
// Matched as well, we're done
found = true;
done = true;
}
}
}
ind++;
}
}
return found;
}
// -----------------------------------------------------------------------
char* CDbSigs::m_sSwIjgList[] = {
"GIMP",
"IrfanView",
"idImager",
"FastStone Image Viewer",
"NeatImage",
"Paint.NET",
"Photomatix",
"XnView",
"*",
};
char* CDbSigs::m_sSwLeadList[] = {
"IMatch",
"*",
};
// Indicators of software located in EXIF.COMMENT field
// Note: I don't include:
// "LEAD Technologies"
// "U-Lead Systems"
// "Intel(R) JPEG Library" (unsure if ever in hardware)
// as it appears in both software and some digicams!
//
// To strip out comment field from files do:
// e:\new\_graphics\_jpeg\exiftool.exe -r -comment "e:\photos cal\jpeg analysis"
// | grep "Comment"
char* CDbSigs::m_sXComSwList[] = {
"gd-jpeg",
"Photoshop",
"ACD Systems",
"AppleMark",
"PICResize",
"NeatImage",
"*",
};
//CAL! *** NOTE:
// Leica M8 has several entries with diff SW string (for firmware), and all have src=50
// What is the best solution?
// also Olympus E-400
// Actual signature list (m_sSigList) is in Signatures.inl