~ubuntu-branches/ubuntu/utopic/coreutils/utopic-proposed

« back to all changes in this revision

Viewing changes to lib/mbrtowc.c

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2012-11-28 03:03:42 UTC
  • mfrom: (8.3.4 sid)
  • Revision ID: package-import@ubuntu.com-20121128030342-21zanj8354gas5gr
Tags: 8.20-3ubuntu1
* Resynchronise with Debian.  Remaining changes:
  - Make 'uname -i -p' return the real processor/hardware, instead of
    unknown.
  - Build-depend on gettext:any instead of on gettext, so that apt-get can
    properly resolve build-dependencies on the tool when cross-building.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Convert multibyte character to wide character.
2
 
   Copyright (C) 1999-2002, 2005-2011 Free Software Foundation, Inc.
 
2
   Copyright (C) 1999-2002, 2005-2012 Free Software Foundation, Inc.
3
3
   Written by Bruno Haible <bruno@clisp.org>, 2008.
4
4
 
5
5
   This program is free software: you can redistribute it and/or modify
128
128
      {
129
129
        const char *encoding = locale_charset ();
130
130
 
131
 
        if (STREQ (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0))
 
131
        if (STREQ_OPT (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0))
132
132
          {
133
133
            /* Cf. unistr/u8-mblen.c.  */
134
134
            unsigned char c = (unsigned char) p[0];
185
185
        /* As a reference for this code, you can use the GNU libiconv
186
186
           implementation.  Look for uses of the RET_TOOFEW macro.  */
187
187
 
188
 
        if (STREQ (encoding, "EUC-JP", 'E', 'U', 'C', '-', 'J', 'P', 0, 0, 0))
 
188
        if (STREQ_OPT (encoding,
 
189
                       "EUC-JP", 'E', 'U', 'C', '-', 'J', 'P', 0, 0, 0))
189
190
          {
190
191
            if (m == 1)
191
192
              {
208
209
              }
209
210
            goto invalid;
210
211
          }
211
 
        if (STREQ (encoding, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0)
212
 
            || STREQ (encoding, "GB2312", 'G', 'B', '2', '3', '1', '2', 0, 0, 0)
213
 
            || STREQ (encoding, "BIG5", 'B', 'I', 'G', '5', 0, 0, 0, 0, 0))
 
212
        if (STREQ_OPT (encoding,
 
213
                       "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0)
 
214
            || STREQ_OPT (encoding,
 
215
                          "GB2312", 'G', 'B', '2', '3', '1', '2', 0, 0, 0)
 
216
            || STREQ_OPT (encoding,
 
217
                          "BIG5", 'B', 'I', 'G', '5', 0, 0, 0, 0, 0))
214
218
          {
215
219
            if (m == 1)
216
220
              {
221
225
              }
222
226
            goto invalid;
223
227
          }
224
 
        if (STREQ (encoding, "EUC-TW", 'E', 'U', 'C', '-', 'T', 'W', 0, 0, 0))
 
228
        if (STREQ_OPT (encoding,
 
229
                       "EUC-TW", 'E', 'U', 'C', '-', 'T', 'W', 0, 0, 0))
225
230
          {
226
231
            if (m == 1)
227
232
              {
239
244
              }
240
245
            goto invalid;
241
246
          }
242
 
        if (STREQ (encoding, "GB18030", 'G', 'B', '1', '8', '0', '3', '0', 0, 0))
 
247
        if (STREQ_OPT (encoding,
 
248
                       "GB18030", 'G', 'B', '1', '8', '0', '3', '0', 0, 0))
243
249
          {
244
250
            if (m == 1)
245
251
              {
272
278
              }
273
279
            goto invalid;
274
280
          }
275
 
        if (STREQ (encoding, "SJIS", 'S', 'J', 'I', 'S', 0, 0, 0, 0, 0))
 
281
        if (STREQ_OPT (encoding, "SJIS", 'S', 'J', 'I', 'S', 0, 0, 0, 0, 0))
276
282
          {
277
283
            if (m == 1)
278
284
              {