~ubuntu-branches/ubuntu/maverick/openldap/maverick-proposed

« back to all changes in this revision

Viewing changes to libraries/libldap/utf-8-conv.c

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug
  • Date: 2009-09-07 13:41:10 UTC
  • mto: This revision was merged to the branch mainline in revision 19.
  • Revision ID: james.westby@ubuntu.com-20090907134110-jsdrvn0atu1fex4m
Tags: upstream-2.4.18
ImportĀ upstreamĀ versionĀ 2.4.18

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $OpenLDAP: pkg/ldap/libraries/libldap/utf-8-conv.c,v 1.16.2.4 2009/01/22 00:00:56 kurt Exp $ */
 
1
/* $OpenLDAP: pkg/ldap/libraries/libldap/utf-8-conv.c,v 1.16.2.5 2009/08/25 22:58:08 quanah Exp $ */
2
2
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
3
3
 *
4
4
 * Copyright 1998-2009 The OpenLDAP Foundation.
191
191
                        return 4;
192
192
                if( wchar < 0x4000000 ) 
193
193
                        return 5;
194
 
                if( wchar < 0x80000000 )
 
194
#if SIZEOF_WCHAR_T > 4
 
195
                /* UL is not strictly needed by ANSI C */
 
196
                if( wchar < (wchar_t)0x80000000UL )
 
197
#endif /* SIZEOF_WCHAR_T > 4 */
195
198
                        return 6;
196
199
                return -1;
197
200
        }
235
238
                        utf8char[len++] = 0x80 | ( wchar & 0x3f );
236
239
                }
237
240
 
238
 
        } else if( wchar < 0x80000000 ) {
 
241
        } else
 
242
#if SIZEOF_WCHAR_T > 4
 
243
                /* UL is not strictly needed by ANSI C */
 
244
                if( wchar < (wchar_t)0x80000000UL )
 
245
#endif /* SIZEOF_WCHAR_T > 4 */
 
246
        {
239
247
                if (count >= 6) {
240
248
                        utf8char[len++] = 0xfc | ( wchar >> 30 );
241
249
                        utf8char[len++] = 0x80 | ( (wchar >> 24) & 0x3f );
245
253
                        utf8char[len++] = 0x80 | ( wchar & 0x3f );
246
254
                }
247
255
 
248
 
        } else
 
256
#if SIZEOF_WCHAR_T > 4
 
257
        } else {
249
258
                len = -1;
 
259
#endif /* SIZEOF_WCHAR_T > 4 */
 
260
        }
250
261
        
251
262
        return len;
252
263
 
467
478
        return n;       
468
479
}
469
480
 
470
 
#endif
 
481
#endif /* SIZEOF_WCHAR_T >= 4 */