~ubuntu-branches/ubuntu/utopic/golang/utopic

« back to all changes in this revision

Viewing changes to src/pkg/runtime/rune.c

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2013-08-20 14:06:23 UTC
  • mfrom: (14.1.23 saucy-proposed)
  • Revision ID: package-import@ubuntu.com-20130820140623-b414jfxi3m0qkmrq
Tags: 2:1.1.2-2ubuntu1
* Merge from Debian unstable (LP: #1211749, #1202027). Remaining changes:
  - 016-armhf-elf-header.patch: Use correct ELF header for armhf binaries.
  - d/control,control.cross: Update Breaks/Replaces for Ubuntu
    versions to ensure smooth upgrades, regenerate control file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
        Runeerror       = 0xFFFD,
48
48
        Runeself        = 0x80,
49
49
 
 
50
        SurrogateMin = 0xD800,
 
51
        SurrogateMax = 0xDFFF,
 
52
 
50
53
        Bad     = Runeerror,
51
54
 
52
55
        Runemax = 0x10FFFF,     /* maximum rune value */
128
131
                l = ((((c << Bitx) | c1) << Bitx) | c2) & Rune3;
129
132
                if(l <= Rune2)
130
133
                        goto bad;
 
134
                if (SurrogateMin <= l && l <= SurrogateMax)
 
135
                        goto bad;
131
136
                *rune = l;
132
137
                return 3;
133
138
        }
193
198
        }
194
199
 
195
200
        /*
196
 
         * If the Rune is out of range, convert it to the error rune.
 
201
         * If the Rune is out of range or a surrogate half, convert it to the error rune.
197
202
         * Do this test here because the error rune encodes to three bytes.
198
203
         * Doing it earlier would duplicate work, since an out of range
199
204
         * Rune wouldn't have fit in one or two bytes.
200
205
         */
201
206
        if (c > Runemax)
202
207
                c = Runeerror;
 
208
        if (SurrogateMin <= c && c <= SurrogateMax)
 
209
                c = Runeerror;
203
210
 
204
211
        /*
205
212
         * three character sequence