]> git.lyx.org Git - features.git/commitdiff
cosmetics.
authorAbdelrazak Younes <younes@lyx.org>
Fri, 8 Feb 2008 18:12:52 +0000 (18:12 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Fri, 8 Feb 2008 18:12:52 +0000 (18:12 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22873 a592a061-630c-0410-9148-cb99ea01b6c8

src/Encoding.cpp

index e4160988687809db2b57843d08adbb84fa371fe3..77b52b3eb891e76458c7e0d4aee2f2e95b26d35d 100644 (file)
@@ -279,6 +279,9 @@ Encoding::Encoding(string const & n, string const & l, string const & i,
 
 void Encoding::init() const
 {
+       if (complete_)
+               return;
+
        start_encodable_ = 0;
        // temporarily switch off lyxerr, since we will generate iconv errors
        lyxerr.disable();
@@ -288,12 +291,12 @@ void Encoding::init() const
                for (unsigned short j = 0; j < 256; ++j) {
                        char const c = char(j);
                        vector<char_type> const ucs4 = eightbit_to_ucs4(&c, 1, iconvName_);
-                       if (ucs4.size() == 1) {
-                               char_type const c = ucs4[0];
-                               CharInfoMap::const_iterator const it = unicodesymbols.find(c);
-                               if (it == unicodesymbols.end() || !it->second.force)
-                                       encodable_.insert(c);
-                       }
+                       if (ucs4.size() != 1)
+                               continue;
+                       char_type const uc = ucs4[0];
+                       CharInfoMap::const_iterator const it = unicodesymbols.find(uc);
+                       if (it == unicodesymbols.end() || !it->second.force)
+                               encodable_.insert(uc);
                }
        } else {
                // We do not know how many code points this encoding has, and
@@ -323,9 +326,7 @@ void Encoding::init() const
 docstring const Encoding::latexChar(char_type c) const
 {
        // assure the used encoding is properly initialized
-       if (!complete_)
-               init();
-       BOOST_ASSERT(complete_);
+       init();
 
        if (c < start_encodable_)
                return docstring(1, c);
@@ -344,9 +345,7 @@ docstring const Encoding::latexChar(char_type c) const
 set<char_type> Encoding::getSymbolsList() const
 {
        // assure the used encoding is properly initialized
-       if (!complete_)
-               init();
-       BOOST_ASSERT(complete_);
+       init();
 
        // first all encodable characters
        CharSet symbols = encodable_;