~ubuntu-branches/ubuntu/maverick/wxwidgets2.8/maverick-proposed

« back to all changes in this revision

Viewing changes to src/mac/corefoundation/cfstring.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Devid Filoni
  • Date: 2008-06-30 22:02:17 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20080630220217-vag3tkfp91t0453d
Tags: 2.8.8.0-0ubuntu1
* New upstream version, based on the upstream tarball
  wxPython-src-2.8.8.0.tar.bz2, remove upstream debian dir (LP: #244355).
* Add debian/watch file, LP: #242164.
* Edit get-orig-source target to provide a .orig.tar.gz with the same md5 for
  each .orig.tar.gz generated.
* debian/rules: remove get-orig-source from .PHONY target.
* debian/control.in: add python-wxtools in python-wxgtk=V=U Suggests field.
* Do not apply fix_from_upstream_svn_r52465 patch, not needed.
* Regenerate octave_oct, tcl_tk_tcl patches for the new version.
* Fix spelling-error-in-description lintian warning.
* Fix depends-on-obsolete-package lintian error.
* Fix executable-not-elf-or-script lintian warnings.
* Fix script-not-executable lintian warnings.
* Fix missing-dependency-on-libc lintian error.
* Fix dbg-package-missing-depends lintian warnings.
* Fix package-contains-empty-directory lintian warnings.
* Fix manpage-has-errors-from-man lintian warning.
* Fix image-file-in-usr-lib lintian warnings:
  - add editra_pixmaps patch
  - add xrced_bitmaps patch
* Fix unused-override lintian info.
* Fix malformed-override lintian errors.
* Fix extra-license-file lintian warnings.
* Install upstream wx.pth instead of generated file links (LP: #211553).
* Add editra.png, pyshell.png (encoded using uuencode) icons, LP: #236876:
  - debian/rules: use uudecode to decode .png icons.
* Add a new pyshell.xpm icon.
* Fix doc-base-file-references-missing-file lintian error.
* Fix doc-base-unknown-section lintian warning.
* Fix ruby-script-but-no-ruby-dep lintian errors.
* Fix wish-script-but-no-wish-dep lintian errors.
* Fix missing-dep-for-interpreter errors.
* Bump Standards-Version to 3.8.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
// Author:      Stefan Csomor
5
5
// Modified by:
6
6
// Created:     2004-10-29 (from code in src/mac/carbon/utils.cpp)
7
 
// RCS-ID:      $Id: cfstring.cpp 40283 2006-07-24 18:01:39Z VZ $
 
7
// RCS-ID:      $Id: cfstring.cpp 51658 2008-02-11 15:19:53Z SC $
8
8
// Copyright:   (c) Stefan Csomor
9
9
// Licence:     wxWindows licence
10
10
/////////////////////////////////////////////////////////////////////////////
651
651
            (UniChar*)str.wc_str() , str.Len() );
652
652
#else
653
653
        wxMBConvUTF16 converter ;
654
 
        size_t unicharlen = converter.WC2MB( NULL , str.wc_str() , 0 ) ;
655
 
        UniChar *unibuf = new UniChar[ unicharlen / sizeof(UniChar) + 1 ] ;
656
 
        converter.WC2MB( (char*)unibuf , str.wc_str() , unicharlen ) ;
657
 
        m_cfs = CFStringCreateWithCharacters( kCFAllocatorDefault ,
658
 
            unibuf , unicharlen / sizeof(UniChar) ) ;
659
 
        delete[] unibuf ;
 
654
        size_t unicharbytes = converter.FromWChar( NULL , 0 , str.wc_str() , str.Length() ) ;
 
655
        wxASSERT( unicharbytes != wxCONV_FAILED );
 
656
        if ( unicharbytes == wxCONV_FAILED )
 
657
        {
 
658
            // create an empty string
 
659
            m_cfs = CFSTR("") ;
 
660
            CFRetain( m_cfs ) ;
 
661
        }
 
662
        else
 
663
        {
 
664
            // unicharbytes: number of bytes needed for UTF-16 encoded string (without terminating null)
 
665
            // unichars: number of UTF-16 characters (without terminating null)
 
666
            size_t unichars = unicharbytes /  sizeof(UniChar) ;
 
667
            UniChar *unibuf = new UniChar[ unichars ] ;
 
668
            converter.FromWChar( (char*)unibuf , unicharbytes , str.wc_str() , str.Length() ) ;
 
669
            m_cfs = CFStringCreateWithCharacters( kCFAllocatorDefault , unibuf , unichars ) ;
 
670
            delete[] unibuf ;
 
671
        }
660
672
#endif
661
673
#else // not wxUSE_UNICODE
662
674
        m_cfs = CFStringCreateWithCString( kCFAllocatorSystemDefault , str.c_str() ,