예제 #1
0
enum dom_code  render_dom_element_end_source( struct dom_stack *stack, struct dom_node *node, void *data )
{
  int eax;
  int ecx;
  int edx;
  struct dom_renderer *renderer = &stack->current[0].data[0];
  unsigned char *string;
  if ( assert_failed == 0 )
    assert_failed = 0;
  if ( stack->contexts[0]->info->object_size )
  {
    if ( assert_failed == 0 )
    {
      assert_failed = *(int*)(esi + 4) == 0;
      if ( !(_Bool)( *(int*)(esi + 4) != 0 ) )
      {
        errfile = "/home/naftali/source/elinks-0.12~pre5/src/dom/stack.h";
        errline = 198;
        elinks_internal( "assertion context->state_objects failed!" );
        *ebp_32 = stack->depth;
      }
    }
  }
  string[0] = *(int*)(eax + 20);
  if ( assert_failed == 0 )
  {
    if ( node && renderer[0] && renderer->document )
      assert_failed = 0;
    else
    {
      assert_failed = 1;
      errfile = "/home/naftali/source/elinks-0.12~pre5/src/document/dom/renderer.c";
      errline = 578;
      elinks_internal( "assertion node && renderer && renderer->document failed!" );
      string[0] = string[0];
    }
  }
  if ( esi && string[0] )
  {
    if ( renderer->source <= string[0] && string[ esi ] <= renderer->end )
    {
      render_dom_flush( &renderer[0], &string[0] );
      renderer->position = &edi;
      if ( assert_failed == 0 )
      {
        if ( renderer->position < renderer->source || renderer->end < renderer->position )
        {
          assert_failed = 1;
          errfile = "/home/naftali/source/elinks-0.12~pre5/src/document/dom/renderer.c";
          errline = 586;
          elinks_internal( "assertion check_dom_node_source(renderer, renderer-&gt;position, 0) failed: renderer[%p : %p] str[%p : %p]" );
        }
        else
          assert_failed = 0;
      }
    }
    render_dom_text( &renderer[0], &renderer->styles[ node[0].type ] );
  }
  return DOM_CODE_OK;
}
예제 #2
0
int get_protocol_port( enum protocol  protocol )
{
  int eax;
  if ( assert_failed == 0 )
  {
    assert_failed = protocol > 20;
    if ( protocol > 20 )
    {
      errfile = "/home/naftali/source/elinks-0.12~pre5/src/protocol/protocol.c";
      errline = 154;
      elinks_internal( "assertion VALID_PROTOCOL(protocol) failed!" );
      if ( assert_failed == 0 )
        goto B3;
    }
B3:    assert_failed = protocol_backends[ protocol << 4 ].port > 65535;
    if ( protocol_backends[ protocol << 4 ].port > 65535 )
    {
      errfile = "/home/naftali/source/elinks-0.12~pre5/src/protocol/protocol.c";
      errline = 157;
      elinks_internal( "assertion uri_port_is_valid(protocol_backends[protocol].port) failed!" );
      if ( assert_failed )
        goto B2;
    }
    return ebp_12;
  }
B2:  assert_failed = 0;
  return 0;
}
예제 #3
0
void render_dom_flush( struct dom_renderer *renderer, unsigned char *string )
{
  int ecx;
  if ( assert_failed == 0 )
  {
    if ( renderer->position < renderer->source || renderer->end < renderer->position )
    {
      assert_failed = 1;
      errfile = "/home/naftali/source/elinks-0.12~pre5/src/document/dom/renderer.c";
      errline = 457;
      elinks_internal( renderer->source );
      if ( assert_failed == 0 )
      {
        if ( string[0] < renderer->source )
        {
          assert_failed = 1;
          errfile = "/home/naftali/source/elinks-0.12~pre5/src/document/dom/renderer.c";
          errline = 458;
          elinks_internal( renderer->source );
        }
      }
    }
    else
    {
      assert_failed = 0;
      if ( string[0] < renderer->source )
        continue;
    }
    if ( renderer->end < string[0] )
      continue;
    else
      assert_failed = 0;
  }
  if ( string - renderer->position >= 1 )
  {
    render_dom_text( &renderer[0], &renderer->styles[3], renderer->position, string - renderer->position );
    renderer->position = &string[0];
    if ( assert_failed == 0 )
    {
      if ( string[0] < renderer->source || renderer->end < string[0] )
      {
        assert_failed = 1;
        errfile = "/home/naftali/source/elinks-0.12~pre5/src/document/dom/renderer.c";
        errline = 464;
        elinks_internal( renderer->source );
        string[0] = string[0];
      }
      else
      {
        assert_failed = 0;
      }
    }
  }
  return;
}
예제 #4
0
void done_connection_info( struct socket *socket )
{
  struct connect_info *connect_info = socket->connect_info;
  if ( assert_failed == 0 )
  {
    assert_failed = connect_info[0].addr == 0;
    if ( !(_Bool)( connect_info[0].addr != 0 ) )
    {
      errfile = "/home/naftali/source/elinks-0.12~pre5/src/network/socket.c";
      errline = 129;
      elinks_internal( "assertion socket-&gt;connect_info failed!" );
    }
  }
  if ( connect_info->dnsquery )
    kill_dns_request( &connect_info->dnsquery );
{
  void *p = (void*)connect_info->addr;
  if ( connect_info->addr )
    mem_free( &((int*)p)[0] );
  done_uri( connect_info->uri );
  if ( socket->connect_info )
  {
    mem_free( (void*)socket->connect_info );
  }
  socket->connect_info = 0;
  return;
}
}
예제 #5
0
struct blacklist_entry *get_blacklist_entry( struct uri *uri )
{
  struct blacklist_entry *entry;
  if ( assert_failed == 0 )
  {
    if ( uri && uri->bits_at_44/*.3_4of4*/ )
      assert_failed = 0;
    else
    {
      assert_failed = 1;
      errfile = "/home/naftali/source/elinks-0.12~pre5/src/protocol/http/blacklist.c";
      errline = 33;
      elinks_internal( "assertion uri && uri-&gt;hostlen &gt; 0 failed!" );
      if ( assert_failed )
        goto B2;
    }
    &entry[0] = &blacklist.next[0];
    if ( blacklist.next != blacklist.next )
    {
      do
      {
        errfile = "/home/naftali/source/elinks-0.12~pre5/src/protocol/http/blacklist.c";
        errline = 37;
        if ( elinks_strlcasecmp( &entry->host[0], -1, uri->host, uri->bits_at_44/*.3_4of4*/, 1 ) == 0 )
          break;
        &entry[0] = &entry;
      }
      while ( entry->next == blacklist.next );
    }
    return 0;
  }
B2:  assert_failed = 0;
  &entry[0] = 0;
  return &entry[0];
}
예제 #6
0
struct string *add_bytes_to_string__( struct string *string, unsigned char *bytes, int length )
{
  int ecx;
  int edx;
  int newlength;
  if ( assert_failed == 0 )
  {
    if ( bytes[0] && string && length >= 0 )
      assert_failed = 0;
    else
    {
      assert_failed = 1;
      errfile = "/home/naftali/source/elinks-0.12~pre5/src/util/string.h";
      errline = 255;
      elinks_internal( "assertion string && bytes && length &gt;= 0 failed: [add_bytes_to_string]" );
      if ( assert_failed )
        goto B2;
    }
    if ( length )
    {
      newlength = string->length + length;
      if ( ( ( string->length + 255 ) & -256 ) < ( ( newlength + 256 ) & -256 ) )
      {
        ebp_32 = bytes[0];
        *ebp_36 = length;
        if ( mem_realloc( (void*)string->source, length ) )
        {
          string = (struct string*)mem_realloc( (void*)string->source, length );
          memset( string[0].source + ( ( string->length + 255 ) & -256 ), 0, ( ( newlength + 256 ) & -256 ) - ( ( string->length + 255 ) & -256 ) );
        }
        else
        {
          string[0].source = 0;
          return &string[0];
        }
      }
      if ( string->source )
      {
        memcpy( string->length + string->source, &bytes[0], length );
        string->length = newlength;
        return &string[0];
      }
      string[0].source = 0;
      return &string[0];
    }
    else
    {
      return &string[0];
    }
  }
B2:  assert_failed = 0;
  string[0].source = 0;
  return &string[0];
}
예제 #7
0
void detach_downloads_from_terminal( struct terminal *term )
{
  int edx;
  struct file_download *file_download, *next;
  if ( assert_failed == 0 )
  {
    assert_failed = term[0].next == 0;
    if ( !(_Bool)( term[0].next != 0 ) )
    {
      errfile = "/home/naftali/source/elinks-0.12~pre5/src/session/download.c";
      errline = 227;
      elinks_internal( "assertion term != NULL failed!" );
      if ( assert_failed )
      {
        term = &term[0];
      }
    }
    file_download = &downloads.next[0];
    next = &downloads.next[0];
    if ( downloads.next != downloads.next )
    {
      while ( 1 )
      {
        if ( file_download->term == term[0].next )
        {
          if ( file_download->external_handler == 0 )
          {
            file_download->term = 0;
            if ( file_download->ses && term[0].next == file_download->ses->tab->term )
              file_download->ses = 0;
          }
          else
          {
            abort_download( &file_download[0] );
            next = &file_download;
            file_download = &next;
            if ( downloads->next == next[0].next )
              break;
            next = &next[0];
          }
        }
        next = &next;
        file_download = &next;
        if ( downloads->next == next[0].next )
          break;
        next = &next[0];
      }
    }
    return;
  }
  assert_failed = 0;
  return;
}
예제 #8
0
int get_protocol_need_slash_after_host( enum protocol  protocol )
{
  if ( assert_failed == 0 )
  {
    assert_failed = protocol > 20;
    if ( protocol > 20 )
    {
      errfile = "/home/naftali/source/elinks-0.12~pre5/src/protocol/protocol.c";
      errline = 174;
      elinks_internal( "assertion VALID_PROTOCOL(protocol) failed!" );
      if ( assert_failed )
      {
      }
    }
    return ( (int)protocol_backends[ protocol ].bits_at_12/*.1_1of4*/ >> 1 ) & 1;
  }
예제 #9
0
void delete_auth_entry( struct listbox_item *item, int last )
{
  struct auth_entry *auth_entry = &item->udata[0];
  if ( assert_failed == 0 )
  {
    assert_failed = auth_entry->object.refcount != 0;
    if ( auth_entry->object.refcount )
    {
      errfile = "/home/naftali/source/elinks-0.12~pre5/src/protocol/auth/dialogs.c";
      errline = 212;
      elinks_internal( "assertion !is_object_used(auth_entry) failed!" );
      item = &auth_entry[0].next[0];
    }
    item = &auth_entry[0].next[0];
  }
  else
  {
    item = &auth_entry[0].next[0];
  }
}
예제 #10
0
void delete_formhist_data( struct listbox_item *item, int last )
{
  struct formhist_data *formhist_data = &item->udata[0];
  if ( assert_failed == 0 )
  {
    assert_failed = formhist_data->object.refcount != 0;
    if ( formhist_data->object.refcount )
    {
      errfile = "/home/naftali/source/elinks-0.12~pre5/src/formhist/dialogs.c";
      errline = 113;
      elinks_internal( "assertion !is_object_used(formhist_data) failed!" );
      item = &formhist_data[0].next[0];
    }
    item = &formhist_data[0].next[0];
  }
  else
  {
    item = &formhist_data[0].next[0];
  }
}
예제 #11
0
void install_signal_handler( int sig, void (*fn)( void * ), void *data, int critical )
{
  struct sigaction sa;
  if ( assert_failed == 0 )
  {
    assert_failed = sig > 31;
    if ( sig > 31 )
    {
      errfile = "/home/naftali/source/elinks-0.12~pre5/src/osdep/signals.c";
      errline = 261;
      elinks_internal( "assertion sig &gt;= 0 && sig &lt; NUM_SIGNALS failed: bad signal number: %d" );
      if ( assert_failed == 0 )
        goto B3;
    }
B3:    memset( sa.__sigaction_handler.sa_handler, 0, 140 );
    if ( fn )
    {
      sa.__sigaction_handler.sa_handler = &got_signal;
      sigfillset( sa.sa_mask.__val );
      signal_info[ sig ].handler = fn;
      signal_info[ sig ].data = data;
      signal_info[ sig ].critical = critical;
      sigaction( sig, sa.__sigaction_handler.sa_handler, 0 );
      return;
    }
    else
    {
      sa.__sigaction_handler.sa_handler = 1;
      sigfillset( sa.sa_mask.__val );
      sigaction( sig, sa.__sigaction_handler.sa_handler, 0 );
      signal_info[ sig ].handler = 0;
      signal_info->data[ sig ] = data;
      signal_info->critical = critical;
      return;
    }
  }
  assert_failed = 0;
  return;
}
예제 #12
0
struct connection_state connection_state( enum connection_basic_state  basic )
{
  int eax;
  int edx;
  if ( assert_failed == 0 )
  {
    assert_failed = basic == -1;
    if ( !(_Bool)( basic != -1 ) )
    {
      errfile = "/home/naftali/source/elinks-0.12~pre5/src/network/state.h";
      errline = 132;
      elinks_internal( "assertion basic != S_ERRNO failed!" );
      if ( assert_failed )
      {
      }
    }
    *(int*)(ebp_12 + 4) = 0;
    *ebp_12 = ebp_16;
    return ebp_12;
  }
  assert_failed = 0;
  return eax;
}
예제 #13
0
void dns_found( struct socket *socket, struct sockaddr_storage *addr, int addrlen )
{
  int eax;
  int edx;
  struct connect_info *connect_info = socket->connect_info;
  if ( addr == 0 )
  {
  }
  else
  {
    if ( assert_failed == 0 )
    {
      assert_failed = connect_info[0].addr == 0;
      if ( !(_Bool)( connect_info[0].addr != 0 ) )
      {
        errfile = "/home/naftali/source/elinks-0.12~pre5/src/network/socket.c";
        errline = 233;
        elinks_internal( "assertion connect_info failed!" );
      }
    }
    connect_info = (struct connect_info*)mem_alloc( addrlen << 7 );
    *ebp_40 = addrlen << 7;
    if ( connect_info[0].addr )
    {
      memcpy( connect_info[0].addr, &addr[0].ss_family, addrlen << 7 );
      connect_info->addrno = addrlen;
      if ( assert_failed == 0 )
        assert_failed = 0;
        socket = &socket[0];
        addr = -100003;
        addrlen = 0;
      else
        assert_failed = 0;
        socket = &socket[0];
        addr = -100003;
        addrlen = 0;
    }
예제 #14
0
void http_error_document( struct connection *conn, int code )
{
  if ( assert_failed == 0 )
  {
    if ( conn[0] && conn->uri )
      assert_failed = 0;
    else
    {
      assert_failed = 1;
      errfile = "/home/naftali/source/elinks-0.12~pre5/src/protocol/http/codes.c";
      errline = 202;
      elinks_internal( "assertion conn && conn-&gt;uri failed!" );
    }
  }
  if ( mem_calloc( 1, 8 ) )
  {
    *(int*)(mem_calloc( 1, 8 )) = code;
    conn->uri->object.object = conn->uri->object.refcount;
    *(int*)(mem_calloc( 1, 8 ) + 4) = conn->uri->string[0];
    code = mem_calloc( 1, 8 );
    conn = &show_http_error_document;
  }
  return;
}
예제 #15
0
unsigned char *format_command( unsigned char *command, unsigned char *type, int copiousoutput )
{
  struct string cmd;
  if ( init_string( &cmd ) )
  {
    while ( 1 )
    {
      while ( ( command[0] & 255 ) == 0 )
      {
        if ( command[0] != '%' )
        {
          if ( command[0] != '\\' )
          {
            if ( command[0] == '\'' )
            {
              command[0] = command[1];
              strcmp( "%s'", &command[1] );
              if ( 1 )
              {
                command[0] = command[3];
                add_char_to_string( &cmd, 37 );
              }
              else
              {
                add_char_to_string( &cmd, 39 );
              }
            }
            else
            {
              do
              {
                command[0] = command[1];
              }
              while ( command[0] != '%' && ( command[0] & 255 ) && command[0] != '\\' && command[0] != '\'' );
              if ( command[0] < command[0] )
              {
                if ( assert_failed == 0 )
                {
                  if ( command[0] && command[0] - command[0] >= 0 )
                    assert_failed = 0;
                  else
                  {
                    assert_failed = 1;
                    errfile = "/home/naftali/source/elinks-0.12~pre5/src/util/string.h";
                    errline = 255;
                    elinks_internal( "assertion string && bytes && length &gt;= 0 failed: [add_bytes_to_string]" );
                    if ( assert_failed )
                    {
                    }
                  }
                  if ( command[0] - command[0] )
                  {
                    if ( 0 < 0 )
                    {
                      if ( mem_realloc( (void*)cmd.source, 0 ) == 0 )
                        command[0] = command[0];
                      else
                      {
                        cmd.source = (unsigned char*)mem_realloc( (void*)cmd.source, 0 );
                        memset( cmd.source + 0, 0, 0 - 0 );
                      }
                    }
                    if ( cmd.source )
                    {
                      memcpy( cmd.length + cmd.source, &command[0], command[0] - command[0] );
                      cmd.source[ ebp_56 ] = 0;
                      cmd.length = ebp_56;
                    }
                  }
                }
                assert_failed = 0;
                command[0] = command[0];
                if ( command[0] != '\'' )
                {
                  if ( command[0] != '\\' )
                  {
                    if ( command[0] != '%' )
                      continue;
                    else
                    {
                      command[0] = command[0] + 1;
                      if ( command[1] )
                      {
                        if ( command[1] == 's' )
                          add_char_to_string( &cmd, 37 );
                          command[0] = command[0] + 1;
                        else
                        if ( command[1] == 't' )
                        {
                          if ( type[0] )
                            add_to_string( &cmd, &type[0] );
                        }
                      }
                      done_string( &cmd );
                      break;
                    }
                  }
                  else
                  {
                    command[0] = command[1];
                    if ( command[0] )
                    {
                      command[0] = command[1];
                      add_char_to_string( &cmd, command[0] );
                      break;
                      while ( 1 )
                      {
                      }
                    }
                    else
                    {
                      if ( copiousoutput && ( getenv( "PAGER" ) || file_exists( "/usr/bin/pager" ) || file_exists( "/usr/bin/less" ) || file_exists( "/usr/bin/more" ) ) )
                      {
                        add_char_to_string( &cmd, 124 );
                        add_to_string( &cmd, &pager[0] );
                      }
                      break;
                    }
                  }
                }
              }
              command[0] = command[0];
            }
          }
          else
          {
            command[0] = command[1];
          }
        }
        if ( command[0] != '\'' )
        {
        }
      }
예제 #16
0
void do_auth_dialog( struct session *ses, void *data )
{
  int edx;
  struct dialog *dlg;
  struct dialog_data *dlg_data;
  struct terminal *term = ses->tab->term;
  struct auth_entry *a;
  unsigned char sticker[1024], *text;
  int sticker_len;
  if ( get_invalid_auth_entry(  ) && !( ( *(char*)(get_invalid_auth_entry(  ) + 112) & 1 ) & 255 ) && get_uri_string( &a->uri->user[0], URI_HTTP_AUTH ) )
  {
    dlg = &a->realm[0];
    if ( 0 != 65 )
    {
      if ( term[0] && current_charset != get_terminal_codepage( &term[0] ) )
      {
        bind_textdomain_codeset( "elinks", get_cp_mime_name( get_terminal_codepage( &term[0] ) ) );
        *ebp_1076 = text[0];
        current_charset = get_terminal_codepage( &term[0] );
      }
      gettext( "Authentication required for %s at %s" );
      text[0] = text[0];
    }
    sticker_len = __snprintf_chk( sticker, 1024, 1, 1024, (char*)gettext( "Authentication required for %s at %s" ), dlg, text[0] );
    mem_free( &text[0] );
    if ( sticker_len <= 1024 )
    {
      dlg = (struct dialog*)mem_calloc( 1, sticker_len + 277 );
      if ( dlg )
      {
        a->bits_at_112/*.1_1of4*/ |= 1;
        dlg->layouter = &generic_dialog_layouter;
        dlg[0].title = _( "Authentication required", &term[0] );
        text[0] = dlg[3].abort;
        memcpy( dlg[3].abort, sticker, sticker_len );
        dlg->udata = (void*)ses[0].next;
        dlg->udata2 = (void*)a[0].next;
        add_dlg_text( dlg, (unsigned char*)dlg[3].abort, ALIGN_LEFT, 0 );
        add_dlg_field_do( dlg, WIDGET_FIELD, _( "Login", &term[0] ), 0, 0, 0, 40, &a->user[0], 0, INPFIELD_FLOAT );
        add_dlg_field_do( dlg, WIDGET_FIELD_PASS, _( "Password", &term[0] ), 0, 0, 0, 40, &a->password[0], 0, INPFIELD_FLOAT );
        add_dlg_button_do( dlg, _( "~OK", &term[0] ), 1, &ok_dialog, 0, &auth_ok, (void*)dlg );
        add_dlg_button_do( dlg, _( "~Cancel", &term[0] ), 2, &ok_dialog, 0, &auth_cancel, (void*)a[0].next );
        if ( assert_failed == 0 )
        {
          assert_failed = dlg->number_of_widgets != 5;
          if ( dlg->number_of_widgets != 5 )
          {
            errfile = "/home/naftali/source/elinks-0.12~pre5/src/protocol/auth/dialogs.c";
            errline = 118;
            elinks_internal( "assertion 5 == (dlg)-&gt;number_of_widgets failed!" );
          }
        }
        if ( dlg_data[0] && a->user[0] && a->password[0] == 0 )
          select_widget_by_id( &dlg_data[0], 1 );
      }
    }
  }
  if ( 0 ^ 0 )
  {
    __stack_chk_fail(  );
  }
  return;
}
예제 #17
0
enum dom_code  render_dom_node_source( struct dom_stack *stack, struct dom_node *node, void *data )
{
  int eax;
  int ecx;
  int edx;
  struct dom_renderer *renderer = &stack->current[0].data[0];
  if ( assert_failed == 0 )
  {
    if ( node[0] && renderer[0] && renderer->document )
      assert_failed = 0;
    else
    {
      assert_failed = 1;
      errfile = "/home/naftali/source/elinks-0.12~pre5/src/document/dom/renderer.c";
      errline = 540;
      elinks_internal( "assertion node && renderer && renderer-&gt;document failed!" );
    }
  }
  if ( node->type == 5 )
  {
  }
  if ( renderer->source <= node->string.string && node->string.string + node <= renderer->end )
  {
    *(int*)(esi - renderer->position) = node->string.string - renderer->position;
    if ( assert_failed == 0 )
    {
      if ( renderer->source <= renderer->position && renderer->position <= renderer->end )
        assert_failed = 0;
      else
      {
        assert_failed = 1;
        errfile = "/home/naftali/source/elinks-0.12~pre5/src/document/dom/renderer.c";
        errline = 457;
        elinks_internal( "assertion check_dom_node_source(renderer, renderer-&gt;position, 0) failed: renderer[%p : %p] str[%p : %p]" );
        *ebp_40 = node->string.string - renderer->position;
        if ( assert_failed == 0 )
          goto B28;
      }
B28:      if ( node->string.string < renderer->source || renderer->end < node->string.string )
      {
        assert_failed = 1;
        errfile = "/home/naftali/source/elinks-0.12~pre5/src/document/dom/renderer.c";
        errline = 458;
        elinks_internal( "assertion check_dom_node_source(renderer, string, 0) failed: renderer[%p : %p] str[%p : %p]" );
        *ebp_40 = ebp_40;
      }
      else
        assert_failed = 0;
    }
    if ( ebp_40 >= 1 )
    {
      render_dom_text( &renderer[0], &renderer->styles[3], renderer->position );
      renderer->position = node->string.string;
      if ( assert_failed == 0 )
      {
        if ( renderer->position < renderer->source || renderer->end < renderer->position )
        {
          assert_failed = 1;
          errfile = "/home/naftali/source/elinks-0.12~pre5/src/document/dom/renderer.c";
          errline = 464;
          elinks_internal( "assertion check_dom_node_source(renderer, renderer-&gt;position, 0) failed: renderer[%p : %p] str[%p : %p]" );
        }
        else
          assert_failed = 0;
      }
    }
    renderer->position = node->string.string + node->string.length;
    if ( assert_failed == 0 )
    {
      if ( renderer->position < renderer->source || renderer->end < renderer->position )
      {
        assert_failed = 1;
        errfile = "/home/naftali/source/elinks-0.12~pre5/src/document/dom/renderer.c";
        errline = 482;
        elinks_internal( "assertion check_dom_node_source(renderer, renderer-&gt;position, 0) failed: renderer[%p : %p] str[%p : %p]" );
        render_dom_text( &renderer[0], &renderer->styles[ node->type ], node->string.string, node->string.length );
        return DOM_CODE_OK;
      }
      else
        assert_failed = 0;
    }
  }
}