LCOV - code coverage report
Current view: top level - intl/icu/source/i18n - uspoof_build.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 6 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // © 2016 and later: Unicode, Inc. and others.
       2             : // License & terms of use: http://www.unicode.org/copyright.html
       3             : /*
       4             :  ***************************************************************************
       5             :  * Copyright (C) 2008-2015, International Business Machines Corporation
       6             :  * and others. All Rights Reserved.
       7             :  ***************************************************************************
       8             :  *   file name:  uspoof_build.cpp
       9             :  *   encoding:   UTF-8
      10             :  *   tab size:   8 (not used)
      11             :  *   indentation:4
      12             :  *
      13             :  *   created on: 2008 Dec 8
      14             :  *   created by: Andy Heninger
      15             :  *
      16             :  *   Unicode Spoof Detection Data Builder
      17             :  *   Builder-related functions are kept in separate files so that applications not needing
      18             :  *   the builder can more easily exclude them, typically by means of static linking.
      19             :  *
      20             :  *   There are three relatively independent sets of Spoof data,
      21             :  *      Confusables,
      22             :  *      Whole Script Confusables
      23             :  *      ID character extensions.
      24             :  *
      25             :  *   The data tables for each are built separately, each from its own definitions
      26             :  */
      27             : 
      28             : #include "unicode/utypes.h"
      29             : #include "unicode/uspoof.h"
      30             : #include "unicode/unorm.h"
      31             : #include "unicode/uregex.h"
      32             : #include "unicode/ustring.h"
      33             : #include "cmemory.h"
      34             : #include "uspoof_impl.h"
      35             : #include "uhash.h"
      36             : #include "uvector.h"
      37             : #include "uassert.h"
      38             : #include "uarrsort.h"
      39             : #include "uspoof_conf.h"
      40             : 
      41             : #if !UCONFIG_NO_NORMALIZATION
      42             : 
      43             : U_NAMESPACE_USE
      44             : 
      45             : // Defined in uspoof.cpp, initializes file-static variables.
      46             : U_CFUNC void uspoof_internalInitStatics(UErrorCode *status);
      47             : 
      48             : // The main data building function
      49             : 
      50             : U_CAPI USpoofChecker * U_EXPORT2
      51           0 : uspoof_openFromSource(const char *confusables,  int32_t confusablesLen,
      52             :                       const char* /*confusablesWholeScript*/, int32_t /*confusablesWholeScriptLen*/,
      53             :                       int32_t *errorType, UParseError *pe, UErrorCode *status) {
      54           0 :     uspoof_internalInitStatics(status);
      55           0 :     if (U_FAILURE(*status)) {
      56           0 :         return NULL;
      57             :     }
      58             : #if UCONFIG_NO_REGULAR_EXPRESSIONS 
      59           0 :     *status = U_UNSUPPORTED_ERROR;      
      60           0 :     return NULL;
      61             : #else
      62             :     if (errorType!=NULL) {
      63             :         *errorType = 0;
      64             :     }
      65             :     if (pe != NULL) {
      66             :         pe->line = 0;
      67             :         pe->offset = 0;
      68             :         pe->preContext[0] = 0;
      69             :         pe->postContext[0] = 0;
      70             :     }
      71             : 
      72             :     // Set up a shell of a spoof detector, with empty data.
      73             :     SpoofData *newSpoofData = new SpoofData(*status);
      74             :     SpoofImpl *This = new SpoofImpl(newSpoofData, *status);
      75             : 
      76             :     // Compile the binary data from the source (text) format.
      77             :     ConfusabledataBuilder::buildConfusableData(This, confusables, confusablesLen, errorType, pe, *status);
      78             :     
      79             :     if (U_FAILURE(*status)) {
      80             :         delete This;
      81             :         This = NULL;
      82             :     }
      83             :     return (USpoofChecker *)This;
      84             : #endif // UCONFIG_NO_REGULAR_EXPRESSIONS 
      85             : }
      86             : 
      87             : #endif

Generated by: LCOV version 1.13