LCOV - code coverage report
Current view: top level - ipc/chromium/src/base - string16.cc (source / functions) Hit Total Coverage
Test: output.info Lines: 0 28 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 6 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
       3             : // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
       4             : // Use of this source code is governed by a BSD-style license that can be
       5             : // found in the LICENSE file.
       6             : 
       7             : #include "base/string16.h"
       8             : 
       9             : #if defined(WCHAR_T_IS_UTF16)
      10             : 
      11             : #error This file should not be used on 2-byte wchar_t systems
      12             : // If this winds up being needed on 2-byte wchar_t systems, either the
      13             : // definitions below can be used, or the host system's wide character
      14             : // functions like wmemcmp can be wrapped.
      15             : 
      16             : #elif defined(WCHAR_T_IS_UTF32)
      17             : 
      18             : #include "base/string_util.h"
      19             : 
      20             : namespace base {
      21             : 
      22           0 : int c16memcmp(const char16* s1, const char16* s2, size_t n) {
      23             :   // We cannot call memcmp because that changes the semantics.
      24           0 :   while (n-- > 0) {
      25           0 :     if (*s1 != *s2) {
      26             :       // We cannot use (*s1 - *s2) because char16 is unsigned.
      27           0 :       return ((*s1 < *s2) ? -1 : 1);
      28             :     }
      29           0 :     ++s1;
      30           0 :     ++s2;
      31             :   }
      32           0 :   return 0;
      33             : }
      34             : 
      35           0 : size_t c16len(const char16* s) {
      36           0 :   const char16 *s_orig = s;
      37           0 :   while (*s) {
      38           0 :     ++s;
      39             :   }
      40           0 :   return s - s_orig;
      41             : }
      42             : 
      43           0 : const char16* c16memchr(const char16* s, char16 c, size_t n) {
      44           0 :   while (n-- > 0) {
      45           0 :     if (*s == c) {
      46           0 :       return s;
      47             :     }
      48           0 :     ++s;
      49             :   }
      50           0 :   return 0;
      51             : }
      52             : 
      53           0 : char16* c16memmove(char16* s1, const char16* s2, size_t n) {
      54           0 :   return reinterpret_cast<char16*>(memmove(s1, s2, n * sizeof(char16)));
      55             : }
      56             : 
      57           0 : char16* c16memcpy(char16* s1, const char16* s2, size_t n) {
      58           0 :   return reinterpret_cast<char16*>(memcpy(s1, s2, n * sizeof(char16)));
      59             : }
      60             : 
      61           0 : char16* c16memset(char16* s, char16 c, size_t n) {
      62           0 :   char16 *s_orig = s;
      63           0 :   while (n-- > 0) {
      64           0 :     *s = c;
      65           0 :     ++s;
      66             :   }
      67           0 :   return s_orig;
      68             : }
      69             : 
      70             : }  // namespace base
      71             : 
      72             : template class std::basic_string<char16, base::string16_char_traits>;
      73             : 
      74             : #endif  // WCHAR_T_IS_UTF32

Generated by: LCOV version 1.13