From fd107ae7a38a864662703a8e817220f98cb48369 Mon Sep 17 00:00:00 2001 From: Dan Dennedy Date: Wed, 6 Jul 2011 23:12:33 -0700 Subject: [PATCH] Add LC_NUMERIC to MLT XML. This does not permit one to mix locales within a MLT process! In other words, you can not load a document in a locale using one decimal separator and then filter with a double property using a different separator. --- src/modules/xml/consumer_xml.c | 4 ++++ src/modules/xml/mlt-xml.dtd | 6 ++++++ src/modules/xml/producer_xml.c | 10 +++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/modules/xml/consumer_xml.c b/src/modules/xml/consumer_xml.c index 174aa068..c9823110 100644 --- a/src/modules/xml/consumer_xml.c +++ b/src/modules/xml/consumer_xml.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #define ID_SIZE 128 @@ -635,6 +636,9 @@ xmlDocPtr xml_make_doc( mlt_consumer consumer, mlt_service service ) xmlDocSetRootElement( doc, root ); + // Indicate the numeric locale + xmlNewProp( root, _x("LC_NUMERIC"), _x( setlocale( LC_NUMERIC, NULL ) ) ); + // If we have root, then deal with it now if ( mlt_properties_get( properties, "root" ) != NULL ) { diff --git a/src/modules/xml/mlt-xml.dtd b/src/modules/xml/mlt-xml.dtd index 6c1dc2ba..937ff47c 100644 --- a/src/modules/xml/mlt-xml.dtd +++ b/src/modules/xml/mlt-xml.dtd @@ -3,6 +3,12 @@ + #include #include +#include #include #include // for xmlCreateFileParserCtxt @@ -1176,8 +1177,15 @@ static void on_start_element( void *ctx, const xmlChar *name, const xmlChar **at else if ( xmlStrcmp( name, _x("property") ) == 0 ) on_start_property( context, name, atts ); else if ( xmlStrcmp( name, _x("westley") ) == 0 || xmlStrcmp( name, _x("mlt") ) == 0 ) + { for ( ; atts != NULL && *atts != NULL; atts += 2 ) - mlt_properties_set( context->producer_map, ( const char * )atts[ 0 ], ( const char * )atts[ 1 ] ); + { + if ( xmlStrcmp( atts[0], _x("LC_NUMERIC") ) ) + mlt_properties_set( context->producer_map, _s( atts[0] ), _s(atts[1] ) ); + else + setlocale( LC_NUMERIC, _s( atts[1] ) ); + } + } } static void on_end_element( void *ctx, const xmlChar *name ) -- 2.39.2