bump :)

On Mon, Oct 27, 2014 at 4:51 PM, Olivier Tristan <
o.tris...@ultimatesoundbank.com> wrote:

> Hi Guys,
>
> Please find enclosed a patch to support UTF8 device name on OSX (Japanese
> one in my case)
>
> I removed as well the deprecated old code between ifdef, feel free to put
> those back if needed
>
> Please let me know if you need further informations
>
> Regards,
>
> Index: pm_mac/pmmacosxcm.c
> ===================================================================
> --- pm_mac/pmmacosxcm.c (revision 228)
> +++ pm_mac/pmmacosxcm.c (working copy)
> @@ -836,47 +836,18 @@
>
>  char* cm_get_full_endpoint_name(MIDIEndpointRef endpoint)
>  {
> -#ifdef OLDCODE
> -    MIDIEntityRef entity;
> -    MIDIDeviceRef device;
> -
> -    CFStringRef endpointName = NULL;
> -    CFStringRef deviceName = NULL;
> -#endif
>      CFStringRef fullName = NULL;
> -    CFStringEncoding defaultEncoding;
>      char* newName;
> +    int size;
>
> -    /* get the default string encoding */
> -    defaultEncoding = CFStringGetSystemEncoding();
> -
>      fullName = ConnectedEndpointName(endpoint);
> -
> -#ifdef OLDCODE
> -    /* get the entity and device info */
> -    MIDIEndpointGetEntity(endpoint, &entity);
> -    MIDIEntityGetDevice(entity, &device);
> -
> -    /* create the nicely formated name */
> -    MIDIObjectGetStringProperty(endpoint, kMIDIPropertyName,
> &endpointName);
> -    MIDIObjectGetStringProperty(device, kMIDIPropertyName, &deviceName);
> -    if (deviceName != NULL) {
> -        fullName = CFStringCreateWithFormat(NULL, NULL, CFSTR("%@: %@"),
> -                                            deviceName, endpointName);
> -    } else {
> -        fullName = endpointName;
> -    }
> -#endif
> +    size = CFStringGetMaximumSizeForEncoding(CFStringGetLength(fullName),
> kCFStringEncodingUTF8);;
>      /* copy the string into our buffer */
> -    newName = (char *) malloc(CFStringGetLength(fullName) + 1);
> -    CFStringGetCString(fullName, newName, CFStringGetLength(fullName) + 1,
> -                       defaultEncoding);
> +    newName = (char *) malloc(size + 1);
> +    CFStringGetCString(fullName, newName, size + 1,
> +                       kCFStringEncodingUTF8);
>
>      /* clean up */
> -#ifdef OLDCODE
> -    if (endpointName) CFRelease(endpointName);
> -    if (deviceName) CFRelease(deviceName);
> -#endif
>      if (fullName) CFRelease(fullName);
>
>      return newName;
>
>
> --
> Olivier TRISTAN
> uvi.net
>
>


-- 
[image: UVI] <http://www.uvi.net/>
 Olivier Tristan | Research & Development
o.tris...@ultimatesoundbank.com

 [image: Facebook] <http://www.facebook.com/UVI.Official> [image: Twitter]
<http://twitter.com/UVIofficial> [image: Youtube]
<http://www.youtube.com/user/UVIofficial> [image: SoundCloud]
<http://soundcloud.com/uvi-official> [image: Blog UVI]
<http://blog.uvi.net/>
_______________________________________________
media_api mailing list
media_api@create.ucsb.edu
http://lists.create.ucsb.edu/mailman/listinfo/media_api

Reply via email to