[Cmap-cvs] cmap PolishFormat.cpp,1.25,1.26 dbf.h,1.6,1.7 dbf.cpp,1.14,1.15
Status: Beta
Brought to you by:
dyp
From: Denis P. <dy...@us...> - 2004-05-12 18:40:53
|
Update of /cvsroot/cmap/cmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8422 Modified Files: PolishFormat.cpp dbf.h dbf.cpp Log Message: Add check for repeated no record in DBF messages. Index: dbf.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/dbf.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- dbf.cpp 12 May 2004 05:26:53 -0000 1.14 +++ dbf.cpp 12 May 2004 18:40:41 -0000 1.15 @@ -63,6 +63,33 @@ printf("0x%.4X ", value); } +static char const **warnedCODs = NULL; +static size_t warnedCODpos = 0; +static size_t warnedCODsize = 0; + +static bool checkWarned(const char *cod) { + for (size_t i = 0; i < warnedCODpos; i++) + if (strcmp(warnedCODs[i], cod) == 0) + return true; + + if (warnedCODpos >= warnedCODsize) { + warnedCODsize = (warnedCODs == NULL) ? 256 : warnedCODsize * 2; + warnedCODs = (char const **)s_realloc(warnedCODs, warnedCODsize * sizeof(char *)); + } + + warnedCODs[warnedCODpos++] = cod; + + return false; +} + +void clearWarnedDBF() { + if (warnedCODs != NULL) + s_free(warnedCODs); + warnedCODs = NULL; + warnedCODpos = 0; + warnedCODsize = 0; +} + //=================================================================================== // Ïðîâåðêà íà EXPORT èìåíè Êîäèôèêàòîðà // ÅÑÒÜ è ÂÛÁÐÀÍ - Âîçâðàùàåò íîìåð ñòðîêè, @@ -72,7 +99,8 @@ if (strcmp(str, file_cod1[i].object_cod) == 0) return (file_cod1[i].do_export != 0) ? i : -1; ASSERT(*str != 0); - printf("Warning!!! Type not found in DBF table: '%s'\n", str); + if (!checkWarned(str)) + printf("Warning!!! Type not found in DBF table: '%s'\n", str); return -1; } //=================================================================================== Index: dbf.h =================================================================== RCS file: /cvsroot/cmap/cmap/dbf.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- dbf.h 5 May 2004 15:33:19 -0000 1.6 +++ dbf.h 12 May 2004 18:40:41 -0000 1.7 @@ -34,6 +34,7 @@ void Read_DBF(char *file_dbf); int Check_export (const char *str); +void clearWarnedDBF(); #endif // __CMAP_CBF_H__ Index: PolishFormat.cpp =================================================================== RCS file: /cvsroot/cmap/cmap/PolishFormat.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- PolishFormat.cpp 12 May 2004 05:12:49 -0000 1.25 +++ PolishFormat.cpp 12 May 2004 18:40:41 -0000 1.26 @@ -1959,4 +1959,5 @@ } // END FOR clearWarned(); + clearWarnedDBF(); } |