[PATCH] changes to poinfo.cpp (No msgfmt call)
Nicolas Goutte <[email protected]> Sun, 23 Oct 2005 23:33:47 +0200
| Newsgroups | gmane.comp.kde.devel.kbabel |
|---|---|
| Message-ID | <[email protected]> |
Attached is the first patch for kdesdk/kbabel/common/poinfo.cpp It is for allowing the catalog manager to handle PO files with Gettext contexts, even if the Gettext tools cannot handle them. Mainly the change is in Flex to catch characters that should not happen in a normal PO file. This is just a first change to the code. I have tested it on l10/xx (which is much faster to process now, even if still slow), on the PO test file with Gettext context and on an email (to check that it does not crash.) Have a nice day! _______________________________________________ kbabel mailing list [email protected] https://mail.kde.org/mailman/listinfo/kbabel
catman_directload.diff
(text/x-diff, 1.7 KB)
Index: poinfo.cpp
===================================================================
--- poinfo.cpp (Revision 472744)
+++ poinfo.cpp (Arbeitskopie)
@@ -362,6 +362,7 @@
{
QFile file(target);
+#if 0
// first check file with msgfmt to be sure, it is
// syntactically correct
Msgfmt msgfmt;
@@ -372,6 +373,7 @@
KIO::NetAccess::removeTempFile(target);
return PARSE_ERROR;
}
+#endif
std::ifstream* stream = new std::ifstream( file.name().local8Bit());
@@ -396,6 +398,7 @@
if( stopStaticRead )
{
+ // ### FIXME: delete temporary file
delete lexer;
delete stream;
return OK;
Index: libgettext/pofiles.ll
===================================================================
--- libgettext/pofiles.ll (Revision 472744)
+++ libgettext/pofiles.ll (Arbeitskopie)
@@ -97,8 +97,24 @@
return T_STRING;
}
-. ;
+[ \t]+ ; /* This catches additional white-space */
+\<\<\<\<\<\<\< {
+ return T_CONFLICT_MARKER;
+ }
+
+======= {
+ return T_CONFLICT_MARKER;
+ }
+
+>>>>>>> {
+ return T_CONFLICT_MARKER;
+ }
+
+. {
+ return T_UNKNOWN;
+ }
+
<<EOF>> {
return T_EOF;
}
Index: libgettext/tokens.h
===================================================================
--- libgettext/tokens.h (Revision 472744)
+++ libgettext/tokens.h (Arbeitskopie)
@@ -41,5 +41,7 @@
#define T_OBSOLETE 261
#define T_MSGIDPLURAL 262
#define T_MSGCTXT 263
+#define T_UNKNOWN 264
+#define T_CONFLICT_MARKER 265
#endif