gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r9527: URL querystring parsing fix,


From: Sandro Santilli
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r9527: URL querystring parsing fix, agg cleanups, avm1 reduced paranoia
Date: Wed, 23 Jul 2008 19:11:34 +0200
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9527
committer: Sandro Santilli <address@hidden>
branch nick: trunk
timestamp: Wed 2008-07-23 19:11:34 +0200
message:
  URL querystring parsing fix, agg cleanups, avm1 reduced paranoia
modified:
  backend/render_handler_agg.cpp
  libbase/URL.cpp
  libcore/vm/ASHandlers.cpp
  testsuite/libbase/URLTest.cpp
    ------------------------------------------------------------
    revno: 9526.1.1
    committer: Sandro Santilli <address@hidden>
    branch nick: mybranch
    timestamp: Wed 2008-07-23 14:07:52 +0200
    message:
      only check for tag type if GNASH_PARANOIA_LEVEL > 1
    modified:
      libcore/vm/ASHandlers.cpp
    ------------------------------------------------------------
    revno: 9526.1.2
    committer: Sandro Santilli <address@hidden>
    branch nick: mybranch
    timestamp: Wed 2008-07-23 15:35:48 +0200
    message:
      prefix increments, some consts
    modified:
      backend/render_handler_agg.cpp
    ------------------------------------------------------------
    revno: 9526.1.3
    committer: Sandro Santilli <address@hidden>
    branch nick: mybranch
    timestamp: Wed 2008-07-23 19:08:27 +0200
    message:
      Query strings starts on the first question mark, not the last.
      Should fix bug #23629.
      Thanks to Kristof Szilagyi for finding this!
    modified:
      libbase/URL.cpp
      testsuite/libbase/URLTest.cpp
=== modified file 'backend/render_handler_agg.cpp'
--- a/backend/render_handler_agg.cpp    2008-07-16 15:00:04 +0000
+++ b/backend/render_handler_agg.cpp    2008-07-23 13:35:48 +0000
@@ -219,9 +219,9 @@
   /// Returns NULL if no cache item matches 
   std::vector <agg::path_storage>* search(const matrix& mat, bool rounded) {
   
-    size_t ccount = m_items.size();
+    const size_t ccount = m_items.size();
     
-    for (size_t cno=0; cno<ccount; cno++) {    
+    for (size_t cno=0; cno<ccount; ++cno) {    
       agg_transformed_path& item = m_items[cno];
           
       if ((item.m_mat == mat) && (item.m_rounded == rounded)) {
@@ -307,7 +307,7 @@
     unsigned int width=region.width()+1;
 
     const unsigned int max_y = region.getMaxY();
-          for (unsigned int y=region.getMinY(); y<=max_y; y++) 
+          for (unsigned int y=region.getMinY(); y<=max_y; ++y) 
     {
        m_pixf.copy_hline(left, y, width, black);
     }
@@ -531,7 +531,7 @@
 
       agg::scanline_u8 sl;
   
-      for (unsigned int cno=0; cno<_clipbounds.size(); cno++) {    
+      for (unsigned int cno=0; cno<_clipbounds.size(); ++cno) {    
       
         const geometry::Range2d<int>& cbounds = _clipbounds[cno];
         apply_clip_box<ras_type> (ras, cbounds);
@@ -552,7 +552,7 @@
       typedef agg::scanline_u8_am<agg::alpha_mask_gray8> scanline_type;
       scanline_type sl(m_alpha_mask.back()->get_amask());
   
-      for (unsigned int cno=0; cno<_clipbounds.size(); cno++) {    
+      for (unsigned int cno=0; cno<_clipbounds.size(); ++cno) {    
       
         const geometry::Range2d<int>& cbounds = _clipbounds[cno];
         apply_clip_box<ras_type> (ras, cbounds);
@@ -652,7 +652,7 @@
     
     assert(scale_set);
     // clear the stage using the background color
-    for (unsigned int i=0; i<_clipbounds.size(); i++) 
+    for (unsigned int i=0; i<_clipbounds.size(); ++i) 
       clear_framebuffer(_clipbounds[i], agg::rgba8_pre(background_color.m_r,
         background_color.m_g, background_color.m_b,
         background_color.m_a));        
@@ -728,7 +728,7 @@
     matrix mat = stage_matrix;
     mat.concatenate(line_mat);    
 
-    if ( _clipbounds.size()==0 ) return;
+    if ( _clipbounds.empty() ) return;
 
     point pnt;
     
@@ -766,7 +766,7 @@
       
       agg::scanline_p8 sl;      
       
-      for (unsigned int cno=0; cno<_clipbounds.size(); cno++) {
+      for (unsigned int cno=0; cno<_clipbounds.size(); ++cno) {
       
         const geometry::Range2d<int>& bounds = _clipbounds[cno];
               
@@ -790,7 +790,7 @@
       
       sl_type sl(m_alpha_mask.back()->get_amask());      
       
-      for (unsigned int cno=0; cno<_clipbounds.size(); cno++) {
+      for (unsigned int cno=0; cno<_clipbounds.size(); ++cno) {
       
         const geometry::Range2d<int>& bounds = _clipbounds[cno];
               
@@ -818,7 +818,7 @@
     
     agg_alpha_mask* new_mask = new agg_alpha_mask(xres, yres);
     
-    for (unsigned int cno=0; cno<_clipbounds.size(); cno++)  
+    for (unsigned int cno=0; cno<_clipbounds.size(); ++cno)  
       new_mask->clear(_clipbounds[cno]);
     
     m_alpha_mask.push_back(new_mask);
@@ -914,8 +914,8 @@
     );
     
     
-    int count = _clipbounds.size();
-    for (int cno=0; cno<count; cno++) {
+    const int count = _clipbounds.size();
+    for (int cno=0; cno<count; ++cno) {
           
       if (_clipbounds[cno].intersects(bounds.getRange())) 
         _clipbounds_selected.push_back(&_clipbounds[cno]);
@@ -925,14 +925,15 @@
   
   void select_all_clipbounds() {
   
-    if (_clipbounds_selected.size() == _clipbounds.size()) 
+    const unsigned int count = _clipbounds.size();
+
+    if (_clipbounds_selected.size() == count)
       return; // already all selected
   
     _clipbounds_selected.clear();
-    _clipbounds_selected.resize(_clipbounds.size());
+    _clipbounds_selected.resize(count);
     
-    int count = _clipbounds.size();
-    for (int cno=0; cno<count; cno++) 
+    for (unsigned int cno=0; cno<count; ++cno) 
       _clipbounds_selected[cno] = &_clipbounds[cno];
   }
 
@@ -993,7 +994,7 @@
       // We need to separate sub-shapes during rendering. 
       const unsigned int subshape_count = count_sub_shapes(paths);
      
-      for (unsigned int subshape=0; subshape<subshape_count; subshape++)
+      for (unsigned int subshape=0; subshape<subshape_count; ++subshape)
       {
         if (have_shape)
         {
@@ -1022,9 +1023,9 @@
     have_shape=false;
     have_outline=false;
     
-    int pcount = paths.size();
+    const int pcount = paths.size();
     
-    for (int pno=0; pno<pcount; pno++) {
+    for (int pno=0; pno<pcount; ++pno) {
     
       const path &the_path = paths[pno];
     
@@ -1074,9 +1075,9 @@
   unsigned int count_sub_shapes(const std::vector<path> &path_in)
   {
     unsigned int sscount=1;
-    size_t pcnt = path_in.size();
+    const size_t pcnt = path_in.size();
     
-    for (size_t pno=0; pno<pcnt; pno++) {
+    for (size_t pno=0; pno<pcnt; ++pno) {
       const path& this_path = path_in[pno];
       
       if (this_path.m_new_shape)
@@ -1091,11 +1092,11 @@
   /// TWIPS to pixels on the fly.
   void build_agg_paths(std::vector<agg::path_storage>& dest, const 
std::vector<path>& paths) 
   {
-    const double subpixel_offset = 0.5;
+    //const double subpixel_offset = 0.5; // unused, should be ?
     size_t pcnt = paths.size();
     dest.resize(pcnt);
     
-    for (size_t pno=0; pno<pcnt; pno++)
+    for (size_t pno=0; pno<pcnt; ++pno)
     {
         const path& path_in_sub = paths[pno]; 
         agg::path_storage& new_path = dest[pno];
@@ -1103,8 +1104,8 @@
         new_path.move_to(TWIPS_TO_SHIFTED_PIXELS(path_in_sub.ap.x), 
                           TWIPS_TO_SHIFTED_PIXELS(path_in_sub.ap.y));
 
-        size_t ecnt = path_in_sub.m_edges.size();
-        for (size_t eno=0; eno<ecnt; eno++)
+        const size_t ecnt = path_in_sub.m_edges.size();
+        for (size_t eno=0; eno<ecnt; ++eno)
         {
             const edge& this_edge = path_in_sub.m_edges[eno];             
             if (this_edge.is_straight())
@@ -1147,11 +1148,11 @@
 
     const float subpixel_offset = 0.5f;
     
-    size_t pcount = paths.size();
+    const size_t pcount = paths.size();
 
     dest.resize(pcount);    
     
-    for (size_t pno=0; pno<pcount; pno++) {
+    for (size_t pno=0; pno<pcount; ++pno) {
       
       const path& this_path = paths[pno];
       agg::path_storage& new_path = dest[pno];
@@ -1182,7 +1183,7 @@
       if (closed && ecount && 
         this_path.m_edges.back().is_straight()) ecount--;      
       
-      for (size_t eno=0; eno<ecount; eno++) {
+      for (size_t eno=0; eno<ecount; ++eno) {
         
         const edge& this_edge = this_path.m_edges[eno];
         
@@ -1287,8 +1288,8 @@
     matrix inv_stage_matrix = stage_matrix;
     inv_stage_matrix.invert();
     
-    size_t fcount = fill_styles.size();
-    for (size_t fno=0; fno<fcount; fno++) {
+    const size_t fcount = fill_styles.size();
+    for (size_t fno=0; fno<fcount; ++fno) {
     
       bool smooth=false;
       int fill_type = fill_styles[fno].get_type();
@@ -1436,7 +1437,7 @@
     
     assert(!m_drawing_mask);
     
-    if ( _clipbounds.size()==0 ) return;
+    if ( _clipbounds.empty() ) return;
 
     // AGG stuff
     typedef agg::rasterizer_compound_aa<agg::rasterizer_sl_clip_dbl> ras_type;
@@ -1454,7 +1455,7 @@
       rasc.filling_rule(agg::fill_non_zero);
       
     
-    for (unsigned int cno=0; cno<_clipbounds_selected.size(); cno++) {
+    for (unsigned int cno=0; cno<_clipbounds_selected.size(); ++cno) {
     
       const geometry::Range2d<int>* bounds = _clipbounds_selected[cno];
       
@@ -1463,9 +1464,9 @@
       int current_subshape=0;
         
       // push paths to AGG
-      size_t pcount = paths.size();
+      const size_t pcount = paths.size();
   
-      for (size_t pno=0; pno<pcount; pno++) {
+      for (size_t pno=0; pno<pcount; ++pno) {
           
         const path &this_path_gnash = paths[pno];
         agg::path_storage &this_path_agg = 
@@ -1473,7 +1474,7 @@
         agg::conv_curve< agg::path_storage > curve(this_path_agg);        
         
         if (this_path_gnash.m_new_shape)
-          current_subshape++;
+          ++current_subshape;
           
         if ((subshape_id>=0) && (current_subshape!=subshape_id)) {
           // Skip this path as it is not part of the requested sub-shape.
@@ -1579,7 +1580,7 @@
     agg::path_storage path; // be carefull about this name 
     agg::conv_curve< agg::path_storage > curve(path);
 
-    for (size_t pno=0, pcount=paths.size(); pno < pcount; pno++) {
+    for (size_t pno=0, pcount=paths.size(); pno < pcount; ++pno) {
 
       const Path& this_path = paths[pno];
 
@@ -1593,8 +1594,8 @@
       path.move_to(TWIPS_TO_PIXELS(this_path.ap.x), 
                    TWIPS_TO_PIXELS(this_path.ap.y));
     
-      unsigned int ecount = this_path.m_edges.size();
-      for (unsigned int eno=0; eno<ecount; eno++) {
+      const unsigned int ecount = this_path.m_edges.size();
+      for (unsigned int eno=0; eno<ecount; ++eno) {
 
         const edge &this_edge = this_path.m_edges[eno];
 
@@ -1668,7 +1669,7 @@
     if (m_drawing_mask)    // Flash ignores lines in mask /definitions/
       return;    
     
-    if ( _clipbounds.size()==0 ) return;
+    if ( _clipbounds.empty() ) return;
 
     // TODO: While walking the paths for filling them, remember when a path
     // has a line style associated, so that we avoid walking the paths again
@@ -1690,7 +1691,7 @@
       agg::renderer_base<PixelFormat> > ren_sl(rbase); // solid fills
       
     
-    for (unsigned int cno=0; cno<_clipbounds_selected.size(); cno++) {
+    for (unsigned int cno=0; cno<_clipbounds_selected.size(); ++cno) {
     
       const geometry::Range2d<int>* bounds = _clipbounds_selected[cno];
           
@@ -1698,7 +1699,7 @@
       
       int current_subshape=0;
 
-      for (size_t pno=0, pcount=paths.size(); pno<pcount; pno++) {
+      for (size_t pno=0, pcount=paths.size(); pno<pcount; ++pno) {
 
         const path& this_path_gnash = paths[pno];
 
@@ -1706,7 +1707,7 @@
           const_cast<agg::path_storage&>(agg_paths[pno]);
         
         if (this_path_gnash.m_new_shape)
-          current_subshape++;
+          ++current_subshape;
           
         if ((subshape_id>=0) && (current_subshape!=subshape_id)) {
           // Skip this path as it is not part of the requested sub-shape.
@@ -1784,7 +1785,7 @@
 
     if (corner_count<1) return;
     
-    if ( _clipbounds.size()==0 ) return;
+    if ( _clipbounds.empty() ) return;
     
     matrix mat = stage_matrix;
     mat.concatenate(poly_mat);
@@ -1807,7 +1808,7 @@
       point(trunc(corners[0].x), trunc(corners[0].y)));
     path.move_to(trunc(origin.x)+0.5, trunc(origin.y)+0.5);
     
-    for (unsigned int i=1; i<corner_count; i++) {
+    for (unsigned int i=1; i<corner_count; ++i) {
     
       mat.transform(&pnt, point(corners[i].x, corners[i].y));
         
@@ -1822,7 +1823,7 @@
     // -- render --
       
     // iterate through clipping bounds
-    for (unsigned int cno=0; cno<_clipbounds.size(); cno++) {
+    for (unsigned int cno=0; cno<_clipbounds.size(); ++cno) {
     
       const geometry::Range2d<int>& bounds = _clipbounds[cno];         
       apply_clip_box<ras_type> (ras, bounds);     
@@ -1962,7 +1963,7 @@
     Range2d<int> visiblerect;
     if ( xres && yres ) visiblerect = Range2d<int>(0, 0, xres-1, yres-1);
     
-    for (size_t rno=0; rno<ranges.size(); rno++) {
+    for (size_t rno=0; rno<ranges.size(); ++rno) {
     
       const Range2d<float>& range = ranges.getRange(rno);
 
@@ -1976,7 +1977,7 @@
       
       _clipbounds.push_back(bounds);
       
-      count++;
+      ++count;
     }
     //log_debug("%d inv. bounds in frame", count);
     
@@ -1989,7 +1990,7 @@
   
     Range2d<int> pixbounds = world_to_pixel(bounds);
     
-    for (unsigned int cno=0; cno<_clipbounds.size(); cno++) {  
+    for (unsigned int cno=0; cno<_clipbounds.size(); ++cno) {  
       if (Intersect(pixbounds, _clipbounds[cno]))
         return true;
     }

=== modified file 'libbase/URL.cpp'
--- a/libbase/URL.cpp   2008-06-14 21:12:13 +0000
+++ b/libbase/URL.cpp   2008-07-23 17:08:27 +0000
@@ -375,7 +375,7 @@
 
        // extract the parameters from the URL
 
-       size_t qmpos = _path.rfind("?");
+       size_t qmpos = _path.find("?");
        if (qmpos == string::npos)
        {
                // no query string

=== modified file 'libcore/vm/ASHandlers.cpp'
--- a/libcore/vm/ASHandlers.cpp 2008-07-21 09:56:09 +0000
+++ b/libcore/vm/ASHandlers.cpp 2008-07-23 12:07:52 +0000
@@ -64,6 +64,15 @@
 #include <boost/lexical_cast.hpp>
 #include <algorithm> // std::swap
 
+// GNASH_PARANOIA_LEVEL:
+// 0 : no assertions
+// 1 : quick assertions
+// 2 : check that handlers are called on correct tag
+//
+#ifndef GNASH_PARANOIA_LEVEL
+# define GNASH_PARANOIA_LEVEL 1
+#endif
+
 namespace {
 #ifdef USE_DEBUGGER
 static gnash::Debugger& debugger = gnash::Debugger::getDefaultInstance();
@@ -458,7 +467,7 @@
 SWFHandlers::ActionEnd(ActionExec& thread)
 {
 
-#ifndef NDEBUG
+#if GNASH_PARANOIA_LEVEL > 1
     assert(thread.atActionTag(SWF::ACTION_END));
 #endif
 
@@ -473,7 +482,7 @@
 
     as_environment& env = thread.env;
 
-#ifndef NDEBUG
+#if GNASH_PARANOIA_LEVEL > 1
     assert(thread.atActionTag(SWF::ACTION_NEXTFRAME));
 #endif
 
@@ -489,7 +498,7 @@
 
     as_environment& env = thread.env;
 
-#ifndef NDEBUG
+#if GNASH_PARANOIA_LEVEL > 1
     assert(thread.atActionTag(SWF::ACTION_PREVFRAME));
 #endif
 
@@ -505,7 +514,7 @@
 
     as_environment& env = thread.env;
 
-#ifndef NDEBUG
+#if GNASH_PARANOIA_LEVEL > 1
     assert(thread.atActionTag(SWF::ACTION_PLAY));
 #endif
 
@@ -521,7 +530,7 @@
 
     as_environment& env = thread.env;
 
-#ifndef NDEBUG
+#if GNASH_PARANOIA_LEVEL > 1
     assert(thread.atActionTag(SWF::ACTION_STOP));
 #endif
 
@@ -535,18 +544,18 @@
 SWFHandlers::ActionToggleQuality(ActionExec& thread)
 {
 
-#ifndef NDEBUG
+#if GNASH_PARANOIA_LEVEL > 1
     assert(thread.atActionTag(SWF::ACTION_TOGGLEQUALITY));
 #endif
 
-    log_unimpl (__PRETTY_FUNCTION__);
+    LOG_ONCE( log_unimpl (__PRETTY_FUNCTION__) );
 }
 
 void
 SWFHandlers::ActionStopSounds(ActionExec& thread)
 {
 
-#ifndef NDEBUG
+#if GNASH_PARANOIA_LEVEL > 1
     assert(thread.atActionTag(SWF::ACTION_STOPSOUNDS));
 #endif
 
@@ -564,7 +573,9 @@
     as_environment& env = thread.env;
     const action_buffer& code = thread.code;
 
+#if GNASH_PARANOIA_LEVEL > 1
     assert(thread.atActionTag(SWF::ACTION_GOTOFRAME));
+#endif
 
     size_t frame = code.read_int16(thread.getCurrentPC()+3);
 
@@ -583,7 +594,9 @@
     as_environment& env = thread.env;
     const action_buffer& code = thread.code;
 
+#if GNASH_PARANOIA_LEVEL > 1
     assert(thread.atActionTag(SWF::ACTION_GETURL));
+#endif
 
     size_t pc = thread.getCurrentPC();
 
@@ -617,7 +630,9 @@
     as_environment& env = thread.env;
     const action_buffer& code = thread.code;
 
+#if GNASH_PARANOIA_LEVEL > 1
     assert(thread.atActionTag(SWF::ACTION_WAITFORFRAME));
+#endif
 
     // SWF integrity check
     size_t tag_len = code.read_int16(thread.getCurrentPC()+1);
@@ -667,7 +682,9 @@
     const action_buffer& code = thread.code;
     size_t pc = thread.getCurrentPC();
 
+#if GNASH_PARANOIA_LEVEL > 1
     assert(thread.atActionTag(SWF::ACTION_SETTARGET)); // 0x8B
+#endif
 
     // Change the movie we're working on.
     std::string target_name ( code.read_string(pc+3) );
@@ -760,7 +777,9 @@
 
     as_environment& env = thread.env;
 
+#if GNASH_PARANOIA_LEVEL > 1
     assert(thread.atActionTag(SWF::ACTION_EQUAL)); // 0x0E
+#endif
 
     thread.ensureStack(2);
 
@@ -933,9 +952,11 @@
         size = wstr.length() - start;
     }
 
+#if GNASH_PARANOIA_LEVEL > 1
     assert(start >= 0);
     assert(static_cast<unsigned int>(start) < wstr.length() );
     assert(size >= 0);
+#endif
 
     env.drop(2);
     env.top(0).set_string(utf8::encodeCanonicalString(
@@ -1081,7 +1102,9 @@
         if ( prop_number < get_property_names().size() )
         {
             as_value val;
-            assert( get_property_names().size() );
+#if GNASH_PARANOIA_LEVEL > 1
+            assert( ! get_property_names().empty() );
+#endif
             std::string propname = get_property_names()[prop_number];
 
             thread.getObjectMember(*target, propname, val);
@@ -1257,7 +1280,9 @@
 
     as_environment& env = thread.env;
 
+#if GNASH_PARANOIA_LEVEL > 1
     assert(thread.atActionTag(SWF::ACTION_STARTDRAGMOVIE));
+#endif
 
     thread.ensureStack(3);
 
@@ -1497,7 +1522,9 @@
 {
     
 
+#if GNASH_PARANOIA_LEVEL > 1
     assert(thread.atActionTag(SWF::ACTION_FSCOMMAND2)); // 0x0E
+#endif
 
     as_environment& env = thread.env;
 
@@ -1982,7 +2009,7 @@
 
     size_t pc = thread.getCurrentPC();
     boost::int16_t length = code.read_int16(pc+1);
-    assert( length >= 0 );
+    assert( length >= 0 ); // TODO: trigger this with a testcase !
 
 #if 0 // is this really useful ?
         IF_VERBOSE_ACTION (
@@ -2366,7 +2393,7 @@
             log_debug("TESTME: target of a loadMovie changed its target path");
         }
         movie_root& mr = VM::get().getRoot();
-        assert( mr.findCharacterByTarget(s) == target_movie );
+        assert( mr.findCharacterByTarget(s) == target_movie ); // TODO: try to 
trigger this !
 
         if ( usePost )
         {
@@ -2519,7 +2546,9 @@
 
     const action_buffer& code = thread.code;
 
+#if GNASH_PARANOIA_LEVEL > 1
     assert(thread.atActionTag(SWF::ACTION_GETURL2));
+#endif
 
     boost::uint8_t method = code[thread.getCurrentPC() + 3];
 
@@ -2548,7 +2577,9 @@
     size_t nextPC = thread.getNextPC();
     size_t stopPC = thread.getStopPC();
 
+#if GNASH_PARANOIA_LEVEL > 1
     assert(thread.atActionTag(SWF::ACTION_BRANCHIFTRUE));
+#endif
 
     thread.ensureStack(1); // bool
 
@@ -2692,7 +2723,9 @@
     //GNASH_REPORT_FUNCTION;
     as_environment& env = thread.env;
 
+#if GNASH_PARANOIA_LEVEL > 1
     assert(thread.atActionTag(SWF::ACTION_DELETE)); // 0x3A
+#endif
 
     thread.ensureStack(2); // obj, member
 
@@ -2725,7 +2758,9 @@
 
     as_environment& env = thread.env;
 
+#if GNASH_PARANOIA_LEVEL > 1
     assert(thread.atActionTag(SWF::ACTION_DELETE2)); // 0x3B
+#endif
 
     thread.ensureStack(1); // var
 
@@ -2969,7 +3004,7 @@
     thread.ensureStack(1); // array size name
 
     const int array_size = env.pop().to_int();
-    assert(array_size >= 0);
+    assert(array_size >= 0); // TODO: trigger this !!
 
     thread.ensureStack(static_cast<unsigned int>(array_size)); // array 
elements
 
@@ -3218,7 +3253,9 @@
     //GNASH_REPORT_FUNCTION;
     as_environment& env = thread.env;
 
+#if GNASH_PARANOIA_LEVEL > 1
     assert(thread.atActionTag(SWF::ACTION_NEWEQUALS));
+#endif
 
     thread.ensureStack(2);
 
@@ -3562,7 +3599,9 @@
 
     as_environment& env = thread.env;
 
+#if GNASH_PARANOIA_LEVEL > 1
     assert(thread.atActionTag(SWF::ACTION_NEWMETHOD));
+#endif
 
     thread.ensureStack(3); // method, object, nargs
 
@@ -4019,7 +4058,7 @@
 
     const action_buffer& code = thread.code;
 
-#ifndef NDEBUG
+#if GNASH_PARANOIA_LEVEL > 1
     assert(thread.atActionTag(SWF::ACTION_TRY));
 #endif
 
@@ -4079,7 +4118,9 @@
     const action_buffer& code = thread.code;
     size_t pc = thread.getCurrentPC();
 
+#if GNASH_PARANOIA_LEVEL > 1
     assert(thread.atActionTag(SWF::ACTION_WITH));
+#endif
 
     thread.ensureStack(1);  // the object
     as_value with_obj_val = env.pop().to_object();
@@ -4141,6 +4182,7 @@
     const action_buffer& code = thread.code;
 
 #ifndef NDEBUG
+    // TODO: check effects of the following 'length' 
     boost::int16_t length = code.read_int16(thread.getCurrentPC()+1);
     assert( length >= 0 );
 #endif

=== modified file 'testsuite/libbase/URLTest.cpp'
--- a/testsuite/libbase/URLTest.cpp     2008-02-15 21:07:19 +0000
+++ b/testsuite/libbase/URLTest.cpp     2008-07-23 17:08:27 +0000
@@ -195,6 +195,38 @@
        check_equals (u21.path(), "/~gnash/movie2.swf");
        check_equals (u21.hostname(), "www.gnu.org");
 
+       // Test url with mixed query string and anchor
+       URL u22("http://localhost/?query#anchor";); // simple case
+       check_equals (u22.querystring(), "query");
+       check_equals (u22.anchor(), "anchor");
+       check_equals (u22.hostname(), "localhost");
+       check_equals (u22.path(), "/");
+       URL u23("http://localhost/?query#questions?";); 
+       check_equals (u23.querystring(), "query");
+       check_equals (u23.anchor(), "questions?");
+       check_equals (u23.hostname(), "localhost");
+       check_equals (u23.path(), "/");
+       URL u24("http://localhost/?query#questions?yes";); 
+       check_equals (u24.querystring(), "query");
+       check_equals (u24.anchor(), "questions?yes");
+       check_equals (u24.hostname(), "localhost");
+       check_equals (u24.path(), "/");
+       URL u25("http://localhost/#anchor?query";);
+       check_equals (u25.querystring(), "");
+       check_equals (u25.anchor(), "anchor?query");
+       check_equals (u25.hostname(), "localhost");
+       check_equals (u25.path(), "/");
+       URL u26("http://localhost/?query1?query2?query3";);
+       check_equals (u26.querystring(), "query1?query2?query3");
+       check_equals (u26.anchor(), "");
+       check_equals (u26.hostname(), "localhost");
+       check_equals (u26.path(), "/");
+       URL u27("http://localhost/?query1?query2#anchor?query3";);
+       check_equals (u27.querystring(), "query1?query2");
+       check_equals (u27.anchor(), "anchor?query3");
+       check_equals (u27.hostname(), "localhost");
+       check_equals (u27.path(), "/");
+
 
        // TODO: Samba paths
 }


reply via email to

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