genericopenlibs/openenvcore/libc/src/string/wcsnlen.c
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 /*
       
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 * Name        : wcsnlen.c
       
    16 * Part of     : MRT
       
    17 * Implementation for wcsnlen API
       
    18 * Version     : 1.0
       
    19 *
       
    20 */
       
    21 
       
    22 
       
    23 
       
    24 #include <wchar.h>
       
    25 
       
    26 //determine the length of a fixed-size wide-character string
       
    27 EXPORT_C size_t wcsnlen(const wchar_t *s, size_t maxlen)
       
    28 {
       
    29         size_t len = 0;
       
    30         while(s[len] != L'\0' && maxlen > 0)
       
    31         {
       
    32                 len++;
       
    33                 maxlen--;
       
    34         }
       
    35         return (len);
       
    36 }
       
    37