Hello all

a patch for Vim's code style that does not change any functionality.

Elias

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
*** ../vim/src/os_qnx.c	2011-09-19 09:38:59.000000000 +0200
--- src/os_qnx.c	2011-09-19 09:44:22.000000000 +0200
***************
*** 24,33 ****
  #if defined(FEAT_GUI_PHOTON)
      PhChannelParms_t parms;
  
!     memset( &parms, 0, sizeof( parms ) );
      parms.flags = Ph_DYNAMIC_BUFFER;
  
!     is_photon_available = (PhAttach( NULL, &parms ) != NULL) ? TRUE : FALSE;
  #endif
  }
  
--- 24,33 ----
  #if defined(FEAT_GUI_PHOTON)
      PhChannelParms_t parms;
  
!     memset(&parms, 0, sizeof(parms));
      parms.flags = Ph_DYNAMIC_BUFFER;
  
!     is_photon_available = (PhAttach(NULL, &parms) != NULL) ? TRUE : FALSE;
  #endif
  }
  
***************
*** 39,46 ****
  /* Turn on the clipboard for a console vim when photon is running */
  void qnx_clip_init()
  {
!     if( is_photon_available == TRUE && !gui.in_use)
! 	clip_init( TRUE );
  }
  
  /*****************************************************************************/
--- 39,46 ----
  /* Turn on the clipboard for a console vim when photon is running */
  void qnx_clip_init()
  {
!     if (is_photon_available == TRUE && !gui.in_use)
! 	clip_init(TRUE);
  }
  
  /*****************************************************************************/
***************
*** 48,79 ****
  
  /* No support for owning the clipboard */
  int
! clip_mch_own_selection( VimClipboard *cbd )
  {
      return FALSE;
  }
  
  void
! clip_mch_lose_selection( VimClipboard *cbd )
  {
  }
  
  void
! clip_mch_request_selection( VimClipboard *cbd )
  {
      int		    type = MLINE, clip_length = 0, is_type_set = FALSE;
      void	    *cbdata;
      PhClipHeader    *clip_header;
      char_u	    *clip_text = NULL;
  
!     cbdata = PhClipboardPasteStart( PhInputGroup( NULL ));
!     if( cbdata != NULL )
      {
  	/* Look for the vim specific clip first */
! 	clip_header = PhClipboardPasteType( cbdata, CLIP_TYPE_VIM );
! 	if( clip_header != NULL && clip_header->data != NULL )
  	{
! 	    switch( *(char *) clip_header->data )
  	    {
  		default: /* fallthrough to line type */
  		case 'L': type = MLINE; break;
--- 48,79 ----
  
  /* No support for owning the clipboard */
  int
! clip_mch_own_selection(VimClipboard *cbd)
  {
      return FALSE;
  }
  
  void
! clip_mch_lose_selection(VimClipboard *cbd)
  {
  }
  
  void
! clip_mch_request_selection(VimClipboard *cbd)
  {
      int		    type = MLINE, clip_length = 0, is_type_set = FALSE;
      void	    *cbdata;
      PhClipHeader    *clip_header;
      char_u	    *clip_text = NULL;
  
!     cbdata = PhClipboardPasteStart(PhInputGroup(NULL));
!     if (cbdata != NULL)
      {
  	/* Look for the vim specific clip first */
! 	clip_header = PhClipboardPasteType(cbdata, CLIP_TYPE_VIM);
! 	if (clip_header != NULL && clip_header->data != NULL)
  	{
! 	    switch(*(char *) clip_header->data)
  	    {
  		default: /* fallthrough to line type */
  		case 'L': type = MLINE; break;
***************
*** 86,112 ****
  	}
  
  	/* Try for just normal text */
! 	clip_header = PhClipboardPasteType( cbdata, CLIP_TYPE_TEXT );
! 	if( clip_header != NULL )
  	{
  	    clip_text = clip_header->data;
  	    clip_length  = clip_header->length - 1;
  
! 	    if( clip_text != NULL && is_type_set == FALSE )
  		type = MAUTO;
  	}
  
! 	if( (clip_text != NULL) && (clip_length > 0) )
  	{
! 	    clip_yank_selection( type, clip_text, clip_length, cbd );
  	}
  
! 	PhClipboardPasteFinish( cbdata );
      }
  }
  
  void
! clip_mch_set_selection( VimClipboard *cbd )
  {
      int type;
      long_u  len;
--- 86,112 ----
  	}
  
  	/* Try for just normal text */
! 	clip_header = PhClipboardPasteType(cbdata, CLIP_TYPE_TEXT);
! 	if (clip_header != NULL)
  	{
  	    clip_text = clip_header->data;
  	    clip_length  = clip_header->length - 1;
  
! 	    if (clip_text != NULL && is_type_set == FALSE)
  		type = MAUTO;
  	}
  
! 	if ((clip_text != NULL) && (clip_length > 0))
  	{
! 	    clip_yank_selection(type, clip_text, clip_length, cbd);
  	}
  
! 	PhClipboardPasteFinish(cbdata);
      }
  }
  
  void
! clip_mch_set_selection(VimClipboard *cbd)
  {
      int type;
      long_u  len;
***************
*** 114,144 ****
      PhClipHeader clip_header[2];
  
      /* Prevent recursion from clip_get_selection() */
!     if( cbd->owned == TRUE )
  	return;
  
      cbd->owned = TRUE;
!     clip_get_selection( cbd );
      cbd->owned = FALSE;
  
!     type = clip_convert_selection( &str, &len, cbd );
!     if( type >= 0 )
      {
! 	text_clip = lalloc( len + 1, TRUE ); /* Normal text */
  
! 	if( text_clip && vim_clip )
  	{
! 	    memset( clip_header, 0, sizeof( clip_header ) );
  
! 	    STRNCPY( clip_header[0].type, CLIP_TYPE_VIM, 8 );
! 	    clip_header[0].length = sizeof( vim_clip );
  	    clip_header[0].data   = vim_clip;
  
! 	    STRNCPY( clip_header[1].type, CLIP_TYPE_TEXT, 8 );
  	    clip_header[1].length = len + 1;
  	    clip_header[1].data   = text_clip;
  
! 	    switch( type )
  	    {
  		default: /* fallthrough to MLINE */
  		case MLINE:	*vim_clip = 'L'; break;
--- 114,144 ----
      PhClipHeader clip_header[2];
  
      /* Prevent recursion from clip_get_selection() */
!     if (cbd->owned == TRUE)
  	return;
  
      cbd->owned = TRUE;
!     clip_get_selection(cbd);
      cbd->owned = FALSE;
  
!     type = clip_convert_selection(&str, &len, cbd);
!     if (type >= 0)
      {
! 	text_clip = lalloc(len + 1, TRUE); /* Normal text */
  
! 	if (text_clip && vim_clip)
  	{
! 	    memset(clip_header, 0, sizeof(clip_header));
  
! 	    STRNCPY(clip_header[0].type, CLIP_TYPE_VIM, 8);
! 	    clip_header[0].length = sizeof(vim_clip);
  	    clip_header[0].data   = vim_clip;
  
! 	    STRNCPY(clip_header[1].type, CLIP_TYPE_TEXT, 8);
  	    clip_header[1].length = len + 1;
  	    clip_header[1].data   = text_clip;
  
! 	    switch(type)
  	    {
  		default: /* fallthrough to MLINE */
  		case MLINE:	*vim_clip = 'L'; break;
***************
*** 148,161 ****
  #endif
  	    }
  
! 	    vim_strncpy( text_clip, str, len );
  
  	    vim_clip[ 1 ] = NUL;
  
! 	    PhClipboardCopy( PhInputGroup( NULL ), 2, clip_header);
  	}
! 	vim_free( text_clip );
      }
!     vim_free( str );
  }
  #endif
--- 148,161 ----
  #endif
  	    }
  
! 	    vim_strncpy(text_clip, str, len);
  
  	    vim_clip[ 1 ] = NUL;
  
! 	    PhClipboardCopy(PhInputGroup(NULL), 2, clip_header);
  	}
! 	vim_free(text_clip);
      }
!     vim_free(str);
  }
  #endif

Raspunde prin e-mail lui