gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] /srv/bzr/gnash/trunk r9794: Prevent an abort.


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r9794: Prevent an abort.
Date: Fri, 19 Sep 2008 18:18:11 +0200
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9794
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Fri 2008-09-19 18:18:11 +0200
message:
  Prevent an abort.
  
  Test Transform more.
modified:
  libcore/asobj/String_as.cpp
  testsuite/actionscript.all/Transform.as
    ------------------------------------------------------------
    revno: 9788.2.3
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Fri 2008-09-19 18:14:10 +0200
    message:
      One more test.
    modified:
      testsuite/actionscript.all/Transform.as
    ------------------------------------------------------------
    revno: 9788.2.4
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Fri 2008-09-19 18:16:31 +0200
    message:
      Don't abort on an invalid locale.
    modified:
      libcore/asobj/String_as.cpp
    ------------------------------------------------------------
    revno: 9788.2.5
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Fri 2008-09-19 18:16:50 +0200
    message:
      Correct totals.
    modified:
      testsuite/actionscript.all/Transform.as
=== modified file 'libcore/asobj/String_as.cpp'
--- a/libcore/asobj/String_as.cpp       2008-09-17 07:27:11 +0000
+++ b/libcore/asobj/String_as.cpp       2008-09-19 16:16:31 +0000
@@ -38,6 +38,7 @@
 #include <boost/algorithm/string/case_conv.hpp>
 #include <algorithm>
 #include <locale>
+#include <stdexcept>
 
 #define ENSURE_FN_ARGS(min, max, rv)                                    \
     if (fn.nargs < min) {                                               \
@@ -685,7 +686,15 @@
     // If this is the C locale, the conversion will be wrong.
     // Most other locales are correct. FIXME: get this to
     // work regardless of user's current settings.
-    std::locale currentLocale("");
+    std::locale currentLocale;
+    try
+    {
+        currentLocale = std::locale("");
+    }
+    catch (std::runtime_error& e)
+    {
+        currentLocale = std::locale::classic();
+    }
     boost::to_upper(wstr, currentLocale);
 
     return as_value(utf8::encodeCanonicalString(wstr, version));
@@ -703,9 +712,18 @@
 
     std::wstring wstr = utf8::decodeCanonicalString(val.to_string(), version);
 
-    // If this the C locale, the conversion will be wrong.
-    // Most other locales are correct.
-    std::locale currentLocale("");
+    // If this is the C locale, the conversion will be wrong.
+    // Most other locales are correct. FIXME: get this to
+    // work regardless of user's current settings.
+    std::locale currentLocale;
+    try
+    {
+        currentLocale = std::locale("");
+    }
+    catch (std::runtime_error& e)
+    {
+        currentLocale = std::locale::classic();
+    }
     boost::to_lower(wstr, currentLocale);
 
     return as_value(utf8::encodeCanonicalString(wstr, version));

=== modified file 'testsuite/actionscript.all/Transform.as'
--- a/testsuite/actionscript.all/Transform.as   2008-09-19 15:29:35 +0000
+++ b/testsuite/actionscript.all/Transform.as   2008-09-19 16:16:50 +0000
@@ -50,6 +50,7 @@
 // Only (?) obtainable from MovieClip.transform?
 t = _root.transform;
 xcheck_equals(typeOf(t), "object");
+xcheck(t instanceOf Transform);
 
 xcheck(t.matrix instanceOf Matrix);
 xcheck(t.concatenatedMatrix instanceOf Matrix);
@@ -85,5 +86,5 @@
 xcheck(t.pixelBounds instanceOf Rectangle);
 
 
-totals(25);
+totals(26);
 #endif


reply via email to

[Prev in Thread] Current Thread [Next in Thread]