intl/icu/source/extra/scrptrun/srtest.cpp

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 /*
     2  * %W% %E%
     3  *
     4  * (C) Copyright IBM Corp. 2001 - All Rights Reserved
     5  *
     6  */
     8 #include "unicode/utypes.h"
     9 #include "unicode/uscript.h"
    11 #include "scrptrun.h"
    13 #include <stdio.h>
    15 UChar testChars[] = {
    16             0x0020, 0x0946, 0x0939, 0x093F, 0x0928, 0x094D, 0x0926, 0x0940, 0x0020,
    17             0x0627, 0x0644, 0x0639, 0x0631, 0x0628, 0x064A, 0x0629, 0x0020,
    18             0x0420, 0x0443, 0x0441, 0x0441, 0x043A, 0x0438, 0x0439, 0x0020,
    19             'E', 'n', 'g', 'l', 'i', 's', 'h',  0x0020,
    20             0x6F22, 0x5B75, 0x3068, 0x3072, 0x3089, 0x304C, 0x306A, 0x3068, 
    21             0x30AB, 0x30BF, 0x30AB, 0x30CA,
    22             0xD801, 0xDC00, 0xD801, 0xDC01, 0xD801, 0xDC02, 0xD801, 0xDC03
    23 };
    25 int32_t testLength = sizeof testChars / sizeof testChars[0];
    27 void main()
    28 {
    29     ScriptRun scriptRun(testChars, 0, testLength);
    31     while (scriptRun.next()) {
    32         int32_t     start = scriptRun.getScriptStart();
    33         int32_t     end   = scriptRun.getScriptEnd();
    34         UScriptCode code  = scriptRun.getScriptCode();
    36         printf("Script '%s' from %d to %d.\n", uscript_getName(code), start, end);
    37     }
    38 }

mercurial