* modules/gui/ncurses.c: support for tree playlist in ncurses interface   use 'v' to toggle view

--- modules/gui/ncurses.c
+++ modules/gui/ncurses.c
@@ -75,6 +75,12 @@

 static int  HandleKey      ( intf_thread_t *, int );
 static void Redraw         ( intf_thread_t *, time_t * );
+static void PlaylistRebuild( intf_thread_t * );
+static void PlaylistAddNode( intf_thread_t *, playlist_item_t *, int, char *);
+static void PlaylistDestroy( intf_thread_t * );
+static int  PlaylistChanged( vlc_object_t *, const char *, vlc_value_t,
+                             vlc_value_t, void * );
+static void FindIndex      ( intf_thread_t * );
 static void SearchPlaylist ( intf_thread_t *, char * );
 static void ManageSlider   ( intf_thread_t * );
 static void ReadDir        ( intf_thread_t * );
@@ -117,6 +123,11 @@
     vlc_bool_t  b_file;
     char        *psz_path;
 };
+struct pl_item_t
+{
+    playlist_item_t *p_item;
+    char            *psz_display;
+};
 struct intf_sys_t
 {
     playlist_t     *p_playlist;
@@ -135,7 +146,8 @@

     int             i_box_plidx;    /* Playlist index */
     int             b_box_plidx_follow;
-    int             i_box_bidx;    /* browser index */
+    playlist_item_t *p_plnode;      /* Playlist node */
+    int             i_box_bidx;     /* browser index */

     int             b_box_cleared;

@@ -146,10 +158,15 @@
     int             i_before_search;

     char            *psz_open_chain;
-
+
     char            *psz_current_dir;
     int             i_dir_entries;
     struct dir_entry_t  **pp_dir_entries;
+
+    int             i_current_view;             /* playlist view             */
+    struct pl_item_t    **pp_plist;
+    int             i_plist_entries;
+    vlc_bool_t      b_need_update;              /* for playlist view */
 };

 static void DrawBox( WINDOW *win, int y, int x, int h, int w, char *title );
@@ -178,6 +195,7 @@
     p_sys->b_box_plidx_follow = VLC_TRUE;
     p_sys->b_box_cleared = VLC_FALSE;
     p_sys->i_box_plidx = 0;
+    p_sys->p_plnode = NULL;
     p_sys->i_box_bidx = 0;
     p_sys->p_sub = msg_Subscribe( p_intf );

@@ -203,6 +221,12 @@
     val.i_int = -1;
     var_Set( p_intf->p_vlc, "verbose", val );

+    /* Set defaul playlist view */
+    p_sys->i_current_view = VIEW_SIMPLE;
+    p_sys->pp_plist = NULL;
+    p_sys->i_plist_entries = 0;
+    p_sys->b_need_update = VLC_FALSE;
+
     /* Initialize search chain */
     p_sys->psz_search_chain = (char *)malloc( SEARCH_CHAIN_SIZE + 1 );
     p_sys->psz_old_search = NULL;
@@ -210,11 +234,11 @@

     /* Initialize open chain */
     p_sys->psz_open_chain = (char *)malloc( OPEN_CHAIN_SIZE + 1 );
-
+
     /* Initialize browser options */
     var_Create( p_intf, "browse-dir", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
     var_Get( p_intf, "browse-dir", &val);
-
+
     if( val.psz_string && *val.psz_string )
     {
         p_sys->psz_current_dir = strdup( val.psz_string);
@@ -224,9 +248,9 @@
     {
         p_sys->psz_current_dir = strdup( p_intf->p_vlc->psz_homedir );
     }
-
+
     p_sys->i_dir_entries = 0;
-    p_sys->pp_dir_entries  = NULL;
+    p_sys->pp_dir_entries = NULL;
     ReadDir( p_intf );

     return VLC_SUCCESS;
@@ -241,6 +265,13 @@
     intf_sys_t    *p_sys = p_intf->p_sys;
     int i;

+    var_DelCallback( p_sys->p_playlist, "intf-change", PlaylistChanged,
+                     p_intf );
+    var_DelCallback( p_sys->p_playlist, "item-append", PlaylistChanged,
+                     p_intf );
+
+    PlaylistDestroy( p_intf );
+
     for( i = 0; i < p_sys->i_dir_entries; i++ )
     {
         struct dir_entry_t *p_dir_entry = p_sys->pp_dir_entries[i];
@@ -249,7 +280,7 @@
         if( p_dir_entry ) free( p_dir_entry );
     }
     p_sys->pp_dir_entries = NULL;
-
+
     if( p_sys->psz_current_dir ) free( p_sys->psz_current_dir );
     if( p_sys->psz_search_chain ) free( p_sys->psz_search_chain );
     if( p_sys->psz_old_search ) free( p_sys->psz_old_search );
@@ -295,7 +326,15 @@
         /* Update the input */
         if( p_sys->p_playlist == NULL )
         {
-            p_sys->p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+            p_sys->p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
+                                                 FIND_ANYWHERE );
+            if( p_sys->p_playlist )
+            {
+                var_AddCallback( p_sys->p_playlist, "intf-change",
+                                 PlaylistChanged, p_intf );
+                var_AddCallback( p_sys->p_playlist, "item-append",
+                                 PlaylistChanged, p_intf );
+            }
         }
         if( p_sys->p_playlist )
         {
@@ -323,7 +362,7 @@

         if( p_sys->b_box_plidx_follow && p_sys->p_playlist->i_index >= 0 )
         {
-            p_sys->i_box_plidx = p_sys->p_playlist->i_index;
+            FindIndex( p_intf );
         }

         while( ( i_key = getch()) != -1 )
@@ -331,7 +370,7 @@
             /*
              * HandleKey returns 1 if the screen needs to be redrawn
              */
-            if ( HandleKey( p_intf, i_key ) )
+            if( HandleKey( p_intf, i_key ) )
             {
                 Redraw( p_intf, &t_last_refresh );
             }
@@ -347,9 +386,9 @@
         /*
          * redraw the screen every second
          */
-        if ( (time(0) - t_last_refresh) >= 1 )
-        {
-            ManageSlider ( p_intf );
+        if( (time(0) - t_last_refresh) >= 1 )
+        {
+            ManageSlider( p_intf );
             Redraw( p_intf, &t_last_refresh );
         }
     }
@@ -394,6 +433,23 @@
                 playlist_Sort( p_sys->p_playlist, SORT_TITLE, ORDER_REVERSE );
                 return 1;

+            /* Playlist view */
+            case 'v':
+                switch( p_sys->i_current_view )
+                {
+                    case VIEW_SIMPLE:
+                        p_sys->i_current_view = VIEW_CATEGORY;
+                        break;
+                    case VIEW_CATEGORY:
+                        p_sys->i_current_view = VIEW_ALL;
+                        break;
+                    default:
+                        p_sys->i_current_view = VIEW_SIMPLE;
+                }
+                PlaylistRebuild( p_intf );
+                FindIndex( p_intf );
+                return 1;
+
             /* Playlist navigation */
             case KEY_HOME:
                 p_sys->i_box_plidx = 0;
@@ -430,7 +486,27 @@

             case KEY_ENTER:
             case 0x0d:
-                playlist_Goto( p_sys->p_playlist, p_sys->i_box_plidx );
+                if( p_sys->i_current_view == VIEW_ALL )
+                {
+                    playlist_Goto( p_sys->p_playlist, p_sys->i_box_plidx );
+                }
+                else
+                {
+                    if( p_sys->pp_plist[p_sys->i_box_plidx]->p_item->i_children
+                                == -1 )
+                    {
+                        playlist_Control( p_sys->p_playlist, PLAYLIST_ITEMPLAY,
+                            p_sys->pp_plist[p_sys->i_box_plidx]->p_item );
+                    }
+                    else
+                    {
+                        playlist_Control( p_sys->p_playlist, PLAYLIST_VIEWPLAY,
+                            p_sys->i_current_view,
+                            p_sys->pp_plist[p_sys->i_box_plidx]->p_item,
+                            NULL );
+                    }
+                }
+                p_sys->b_box_plidx_follow = VLC_TRUE;
                 break;
             default:
                 b_ret = VLC_FALSE;
@@ -439,12 +515,26 @@

         if( b_ret )
         {
-            if( p_sys->i_box_plidx >= p_sys->p_playlist->i_size ) p_sys->i_box_plidx = p_sys->p_playlist->i_size - 1;
+            int i_max = p_sys->i_plist_entries;
+            if( p_sys->i_current_view == VIEW_ALL )
+                i_max = p_sys->p_playlist->i_size;
+            if( p_sys->i_box_plidx >= i_max ) p_sys->i_box_plidx = i_max - 1;
             if( p_sys->i_box_plidx < 0 ) p_sys->i_box_plidx = 0;
-            if( p_sys->i_box_plidx == p_sys->p_playlist->i_index )
-                p_sys->b_box_plidx_follow = VLC_TRUE;
+            if( p_sys->i_current_view == VIEW_ALL )
+            {
+                if( p_sys->i_box_plidx == p_sys->p_playlist->i_index )
+                    p_sys->b_box_plidx_follow = VLC_TRUE;
+                else
+                    p_sys->b_box_plidx_follow = VLC_FALSE;
+            }
             else
-                p_sys->b_box_plidx_follow = VLC_FALSE;
+            {
+                if( p_sys->pp_plist[p_sys->i_box_plidx]->p_item ==
+                        p_sys->p_playlist->status.p_item )
+                    p_sys->b_box_plidx_follow = VLC_TRUE;
+                else
+                    p_sys->b_box_plidx_follow = VLC_FALSE;
+            }
             return 1;
         }
     }
@@ -495,7 +585,7 @@
                     char *psz_uri = (char *)malloc( sizeof(char)*i_size_entry);

                     sprintf( psz_uri, "%s/%s", p_sys->psz_current_dir, p_sys->pp_dir_entries[p_sys->i_box_bidx]->psz_path );
-
+
                     p_sys->psz_current_dir = strdup( psz_uri );
                     ReadDir( p_intf );
                     free( psz_uri );
@@ -552,21 +642,21 @@
         {
             case KEY_HOME:
                 p_sys->f_slider = 0;
-                ManageSlider ( p_intf );
+                ManageSlider( p_intf );
                 return 1;
             case KEY_END:
                 p_sys->f_slider = 99.9;
-                ManageSlider ( p_intf );
+                ManageSlider( p_intf );
                 return 1;
             case KEY_UP:
                 p_sys->f_slider += 5.0;
                 if( p_sys->f_slider >= 99.0 ) p_sys->f_slider = 99.0;
-                ManageSlider ( p_intf );
+                ManageSlider( p_intf );
                 return 1;
             case KEY_DOWN:
                 p_sys->f_slider -= 5.0;
                 if( p_sys->f_slider < 0.0 ) p_sys->f_slider = 0.0;
-                ManageSlider ( p_intf );
+                ManageSlider( p_intf );
                 return 1;

             default:
@@ -734,13 +824,13 @@
         case KEY_RIGHT:
             p_sys->f_slider += 1.0;
             if( p_sys->f_slider > 99.9 ) p_sys->f_slider = 99.9;
-            ManageSlider ( p_intf );
+            ManageSlider( p_intf );
             return 1;

         case KEY_LEFT:
             p_sys->f_slider -= 1.0;
             if( p_sys->f_slider < 0.0 ) p_sys->f_slider = 0.0;
-            ManageSlider ( p_intf );
+            ManageSlider( p_intf );
             return 1;

         /* Common control */
@@ -845,7 +935,7 @@
     }
 }

-static void ManageSlider ( intf_thread_t *p_intf )
+static void ManageSlider( intf_thread_t *p_intf )
 {
     intf_sys_t     *p_sys = p_intf->p_sys;
     input_thread_t *p_input = p_sys->p_input;
@@ -935,11 +1025,11 @@
     char    *p_buf = NULL;
     int      i_len;

-    va_start ( vl_args, p_fmt );
-    vasprintf ( &p_buf, p_fmt, vl_args );
-    va_end ( vl_args );
-
-    if ( p_buf == NULL )
+    va_start( vl_args, p_fmt );
+    vasprintf( &p_buf, p_fmt, vl_args );
+    va_end( vl_args );
+
+    if( p_buf == NULL )
     {
         return;
     }
@@ -983,9 +1073,9 @@
         return;
     }

-    va_start ( vl_args, p_fmt );
-    vasprintf ( &p_buf, p_fmt, vl_args );
-    va_end ( vl_args );
+    va_start( vl_args, p_fmt );
+    vasprintf( &p_buf, p_fmt, vl_args );
+    va_end( vl_args );

     if( p_buf == NULL )
     {
@@ -995,7 +1085,7 @@
     mvnprintw( p_sys->i_box_y + l - p_sys->i_box_start, x, COLS - x - 1, "%s", p_buf );
 }

-static void Redraw ( intf_thread_t *p_intf, time_t *t_last_refresh )
+static void Redraw( intf_thread_t *p_intf, time_t *t_last_refresh )
 {
     intf_sys_t     *p_sys = p_intf->p_sys;
     input_thread_t *p_input = p_sys->p_input;
@@ -1006,9 +1096,9 @@
     //clear();

     /* Title */
-    attrset ( A_REVERSE );
+    attrset( A_REVERSE );
     mvnprintw( y, 0, COLS, "VLC media player" " (ncurses interface) [ h for help ]" );
-    attroff ( A_REVERSE );
+    attroff( A_REVERSE );
     y += 2;

     /* Infos */
@@ -1078,7 +1168,7 @@
         }
         else
         {
-            y++;
+            y += 2;
         }
     }
     else
@@ -1177,12 +1267,12 @@
         {
             int i,j;
             vlc_mutex_lock( &p_input->input.p_item->lock );
-            for ( i = 0; i < p_input->input.p_item->i_categories; i++ )
+            for( i = 0; i < p_input->input.p_item->i_categories; i++ )
             {
                 info_category_t *p_category = p_input->input.p_item->pp_categories[i];
                 if( y >= y_end ) break;
                 MainBoxWrite( p_intf, l++, 1, "  [%s]", p_category->psz_name );
-                for ( j = 0; j < p_category->i_infos; j++ )
+                for( j = 0; j < p_category->i_infos; j++ )
                 {
                     info_t *p_info = p_category->pp_infos[j];
                     if( y >= y_end ) break;
@@ -1250,7 +1340,7 @@
     }
     else if( p_sys->i_box_type == BOX_BROWSE )
     {
-        /* Playlist box */
+        /* Filebrowser box */
         int        i_start, i_stop;
         int        i_item;
         DrawBox( p_sys->w, y++, 0, h, COLS, " Browse " );
@@ -1295,7 +1385,7 @@
                             p_sys->pp_dir_entries[i_item]->psz_path );
             if( b_selected )
             {
-                attroff ( A_REVERSE );
+                attroff( A_REVERSE );
             }
         }

@@ -1306,11 +1396,37 @@
     {
         /* Playlist box */
         playlist_t *p_playlist = p_sys->p_playlist;
-        int        i_start, i_stop;
+        int        i_start, i_stop, i_max = p_sys->i_plist_entries;
         int        i_item;
-        DrawBox( p_sys->w, y++, 0, h, COLS, " Playlist " );
-
-        if( p_sys->i_box_plidx >= p_playlist->i_size ) p_sys->i_box_plidx = p_playlist->i_size - 1;
+        char       *psz_title;
+
+        switch( p_sys->i_current_view )
+        {
+            case VIEW_ALL:
+                psz_title = strdup( " Playlist (All, unsorted) " );
+                i_max = p_playlist->i_size;
+                break;
+            case VIEW_CATEGORY:
+                psz_title = strdup( " Playlist (By category) " );
+                break;
+            default:
+                psz_title = strdup( " Playlist (Manually added) " );
+        }
+
+        DrawBox( p_sys->w, y++, 0, h, COLS, psz_title );
+
+        if( p_sys->i_current_view != VIEW_ALL &&
+                ( p_sys->b_need_update || p_sys->pp_plist == NULL ) )
+        {
+            PlaylistRebuild( p_intf );
+        }
+        if( p_sys->b_box_plidx_follow &&
+            ( p_sys->pp_plist[p_sys->i_box_plidx]->p_item !=
+              p_sys->p_playlist->status.p_item ) )
+        {
+            FindIndex( p_intf );
+        }
+
         if( p_sys->i_box_plidx < 0 ) p_sys->i_box_plidx = 0;

         if( p_sys->i_box_plidx < (h - 2)/2 )
@@ -1318,24 +1434,27 @@
             i_start = 0;
             i_stop = h - 2;
         }
-        else if( p_playlist->i_size - p_sys->i_box_plidx > (h - 2)/2 )
+        else if( i_max - p_sys->i_box_plidx > (h - 2)/2 )
         {
             i_start = p_sys->i_box_plidx - (h - 2)/2;
             i_stop = i_start + h - 2;
         }
         else
         {
-            i_stop = p_playlist->i_size;
-            i_start = p_playlist->i_size - (h - 2);
+            i_stop = i_max;
+            i_start = i_max - (h - 2);
         }
         if( i_start < 0 )
         {
             i_start = 0;
         }
-        if( i_stop > p_playlist->i_size )
-        {
-            i_stop = p_playlist->i_size;
-        }
+        if( i_stop > i_max )
+        {
+            i_stop = i_max;
+        }
+
+       if( p_sys->i_current_view == VIEW_ALL )
+       {

         for( i_item = i_start; i_item < i_stop; i_item++ )
         {
@@ -1365,9 +1484,34 @@
             }
             if( b_selected )
             {
-                attroff ( A_REVERSE );
-            }
-        }
+                attroff( A_REVERSE );
+            }
+        }
+
+       }
+       else
+       {
+
+        for( i_item = i_start; i_item < i_stop; i_item++ )
+        {
+            vlc_bool_t b_selected = ( p_sys->i_box_plidx == i_item );
+            int c = ( p_playlist->status.p_item ==
+                          p_sys->pp_plist[i_item]->p_item ) ? '>' : ' ';
+
+            if( y >= y_end ) break;
+            if( b_selected )
+            {
+                attrset( A_REVERSE );
+            }
+            mvnprintw( y++, 1, COLS - 2, "%c%s", c,
+                       p_sys->pp_plist[i_item]->psz_display );
+            if( b_selected )
+            {
+                attroff( A_REVERSE );
+            }
+        }
+
+       }
     }
     else
     {
@@ -1409,7 +1553,129 @@
     *t_last_refresh = time( 0 );
 }

-static void Eject ( intf_thread_t *p_intf )
+static void PlaylistRebuild( intf_thread_t *p_intf )
+{
+    intf_sys_t *p_sys = p_intf->p_sys;
+    playlist_view_t *p_view;
+    playlist_t *p_playlist = p_sys->p_playlist;
+
+    if( p_playlist == NULL )
+    {
+        return;
+    }
+
+    vlc_mutex_lock( &p_playlist->object_lock );
+
+    p_view = playlist_ViewFind( p_playlist, p_intf->p_sys->i_current_view );
+
+    /* First clear the old one */
+    PlaylistDestroy( p_intf );
+
+    /* Build the new one */
+    PlaylistAddNode( p_intf, p_view->p_root, 0, "" );
+
+    p_sys->b_need_update = VLC_FALSE;
+
+    vlc_mutex_unlock( &p_playlist->object_lock );
+}
+
+static void PlaylistAddNode( intf_thread_t *p_intf, playlist_item_t *p_node,
+                             int i, char *c )
+{
+    intf_sys_t *p_sys = p_intf->p_sys;
+    playlist_item_t *p_child;
+    char *psz_tmp;
+    int k;
+
+    psz_tmp = (char *)malloc( strlen( c ) + 4 );
+    if( psz_tmp == NULL ) return;
+    for( k = 0; k < p_node->i_children; k++ )
+    {
+        struct pl_item_t *p_pl_item;
+        char *buff;
+        int i_size;
+
+        p_child = p_node->pp_children[k];
+        i_size = strlen( c ) + strlen( p_child->input.psz_name ) + 4;
+        buff = (char *)malloc( sizeof( char ) * i_size );
+        p_pl_item = (struct pl_item_t *)malloc( sizeof( struct pl_item_t ) );
+        if(  p_pl_item == NULL || buff == NULL ) return;
+
+        if( strlen( c ) )
+        {
+            sprintf( buff, "%s%c-%s", c, k == p_node->i_children - 1 ?
+                     '`' : '|', p_child->input.psz_name );
+        }
+        else
+        {
+            sprintf( buff, " %s", p_child->input.psz_name );
+        }
+        p_pl_item->psz_display = strdup( buff );
+        p_pl_item->p_item = p_child;
+        INSERT_ELEM( p_sys->pp_plist, p_sys->i_plist_entries,
+                     p_sys->i_plist_entries, p_pl_item );
+        free( buff );
+        i++;
+
+        if( p_child->i_children > 0 )
+        {
+            sprintf( psz_tmp, "%s%c ", c,
+                     k == p_node->i_children - 1 ? ' ' : '|' );
+            PlaylistAddNode( p_intf, p_child, i,
+                             strlen( c ) ? psz_tmp : " " );
+        }
+    }
+    free( psz_tmp );
+}
+
+static int PlaylistChanged( vlc_object_t *p_this, const char *psz_variable,
+                            vlc_value_t oval, vlc_value_t nval, void *param )
+{
+    intf_thread_t *p_intf = (intf_thread_t *)param;
+    p_intf->p_sys->b_need_update = VLC_TRUE;
+    return VLC_SUCCESS;
+}
+
+static void FindIndex( intf_thread_t *p_intf )
+{
+    intf_sys_t *p_sys = p_intf->p_sys;
+    int i;
+
+    if( p_sys->i_current_view == VIEW_ALL )
+    {
+         p_sys->i_box_plidx = p_sys->p_playlist->i_index;
+    }
+    else
+    {
+        for( i = 0; i < p_sys->i_plist_entries; i++ )
+        {
+            if( p_sys->pp_plist[i]->p_item ==
+                p_sys->p_playlist->status.p_item )
+            {
+                p_sys->i_box_plidx = i;
+                break;
+            }
+        }
+    }
+}
+
+static void PlaylistDestroy( intf_thread_t *p_intf )
+{
+    intf_sys_t *p_sys = p_intf->p_sys;
+    int i;
+
+    for( i = 0; i < p_sys->i_plist_entries; i++ )
+    {
+        struct pl_item_t *p_pl_item = p_sys->pp_plist[i];
+        free( p_pl_item->psz_display );
+        REMOVE_ELEM( p_sys->pp_plist, p_sys->i_plist_entries, i );
+        free( p_pl_item );
+    }
+    p_sys->pp_plist = NULL;
+    p_sys->i_plist_entries = 0;
+}
+
+static void Eject( intf_thread_t *p_intf )
 {
     char *psz_device = NULL, *psz_parser, *psz_name;

@@ -1542,7 +1808,7 @@
 #endif
             return;
         }
-
+
         /* Clean the old shit */
         for( i = 0; i < p_sys->i_dir_entries; i++ )
         {
@@ -1645,7 +1911,7 @@
     int i;
     int i_len;

-    if(  w > 3 && h > 2 )
+    if( w > 3 && h > 2 )
     {
         if( title == NULL ) title = "";
         i_len = strlen( title );
@@ -1684,6 +1950,6 @@
     {
         attrset( A_REVERSE );
         mvhline( y, x, ' ', w );
-        attroff ( A_REVERSE );
+        attroff( A_REVERSE );
     }
 }


Added new LL_COMMON_API dll export declaration for new llsd_equals function.

--- indra/llcommon/llsdutil.h
+++ indra/llcommon/llsdutil.h
@@ -130,7 +130,7 @@
 LL_COMMON_API std::string llsd_matches(const LLSD& prototype, const LLSD& data, const std::string& pfx="");

 /// Deep equality
-bool llsd_equals(const LLSD& lhs, const LLSD& rhs);
+LL_COMMON_API bool llsd_equals(const LLSD& lhs, const LLSD& rhs);

 // Simple function to copy data out of input & output iterators if
 // there is no need for casting.


lua_modules.c: Bug fix leaked values on the stack when a callback cannot be found.

--- modules/lua_modules.c
+++ modules/lua_modules.c
@@ -109,7 +109,6 @@

     /* Use the user-defined lua module. Do not use ibmod_lua.so. */
     ib_module_t *module = modlua_modules->module;
-    int isfunction;
     ib_status_t rc;

     lua_getglobal(L, "modlua"); /* Get the package. */
@@ -149,12 +148,19 @@
     }

     /* Is the result a table, which should list the functions. */
-    isfunction = lua_istable(L, -1);
-
-    /* Pop off modlua table by moving the function at -1 to -2 and popping. */
-    lua_replace(L, -2);
-
-    return isfunction ? IB_OK : IB_ENOENT;
+    if (lua_istable(L, -1)) {
+        /* Pop off modlua table by moving the function at -1 to -2 and popping. */
+        lua_replace(L, -2);
+        return IB_OK;
+    }
+    else if (lua_isnil(L, -1)) {
+        lua_pop(L, 2);
+        return IB_ENOENT;
+    }
+    else {
+        lua_pop(L, 2);
+        return IB_EINVAL;
+    }
 }

 /**
@@ -183,7 +189,6 @@

     /* Use the user-defined lua module. Do not use ibmod_lua.so. */
     ib_module_t *module = modlua_modules->module;
-    int isfunction;
     ib_status_t rc;

     lua_getglobal(L, "modlua"); /* Get the package. */
@@ -222,12 +227,19 @@
     }

     /* Is the result a table, which should list the functions. */
-    isfunction = lua_istable(L, -1);
-
-    /* Pop off modlua table by moving the function at -1 to -2 and popping. */
-    lua_replace(L, -2);
-
-    return isfunction ? IB_OK : IB_ENOENT;
+    if (lua_istable(L, -1)) {
+        /* Pop off modlua table by moving the function at -1 to -2 and popping. */
+        lua_replace(L, -2);
+        return IB_OK;
+    }
+    else if (lua_isnil(L, -1)) {
+        lua_pop(L, 2);
+        return IB_ENOENT;
+    }
+    else {
+        lua_pop(L, 2);
+        return IB_EINVAL;
+    }
 }

 /**
@@ -313,8 +325,10 @@

     rc = modlua_push_lua_handler_logevents(ib, ibmod_modules, L);

-    /* Pop the lua handler off the stack. We're just checking for it. */
-    lua_pop(L, 1);
+    if (rc == IB_OK) {
+        /* Pop the lua handler off the stack. We're just checking for it. */
+        lua_pop(L, 1);
+    }

     return rc;
 }
@@ -349,8 +363,10 @@

     rc = modlua_push_lua_handler(ib, ibmod_modules, state, L);

-    /* Pop the lua handler off the stack. We're just checking for it. */
-    lua_pop(L, 1);
+    if (rc == IB_OK) {
+        /* Pop the lua handler off the stack. We're just checking for it. */
+        lua_pop(L, 1);
+    }

     return rc;
 }


tracker-status: Fixed typo in --help

tracker-status: Fixed typo in --help

--- src/tracker-utils/tracker-status.c
+++ src/tracker-utils/tracker-status.c
@@ -73,7 +73,7 @@
 	  NULL
 	},
 	{ "list-miners-running", 'l', 0, G_OPTION_ARG_NONE, &list_miners_running,
-	  N_("List all miners installed"),
+	  N_("List all miners currently running"),
 	  NULL
 	},
 	{ "list-miners-available", 'a', 0, G_OPTION_ARG_NONE, &list_miners_available,


logger: Mac OS X compile fix

logger: Mac OS X compile fix

--- modules/misc/logger.c
+++ modules/misc/logger.c
@@ -210,7 +210,7 @@
         {
 #ifdef __APPLE__
             if( asprintf( &psz_file, "%s/"LOG_DIR"/%s", config_GetHomeDir(),
-                (p_sys->i_mode == MODE_HTML) ? LOG_FILE_HTML
+                (p_sys->msg.i_mode == MODE_HTML) ? LOG_FILE_HTML
                                              : LOG_FILE_TEXT ) == -1 )
                 psz_file = NULL;
 #else


Fix spelling mistake

Fix spelling mistake

--- nodes/examples/i2c/main.c
+++ nodes/examples/i2c/main.c
@@ -17,7 +17,7 @@
 	printf("i2c init complete\n");

 	for (uint8_t i = 0; ; i++) {
-	 	i2c_master_transmits(17, &i, 1);
+	 	i2c_master_transmit(17, &i, 1);
 		printf("Transmit complete\n");

 		HAL_Delay(100);


Define S_IREAD and S_IWRITE if they're not defined.
This is needed to get sipXportLib compilable on Android.

git-svn-id: f26ccc5efe72c2bd8e1c40f599fe313f2692e4de@10956 a612230a-c5fa-0310-af8b-88eea846685b

--- sipXportLib/include/os/OsDefs.h
+++ sipXportLib/include/os/OsDefs.h
@@ -39,6 +39,14 @@
 #  define IS_INET_RETURN_OK( x )    (x > 0)
 #endif

+// S_IREAD and S_IWRITE are not always defined, e.g. they're not
+// defined in in bionic (Android's libc).
+#ifndef S_IREAD
+#  define S_IREAD  (S_IRUSR | S_IRGRP | S_IROTH)
+#endif
+#ifndef S_IWRITE
+#  define S_IWRITE (S_IWUSR)
+#endif

 #ifdef WIN32
 #  define snprintf _snprintf


i*l*l is a simple replace, not an extended one.

--- francotone_p.h
+++ francotone_p.h
@@ -44,7 +44,7 @@
     { FRANCOTONEFUNC_PREG_EXT_REPLACE, "^[cs]([eiy])", "s$1", NULL, NULL },
     { FRANCOTONEFUNC_PREG_EXT_REPLACE, "^[gj]([eiy])", "j$1", NULL, NULL },
     { FRANCOTONEFUNC_PREG_EXT_REPLACE, "[c]+([ei])", "s$1", NULL, NULL },
-    { FRANCOTONEFUNC_PREG_EXT_REPLACE, "[i]+[l][l]+", "y", NULL, NULL },
+    { FRANCOTONEFUNC_REPLACE, "[i]+[l][l]+", "y", NULL, NULL },
     { FRANCOTONEFUNC_PREG_EXT_REPLACE, "(ai|ss|ch|nn)ent$", "$1", NULL, NULL },
     { FRANCOTONEFUNC_REPLACE, "en", "an", NULL, NULL },
     { FRANCOTONEFUNC_REPLACE, "eau", "o", NULL, NULL },


dict0dict.c:   Revert the test changes to wait for a full push of new auto-inc algorithm

--- innobase/dict/dict0dict.c
+++ innobase/dict/dict0dict.c
@@ -261,7 +261,7 @@
 {
 	return(dict_table_get_index(table, name));
 }
-
+
 /************************************************************************
 Initializes the autoinc counter. It is not an error to initialize an already
 initialized counter. */
@@ -270,7 +270,7 @@
 dict_table_autoinc_initialize(
 /*==========================*/
 	dict_table_t*	table,	/* in: table */
-	ib_longlong	value)	/* in: next value to assign to a row */
+	ib_longlong	value)	/* in: value which was assigned to a row */
 {
 	mutex_enter(&(table->autoinc_mutex));

@@ -281,8 +281,8 @@
 }

 /************************************************************************
-Gets the next autoinc value (== autoinc counter value), 0 if not yet
-initialized. If initialized, increments the counter by 1. */
+Gets the next autoinc value, 0 if not yet initialized. If initialized,
+increments the counter by 1. */

 ib_longlong
 dict_table_autoinc_get(
@@ -298,8 +298,8 @@

 		value = 0;
 	} else {
+		table->autoinc = table->autoinc + 1;
 		value = table->autoinc;
-		table->autoinc = table->autoinc + 1;
 	}

 	mutex_exit(&(table->autoinc_mutex));
@@ -334,43 +334,20 @@
 }

 /************************************************************************
-Peeks the autoinc counter value, 0 if not yet initialized. Does not
-increment the counter. The read not protected by any mutex! */
-
-ib_longlong
-dict_table_autoinc_peek(
-/*====================*/
-				/* out: value of the counter */
-	dict_table_t*	table)	/* in: table */
-{
-	ib_longlong	value;
-
-	if (!table->autoinc_inited) {
-
-		value = 0;
-	} else {
-		value = table->autoinc;
-	}
-
-	return(value);
-}
-
-/************************************************************************
-Updates the autoinc counter if the value supplied is equal or bigger than the
+Updates the autoinc counter if the value supplied is bigger than the
 current value. If not inited, does nothing. */

 void
 dict_table_autoinc_update(
 /*======================*/
-
 	dict_table_t*	table,	/* in: table */
 	ib_longlong	value)	/* in: value which was assigned to a row */
 {
 	mutex_enter(&(table->autoinc_mutex));

 	if (table->autoinc_inited) {
-		if (value >= table->autoinc) {
-			table->autoinc = value + 1;
+		if (value > table->autoinc) {
+			table->autoinc = value;
 		}
 	}


sorry for the compilation...

sorry for the compilation...

--- SofaKernel/framework/sofa/helper/system/config.h
+++ SofaKernel/framework/sofa/helper/system/config.h
@@ -132,10 +132,7 @@
 #define SOFA_UNUSED(x) (void)(x)

 // utility for debug tracing
-#ifdef _MSC_VER
-    #define SOFA_CLASS_METHOD ( std::string(this->getClassName()) + "::" + __FUNCTION__ + " " )
-#else
-    #define SOFA_CLASS_METHOD ( std::string(this->getClassName()) + "::" + __func__ + " " )
-#endif
+#define SOFA_CLASS_METHOD ( std::string(this->getClassName()) + "::" + __FUNCTION__ + " " )
+

 #endif // SOFA_HELPER_SYSTEM_CONFIG_H


dict0load.c:   dict_load_table(): Remove unused label that was accidentally introduced   in a 4.0->4.1->5.0 merge.

--- innobase/dict/dict0load.c
+++ innobase/dict/dict0load.c
@@ -769,7 +769,6 @@

 	/* Check if the table name in record is the searched one */
 	if (len != ut_strlen(name) || ut_memcmp(name, field, len) != 0) {
-	err_exit:
 		btr_pcur_close(&pcur);
 		mtr_commit(&mtr);
 		mem_heap_free(heap);


lock0lock.c:   Fix a latching order violation in the previous (2003-06-15) push: could lead to a hang on the btr0sea.c semaphore

--- innobase/lock/lock0lock.c
+++ innobase/lock/lock0lock.c
@@ -579,20 +579,15 @@
 	ut_ad(index->type & DICT_CLUSTERED);
 	ut_ad(page_rec_is_user_rec(rec));

+	/* NOTE that we call this function while holding the search
+	system latch. To obey the latching order we must NOT reserve the
+	kernel mutex here! */
+
 	trx_id = row_get_rec_trx_id(rec, index);

 	if (read_view_sees_trx_id(view, trx_id)) {

 		return(TRUE);
-	}
-
-	if (!lock_check_trx_id_sanity(trx_id, rec, index, FALSE)) {
-		/* Trying to get the 'history' of a corrupt record is bound
-		to fail: let us try to use the record itself in the query */
-		fprintf(stderr,
-"InnoDB: We try to access the corrupt record in the query anyway.\n");
-
-	        return(TRUE);
 	}

 	return(FALSE);
@@ -624,6 +619,10 @@
 	ut_ad(!(index->type & DICT_CLUSTERED));
 	ut_ad(page_rec_is_user_rec(rec));

+	/* NOTE that we might call this function while holding the search
+	system latch. To obey the latching order we must NOT reserve the
+	kernel mutex here! */
+
 	if (recv_recovery_is_on()) {

 		return(FALSE);
@@ -632,16 +631,6 @@
 	max_trx_id = page_get_max_trx_id(buf_frame_align(rec));

 	if (ut_dulint_cmp(max_trx_id, view->up_limit_id) >= 0) {
-
-		if (!lock_check_trx_id_sanity(max_trx_id, rec, index, FALSE)) {
-		        /* Trying to get the 'history' of a corrupt record is
-			bound to fail: let us try to use the record itself in
-			the query */
-			fprintf(stderr,
-"InnoDB: We try to access the corrupt record in the query anyway.\n");
-
-			return(TRUE);
-		}

 		return(FALSE);
 	}


fixed memleak

fixed memleak

--- naxsi_src/naxsi_runtime.c
+++ naxsi_src/naxsi_runtime.c
@@ -22,7 +22,7 @@
  then, accessed by the hashtable building feature during "init" time. */
 ngx_http_dummy_loc_conf_t *dummy_lc;

-#define whitelist_debug
+//#define whitelist_debug

 #define dummy_error_fatal(ctx, r, ...) do {	\
@@ -389,7 +389,7 @@
 }

-#define output_forbidden
+//#define output_forbidden
 ngx_int_t
 ngx_http_output_forbidden_page(ngx_http_request_ctx_t *ctx,
 			       ngx_http_request_t *r)
@@ -526,7 +526,7 @@
 /*
 ** new rulematch, less arguments ^
 */
-#define whitelist_debug
+//#define whitelist_debug
 //#define whitelist_light_debug
 //#define whitelist_debug

@@ -663,7 +663,7 @@
 **	  this couple along with valid rules to checking func.
 ** WARN/TODO : Even I tried to make my code bof proof, this should be seriously audited :)
 */
-#define spliturl_ruleset_debug
+//#define spliturl_ruleset_debug
 int
 ngx_http_spliturl_ruleset(ngx_pool_t *pool,
 			  char	*str,
@@ -786,7 +786,7 @@
 /*
 ** check variable + name against a set of rules, checking against 'custom' location rules too.
 */
-#define basestr_ruleset_debug
+//#define basestr_ruleset_debug
 int
 ngx_http_basestr_ruleset_n(ngx_pool_t *pool,
 			   ngx_str_t	*name,
@@ -887,8 +887,8 @@
   ** [XXX] : this function sucks ! I don't parse bigger-than-body-size posts that
   **	   are partially stored in files, TODO ;)
   */
-#define post_heavy_debug
-#define dummy_body_parse_debug
+//#define post_heavy_debug
+//#define dummy_body_parse_debug
 void	ngx_http_dummy_multipart_parse(ngx_http_request_ctx_t *ctx,
 				       ngx_http_request_t	 *r,
 				       u_char			*src,
@@ -1125,7 +1125,7 @@

 }

-#define dummy_body_parse_debug
+//#define dummy_body_parse_debug

 void
 ngx_http_dummy_body_parse(ngx_http_request_ctx_t *ctx,


fix bad copy-paste in previous commit

fix bad copy-paste in previous commit

--- ncd/modules/multidepend.c
+++ ncd/modules/multidepend.c
@@ -227,7 +227,7 @@

     // start collapsing our depends
     for (LinkedList1Node *n = LinkedList1_GetFirst(&o->depends); n; n = LinkedList1Node_Next(n)) {
-        struct depend *d = UPPER_OBJECT(n, struct depend, depends_node);
+        struct depend *d = UPPER_OBJECT(n, struct depend, provide_node);
         ASSERT(d->provide == o)

         // update depend to make sure it is collapsing


Update lock.c

Update lock.c


input/output extplug within a single iemladspa

--- pcm_iemladspa.c
+++ pcm_iemladspa.c
@@ -50,7 +50,7 @@

 typedef struct snd_pcm_iemladspa {
   unsigned int usecount;
-	snd_pcm_extplug_t ext;
+	snd_pcm_extplug_t extIN, extOUT;

   snd_config_t   *sndconfig;

@@ -442,6 +442,7 @@
   long inchannels = 2;
   long outchannels = 2;
   unsigned int pcmchannels = 2;
+  snd_pcm_extplug_t*ext=NULL;

 	/* Parse configuration options from asoundrc */
 	snd_config_for_each(i, next, conf) {
@@ -498,73 +499,75 @@
 		return -EINVAL;
 	}

+  /* ========= init phase done ============ */
+
 	/* Intialize the local object data */
-	iemladspa = calloc(1, sizeof(*iemladspa));
+  iemladspa = iemladspa_mergeplugin_findorcreate(root,
+                                             library,
+                                             module,
+                                             controls,
+                                             sourcechannels, sinkchannels);
 	if (iemladspa == NULL)
 		return -ENOMEM;

-	iemladspa->ext.version = SND_PCM_EXTPLUG_VERSION;
-	iemladspa->ext.name = "alsaiemladspa";
-	iemladspa->ext.callback = &iemladspa_callback;
-	iemladspa->ext.private_data = iemladspa;
-
-  iemladspa->stream_direction = -1;
-
-	/* Open the LADSPA Plugin */
-	iemladspa->library = LADSPAload(library);
-  printf("LADSPAlib: %p\n", iemladspa->library);
-	if(iemladspa->library == NULL) {
-		return -1;
-	}
-
-	iemladspa->klass = LADSPAfind(iemladspa->library, library, module);
-  printf("LADSPAklass: %p\n", iemladspa->klass);
-
-	if(iemladspa->klass == NULL) {
-		return -1;
-	}
-
-  print_pcm_config(root, "root");
-  print_pcm_config(sconf, "sconf");
+  /* check whether we already have an ext for this stream,
+     if so, we are done;
+     if not, create a new one
+  */
+
+  if(SND_PCM_STREAM_PLAYBACK==stream) {
+    if(iemladspa->extOUT.private_data == iemladspa)return 0;
+    ext=&iemladspa->extOUT;
+  } else {
+    if(iemladspa->extIN.private_data == iemladspa)return 0;
+    ext=&iemladspa->extIN;
+  }
+
+	ext->version = SND_PCM_EXTPLUG_VERSION;
+	ext->name = "alsaiemladspa";
+	ext->callback = &iemladspa_callback;
+	ext->private_data = iemladspa;

 	/* Create the ALSA External Plugin */
-	err = snd_pcm_extplug_create(&iemladspa->ext, name, root, sconf, stream, mode);
+	err = snd_pcm_extplug_create(ext, name, root, sconf, stream, mode);
 	if (err < 0) {
     printf("extplug failed\n");
 		return err;
 	}

-  //printf("ROOT:\n"); print_pcm_extplug(&iemladspa->ext); printf(":ROOT \n");
+  //printf("ROOT:\n"); print_pcm_extplug(ext); printf(":ROOT \n");

 	/* MMAP to the controls file */
-  iemladspa->control_data = LADSPAcontrolMMAP(iemladspa->klass, controls,
-                                            sourcechannels, sinkchannels);
-	if(iemladspa->control_data == NULL) {
-		return -1;
-	}
-
-	/* Make sure that the control file makes sense */
-  unsigned int j;
-
-  const unsigned long offset_in = iemladspa->control_data->num_controls;
-  const unsigned long offset_out = offset_in + iemladspa->control_data->num_inchannels;
-
-  for(j=0; j<iemladspa->control_data->num_inchannels; j++) {
-    unsigned int index=iemladspa->control_data->data[offset_in + j].index;
-    if(index>=iemladspa->klass->PortCount || iemladspa->klass->PortDescriptors[index] !=
-       (LADSPA_PORT_INPUT | LADSPA_PORT_AUDIO)) {
-      SNDERR("Problem with control file %s.", controls);
+  if(!iemladspa->control_data) {
+    iemladspa->control_data = LADSPAcontrolMMAP(iemladspa->klass, controls,
+                                              sourcechannels, sinkchannels);
+    if(iemladspa->control_data == NULL) {
       return -1;
     }
-  }
-  for(j=0; j<iemladspa->control_data->num_outchannels; j++) {
-    unsigned int index=iemladspa->control_data->data[offset_out+ j].index;
-
-    if(index>=iemladspa->klass->PortCount || iemladspa->klass->PortDescriptors[index] !=
-       (LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO)) {
-      SNDERR("Problem with control file %s.", controls);
-      return -1;
+
+    /* Make sure that the control file makes sense */
+    unsigned int j;
+
+    const unsigned long offset_in = iemladspa->control_data->num_controls;
+    const unsigned long offset_out = offset_in + iemladspa->control_data->num_inchannels;
+
+    for(j=0; j<iemladspa->control_data->num_inchannels; j++) {
+      unsigned int index=iemladspa->control_data->data[offset_in + j].index;
+      if(index>=iemladspa->klass->PortCount || iemladspa->klass->PortDescriptors[index] !=
+         (LADSPA_PORT_INPUT | LADSPA_PORT_AUDIO)) {
+        SNDERR("Problem with control file %s.", controls);
+        return -1;
+      }
+    }
+    for(j=0; j<iemladspa->control_data->num_outchannels; j++) {
+      unsigned int index=iemladspa->control_data->data[offset_out+ j].index;
+
+      if(index>=iemladspa->klass->PortCount || iemladspa->klass->PortDescriptors[index] !=
+         (LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO)) {
+        SNDERR("Problem with control file %s.", controls);
+        return -1;
+      }
     }
   }

@@ -573,22 +576,22 @@
     ? iemladspa->control_data->sourcechannels.out
     : iemladspa->control_data->sinkchannels.in;

-  snd_pcm_extplug_set_param_minmax(&iemladspa->ext,
+  snd_pcm_extplug_set_param_minmax(ext,
                                    SND_PCM_EXTPLUG_HW_CHANNELS,
                                    pcmchannels,
                                    pcmchannels);

-  snd_pcm_extplug_set_slave_param(&iemladspa->ext,
+  snd_pcm_extplug_set_slave_param(ext,
                                   SND_PCM_EXTPLUG_HW_CHANNELS,
                                   pcmchannels);

-	snd_pcm_extplug_set_param(&iemladspa->ext,
+	snd_pcm_extplug_set_param(ext,
 			SND_PCM_EXTPLUG_HW_FORMAT, SND_PCM_FORMAT_FLOAT);

-	snd_pcm_extplug_set_slave_param(&iemladspa->ext,
+	snd_pcm_extplug_set_slave_param(ext,
 			SND_PCM_EXTPLUG_HW_FORMAT, SND_PCM_FORMAT_FLOAT);

-	*pcmp = iemladspa->ext.pcm;
+	*pcmp = ext->pcm;

 	return 0;


Deleting accounts did not work

Deleting accounts did not work

--- sparrowNet.c
+++ sparrowNet.c
@@ -1774,9 +1774,9 @@
 		spGlobalC4ATask->timeOut = timeOut;
 		spGlobalC4ATask->threadStatus = 1;
 		#ifdef _MSC_VER
-			spGlobalC4ATask->thread = SDL_CreateThread((int (__cdecl *)(void *))spNetC4AUberThread,c4a_delete_thread);
+			spGlobalC4ATask->thread = SDL_CreateThread((int (__cdecl *)(void *))spNetC4AUberThread,data);
 		#else
-			spGlobalC4ATask->thread = SDL_CreateThread((int (*)(void *))spNetC4AUberThread,c4a_delete_thread);
+			spGlobalC4ATask->thread = SDL_CreateThread((int (*)(void *))spNetC4AUberThread,data);
 		#endif
 		return 0;
 	}


CIFS: Fix the VFS brlock cache usage in posix locking case

Request to the cache in FL_POSIX case only.

Signed-off-by: Pavel Shilovsky <7cbcbfe495bad5f7f26ddc6bf28ecd9f36b2e347@etersoft.ru>
Signed-off-by: Steve French <51565b4e5841e493fd669866e11ea3c7c0d781cc@gmail.com>

--- fs/cifs/file.c
+++ fs/cifs/file.c
@@ -793,6 +793,9 @@
 	struct cifsInodeInfo *cinode = CIFS_I(file->f_path.dentry->d_inode);
 	unsigned char saved_type = flock->fl_type;

+	if ((flock->fl_flags & FL_POSIX) == 0)
+		return 1;
+
 	mutex_lock(&cinode->lock_mutex);
 	posix_test_lock(file, flock);

@@ -809,12 +812,15 @@
 cifs_posix_lock_set(struct file *file, struct file_lock *flock)
 {
 	struct cifsInodeInfo *cinode = CIFS_I(file->f_path.dentry->d_inode);
-	int rc;
+	int rc = 1;
+
+	if ((flock->fl_flags & FL_POSIX) == 0)
+		return rc;

 	mutex_lock(&cinode->lock_mutex);
 	if (!cinode->can_cache_brlcks) {
 		mutex_unlock(&cinode->lock_mutex);
-		return 1;
+		return rc;
 	}
 	rc = posix_lock_file_wait(file, flock);
 	mutex_unlock(&cinode->lock_mutex);


better printout

better printout

--- pcm_iemladspa.c
+++ pcm_iemladspa.c
@@ -175,7 +175,7 @@

 static int iemladspa_close(snd_pcm_extplug_t *ext) {
 	snd_pcm_iemladspa_t *iemladspa = (snd_pcm_iemladspa_t*)ext->private_data;
-  printf("closing: %p", ext);
+  printf("closing: %p\n", ext);
   print_pcm_extplug(ext);

   if(iemladspa->klass->deactivate) {
@@ -202,7 +202,7 @@
 	snd_pcm_iemladspa_t *iemladspa = (snd_pcm_iemladspa_t *)ext->private_data;
 	int i;

-  print_pcm_extplug(ext);
+  //print_pcm_extplug(ext);

 	/* Instantiate a LADSPA Plugin */
   if(!s_plugininstance) {
@@ -246,9 +246,6 @@
   long inchannels = 2;
   long outchannels = 2;

-
-  printf("stream=%d\n", stream);
-
 	/* Parse configuration options from asoundrc */
 	snd_config_for_each(i, next, conf) {
 		snd_config_t *n = snd_config_iterator_entry(i);
@@ -341,9 +338,7 @@
 		return err;
 	}

-  printf("ROOT:\n");
-  print_pcm_extplug(&iemladspa->ext);
-  printf(":ROOT \n");
+  //printf("ROOT:\n"); print_pcm_extplug(&iemladspa->ext); printf(":ROOT \n");

 	/* MMAP to the controls file */


Fix assert messages.

Fix assert messages.

Approved by:	pjd (mentor)

--- sbin/hastctl/hastctl.c
+++ sbin/hastctl/hastctl.c
@@ -465,7 +465,7 @@
 		}
 		break;
 	default:
-		assert(!"Impossible role!");
+		assert(!"Impossible command!");
 	}

 	/* Setup control connection... */
@@ -512,7 +512,7 @@
 		error = control_status(nv);
 		break;
 	default:
-		assert(!"Impossible role!");
+		assert(!"Impossible command!");
 	}

 	exit(error);


also ACKsTimeout is now used so we do not need TDB anymore

git-svn-id: afcf11d89342f630bd950d18a70234a9e277d909@166859 523d945c-050c-4681-91ec-863ad3bb968a

--- LGPL/CommonSoftware/bulkDataNT/include/bulkDataNTConfiguration.h
+++ LGPL/CommonSoftware/bulkDataNT/include/bulkDataNTConfiguration.h
@@ -19,7 +19,7 @@
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 *
-* "@(#) $Id: bulkDataNTConfiguration.h,v 1.21 2011/12/15 15:10:47 bjeram Exp $"
+* "@(#) $Id: bulkDataNTConfiguration.h,v 1.22 2011/12/15 15:26:06 bjeram Exp $"
 *
 * who       when        what
 * --------  ---------   ----------------------------------------------
@@ -115,7 +115,7 @@
 public:
 	SenderFlowConfiguration();
 	double frameTimeout;
-	double ACKsTimeout;  /// TBD:: not used yet
+	double ACKsTimeout;
 };

 /** A Sender stream configuration. It consists in a seres


f2fs: convert dev_valid_block_count to void

Signed-off-by: Gu Zheng <9eae2d327ddc4c2ff66f290d0aa6288f14fc5928@cn.fujitsu.com>
Signed-off-by: Jaegeuk Kim <20424effba9d4aeeb410130c5f23aa328fa29e09@samsung.com>

--- fs/f2fs/f2fs.h
+++ fs/f2fs/f2fs.h
@@ -606,7 +606,7 @@
 	return true;
 }

-static inline int dec_valid_block_count(struct f2fs_sb_info *sbi,
+static inline void dec_valid_block_count(struct f2fs_sb_info *sbi,
 						struct inode *inode,
 						blkcnt_t count)
 {
@@ -616,7 +616,6 @@
 	inode->i_blocks -= count;
 	sbi->total_valid_block_count -= (block_t)count;
 	spin_unlock(&sbi->stat_lock);
-	return 0;
 }

 static inline void inc_page_count(struct f2fs_sb_info *sbi, int count_type)


fuse: writepages: roll back changes if request not found

fuse_writepage_in_flight() returns false if it fails to find request with
given index in fi->writepages.  Then the caller proceeds with populating
data->orig_pages[] and incrementing req->num_pages.  Hence,
fuse_writepage_in_flight() must revert changes it made in request before
returning false.

Signed-off-by: Maxim Patlasov <a03f90017ab580fcc9558a98cd061c91599c42fd@parallels.com>
Signed-off-by: Miklos Szeredi <84cd5483a2f9acd1c37251cba7c2908448f221b8@suse.cz>


GFS2: Fix truncation of journaled data files

This patch fixes an issue relating to not having enough revokes
available when truncating journaled data files. In order to ensure
that we do no run out, the truncation is broken into separate pieces
if it is large enough.

Tested using fsx on a journaled data file.

Signed-off-by: Steven Whitehouse <9801c4ef11586b619a1c43ac9377eea2aee672dd@redhat.com>


GFS2: Fix one RG corner case

GFS2: Fix one RG corner case

For filesystems with only a single resource group, we need to be careful
that the allocation loop will not land up with a NULL resource group. This
fixes a bug in a previous patch where the gfs2_rgrpd_get_next() function
was being used instead of gfs2_rgrpd_get_first()

Signed-off-by: Steven Whitehouse <9801c4ef11586b619a1c43ac9377eea2aee672dd@redhat.com>

--- fs/gfs2/rgrp.c
+++ fs/gfs2/rgrp.c
@@ -1776,10 +1776,11 @@
 static bool gfs2_select_rgrp(struct gfs2_rgrpd **pos, const struct gfs2_rgrpd *begin)
 {
 	struct gfs2_rgrpd *rgd = *pos;
+	struct gfs2_sbd *sdp = rgd->rd_sbd;

 	rgd = gfs2_rgrpd_get_next(rgd);
 	if (rgd == NULL)
-		rgd = gfs2_rgrpd_get_next(NULL);
+		rgd = gfs2_rgrpd_get_first(sdp);
 	*pos = rgd;
 	if (rgd != begin) /* If we didn't wrap */
 		return true;


[JFFS2] Add missing call to posix_acl_release

posix_acl_clone does a memory allocation and sets a reference count, so
posix_acl_release is needed afterwards to free it.

The problem was fixed using the following semantic patch.
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@
type T;
identifier E;
expression E1, E2;
int ret;
statement S;
@@

  T E;
  <+...
(
  E = \(posix_acl_clone\|posix_acl_alloc\|posix_acl_dup\)(...);
  if (E == NULL) S
|
  if ((E = \(posix_acl_clone\|posix_acl_alloc\|posix_acl_dup\)(...)) == NULL) S
)
  ... when != E2 = E
      when strict
(
  posix_acl_release(E);
|
  E1 = E;
|
+ posix_acl_release(E);
  return;
|
+ posix_acl_release(E);
  return ret;
)
  ...+>
// </smpl>

Signed-off-by: Julia Lawall <b43b0ad1e8108e7ab870d7a54feac93ae8b8600e@diku.dk>
Acked-by: KaiGai Kohei <020bb962ab32b234f572e47aa81c2ce755d90017@ak.jp.nec.com>
Signed-off-by: David Woodhouse <97b3379caa91f4ee97e44013ae4dc6350540fa9d@infradead.org>

--- fs/jffs2/acl.c
+++ fs/jffs2/acl.c
@@ -345,8 +345,10 @@
 		if (!clone)
 			return -ENOMEM;
 		rc = posix_acl_create_masq(clone, (mode_t *)i_mode);
-		if (rc < 0)
+		if (rc < 0) {
+			posix_acl_release(clone);
 			return rc;
+		}
 		if (rc > 0)
 			jffs2_iset_acl(inode, &f->i_acl_access, clone);


NLM: Always start both UDP and TCP listeners

Commit 24e36663, which first appeared in 2.6.19, changed lockd so that
the client side starts a UDP listener only if there is a UDP NFSv2/v3
mount.  Its description notes:

    This... means that lockd will *not* listen on UDP if the only
    mounts are TCP mount (and nfsd hasn't started).

    The latter is the only one that concerns me at all - I don't know
    if this might be a problem with some servers.

Unfortunately it is a problem for Linux itself.  The rpc.statd daemon
on Linux uses UDP for contacting the local lockd, no matter which
protocol is used for NFS mounts.  Without a local lockd UDP listener,
NFSv2/v3 lock recovery from Linux NFS clients always fails.

Revert parts of commit 24e36663 so lockd_up() always starts both
listeners.

Signed-off-by: Chuck Lever <e7d8216bf9b1956703857d0050bd04192118f43d@oracle.com>
Cc: Neil Brown <1c00aa603bb92d594c03cff60ecf8e63b2a5bcb1@suse.de>
Signed-off-by: J. Bruce Fields <51738506c1b2ccb0761f23bdc612c93babf738ea@citi.umich.edu>

--- fs/lockd/svc.c
+++ fs/lockd/svc.c
@@ -189,25 +189,28 @@
 }

 /*
- * Make any sockets that are needed but not present.
- * If nlm_udpport or nlm_tcpport were set as module
- * options, make those sockets unconditionally
- */
-static int make_socks(struct svc_serv *serv, int proto)
+ * Ensure there are active UDP and TCP listeners for lockd.
+ *
+ * Even if we have only TCP NFS mounts and/or TCP NFSDs, some
+ * local services (such as rpc.statd) still require UDP, and
+ * some NFS servers do not yet support NLM over TCP.
+ *
+ * Returns zero if all listeners are available; otherwise a
+ * negative errno value is returned.
+ */
+static int make_socks(struct svc_serv *serv)
 {
 	static int warned;
 	struct svc_xprt *xprt;
 	int err = 0;

-	if (proto == IPPROTO_UDP || nlm_udpport) {
-		xprt = svc_find_xprt(serv, "udp", 0, 0);
-		if (!xprt)
-			err = svc_create_xprt(serv, "udp", nlm_udpport,
-					      SVC_SOCK_DEFAULTS);
-		else
-			svc_xprt_put(xprt);
-	}
-	if (err >= 0 && (proto == IPPROTO_TCP || nlm_tcpport)) {
+	xprt = svc_find_xprt(serv, "udp", 0, 0);
+	if (!xprt)
+		err = svc_create_xprt(serv, "udp", nlm_udpport,
+				      SVC_SOCK_DEFAULTS);
+	else
+		svc_xprt_put(xprt);
+	if (err >= 0) {
 		xprt = svc_find_xprt(serv, "tcp", 0, 0);
 		if (!xprt)
 			err = svc_create_xprt(serv, "tcp", nlm_tcpport,
@@ -237,11 +240,8 @@
 	/*
 	 * Check whether we're already up and running.
 	 */
-	if (nlmsvc_rqst) {
-		if (proto)
-			error = make_socks(nlmsvc_rqst->rq_server, proto);
+	if (nlmsvc_rqst)
 		goto out;
-	}

 	/*
 	 * Sanity check: if there's no pid,
@@ -258,7 +258,8 @@
 		goto out;
 	}

-	if ((error = make_socks(serv, proto)) < 0)
+	error = make_socks(serv);
+	if (error < 0)
 		goto destroy_and_out;

 	/*


vfs: spread struct mount - tree_contains_unbindable

Signed-off-by: Al Viro <de609eb4d5d70b1d38ec6642adbfc33a2781f63c@zeniv.linux.org.uk>

--- fs/namespace.c
+++ fs/namespace.c
@@ -1845,10 +1845,10 @@
 	return err;
 }

-static inline int tree_contains_unbindable(struct vfsmount *mnt)
+static inline int tree_contains_unbindable(struct mount *mnt)
 {
 	struct mount *p;
-	for (p = real_mount(mnt); p; p = next_mnt(p, mnt)) {
+	for (p = mnt; p; p = next_mnt(p, &mnt->mnt)) {
 		if (IS_MNT_UNBINDABLE(&p->mnt))
 			return 1;
 	}
@@ -1902,7 +1902,7 @@
 	 * mount which is shared.
 	 */
 	if (IS_MNT_SHARED(path->mnt) &&
-	    tree_contains_unbindable(old_path.mnt))
+	    tree_contains_unbindable(old))
 		goto out1;
 	err = -ELOOP;
 	for (p = path->mnt; mnt_has_parent(p); p = p->mnt_parent)


mnt: In detach_mounts detach the appropriate unmounted mount

The handling of in detach_mounts of unmounted but connected mounts is
buggy and can lead to an infinite loop.

Correct the handling of unmounted mounts in detach_mount.  When the
mountpoint of an unmounted but connected mount is connected to a
dentry, and that dentry is deleted we need to disconnect that mount
from the parent mount and the deleted dentry.

Nothing changes for the unmounted and connected children.  They can be
safely ignored.

Cc: 4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@vger.kernel.org
Fixes: ce07d891a0891d3c0d0c2d73d577490486b809e1 mnt: Honor MNT_LOCKED when detaching mounts
Signed-off-by: "Eric W. Biederman" <8a741aa8cbd77ebc4a56ddb528ce9fd15d42f034@xmission.com>


NFS: Add a helper to sync both O_DIRECT and buffered writes

Then apply it to nfs_setattr() and nfs_getattr().

Signed-off-by: Trond Myklebust <cc958843532c615cbd4920e868f78c7985331a5a@primarydata.com>


nfs: nfs_kill_super() should call bdi_unregister() after killing super

Otherwise we could be attempting to flush data for a writeback
thread and bdi that have already disappeared.

Signed-off-by: Jens Axboe <165ab144a3ccfd9429d5c6466b275f24fafdb114@oracle.com>

--- fs/nfs/super.c
+++ fs/nfs/super.c
@@ -2190,8 +2190,8 @@
 {
 	struct nfs_server *server = NFS_SB(s);

+	kill_anon_super(s);
 	bdi_unregister(&server->backing_dev_info);
-	kill_anon_super(s);
 	nfs_fscache_release_super_cookie(s);
 	nfs_free_server(server);
 }


proc: restrict access to /proc/PID/io

proc: restrict access to /proc/PID/io

/proc/PID/io may be used for gathering private information.  E.g.  for
openssh and vsftpd daemons wchars/rchars may be used to learn the
precise password length.  Restrict it to processes being able to ptrace
the target process.

ptrace_may_access() is needed to prevent keeping open file descriptor of
"io" file, executing setuid binary and gathering io information of the
setuid'ed process.

Signed-off-by: Vasiliy Kulikov <942b402b07c522a8271785df04894b4692262f69@openwall.com>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- fs/proc/base.c
+++ fs/proc/base.c
@@ -2708,6 +2708,9 @@
 	struct task_io_accounting acct = task->ioac;
 	unsigned long flags;

+	if (!ptrace_may_access(task, PTRACE_MODE_READ))
+		return -EACCES;
+
 	if (whole && lock_task_sighand(task, &flags)) {
 		struct task_struct *t = task;

@@ -2839,7 +2842,7 @@
 	REG("coredump_filter", S_IRUGO|S_IWUSR, proc_coredump_filter_operations),
 #endif
 #ifdef CONFIG_TASK_IO_ACCOUNTING
-	INF("io",	S_IRUGO, proc_tgid_io_accounting),
+	INF("io",	S_IRUSR, proc_tgid_io_accounting),
 #endif
 #ifdef CONFIG_HARDWALL
 	INF("hardwall",   S_IRUGO, proc_pid_hardwall),
@@ -3181,7 +3184,7 @@
 	REG("make-it-fail", S_IRUGO|S_IWUSR, proc_fault_inject_operations),
 #endif
 #ifdef CONFIG_TASK_IO_ACCOUNTING
-	INF("io",	S_IRUGO, proc_tid_io_accounting),
+	INF("io",	S_IRUSR, proc_tid_io_accounting),
 #endif
 #ifdef CONFIG_HARDWALL
 	INF("hardwall",   S_IRUGO, proc_pid_hardwall),


Bluetooth: Reduce critical region.

Bluetooth: Reduce critical region.

This patch reduces the critial region (protected by hdev->lock) in
hci_cc_le_set_scan_enable(). This way, only really required code is
synchronized.

Signed-off-by: Andre Guedes <282d5d3bbdb7014316a30ab22daf425f10cd096c@openbossa.org>
Signed-off-by: Gustavo F. Padovan <8463bae6aa74c6c37654a5ac7ce3bbb9fe6ffff8@profusion.mobi>

--- net/bluetooth/hci_event.c
+++ net/bluetooth/hci_event.c
@@ -898,16 +898,15 @@
 	if (!cp)
 		return;

-	hci_dev_lock(hdev);
-
 	if (cp->enable == 0x01) {
 		del_timer(&hdev->adv_timer);
+
+		hci_dev_lock(hdev);
 		hci_adv_entries_clear(hdev);
+		hci_dev_unlock(hdev);
 	} else if (cp->enable == 0x00) {
 		mod_timer(&hdev->adv_timer, jiffies + ADV_CLEAR_TIMEOUT);
 	}
-
-	hci_dev_unlock(hdev);
 }

 static void hci_cc_le_ltk_reply(struct hci_dev *hdev, struct sk_buff *skb)


Relax /proc fix a bit

Relax /proc fix a bit

Clearign all of i_mode was a bit draconian. We only really care about
S_ISUID/ISGID, after all.

Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@osdl.org>

--- fs/proc/base.c
+++ fs/proc/base.c
@@ -1338,8 +1338,8 @@
 		} else {
 			inode->i_uid = 0;
 			inode->i_gid = 0;
-			inode->i_mode = 0;
 		}
+		inode->i_mode &= ~(S_ISUID | S_ISGID);
 		security_task_to_inode(task, inode);
 		put_task_struct(task);
 		return 1;
@@ -1390,6 +1390,7 @@
 					inode->i_uid = 0;
 					inode->i_gid = 0;
 				}
+				inode->i_mode &= ~(S_ISUID | S_ISGID);
 				security_task_to_inode(task, inode);
 				put_task_struct(task);
 				return 1;


Bluetooth: Don't send device found events for duplicate reports

Occasionally, during active scanning we will receive duplicate ADV_IND
reports from the same device before receiving the SCAN_RSP from them. In
order to not wake up user space unnecessarily it's better not to send
these extra events as they do not contain any new information.

Signed-off-by: Johan Hedberg <628991c7b0a19c384f9b99c21ec330ce952bb838@intel.com>
Signed-off-by: Marcel Holtmann <44592b4eea36663c86b994bb0ea99d15309c1c7d@holtmann.org>


sysfs: skip bin_buffer->buffer while reading

After b31ca3f5dfc ("sysfs: fix deadlock"), bin read() first writes
data to bb->buffer and bounces it to a transient kernel buffer which
is then copied out to userland.  The double bouncing doesn't add
anything.  Let's just use the transient buffer directly.

While at it, rename @temp to @buf for clarity.

Signed-off-by: Tejun Heo <546b05909706652891a87f7bfe385ae147f61f91@kernel.org>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>


Bluetooth: Ignore key unauthenticated for high security

High security level for pre v2.1 devices requires combination link key
authenticated by at least 16 digit PIN code.

It's also necessary to update key_type and pin_length when the key
exists and is sufficently secured for the connection as there will be
no link key notify event in that case.

Signed-off-by: Waldemar Rymarkiewicz <35d304b3075d514779e58e47500a1aa9e0a46d68@tieto.com>
Signed-off-by: Gustavo F. Padovan <8463bae6aa74c6c37654a5ac7ce3bbb9fe6ffff8@profusion.mobi>

--- net/bluetooth/hci_event.c
+++ net/bluetooth/hci_event.c
@@ -2059,11 +2059,23 @@
 	}

 	conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr);
-
-	if (key->type == HCI_LK_UNAUTH_COMBINATION && conn &&
-			conn->auth_type != 0xff && (conn->auth_type & 0x01)) {
-		BT_DBG("%s ignoring unauthenticated key", hdev->name);
-		goto not_found;
+	if (conn) {
+		if (key->type == HCI_LK_UNAUTH_COMBINATION &&
+				conn->auth_type != 0xff &&
+				(conn->auth_type & 0x01)) {
+			BT_DBG("%s ignoring unauthenticated key", hdev->name);
+			goto not_found;
+		}
+
+		if (key->type == HCI_LK_COMBINATION && key->pin_len < 16 &&
+				conn->pending_sec_level == BT_SECURITY_HIGH) {
+			BT_DBG("%s ignoring key unauthenticated for high \
+							security", hdev->name);
+			goto not_found;
+		}
+
+		conn->key_type = key->type;
+		conn->pin_length = key->pin_len;
 	}

 	bacpy(&cp.bdaddr, &ev->bdaddr);


udf: Protect all modifications of LVID with s_alloc_mutex

udf_open_lvid() and udf_close_lvid() were modifying LVID without
s_alloc_mutex. Since they can be called from remount, the modification
could race with other filesystem modifications of LVID so protect them
by s_alloc_mutex just to be sure.

Signed-off-by: Jan Kara <596727c8a0ea4db3ba2ceceedccbacd3d7b371b8@suse.cz>

--- fs/udf/super.c
+++ fs/udf/super.c
@@ -1773,6 +1773,8 @@

 	if (!bh)
 		return;
+
+	mutex_lock(&sbi->s_alloc_mutex);
 	lvid = (struct logicalVolIntegrityDesc *)bh->b_data;
 	lvidiu = udf_sb_lvidiu(sbi);

@@ -1789,6 +1791,7 @@
 	lvid->descTag.tagChecksum = udf_tag_checksum(&lvid->descTag);
 	mark_buffer_dirty(bh);
 	sbi->s_lvid_dirty = 0;
+	mutex_unlock(&sbi->s_alloc_mutex);
 }

 static void udf_close_lvid(struct super_block *sb)
@@ -1801,6 +1804,7 @@
 	if (!bh)
 		return;

+	mutex_lock(&sbi->s_alloc_mutex);
 	lvid = (struct logicalVolIntegrityDesc *)bh->b_data;
 	lvidiu = udf_sb_lvidiu(sbi);
 	lvidiu->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX;
@@ -1821,6 +1825,7 @@
 	lvid->descTag.tagChecksum = udf_tag_checksum(&lvid->descTag);
 	mark_buffer_dirty(bh);
 	sbi->s_lvid_dirty = 0;
+	mutex_unlock(&sbi->s_alloc_mutex);
 }

 u64 lvid_get_unique_id(struct super_block *sb)


Bluetooth: Add automated SSP user confirmation responses

This patch adds automated negative and positive (auto-accept) responses
for Secure Simple Pairing user confirmation requests. The responses are
only sent if the HCI_MGMT flag is set in order not to confuse older user
space versions (without management interface support).

Signed-off-by: Johan Hedberg <628991c7b0a19c384f9b99c21ec330ce952bb838@nokia.com>
Signed-off-by: Gustavo F. Padovan <8463bae6aa74c6c37654a5ac7ce3bbb9fe6ffff8@profusion.mobi>

--- net/bluetooth/hci_event.c
+++ net/bluetooth/hci_event.c
@@ -2483,14 +2483,47 @@
 							struct sk_buff *skb)
 {
 	struct hci_ev_user_confirm_req *ev = (void *) skb->data;
+	int loc_mitm, rem_mitm;
+	struct hci_conn *conn;

 	BT_DBG("%s", hdev->name);

 	hci_dev_lock(hdev);

-	if (test_bit(HCI_MGMT, &hdev->flags))
-		mgmt_user_confirm_request(hdev->id, &ev->bdaddr, ev->passkey);
-
+	if (!test_bit(HCI_MGMT, &hdev->flags))
+		goto unlock;
+
+	conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr);
+	if (!conn)
+		goto unlock;
+
+	loc_mitm = (conn->auth_type & 0x01);
+	rem_mitm = (conn->remote_auth & 0x01);
+
+	/* If we require MITM but the remote device can't provide that
+	 * (it has NoInputNoOutput) then reject the confirmation
+	 * request. The only exception is when we're dedicated bonding
+	 * initiators (connect_cfm_cb set) since then we always have the MITM
+	 * bit set. */
+	if (!conn->connect_cfm_cb && loc_mitm && conn->remote_cap == 0x03) {
+		BT_DBG("Rejecting request: remote device can't provide MITM");
+		hci_send_cmd(hdev, HCI_OP_USER_CONFIRM_NEG_REPLY,
+					sizeof(ev->bdaddr), &ev->bdaddr);
+		goto unlock;
+	}
+
+	/* If no side requires MITM protection; auto-accept */
+	if ((!loc_mitm || conn->remote_cap == 0x03) &&
+				(!rem_mitm || conn->io_capability == 0x03)) {
+		BT_DBG("Auto-accept of user confirmation");
+		hci_send_cmd(hdev, HCI_OP_USER_CONFIRM_REPLY,
+						sizeof(ev->bdaddr), &ev->bdaddr);
+		goto unlock;
+	}
+
+	mgmt_user_confirm_request(hdev->id, &ev->bdaddr, ev->passkey);
+
+unlock:
 	hci_dev_unlock(hdev);
 }


Fix double-release of framebuffer through C++ wrapper

--- ospray/include/ospray/ospray_cpp/FrameBuffer.h
+++ ospray/include/ospray/ospray_cpp/FrameBuffer.h
@@ -32,13 +32,9 @@
                   OSPFrameBufferFormat format = OSP_FB_SRGBA,
                   int channels                = OSP_FB_COLOR);
       FrameBuffer(const FrameBuffer &copy);
-      FrameBuffer(FrameBuffer &&move);
       FrameBuffer(OSPFrameBuffer existing);

       FrameBuffer &operator=(const FrameBuffer &copy);
-      FrameBuffer &operator=(FrameBuffer &&move);
-
-      ~FrameBuffer();

       float renderFrame(const Renderer &renderer,
                         const Camera &camera,
@@ -47,11 +43,6 @@
       void *map(OSPFrameBufferChannel channel) const;
       void unmap(void *ptr) const;
       void clear() const;
-
-     private:
-      void free() const;
-
-      bool owner = true;
     };

     // Inlined function definitions ///////////////////////////////////////////
@@ -64,15 +55,9 @@
     }

     inline FrameBuffer::FrameBuffer(const FrameBuffer &copy)
-        : ManagedObject_T<OSPFrameBuffer>(copy.handle()), owner(false)
+        : ManagedObject_T<OSPFrameBuffer>(copy.handle())
     {
       ospRetain(copy.handle());
-    }
-
-    inline FrameBuffer::FrameBuffer(FrameBuffer &&move)
-        : ManagedObject_T<OSPFrameBuffer>(move.handle())
-    {
-      move.ospObject = nullptr;
     }

     inline FrameBuffer::FrameBuffer(OSPFrameBuffer existing)
@@ -82,23 +67,9 @@

     inline FrameBuffer &FrameBuffer::operator=(const FrameBuffer &copy)
     {
-      free();
       ospObject = copy.ospObject;
       ospRetain(copy.handle());
       return *this;
-    }
-
-    inline FrameBuffer &FrameBuffer::operator=(FrameBuffer &&move)
-    {
-      free();
-      ospObject      = move.ospObject;
-      move.ospObject = nullptr;
-      return *this;
-    }
-
-    inline FrameBuffer::~FrameBuffer()
-    {
-      free();
     }

     inline float FrameBuffer::renderFrame(const Renderer &renderer,
@@ -124,12 +95,5 @@
       ospResetAccumulation(handle());
     }

-    inline void FrameBuffer::free() const
-    {
-      if (owner && handle()) {
-        ospRelease(handle());
-      }
-    }
-
   }  // namespace cpp
 }  // namespace ospray


Bluetooth: hidp: Don't release device ref if never held

When an hidp connection is added for a boot protocol input
device, don't release a device reference that was never
acquired. The device reference is acquired when the session
is linked to the session list (which hasn't happened yet when
hidp_setup_input is called).

Signed-off-by: Peter Hurley <4b8373d016f277527198385ba72fda0feb5da015@hurleysoftware.com>
Signed-off-by: Gustavo F. Padovan <8463bae6aa74c6c37654a5ac7ce3bbb9fe6ffff8@profusion.mobi>

--- net/bluetooth/hidp/core.c
+++ net/bluetooth/hidp/core.c
@@ -844,7 +844,6 @@
 	if (err < 0) {
 		input_free_device(input);
 		session->input = NULL;
-		hci_conn_put_device(session->conn);
 		return err;
 	}


HID: fix unused rsize usage

HID: fix unused rsize usage

27ce4050 ("HID: fix data access in implement()") by mistake removed
a setting of buffer size in hidp. Fix that by putting it back.

Reported-by: kbuild test robot <24f7fe9d205c8a9f6ade0c2894e14303ca16087f@intel.com>
Signed-off-by: Jiri Kosina <ed58f755cc8caaf10c3e8c731a8b86fb8f13d6cb@suse.cz>


Tweak node cache eviction strategy when the cache is full: kick off new nodes in AUTH state that weren't active during the cache wait interval rather than keeping them for the entire cache timeout interval. Fixes association failures in noisy RF environments. Tested by edd and myself with a slow soekris suffering from RF noise with about of 50 interrupts per second on ral0. ok deraadt

--- net80211/ieee80211_node.c
+++ net80211/ieee80211_node.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: ieee80211_node.c,v 1.68 2012/01/25 17:04:02 stsp Exp $	*/
+/*	$OpenBSD: ieee80211_node.c,v 1.69 2012/07/13 09:46:33 stsp Exp $	*/
 /*	$NetBSD: ieee80211_node.c,v 1.14 2004/05/09 09:18:47 dyoung Exp $	*/

 /*-
@@ -1141,8 +1141,8 @@
  * Else, this function is called because a new node must be allocated but the
  * node cache is full. In this case, return as soon as a free slot was made
  * available. If acting as hostap, clean cached nodes regardless of their
- * recent activity and also allow de-authing inactive authenticated or
- * associated nodes.
+ * recent activity and also allow de-authing of authenticated nodes older
+ * than one cache wait interval, and de-authing of inactive associated nodes.
  */
 void
 ieee80211_clean_nodes(struct ieee80211com *ic, int cache_timeout)
@@ -1172,7 +1172,15 @@
 				    ni->ni_inact < IEEE80211_INACT_MAX))
 					continue;
 			} else {
-				if (ni->ni_state != IEEE80211_STA_COLLECT &&
+				if (ic->ic_opmode == IEEE80211_M_HOSTAP &&
+				    ((ni->ni_state == IEEE80211_STA_ASSOC &&
+				    ni->ni_inact < IEEE80211_INACT_MAX) ||
+				    (ni->ni_state == IEEE80211_STA_AUTH &&
+				     ni->ni_inact == 0)))
+				    	continue;
+
+				if (ic->ic_opmode == IEEE80211_M_IBSS &&
+				    ni->ni_state != IEEE80211_STA_COLLECT &&
 				    ni->ni_state != IEEE80211_STA_CACHE &&
 				    ni->ni_inact < IEEE80211_INACT_MAX)
 					continue;


r4362/sofa-dev : FIX: init of MeshSpringForceField. Fix ticket #39

--- modules/sofa/component/forcefield/MeshSpringForceField.h
+++ modules/sofa/component/forcefield/MeshSpringForceField.h
@@ -66,16 +66,16 @@

 public:
     MeshSpringForceField()
-        : linesStiffness(initData(&linesStiffness,Real(100),"linesStiffness","Stiffness for the Lines",false))
-        , linesDamping(initData(&linesDamping,Real(5),"linesDamping","Damping for the Lines",false))
-        , trianglesStiffness(initData(&trianglesStiffness,Real(100),"trianglesStiffness","Stiffness for the Triangles",false))
-        , trianglesDamping(initData(&trianglesDamping,Real(5),"trianglesDamping","Damping for the Triangles",false))
-        , quadsStiffness(initData(&quadsStiffness,Real(100),"quadsStiffness","Stiffness for the Quads",false))
-        , quadsDamping(initData(&quadsDamping,Real(5),"quadsDamping","Damping for the Quads",false))
-        , tetrasStiffness(initData(&tetrasStiffness,Real(100),"tetrasStiffness","Stiffness for the Tetras",false))
-        , tetrasDamping(initData(&tetrasDamping,Real(5),"tetrasDamping","Damping for the Tetras",false))
-        , cubesStiffness(initData(&cubesStiffness,Real(100),"cubesStiffness","Stiffness for the Cubes",false))
-        , cubesDamping(initData(&cubesDamping,Real(5),"cubesDamping","Damping for the Cubes",false))
+        : linesStiffness(initData(&linesStiffness,Real(0),"linesStiffness","Stiffness for the Lines",false))
+        , linesDamping(initData(&linesDamping,Real(0),"linesDamping","Damping for the Lines",false))
+        , trianglesStiffness(initData(&trianglesStiffness,Real(0),"trianglesStiffness","Stiffness for the Triangles",false))
+        , trianglesDamping(initData(&trianglesDamping,Real(0),"trianglesDamping","Damping for the Triangles",false))
+        , quadsStiffness(initData(&quadsStiffness,Real(0),"quadsStiffness","Stiffness for the Quads",false))
+        , quadsDamping(initData(&quadsDamping,Real(0),"quadsDamping","Damping for the Quads",false))
+        , tetrasStiffness(initData(&tetrasStiffness,Real(0),"tetrasStiffness","Stiffness for the Tetras",false))
+        , tetrasDamping(initData(&tetrasDamping,Real(0),"tetrasDamping","Damping for the Tetras",false))
+        , cubesStiffness(initData(&cubesStiffness,Real(0),"cubesStiffness","Stiffness for the Cubes",false))
+        , cubesDamping(initData(&cubesDamping,Real(0),"cubesDamping","Damping for the Cubes",false))
         , localRange( initData(&localRange, defaulttype::Vec<2,int>(-1,-1), "localRange", "optional range of local DOF indices. Any computation involving only indices outside of this range are discarded (useful for parallelization using mesh partitionning)" ) )
     {
         addAlias(&linesStiffness,    "stiffness"); addAlias(&linesDamping,    "damping");
@@ -162,6 +162,7 @@

     virtual void init();

+
 };

 #if defined(WIN32) && !defined(SOFA_COMPONENT_FORCEFIELD_MESHSPRINGFORCEFIELD_CPP)


Removed XML_ERROR because it conflicts with a Windows symbol

I opted not to remove the entire enum because of ABI compatibility. The
symbol is only removed on Windows where it never existed.

--- src/OVAL/public/oval_types.h
+++ src/OVAL/public/oval_types.h
@@ -303,7 +303,9 @@
 	XML_VALIDITY_WARNING = 1,
 	XML_VALIDITY_ERROR = 2,
 	XML_WARNING = 3,
+#ifndef _WIN32
 	XML_ERROR = 4,
+#endif
 	OVAL_LOG_INFO = 15,
 	OVAL_LOG_DEBUG = 16,
 	OVAL_LOG_WARN = 17


Add missing nullability annotations

Add missing nullability annotations

PiperOrigin-RevId: 480910571

--- components/Snackbar/src/MDCSnackbarManagerDelegate.h
+++ components/Snackbar/src/MDCSnackbarManagerDelegate.h
@@ -17,6 +17,8 @@
 @class MDCSnackbarManager;
 @class MDCSnackbarMessageView;

+NS_ASSUME_NONNULL_BEGIN
+
 /**
  Delegate protocol for the MDCSnackbarManager.
  */
@@ -30,7 +32,7 @@
  @param messageView The messageView of the snackbar that will be presented.
  */
 - (void)snackbarManager:(MDCSnackbarManager *)snackbarManager
-    willPresentSnackbarWithMessageView:(nonnull MDCSnackbarMessageView *)messageView;
+    willPresentSnackbarWithMessageView:(MDCSnackbarMessageView *)messageView;

 @optional

@@ -56,6 +58,8 @@
  @param messageView The messageView of the snackbar that was just presented.
  */
 - (void)snackbarManager:(MDCSnackbarManager *)snackbarManager
-    isPresentingSnackbarWithMessageView:(nonnull MDCSnackbarMessageView *)messageView;
+    isPresentingSnackbarWithMessageView:(MDCSnackbarMessageView *)messageView;

 @end
+
+NS_ASSUME_NONNULL_END


Eliminate zone callback. Export dns_zone_equal. Do not try to set slave options (like transfer_source) on a master zone. Turn off some printing. Add a warning about dns_zone_tostr().

--- lib/dns/zone.c
+++ lib/dns/zone.c
@@ -15,7 +15,7 @@
  * SOFTWARE.
  */

- /* $Id: zone.c,v 1.22 1999/10/14 06:10:35 marka Exp $ */
+ /* $Id: zone.c,v 1.23 1999/10/15 01:39:31 halley Exp $ */

 #include <config.h>

@@ -185,7 +185,6 @@
 				dns_rdatatype_t type);
 extern void dns_zone_transfer_in(dns_zone_t *zone);
 static void record_serial(void);
-static isc_boolean_t dns_zone_equal(dns_zone_t *, dns_zone_t *);
 static char * dns_zone_tostr(dns_zone_t *zone);

@@ -269,8 +268,10 @@
 	zone->xfrtime = MAX_XFER_TIME;
 	zone->diff_on_reload = ISC_FALSE;
 	zone->magic = ZONE_MAGIC;
+#if 0
 	printf("create: %p: %s: references = %d\n", zone, dns_zone_tostr(zone),
 	       zone->references);
+#endif
 	*zonep = zone;
 	return (DNS_R_SUCCESS);
 }
@@ -1108,8 +1109,10 @@
 	LOCK(&source->lock);
 	REQUIRE(source->references > 0);
 	source->references++;
+#if 0
 	printf("%p: %s: references = %d\n", source, dns_zone_tostr(source),
 	       source->references);
+#endif
 	INSIST(source->references != 0xffffffffU);
 	UNLOCK(&source->lock);
 	*target = source;
@@ -1121,11 +1124,18 @@
 	printf("\t%p: %s: references = %d\n", zone, dns_zone_tostr(zone),
 	       zone->references);
 }
+
 static char *
 dns_zone_tostr(dns_zone_t *zone) {
 	isc_buffer_t tbuf;
 	static char outbuf[1024];
 	dns_result_t result;
+
+	/*
+	 * XXXRTH  This is dangerous and must be changed.  You cannot
+	 * return a pointer to an embedded static buffer in a multithreaded
+	 * program!
+	 */

 	isc_buffer_init(&tbuf, outbuf, sizeof(outbuf) - 1,
 			ISC_BUFFERTYPE_TEXT);
@@ -1145,15 +1155,16 @@
 dns_zone_detach(dns_zone_t **zonep) {
 	dns_zone_t *zone;

-
 	REQUIRE(zonep != NULL && DNS_ZONE_VALID(*zonep));

 	zone = *zonep;
 	LOCK(&zone->lock);
 	REQUIRE(zone->references > 0);
 	zone->references--;
+#if 0
 	printf("%p: %s: references = %d\n", zone, dns_zone_tostr(zone),
 	       zone->references);
+#endif
 	UNLOCK(&zone->lock);
 	if (zone->references == 0)
 		zone_free(zone);
@@ -2270,112 +2281,6 @@
 	return (DNS_R_SUCCESS);
 }

-isc_result_t
-dns_zone_callback(dns_c_ctx_t *cfg, dns_c_zone_t *czone, dns_c_view_t *cview,
-		  void *uap) {
-	dns_zone_callbackarg_t *cba = uap;
-	dns_name_t *name = NULL;
-	dns_view_t *oldview = NULL;
-	dns_zone_t *oldzone = NULL;
-	dns_view_t *newview = NULL;
-	dns_zone_t *newzone = NULL;
-	dns_zone_t *tmpzone = NULL;
-	dns_result_t result;
-	isc_boolean_t boolean;
-	const char *viewname;
-
-	REQUIRE(czone != NULL);
-	REQUIRE(cba != NULL);
-
-	/*
-	 * Find views by name.
-	 */
-	if (cview != NULL)
-		dns_c_view_getname(NULL, cview, &viewname);
-	else
-		viewname = "default";
-
-	printf("view %s\n", viewname);
-
-	oldview = dns_view_findinlist(&cba->oldviews, viewname, czone->zclass);
-	newview = dns_view_findinlist(&cba->newviews, viewname, czone->zclass);
-
-	if (newview == NULL) {
-		result = dns_view_create(cba->mctx, czone->zclass, viewname,
-					 &newview);
-		if (result != DNS_R_SUCCESS)
-			goto cleanup;
-		ISC_LIST_APPEND(cba->newviews, newview, link);
-	}
-
-	/*
-	 * Create and populate a new zone structure.
-	 */
-	result = dns_zone_create(&newzone, cba->mctx);
-	if (result != DNS_R_SUCCESS)
-		goto cleanup;
-
-	result = dns_zone_copy(cfg, czone, newzone);
-	if (result != DNS_R_SUCCESS)
-		goto cleanup;
-
-#if 0
-	/* XXX hints should be a zone */
-	if (dns_zone_gettype(newzone) == dns_zone_hint) {
-		dns_view_sethints(newview, newzone);
-		goto cleanup;
-	}
-#endif
-
-	/*
-	 * Find zone in mount table.
-	 */
-	name = dns_zone_getorigin(newzone);
-	dns_zone_print(newzone);
-
-	result = dns_zt_find(newview->zonetable, name, NULL, &tmpzone);
-	if (result == DNS_R_SUCCESS) {
-		printf("zone already exists=\n");
-		result = DNS_R_EXISTS;
-		goto cleanup;
-	} else if (result != DNS_R_PARTIALMATCH && result != DNS_R_NOTFOUND)
-		goto cleanup;
-
-	if (oldview != NULL)
-		result = dns_zt_find(oldview->zonetable, name, NULL, &oldzone);
-	else
-		result = DNS_R_NOTFOUND;
-
-	printf("dns_zt_find() returned %s\n", dns_result_totext(result));
-
-	if (result == DNS_R_NOTFOUND || result == DNS_R_PARTIALMATCH) {
-		if (result == DNS_R_PARTIALMATCH) {
-			dns_zone_print(oldzone);
-		}
-		result = dns_view_addzone(newview, newzone);
-		if (result != DNS_R_SUCCESS)
-			goto cleanup;
-	} else if (result == DNS_R_SUCCESS) {
-		dns_zone_print(oldzone);
-		/* Does the new configuration match the existing one? */
-		boolean = dns_zone_equal(newzone, oldzone);
-	printf("dns_zone_equal() returned %s\n", boolean ? "TRUE" : "FALSE");
-		if (boolean)
-			result = dns_view_addzone(newview, oldzone);
-		else
-			result = dns_view_addzone(newview, newzone);
-	}
-
- cleanup:
-	if (tmpzone != NULL)
-		dns_zone_detach(&tmpzone);
-	if (newzone != NULL)
-		dns_zone_detach(&newzone);
-	if (oldzone != NULL)
-		dns_zone_detach(&oldzone);
-	return (result);
-}
-
 /*
  *	Copy / translate zone configuration data to dns_zone_t.
  */
@@ -2513,43 +2418,6 @@
 			dns_zone_setpubkey(zone, pubkey);
 		else
 			dns_zone_setpubkey(zone, NULL);
-
-		/*
-		 * should master port be seperate or just applied to
-		 * isc_sockaddr_t's
-		 */
-		iresult = dns_c_zone_getmasterport(NULL /* isc_log_t */,
-						   czone, &port);
-		if (iresult != ISC_R_SUCCESS)
-			port = 53;
-		dns_zone_setmasterport(zone, port);
-
-		iresult = dns_c_zone_getmasterips(NULL /* isc_log_t */,
-						  czone, &iplist);
-		if (iresult == ISC_R_SUCCESS) {
-			for (i = 0; i < iplist->nextidx; i++) {
-				result = dns_zone_addmaster(zone,
-							    &iplist->ips[i]);
-				if (result != DNS_R_SUCCESS)
-					return (result);
-			}
-		} else
-			dns_zone_clearmasters(zone);
-
-		iresult = dns_c_zone_gettransfersource(NULL /* isc_log_t */,
-						       czone, &sockaddr);
-		if (iresult == ISC_R_SUCCESS) {
-			result = dns_zone_setxfrsource(zone, &sockaddr);
-			if (result != DNS_R_SUCCESS)
-				return (result);
-		}
-
-		iresult = dns_c_zone_getmaxtranstimein(NULL /* isc_log_t */,
-						       czone, &xfrtime);
-		if (iresult == ISC_R_SUCCESS)
-			dns_zone_setxfrtime(zone, xfrtime);
-		else
-			dns_zone_setxfrtime(zone, MAX_XFER_TIME);
 		break;

 	case dns_c_zone_forward:
@@ -2996,7 +2864,7 @@
 record_serial() {
 }

-static isc_boolean_t
+isc_boolean_t
 dns_zone_equal(dns_zone_t *oldzone, dns_zone_t *newzone) {
 	unsigned int i;

@@ -3119,7 +2987,9 @@
 	}
 	dns_db_closeversion(db, &ver, ISC_FALSE);

-	printf("replacing database...");
+#if 0
+	printf("replacing database...\n");
+#endif
 	if (zone->top != NULL)
 		dns_db_detach(&zone->top);
 	dns_db_attach(db, &zone->top);


Reduce virtual usage in MediaControlElementTypes

mediaController() is not overridden so remove the virtual.
isMediaControlElement() can just return true instead of calling a virtual not overridden method.

Review URL: https://codereview.chromium.org/134353002

git-svn-id: bf5cd6ccde378db821296732a091cfbcf5285fbd@164902 bbb929c8-8fbe-4397-9dbb-9b2b20218538

--- Source/core/html/shadow/MediaControlElementTypes.h
+++ Source/core/html/shadow/MediaControlElementTypes.h
@@ -87,14 +87,13 @@
     virtual const AtomicString& shadowPseudoId() const = 0;

     virtual void setMediaController(MediaControllerInterface* controller) { m_mediaController = controller; }
-    virtual MediaControllerInterface* mediaController() const { return m_mediaController; }
+    MediaControllerInterface* mediaController() const { return m_mediaController; }

 protected:
     explicit MediaControlElement(MediaControlElementType, HTMLElement*);
     ~MediaControlElement() { }

     virtual void setDisplayType(MediaControlElementType);
-    virtual bool isMediaControlElement() const { return true; }

 private:
     MediaControllerInterface* m_mediaController;
@@ -106,7 +105,7 @@

 class MediaControlDivElement : public HTMLDivElement, public MediaControlElement {
 protected:
-    virtual bool isMediaControlElement() const OVERRIDE { return MediaControlElement::isMediaControlElement(); }
+    virtual bool isMediaControlElement() const OVERRIDE FINAL { return true; }
     explicit MediaControlDivElement(Document&, MediaControlElementType);
 };

@@ -114,7 +113,7 @@

 class MediaControlInputElement : public HTMLInputElement, public MediaControlElement {
 protected:
-    virtual bool isMediaControlElement() const OVERRIDE { return MediaControlElement::isMediaControlElement(); }
+    virtual bool isMediaControlElement() const OVERRIDE FINAL { return true; }
     explicit MediaControlInputElement(Document&, MediaControlElementType);

 private:


Forgot ng-deldir.c

Forgot ng-deldir.c

error: pathspec 'zipscript/src/ng-deldir.c' did not match any file(s) known to git

--- zipscript/src/ng-deldir.c
+++ zipscript/src/ng-deldir.c
@@ -0,0 +1,154 @@
+/*
+ * Marks a directory as deleted in dirlog
+ * @version 20110921
+ * @author Sked
+ */
+
+#include <stdio.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <inttypes.h>
+#include <errno.h>
+#include "../conf/zsconfig.h"
+#include "../include/zsconfig.defaults.h"
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#ifndef HAVE_STRLCPY
+# include "strl/strl.h"
+#endif
+
+/* Force structure alignment to 4 bytes (for 64bit support). */
+#if ( GLVERSION != 20164 )
+#pragma pack(push, 4)
+#endif
+
+/* 32-bit time values (for 64bit support). */
+typedef int32_t time32_t;
+
+#if ( GLVERSION == 13232 )
+struct dirlog {
+    uint16_t    status;          /* 0 = NEWDIR, 1 = NUKE, 2 = UNNUKE, 3 = DELETED */
+    time32_t    uptime;          /* Creation time since epoch (man 2 time) */
+    uint16_t    uploader;        /* The userid of the creator */
+    uint16_t    group;           /* The groupid of the primary group of the creator */
+    uint16_t    files;           /* The number of files inside the dir */
+    int32_t     bytes;           /* The number of bytes in the dir */
+    char        dirname[255];    /* The name of the dir (fullpath) */
+    char        dummy[8];        /* Unused, kept for compatibility reasons */
+} __attribute__((deprecated));
+#elif ( GLVERSION == 20164 )
+struct dirlog {
+    ushort      status;          /* 0 = NEWDIR, 1 = NUKE, 2 = UNNUKE, 3 = DELETED */
+    time_t      uptime;          /* Creation time since epoch (man 2 time) */
+    ushort      uploader;        /* The userid of the creator */
+    ushort      group;           /* The groupid of the primary group of the creator */
+    ushort      files;           /* The number of files inside the dir */
+    unsigned long long bytes;    /* The number of bytes in the dir */
+    char        dirname[255];    /* The name of the dir (fullpath) */
+    struct dirlog *nxt;          /* Unused, kept for compatibility reasons */
+    struct dirlog *prv;          /* Unused, kept for compatibility reasons */
+};
+#else
+/* 20132 & 20032 & 20232 & 20264 */
+struct dirlog {
+    uint16_t    status;          /* 0 = NEWDIR, 1 = NUKE, 2 = UNNUKE, 3 = DELETED */
+    time32_t    uptime;          /* Creation time since epoch (man 2 time) */
+    uint16_t    uploader;        /* The userid of the creator */
+    uint16_t    group;           /* The groupid of the primary group of the creator */
+    uint16_t    files;           /* The number of files inside the dir */
+    uint64_t    bytes;           /* The number of bytes in the dir */
+    char        dirname[255];    /* The name of the dir (fullpath) */
+    char        dummy[8];        /* Unused, kept for compatibility reasons */
+};
+#endif
+
+/* Restore default structure alignment for non-critical structures. */
+#if ( GLVERSION != 20164 )
+#pragma pack(pop)
+#endif
+
+int
+main(int argc, char *argv[])
+{
+	FILE *fp, *fp2;
+	char rlsname[1024], data2[1024], dirlog[1024];
+	struct dirlog buffer;
+
+	if (argc != 2) {
+		printf("Please give a directory to undupe as well\n");
+		return 1;
+	}
+
+	strlcpy(dirlog, dirlogpath, 1024);
+	strlcpy(rlsname, argv[1], 1024);
+	sprintf(data2, "%s/dirlog.%d", storage, (int)getuid());
+
+	if (!(fp = fopen(dirlog, "r+b"))) {
+		printf("FATAL ERROR: Unable to open dirlog (%s)\n", dirlog);
+		return 1;
+	}
+	if (!(fp2 = fopen(data2, "w+b"))) {
+		printf("FATAL ERROR: Unable to write to tempfile (%s)\n", data2);
+		fclose(fp);
+		return 1;
+	}
+
+	while (!feof(fp)) {
+		if (fread(&buffer, sizeof(struct dirlog), 1, fp) < 1)
+			break;
+		/* If we find the rlsname, mark it deleted */
+		if (strcmp(buffer.dirname, rlsname) == 0)
+			buffer.status = 3;
+		/* Write it to the new file, if we can */
+		if (fwrite(&buffer, sizeof(struct dirlog), 1, fp2) < 1)
+			break;
+	}
+
+	fclose(fp);
+	fclose(fp2);
+
+	/*
+	 * Time to put back the remainder of the dirlog. We try renaming the
+	 * tempfile first, if this fails we try streaming the contents of the
+	 * tempfile to the original file. Streaming will work where renaming
+	 * fails if the directory is not writable for the user.
+	 */
+
+	if (rename(data2, dirlog) == -1) {
+		if (!(fp = fopen(data2, "r+b"))) {
+			printf("FATAL ERROR: Unable to open tempfile (%s)\n", data2);
+			return 1;
+		}
+		if (!(fp2 = fopen(dirlog, "w+b"))) {
+			printf("FATAL ERROR: Unable to write to dirlog (%s)\n", dirlog);
+			fclose(fp);
+			return 1;
+		}
+
+		while (!feof(fp)) {
+			if (fread(&buffer, sizeof(struct dirlog), 1, fp) < 1)
+				break;
+			if (fwrite(&buffer, sizeof(struct dirlog), 1, fp2) < 1)
+				break;
+		}
+
+		fclose(fp);
+		fclose(fp2);
+
+		if (chmod(dirlog, 0666))
+			printf("WARNING: Failed to chmod %s: %s\n", dirlog, strerror(errno));
+
+		if (unlink(data2) > 0) {
+			printf("FATAL ERROR: Unable to delete tempfile (%s)\n", data2);
+			return 1;
+		}
+	}
+
+	return 0;
+}


add missing NULLs in arith sample

add missing NULLs in arith sample

--- spec/sample_arith_spec.c
+++ spec/sample_arith_spec.c
@@ -50,11 +50,17 @@
       abr_n_alt(
         "val",
         abr_regex("^-?[0-9]+"),
-        abr_seq(abr_string("("), abr_n("exp"), abr_string(")")));
+        abr_seq(abr_string("("), abr_n("exp"), abr_string(")"), NULL),
+        NULL);
     abr_parser *op =
-      abr_n_seq("op", abr_n("exp"), abr_regex("^[\+\-\*\/]"), abr_n("exp"));
+      abr_n_seq(
+        "op",
+        abr_n("exp"),
+        abr_regex("^[\+\-\*\/]"),
+        abr_n("exp"),
+        NULL);
     abr_parser *exp =
-      abr_n_alt("exp", op, val);
+      abr_n_alt("exp", op, val, NULL);
   }

   it "parses numbers"


Prevent segfault early on in TDD cycle per issue #116

--- exercises/rna-transcription/test/test_rna_transcription.c
+++ exercises/rna-transcription/test/test_rna_transcription.c
@@ -6,8 +6,12 @@
 void test_transcription(const char *dna, const char *expected)
 {
    char *rna = to_rna(dna);
-   TEST_ASSERT_TRUE(strncmp(rna, expected, strlen(dna)) == 0);
-   free(rna);
+   if (rna != NULL) {		/* Prevent segfault on strlen() and free(). */
+      TEST_ASSERT_TRUE(strncmp(rna, expected, (strlen(expected) + 1)) == 0);
+      free(rna);
+   } else {
+      TEST_FAIL();		/* to_rna() returned NULL when it was not epected. */
+   }
 }

 void test_failure(const char *dna)


add const modifier

add const modifier

--- OOModel/src/elements/Modifier.h
+++ OOModel/src/elements/Modifier.h
@@ -56,7 +56,9 @@
 			Virtual = 0x00000040,
 			Override = 0x00000080,

-			Inline = 0x00000100
+			Inline = 0x00000100,
+
+			Const = 0x00000200
 		};
 		Q_DECLARE_FLAGS(Modifiers, ModifierFlag)


Small typo

Small typo

--- mudlib/mud/home/Text/sys/verb/wiz/ooc/system/rebootsys.c
+++ mudlib/mud/home/Text/sys/verb/wiz/ooc/system/rebootsys.c
@@ -56,6 +56,6 @@
 	INITD->reboot_subsystem(args);

 	if (this_object() && user) {
-		send_out("Subsystem booted.\n");
+		send_out("Subsystem rebooted.\n");
 	}
 }