~diwic/ubuntu/lucid/pulseaudio/bugfixes

« back to all changes in this revision

Viewing changes to src/pulse/utf8.c

  • Committer: Bazaar Package Importer
  • Author(s): Luke Yelavich
  • Date: 2008-11-04 15:46:00 UTC
  • mfrom: (1.2.1 upstream) (1.1.6 lenny)
  • Revision ID: james.westby@ubuntu.com-20081104154600-hlzknpcazaam0nxm
Tags: 0.9.13-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Don't build against, and create jack package. Jack is not in main.
  - Remove --disable-per-user-esound-socket from configure flags, as we still
    want per user esound sockets.
  - Remove stop links from rc0 and rc6.
  - Change default resample algorithm and bubffer size.
  - Add alsa configuration files to route alsa applications via pulseaudio.
  - Move libasound2-plugins from Recommends to Depends.
* debian/pulseaudio.preinst: When upgrading from intrepid, remove
  /etc/X11/Xsession.d/70pulseaudio, as this was used to minimize a race
  condition when starting GNOME in intrepid. This race should not exist in
  jaunty once libcanberra is built to use pulseaudio as a backend.
* Do not spawn a pulseaudio server if clients fail to find a running server.
* Remove explicit version dependency for libspeex-dev to allow the package
  to be built for now.
* Regenerate autotools files to work with Ubuntu's newer libtool/libltdl.
* debian/control: libpulsecore5 -> libpulsecore8 to match the library
  soname.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: utf8.c 1971 2007-10-28 19:13:50Z lennart $ */
2
 
 
3
1
/***
4
2
  This file is part of PulseAudio.
5
3
 
66
64
 
67
65
#define FILTER_CHAR '_'
68
66
 
69
 
static inline int is_unicode_valid(uint32_t ch) {
 
67
static inline pa_bool_t is_unicode_valid(uint32_t ch) {
70
68
 
71
69
    if (ch >= 0x110000) /* End of unicode space */
72
 
        return 0;
 
70
        return FALSE;
73
71
    if ((ch & 0xFFFFF800) == 0xD800) /* Reserved area for UTF-16 */
74
 
        return 0;
 
72
        return FALSE;
75
73
    if ((ch >= 0xFDD0) && (ch <= 0xFDEF)) /* Reserved */
76
 
        return 0;
 
74
        return FALSE;
77
75
    if ((ch & 0xFFFE) == 0xFFFE) /* BOM (Byte Order Mark) */
78
 
        return 0;
 
76
        return FALSE;
79
77
 
80
 
    return 1;
 
78
    return TRUE;
81
79
}
82
80
 
83
 
static inline int is_continuation_char(uint8_t ch) {
 
81
static inline pa_bool_t is_continuation_char(uint8_t ch) {
84
82
    if ((ch & 0xc0) != 0x80) /* 10xxxxxx */
85
 
        return 0;
86
 
    return 1;
 
83
        return FALSE;
 
84
    return TRUE;
87
85
}
88
86
 
89
87
static inline void merge_continuation_char(uint32_t *u_ch, uint8_t ch) {
111
109
            if ((*p & 0xe0) == 0xc0) { /* 110xxxxx two-char seq. */
112
110
                size = 2;
113
111
                min = 128;
114
 
                val = *p & 0x1e;
 
112
                val = (uint32_t) (*p & 0x1e);
115
113
                goto ONE_REMAINING;
116
114
            } else if ((*p & 0xf0) == 0xe0) { /* 1110xxxx three-char seq.*/
117
115
                size = 3;
118
116
                min = (1 << 11);
119
 
                val = *p & 0x0f;
 
117
                val = (uint32_t) (*p & 0x0f);
120
118
                goto TWO_REMAINING;
121
119
            } else if ((*p & 0xf8) == 0xf0) { /* 11110xxx four-char seq */
122
120
                size = 4;
123
121
                min = (1 << 16);
124
 
                val = *p & 0x07;
 
122
                val = (uint32_t) (*p & 0x07);
125
123
            } else {
126
124
                size = 1;
127
125
                goto error;
151
149
                goto error;
152
150
 
153
151
            if (o) {
154
 
                memcpy(o, last, size);
 
152
                memcpy(o, last, (size_t) size);
155
153
                o += size - 1;
156
154
            }
157
155
 
191
189
    char *new_str;
192
190
 
193
191
    pa_assert(str);
194
 
    new_str = pa_xnew(char, strlen(str) + 1);
 
192
    new_str = pa_xmalloc(strlen(str) + 1);
195
193
    return utf8_validate(str, new_str);
196
194
}
197
195
 
214
212
        return NULL;
215
213
 
216
214
    inlen = len = strlen(str) + 1;
217
 
    new_str = pa_xnew(char, len);
 
215
    new_str = pa_xmalloc(len);
218
216
 
219
217
    for (;;) {
220
218
        inbuf = (ICONV_CONST char*) str; /* Brain dead prototype for iconv() */