<!DOCTYPE html>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="description" content="API docs for the toStringDeep method from the PhotoFilter class, for the Dart programming language.">
  <title>toStringDeep method - PhotoFilter class - photo_filter library - Dart API</title>

  <base href="../..">

  <link href="https://fonts.googleapis.com/css?family=Source+Code+Pro:500,400i,400,300|Source+Sans+Pro:400,300,700" rel="stylesheet">
  <link rel="stylesheet" href="static-assets/github.css">
  <link rel="stylesheet" href="static-assets/styles.css">
  <link rel="icon" href="static-assets/favicon.png">

  <button id="sidenav-left-toggle" type="button"> </button>

photofilters

photo_filter

PhotoFilter

toStringDeep method

toStringDeep

  <form class="search navbar-right" role="search">
    <input type="text" id="search-box" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
  </form>

PhotoFilter class

Constructors

PhotoFilter

        Properties

filename

filter

fit

image

loader

hashCode

key

runtimeType

Methods

build

createElement

debugDescribeChildren

debugFillProperties

noSuchMethod

toDiagnosticsNode

toString

toStringDeep

toStringShallow

toStringShort

Operators

operator ==

toStringDeep method

      String
      toStringDeep
(<wbr>{String prefixLineOne: '',  String prefixOtherLines,  DiagnosticLevel minLevel: DiagnosticLevel.debug })

Returns a string representation of this node and its descendants.

prefixLineOne will be added to the front of the first line of the
output. prefixOtherLines will be added to the front of each other line.
If prefixOtherLines is null, the prefixLineOne is used for every line.
By default, there is no prefix.

minLevel specifies the minimum DiagnosticLevel for properties included
in the output.

The toStringDeep method takes other arguments, but those are intended
for internal use when recursing to the descendants, and so can be ignored.

See also:

toString, for a brief description of the object but not its children.

toStringShallow, for a detailed description of the object but not its
children.

Implementation

String toStringDeep({
  String prefixLineOne = '',
  String prefixOtherLines,
  DiagnosticLevel minLevel = DiagnosticLevel.debug,
}) {
  return toDiagnosticsNode().toStringDeep(prefixLineOne: prefixLineOne, prefixOtherLines: prefixOtherLines, minLevel: minLevel);
}

    photofilters 0.0.1

{'repo_name': 'skkallayath/photofilters', 'stars': '164', 'repo_language': 'Dart', 'file_name': 'runtimeType.html', 'mime_type': 'text/html', 'hash': 1408163886264917673, 'source_dataset': 'data'}


<?php

/*
 * This file is part of Twig.
 *
 * (c) Fabien Potencier
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Twig\Extra\Intl\Tests;

use PHPUnit\Framework\TestCase;
use Twig\Extra\Intl\IntlExtension;

class IntlExtensionTest extends TestCase
{
    public function testFormatterProto()
    {
        $dateFormatterProto = new \IntlDateFormatter('fr', \IntlDateFormatter::FULL, \IntlDateFormatter::FULL);
        $numberFormatterProto = new \NumberFormatter('fr', \NumberFormatter::DECIMAL);
        $numberFormatterProto->setTextAttribute(\NumberFormatter::POSITIVE_PREFIX, '++');
        $numberFormatterProto->setAttribute(\NumberFormatter::FRACTION_DIGITS, 1);
        $ext = new IntlExtension($dateFormatterProto, $numberFormatterProto);
        $this->assertSame('++12,3', $ext->formatNumber('12.3456'));
    }
}

{'repo_name': 'twigphp/Twig', 'stars': '6867', 'repo_language': 'PHP', 'file_name': 'timezone_name.test', 'mime_type': 'text/plain', 'hash': 3351126578403386089, 'source_dataset': 'data'}


/**
 * A React component to view a PDF document
 *
 * @see https://react-pdf-viewer.dev
 * @license https://react-pdf-viewer.dev/license
 * @copyright 2019-2020 Nguyen Huu Phuoc <me@phuoc.ng>
 */

import React from 'react';
import { Store } from '@react-pdf-viewer/core';

import PrintButton from './PrintButton';
import PrintStatus from './PrintStatus';
import StoreProps from './StoreProps';

export interface RenderPrintProps {
    onClick: () => void;
}

type RenderPrint = (props: RenderPrintProps) => React.ReactElement;

export interface PrintProps {
    children?: RenderPrint;
}

const Print: React.FC<{
    children?: RenderPrint,
    store: Store<StoreProps>,
}> = ({ children, store }) => {
    const print = () => {
        store.update('printStatus', PrintStatus.Preparing);
    };

    const defaultChildern = (props: RenderPrintProps) => <PrintButton onClick={props.onClick} />;
    const render = children || defaultChildern;

    return render({
        onClick: print,
    });
};

export default Print;

{'repo_name': 'phuoc-ng/react-pdf-viewer', 'stars': '294', 'repo_language': 'TypeScript', 'file_name': 'index.js', 'mime_type': 'text/plain', 'hash': 1150763741646985372, 'source_dataset': 'data'}


class PluginAttributesDirective {
  constructor() {
    'ngInject';

    let directive = {
      restrict: 'A',
      scope: {
        pluginAttributes: '='
      },
      controller: PluginAttributesController,
      controllerAs: 'attributes',
      bindToController: true
    };

    return directive;
  }
}

class PluginAttributesController {
  constructor($element) {
    'ngInject';
    if (this.pluginAttributes) {
      this.pluginAttributes.forEach((attribute) => {
        let key = Object.keys(attribute)[0];
        $element.attr(key, attribute[key]);
      });
    }
  }
}

export default PluginAttributesDirective;

{'repo_name': 'volumio/Volumio2-UI', 'stars': '109', 'repo_language': 'JavaScript', 'file_name': 'main.po.js', 'mime_type': 'text/plain', 'hash': -2212980176815116631, 'source_dataset': 'data'}


/***************************************************************************
 *             __________               __   ___.
 *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
 *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
 *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
 *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
 *                     \/            \/     \/    \/            \/
 * $Id$
 *
 * Copyright (C) 2002 Daniel Stenberg
 * Copyright (C) 2014 Michael Sevakis
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
 * KIND, either express or implied.
 *
 ****************************************************************************/
#define RB_FILESYSTEM_OS
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <time.h>
#include <errno.h>
#include <limits.h>
#include "config.h"
#include "system.h"
#include "file.h"
#include "dir.h"
#include "file_internal.h"
#include "pathfuncs.h"
#include "string-extra.h"
#include "debug.h"

#ifndef os_fstatat
#define USE_OSDIRNAME /* we need to remember the open directory path */
#endif

extern const char *sim_root_dir;

/* Windows (and potentially other OSes) distinguish binary and text files.
 * Define a dummy for the others. */
#ifndef O_BINARY
#define O_BINARY 0
#endif

struct filestr_desc
{
    int  osfd;              /* The host OS file descriptor */
    bool mounted;           /* Is host volume still mounted? */
#ifdef HAVE_MULTIVOLUME
    int  volume;            /* The virtual volume number */
#endif
} openfiles[MAX_OPEN_FILES] =
{
    [0 ... MAX_OPEN_FILES-1] = { .osfd = -1 }
};

static struct filestr_desc * alloc_filestr(int *fildesp)
{
    for (unsigned int i = 0; i < MAX_OPEN_FILES; i++)
    {
        struct filestr_desc *filestr = &openfiles[i];
        if (filestr->osfd < 0)
        {
            *fildesp = i;
            return filestr;
        }
    }

    return NULL;
}

static struct filestr_desc * get_filestr(int fildes)
{
    struct filestr_desc *filestr = &openfiles[fildes];

    if ((unsigned int)fildes >= MAX_OPEN_FILES || filestr->osfd < 0)
        filestr = NULL;
    else if (filestr->mounted)
        return filestr;

    errno = filestr ? ENXIO : EBADF;
    DEBUGF("fildes %d: %s\n", fildes, strerror(errno));
    return NULL;
}

struct dirstr_desc
{
    int               osfd;          /* Host OS directory file descriptor */
    bool              osfd_opened;   /* Host fd is another open file */
    OS_DIR_T          *osdirp;       /* Host OS directory stream */
#ifdef USE_OSDIRNAME
    char              *osdirname;    /* Host OS directory path */
#endif
    struct sim_dirent entry;         /* Rockbox directory entry */
#ifdef HAVE_MULTIVOLUME
    int               volume;        /* Virtual volume number */
    int               volumecounter; /* Counter for root volume entries */
#endif
    bool              mounted;       /* Is the virtual volume still mounted? */
} opendirs[MAX_OPEN_DIRS];

static struct dirstr_desc * alloc_dirstr(void)
{
    for (unsigned int i = 0; i < MAX_OPEN_DIRS; i++)
    {
        struct dirstr_desc *dirstr = &opendirs[i];
        if (dirstr->osdirp == NULL)
            return dirstr;
    }

    return NULL;
}

static struct dirstr_desc * get_dirstr(DIR *dirp)
{
    struct dirstr_desc *dirstr = (struct dirstr_desc *)dirp;

    if (!PTR_IN_ARRAY(opendirs, dirstr, MAX_OPEN_DIRS) || !dirstr->osdirp)
        dirstr = NULL;
    else if (dirstr->mounted)
        return dirstr;

    errno = dirstr ? ENXIO : EBADF;
    DEBUGF("dir #%d: %s\n", (int)(dirstr - opendirs), strerror(errno));
    return NULL;
}

static int close_dirstr(struct dirstr_desc *dirstr)
{
    OS_DIR_T *osdirp = dirstr->osdirp;

    dirstr->mounted = false;

#ifdef USE_OSDIRNAME
    free(dirstr->osdirname);
#endif
    if (dirstr->osfd_opened)
    {
        os_close(dirstr->osfd);
        dirstr->osfd_opened = false;
    }

    int rc = os_closedir(osdirp);
    dirstr->osdirp = NULL;

    return rc;
}

#ifdef HAVE_MULTIVOLUME
static int readdir_volume_inner(struct dirstr_desc *dirstr,
                                struct sim_dirent *entry)
{
    /* Volumes (secondary file systems) get inserted into the system root
     * directory. If the path specified volume 0, enumeration will not
     * include other volumes, but just its own files and directories.
     *
     * Fake special directories, which don't really exist, that will get
     * redirected upon opendir()
     */
    while (++dirstr->volumecounter < NUM_VOLUMES)
    {
        /* on the system root */
        if (!volume_present(dirstr->volumecounter))
            continue;

        get_volume_name(dirstr->volumecounter, entry->d_name);
        return 1;
    }

    /* do normal directory entry fetching */
    return 0;
}
#endif /* HAVE_MULTIVOLUME */

static inline int readdir_volume(struct dirstr_desc *dirstr,
                                 struct sim_dirent *entry)
{
#ifdef HAVE_MULTIVOLUME
    if (dirstr->volumecounter < NUM_VOLUMES)
        return readdir_volume_inner(dirstr, entry);
#endif /* HAVE_MULTIVOLUME */

    /* do normal directory entry fetching */
    return 0;
    (void)dirstr; (void)entry;
}

/** Internal functions **/

#ifdef HAVE_MULTIDRIVE
/**
 * Handle drive extraction by pretending the files' volumes no longer exist
 * and invalidating their I/O for the remainder of their lifetimes as would
 * happen on a native target
 */
void sim_ext_extracted(int drive)
{
    for (unsigned int i = 0; i < MAX_OPEN_FILES; i++)
    {
        struct filestr_desc *filestr = &openfiles[i];
        if (filestr->osfd >= 0 && volume_drive(filestr->volume) == drive)
            filestr->mounted = false;
    }

    for (unsigned int i = 0; i < MAX_OPEN_DIRS; i++)
    {
        struct dirstr_desc *dirstr = &opendirs[i];
        if (dirstr->osdirp && volume_drive(dirstr->volume) == drive)
            dirstr->mounted = false;
    }

    (void)drive;
}
#endif /* HAVE_MULTIDRIVE */

/**
 * Provides target-like path parsing behavior with single and multiple volumes
 * while performing minimal transforming of the input.
 *
 * Paths are sandboxed to the simulated namespace:
 *   e.g. "{simdir}/foo/../../../../bar" becomes "{simdir}/foo/../bar"
 */
int sim_get_os_path(char *buffer, const char *path, size_t bufsize)
{
    #define ADVBUF(amt) \
        ({ buffer += (amt); bufsize -= (amt); })

    #define PPP_SHOWPATHS 0

    if (!path_is_absolute(path))
    {
        DEBUGF("ERROR: path is not absolute: \"%s\"\n", path);
        errno = ENOENT;
        return -1;
    }

#if PPP_SHOWPATHS
    const char *const buffer0 = buffer;
    DEBUGF("PPP (pre): \"%s\"\n", path);
#endif

    /* Prepend sim root */
    size_t size = strlcpy(buffer, sim_root_dir, bufsize);
    if (size >= bufsize)
    {
        errno = ENAMETOOLONG;
        return -1;
    }
    ADVBUF(size);

#ifdef HAVE_MULTIVOLUME
    /* Track the last valid volume spec encountered */
    int volume = -1;
    bool sysroot = true;

    /* Basename of sim dir to switch back to simdisk from ext */
    #define DIRBASE_FMT  ".." PATH_SEPSTR "%s"
    ssize_t dirbase_len = 0;
    char dirbase[size + 3 + 1];

    /* Basename of ext directory to switch to alternate volume */
    #define SIMEXT_FMT   ".." PATH_SEPSTR "simext%d"
    char extbuf[sizeof (SIMEXT_FMT) + 20 + 1];
#endif /* HAVE_MULTIVOLUME */

    int level = 0;
    bool done = false;
    while (!done)
    {
        const char *p;
        ssize_t len = parse_path_component(&path, &p);

        switch (len)
        {
        case 0:
            done = true;
            if (path[-1] != PATH_SEPCH)
                continue;

            /* Path ends with a separator; preserve that */
            p = &path[-1];
            len = 1;
            break;

        case 1:
        case 2:
            if (p[0] == '.')
            {
                if (len == 1)
                    break;

                if (p[1] == '.')
                    goto is_dot_dot;
            }

        default:
            level++;

        #ifdef HAVE_MULTIVOLUME
            if (level != 1)
                break; /* Volume spec only valid @ root level */

            const char *next;
            volume = path_strip_volume(p, &next, true);

            if (next > p)
            {
            #ifdef HAVE_MULTIDRIVE
                /* Feign failure if the volume isn't "mounted" */
                if (!volume_present(volume))
                {
                    errno = ENXIO;
                    return -1;
                }
            #endif /* HAVE_MULTIDRIVE */

                sysroot = false;

                if (volume == 0)
                    continue;

                p = extbuf;
                len = snprintf(extbuf, sizeof (extbuf), SIMEXT_FMT, volume);
            }
        #endif /* HAVE_MULTIVOLUME */
            break;

        is_dot_dot:
            if (level <= 0)
                continue; /* Can't go above root; erase */

            level--;

        #ifdef HAVE_MULTIVOLUME
            if (level == 0)
            {
                int v = volume;
                bool sr = sysroot;
                volume = -1;
                sysroot = true;

                if (v <= 0)
                {
                    if (sr)
                        break;

                    continue;
                }

                /* Going up from a volume root and back down to the sys root */
                if (dirbase_len == 0)
                {
                    /* Get the main simdisk directory so it can be reentered */
                    char tmpbuf[sizeof (dirbase)];
                #ifdef WIN32
                    path_correct_separators(tmpbuf, sim_root_dir);
                    path_strip_drive(tmpbuf, &p, false);
                #else
                    p = tmpbuf;
                    strcpy(tmpbuf, sim_root_dir);
                #endif
                    size = path_basename(p, &p);
                    ((char *)p)[size] = '\0';

                    if (size == 0 || is_dotdir_name(p))
                    {
                        /* This is nonsense and won't work */
                        DEBUGF("ERROR: sim root dir basname is dotdir or"
                               " empty: \"%s\"\n", sim_root_dir);
                        errno = ENOENT;
                        return -1;
                    }

                    dirbase_len = snprintf(dirbase, sizeof (dirbase),
                                           DIRBASE_FMT, p);
                }

                p = dirbase;
                len = dirbase_len;
                break;
            }
        #endif /* HAVE_MULTIVOLUME */
            break;
        } /* end switch */

        char compname[len + 1];
        strmemcpy(compname, p, len);

        size = path_append(buffer, PA_SEP_HARD, compname, bufsize);
        if (size >= bufsize)
        {
            errno = ENAMETOOLONG;
            return -1;
        }
        ADVBUF(size);
    }

#if PPP_SHOWPATHS
    DEBUGF("PPP (post): \"%s\"" IF_MV(" vol:%d") "\n",
           buffer0 IF_MV(, volume));
#endif

    return IF_MV(volume) +1;
}

/** File functions **/

int sim_open(const char *path, int oflag, ...)
{
    int fildes;
    struct filestr_desc *filestr = alloc_filestr(&fildes);
    if (!filestr)
    {
        errno = EMFILE;
        return -1;
    }

    char ospath[SIM_TMPBUF_MAX_PATH];
    int pprc = sim_get_os_path(ospath, path, sizeof (ospath));
    if (pprc < 0)
        return -2;

    filestr->osfd = os_open(ospath, oflag | O_BINARY __OPEN_MODE_ARG);
    if (filestr->osfd < 0)
        return -3;

#ifdef HAVE_MULTIVOLUME
    filestr->volume  = MAX(pprc - 1, 0);
#endif
    filestr->mounted = true;
    return fildes;
}

int sim_creat(const char *path, mode_t mode)
{
    return sim_open(path, O_WRONLY|O_CREAT|O_TRUNC, mode);
}

int sim_close(int fildes)
{
    struct filestr_desc *filestr = &openfiles[fildes];
    if ((unsigned int)fildes >= MAX_OPEN_FILES || filestr->osfd < 0)
    {
        errno = EBADF;
        return -1;
    }

    int osfd = filestr->osfd;
    filestr->osfd = -1;
    return os_close(osfd);
}

int sim_ftruncate(int fildes, off_t length)
{
    struct filestr_desc *filestr = get_filestr(fildes);
    if (!filestr)
        return -1;

    off_t size = os_filesize(filestr->osfd);
    if (size < 0)
        return -1;

    if (length >= size)
        return 0;

    int rc = os_ftruncate(filestr->osfd, length);

#ifdef HAVE_DIRCACHE
    if (rc >= 0)
        dircache_ftruncate(xxxxxx);
#endif

    return rc;
}

int sim_fsync(int fildes)
{
    struct filestr_desc *filestr = get_filestr(fildes);
    if (!filestr)
        return -1;

    int rc = os_fsync(filestr->osfd);

#ifdef HAVE_DIRCACHE
    if (rc >= 0)
        dircache_fsync(xxxxxx);
#endif

    return rc;
}

off_t sim_lseek(int fildes, off_t offset, int whence)
{
    struct filestr_desc *filestr = get_filestr(fildes);
    if (!filestr)
        return -1;

    return os_lseek(filestr->osfd, offset, whence);
}

ssize_t sim_read(int fildes, void *buf, size_t nbyte)
{
    struct filestr_desc *filestr = get_filestr(fildes);
    if (!filestr)
        return -1;

    return os_read(filestr->osfd, buf, nbyte);
}

ssize_t sim_write(int fildes, const void *buf, size_t nbyte)
{
    struct filestr_desc *filestr = get_filestr(fildes);
    if (!filestr)
        return -1;

    return os_write(filestr->osfd, buf, nbyte);
}

int sim_remove(const char *path)
{
    char ospath[SIM_TMPBUF_MAX_PATH];
    if (sim_get_os_path(ospath, path, sizeof (ospath)) < 0)
        return -1;

    int rc = os_remove(ospath);

#ifdef HAVE_DIRCACHE
    if (rc >= 0)
        dircache_remove(xxxxxx);
#endif

    return rc;
}

int sim_rename(const char *old, const char *new)
{
    char osold[SIM_TMPBUF_MAX_PATH];
    int pprc1 = sim_get_os_path(osold, old, sizeof (osold));
    if (pprc1 < 0)
        return -1;

    char osnew[SIM_TMPBUF_MAX_PATH];
    int pprc2 = sim_get_os_path(osnew, new, sizeof (osnew));
    if (pprc2 < 0)
        return -1;

    if (MAX(pprc1 - 1, 0) != MAX(pprc2 - 1, 0))
    {
        /* Pretend they're different devices */
        errno = EXDEV;
        return -1;
    }

    int rc = os_rename(osold, osnew);

#ifdef HAVE_DIRCACHE
    if (rc >= 0)
        dircache_rename(xxxxxx);
#endif

    return rc;
}

off_t sim_filesize(int fildes)
{
    struct filestr_desc *filestr = get_filestr(fildes);
    if (!filestr)
        return -1;

    return os_filesize(filestr->osfd);
}

int sim_fsamefile(int fildes1, int fildes2)
{
    struct filestr_desc *filestr1 = get_filestr(fildes1);
    if (!filestr1)
        return -1;

    struct filestr_desc *filestr2 = get_filestr(fildes2);
    if (!filestr2)
        return -1;

    if (filestr1 == filestr2)
        return 1;

    return os_fsamefile(filestr1->osfd, filestr2->osfd);
}

int sim_relate(const char *path1, const char *path2)
{
    char ospath1[SIM_TMPBUF_MAX_PATH];
    if (sim_get_os_path(ospath1, path1, sizeof (ospath1)) < 0)
        return -1;

    char ospath2[SIM_TMPBUF_MAX_PATH];
    if (sim_get_os_path(ospath2, path2, sizeof (ospath2)) < 0)
        return -1;

    return os_relate(ospath1, ospath2);
}

bool sim_file_exists(const char *path)
{
    char ospath[SIM_TMPBUF_MAX_PATH];
    if (sim_get_os_path(ospath, path, sizeof (ospath)) < 0)
        return false;

    return os_file_exists(ospath);
}

/** Directory functions **/
DIR * sim_opendir(const char *dirname)
{
    struct dirstr_desc *dirstr = alloc_dirstr();
    if (!dirstr)
    {
        errno = EMFILE;
        return NULL;
    }

    char osdirname[SIM_TMPBUF_MAX_PATH];
    int pprc = sim_get_os_path(osdirname, dirname, sizeof (osdirname));
    if (pprc < 0)
        return NULL;

    int rc = os_opendir_and_fd(osdirname, &dirstr->osdirp, &dirstr->osfd);
    if (rc < 0)
        return NULL;

    dirstr->osfd_opened = rc > 0;

#ifdef USE_OSDIRNAME
    dirstr->osdirname = strdup(osdirname);
    if (!dirstr->osdirname)
    {
        close_dirstr(dirstr);
        return NULL;
    }
#endif

    dirstr->entry.d_name[0] = 0; /* Mark as invalid */
#ifdef HAVE_MULTIVOLUME
    dirstr->volume = MAX(pprc - 1, 0);
    dirstr->volumecounter = pprc == 0 ? 0 : INT_MAX;
#endif
    dirstr->mounted = true;
    return (DIR *)dirstr; /* A-Okay */
}

int sim_closedir(DIR *dirp)
{
    struct dirstr_desc *dirstr = (struct dirstr_desc *)dirp;
    if (!PTR_IN_ARRAY(opendirs, dirstr, MAX_OPEN_DIRS) || !dirstr->osdirp)
    {
        errno = EBADF;
        return -1;
    }

    return close_dirstr(dirstr);
}

struct sim_dirent * sim_readdir(DIR *dirp)
{
    struct dirstr_desc *dirstr = get_dirstr(dirp);
    if (!dirstr)
        return NULL;

    struct sim_dirent *entry = &dirstr->entry;
    entry->info.osdirent = NULL;

    if (readdir_volume(dirstr, entry))
        return entry;

    OS_DIRENT_T *osdirent = os_readdir(dirstr->osdirp);
    if (!osdirent)
        return NULL;

    size_t size = sizeof (entry->d_name);
    if (strlcpy_from_os(entry->d_name, osdirent->d_name, size) >= size)
        FILE_ERROR_RETURN(ENAMETOOLONG, NULL);

    entry->info.osdirent = osdirent;
    return entry;
}

int sim_mkdir(const char *path)
{
    char ospath[SIM_TMPBUF_MAX_PATH];
    if (sim_get_os_path(ospath, path, sizeof (ospath)) < 0)
        return -1;

    int rc = os_mkdir(ospath __MKDIR_MODE_ARG);

#ifdef HAVE_DIRCACHE
    if (rc >= 0)
        dircache_mkdir(xxxxxx);
#endif

    return rc;
}

int sim_rmdir(const char *path)
{
    char ospath[SIM_TMPBUF_MAX_PATH];
    if (sim_get_os_path(ospath, path, sizeof (ospath)) < 0)
        return -1;

    int rc = os_rmdir(ospath);

#ifdef HAVE_DIRCACHE
    if (rc >= 0)
        dircache_rmdir(xxxxxx);
#endif

    return rc;
}

int sim_samedir(DIR *dirp1, DIR *dirp2)
{
    struct dirstr_desc *dirstr1 = get_dirstr(dirp1);
    if (!dirstr1)
        return -1;

    struct dirstr_desc *dirstr2 = get_dirstr(dirp2);
    if (!dirstr2)
        return -1;

    return os_fsamefile(dirstr1->osfd, dirstr2->osfd);
}

bool sim_dir_exists(const char *dirname)
{
    char osdirname[SIM_TMPBUF_MAX_PATH];
    if (sim_get_os_path(osdirname, dirname, sizeof (osdirname)) < 0)
        return false;

    OS_DIR_T *dirp = os_opendir(osdirname);
    if (!dirp)
        return false;

    os_closedir(dirp);
    return true;
}

struct dirinfo dir_get_info(DIR *dirp, struct sim_dirent *entry)
{
    int rc;
    struct dirstr_desc *dirstr = get_dirstr(dirp);
    if (!dirstr)
        FILE_ERROR(ERRNO, RC);

    if (entry->d_name[0] == 0)
        FILE_ERROR(ENOENT, RC);

    OS_DIRENT_T *osdirent = entry->info.osdirent;
    if (osdirent == NULL)
        return (struct dirinfo){ .attribute = ATTR_MOUNT_POINT };

    struct dirinfo info;
    info.attribute = 0;

    OS_STAT_T s;

#ifdef os_fstatat
    if (os_fstatat(dirstr->osfd, entry->d_name, &s, 0))
#else /* no fstatat; build file name for stat() */
    char statpath[SIM_TMPBUF_MAX_PATH];
    if (path_append(statpath, dirstr->osdirname, entry->d_name,
                    sizeof (statpath)) >= sizeof (statpath))
    {
        FILE_ERROR(ENAMETOOLONG, RC);
    }

    if (os_stat(statpath, &s)) /* get info */
#endif /* os_fstatat */
    {
        /* File size larger than 2 GB? */
    #ifdef EOVERFLOW
        if (errno == EOVERFLOW)
            DEBUGF("stat overflow for \"%s\"\n", entry->d_name);
    #endif
        FILE_ERROR(ERRNO, RC);
    }

    if (S_ISDIR(s.st_mode))
        info.attribute |= ATTR_DIRECTORY;

    info.size = s.st_size;

    struct tm tm;
    if (localtime_r(&s.st_mtime, &tm) == NULL)
        FILE_ERROR(ERRNO, RC);

    info.mtime = mktime(&tm);

    return info;

file_error:
    return (struct dirinfo){ .size = 0 };
}

int os_volume_path(IF_MV(int volume, ) char *buffer, size_t bufsize)
{
    if (!buffer || !bufsize IF_MV( || !volume_present(volume) ))
        return -1;

    char tmpbuf[SIM_TMPBUF_MAX_PATH];
    tmpbuf[0] = '\0';

#ifdef HAVE_MULTIVOLUME
    char volname[VOL_MAX_LEN + 1];
    get_volume_name(volume, volname);

    if (path_append(tmpbuf, PA_SEP_HARD, volname, sizeof (volname))
            >= sizeof (volname))
        return -1;
#endif /* HAVE_MULTIVOLUME */

    if (path_append(tmpbuf, PA_SEP_HARD, ".", sizeof (tmpbuf))
        >= sizeof (tmpbuf))
        return -1;

    return sim_get_os_path(buffer, tmpbuf, bufsize);
}

{'repo_name': 'Rockbox/rockbox', 'stars': '286', 'repo_language': 'C', 'file_name': 'rockbox.desktop', 'mime_type': 'text/plain', 'hash': -1270490515286361252, 'source_dataset': 'data'}


\documentclass{minimal}

% Tikz
\usepackage{pgf}
\usepackage{tikz}

\begin{document}

\begin{center}
 \begin{tikzpicture}
 [
 	vertex/.style={draw=none,circle,fill=black,minimum size=2pt},
	oedge/.style={->,>=latex,shorten >=6pt,draw,black,thick},
	roedge/.style={->,>=latex,shorten >=6pt,draw,black,thick,color=red}
 ]

\coordinate (V1) at (-3,3);
\coordinate (V2) at (0,0);
\coordinate (V3) at (0,6);
\coordinate (V4) at (3,3);

\path[oedge] ([yshift=3pt]V1) to ([yshift=3pt]V2) {};
\path[roedge] ([yshift=-3pt]V2) to ([yshift=-3pt]V1) {};

\path[roedge] ([yshift=3pt]V1) -- ([yshift=3pt]V3) {};
\path[oedge] ([yshift=-3pt]V3) -- ([yshift=-3pt]V1) {};

\path[oedge] ([xshift=2pt]V3) -- ([xshift=2pt]V2) {};
\path[oedge] ([xshift=-2pt]V2) -- ([xshift=-2pt]V3) {};

\path[oedge] ([yshift=3pt]V2) -- ([yshift=3pt]V4) {};
\path[roedge] ([yshift=-3pt]V4) -- ([yshift=-3pt]V2) {};

\path[roedge] ([yshift=3pt]V3) -- ([yshift=3pt]V4) {};
\path[oedge] ([yshift=-3pt]V4) -- ([yshift=-3pt]V3) {};

\node[vertex] at (V1) {};
\node[vertex] at (V2) {};
\node[vertex] at (V3) {};
\node[vertex] at (V4) {};

\draw[<-,>= latex,thick] (3.3,3) arc (0:320:94pt);

\end{tikzpicture}
\end{center}

\end{document}

{'repo_name': 'gaolinorange/Automatic-Unpaired-Shape-Deformation-Transfer', 'stars': '163', 'repo_language': 'Python', 'file_name': '12_0.obj', 'mime_type': 'text/plain', 'hash': 6709519883223626715, 'source_dataset': 'data'}


"use strict";
/* eslint-disable @typescript-eslint/no-explicit-any */
/**
 * Copyright 2016-2019 IBM Corp. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
// eslint-disable-next-line @typescript-eslint/no-var-requires
const debug = require('debug')('watson-middleware:index');
const AssistantV1 = require("ibm-watson/assistant/v1");
const utils_1 = require("./utils");
const deepMerge = require("deepmerge");
class WatsonMiddleware {
    constructor(config) {
        this.minimumConfidence = 0.75;
        // These are initiated by Slack itself and not from the end-user. Won't send these to WCS.
        this.ignoreType = ['presence_change', 'reconnect_url'];
        this.config = config;
        if (config.minimum_confidence) {
            this.minimumConfidence = config.minimum_confidence;
        }
        debug('Creating Assistant object with parameters: ' +
            JSON.stringify(this.config, null, 2));
        this.conversation = new AssistantV1(this.config);
    }
    hear(patterns, message) {
        if (message.watsonData && message.watsonData.intents) {
            for (let p = 0; p < patterns.length; p++) {
                for (let i = 0; i < message.watsonData.intents.length; i++) {
                    if (message.watsonData.intents[i].intent === patterns[p] &&
                        message.watsonData.intents[i].confidence >= this.minimumConfidence) {
                        return true;
                    }
                }
            }
        }
        return false;
    }
    before(message, payload) {
        return Promise.resolve(payload);
    }
    after(message, response) {
        return Promise.resolve(response);
    }
    sendToWatson(bot, message, contextDelta) {
        return __awaiter(this, void 0, void 0, function* () {
            if ((!message.text && message.type !== 'welcome') ||
                this.ignoreType.indexOf(message.type) !== -1 ||
                message.reply_to ||
                message.bot_id) {
                // Ignore messages initiated by Slack. Reply with dummy output object
                message.watsonData = {
                    output: {
                        text: [],
                    },
                };
                return;
            }
            this.storage = bot.controller.storage;
            try {
                const userContext = yield utils_1.readContext(message.user, this.storage);
                const payload = {
                    // eslint-disable-next-line @typescript-eslint/camelcase
                    workspace_id: this.config.workspace_id,
                };
                if (message.text) {
                    // text can not contain the following characters: tab, new line, carriage return.
                    const sanitizedText = message.text.replace(/[\r\n\t]/g, ' ');
                    payload.input = {
                        text: sanitizedText,
                    };
                }
                if (userContext) {
                    payload.context = userContext;
                }
                if (contextDelta) {
                    if (!userContext) {
                        //nothing to merge, this is the first context
                        payload.context = contextDelta;
                    }
                    else {
                        payload.context = deepMerge(payload.context, contextDelta);
                    }
                }
                if (payload.context &&
                    payload.context.workspace_id &&
                    payload.context.workspace_id.length === 36) {
                    // eslint-disable-next-line @typescript-eslint/camelcase
                    payload.workspace_id = payload.context.workspace_id;
                }
                const watsonRequest = yield this.before(message, payload);
                let watsonResponse = yield utils_1.postMessage(this.conversation, watsonRequest);
                if (typeof watsonResponse.output.error === 'string') {
                    debug('Error: %s', watsonResponse.output.error);
                    message.watsonError = watsonResponse.output.error;
                }
                watsonResponse = yield this.after(message, watsonResponse);
                message.watsonData = watsonResponse;
                yield utils_1.updateContext(message.user, this.storage, watsonResponse);
            }
            catch (error) {
                message.watsonError = error;
                debug('Error: %s', JSON.stringify(error, Object.getOwnPropertyNames(error), 2));
            }
        });
    }
    receive(bot, message) {
        return __awaiter(this, void 0, void 0, function* () {
            return this.sendToWatson(bot, message, null);
        });
    }
    interpret(bot, message) {
        return __awaiter(this, void 0, void 0, function* () {
            return this.sendToWatson(bot, message, null);
        });
    }
    readContext(user) {
        return __awaiter(this, void 0, void 0, function* () {
            if (!this.storage) {
                throw new Error('readContext is called before the first this.receive call');
            }
            return utils_1.readContext(user, this.storage);
        });
    }
    updateContext(user, context) {
        return __awaiter(this, void 0, void 0, function* () {
            if (!this.storage) {
                throw new Error('updateContext is called before the first this.receive call');
            }
            return utils_1.updateContext(user, this.storage, {
                context: context,
            });
        });
    }
    deleteUserData(customerId) {
        return __awaiter(this, void 0, void 0, function* () {
            const params = {
                customer_id: customerId,
                return_response: true,
            };
            try {
                const response = yield this.conversation.deleteUserData(params);
                debug('deleteUserData response', response);
            }
            catch (err) {
                throw new Error('Failed to delete user data, response code: ' +
                    err.code +
                    ', message: ' +
                    err.message);
            }
        });
    }
}
exports.WatsonMiddleware = WatsonMiddleware;
//# sourceMappingURL=index.js.map

{'repo_name': 'watson-developer-cloud/botkit-middleware', 'stars': '195', 'repo_language': 'TypeScript', 'file_name': 'post-message.test.ts', 'mime_type': 'text/x-java', 'hash': 2924404303832627644, 'source_dataset': 'data'}


/**
 *
 */
package edu.washington.cs.publickey;

import java.io.IOException;
import java.util.Arrays;

import org.jivesoftware.smack.util.Base64;

/**
 * @author isdal
 *
 */
public class PublicKeyFriend {
	public static PublicKeyFriend[] deserialize(String testFriendSerialized) throws IOException {
		PublicKeyFriendBean[] beans = PublicKeyFriendBean.deserialize(testFriendSerialized);
		PublicKeyFriend[] fks = new PublicKeyFriend[beans.length];
		for (int i = 0; i < fks.length; i++) {
			fks[i] = new PublicKeyFriend(beans[i]);
		}

		return fks;
	}

	public static String serialize(PublicKeyFriend[] f) throws IOException {
		PublicKeyFriendBean[] beans = new PublicKeyFriendBean[f.length];
		for (int i = 0; i < beans.length; i++) {
			beans[i] = f[i].getBean();
		}
		return PublicKeyFriendBean.serialize(beans);
	}

	private final PublicKeyFriendBean bean;

	private transient int hashCode = 0;

	public PublicKeyFriend() {
		bean = new PublicKeyFriendBean();
	}

	public PublicKeyFriend(PublicKeyFriendBean bean) {
		this.bean = bean;
	}

	PublicKeyFriendBean getBean() {
		return bean;
	}

	public String getKeyNick() {
		return bean.getKeyNick();
	}

	public byte[] getPublicKey() {
		if (bean.getPublicKey() == null) {
			return null;
		}
		return Base64.decode(bean.getPublicKey());
	}

	public byte[] getPublicKeySha1() {
		return Base64.decode(bean.getPublicKeySha1());
	}

	public String getRealName() {
		return bean.getRealName();
	}

	public FriendNetwork getSourceNetwork() {
		return FriendNetwork.getFromId(bean.getSourceNetwork());
	}

	public byte[] getSourceNetworkUid() {
		String sourceNetworkUid = bean.getSourceNetworkUid();
		if (sourceNetworkUid == null) {
			return null;
		}
		return Base64.decode(sourceNetworkUid);
	}

	public String serialize() throws IOException {
		return bean.serialize();
	}

	public void setKeyNick(String keyNick) {
		if (keyNick.length() > 255) {
			throw new RuntimeException("max key nick length is 255");
		}
		bean.setKeyNick(keyNick);
	}

	public void setPublicKey(byte[] publicKey) {
		bean.setPublicKey(Base64.encodeBytes(publicKey, Base64.DONT_BREAK_LINES));
	}

	public void setPublicKey(String publicKey) {
		setPublicKey(Base64.decode(publicKey));
	}

	public void setPublicKeySha1(byte[] publicKeySha1) {
		bean.setPublicKeySha1(Base64.encodeBytes(publicKeySha1, Base64.DONT_BREAK_LINES));
	}

	public void setRealName(String realName) {
		bean.setRealName(realName);
	}

	public void setSourceNetwork(FriendNetwork f) {
		bean.setSourceNetwork(f.getNetworkId());
	}

	public void setSourceNetworkUid(byte[] uid) {
		if (uid == null || uid.length != 20) {
			throw new RuntimeException("uid == null or uid.length != 20");
		}
		bean.setSourceNetworkUid(new String(Base64.encodeBytes(uid, Base64.DONT_BREAK_LINES)));
	}

	public String toString() {
		return bean.toString();
	}

	public boolean equals(Object o) {
		if (o.hashCode() == this.hashCode()) {
			if (o instanceof PublicKeyFriend) {
				PublicKeyFriend f = (PublicKeyFriend) o;
				if (f.getPublicKey() != null && this.getPublicKey() != null) {
					return Arrays.equals(f.getPublicKey(), this.getPublicKey());
				} else if (f.getSourceNetworkUid() != null && this.getSourceNetworkUid() != null) {
					return Arrays.equals(f.getSourceNetworkUid(), this.getSourceNetworkUid());
				}

			}
		}
		return false;
	}

	public int hashCode() {
		if (hashCode == 0) {
			if (getPublicKey() != null) {
				hashCode = Arrays.hashCode(getPublicKey());
			} else if (getSourceNetworkUid() != null) {
				hashCode = Arrays.hashCode(getSourceNetworkUid());
			}
		}

		return hashCode;
	}

}

{'repo_name': 'CSEMike/OneSwarm', 'stars': '188', 'repo_language': 'Java', 'file_name': 'CorePatchChecker.java', 'mime_type': 'text/x-java', 'hash': -6111905708451707158, 'source_dataset': 'data'}


import React from 'react';
import PropTypes from 'prop-types';
import {
  TouchableNativeFeedback,
  StyleSheet
} from 'react-native';
import {
  View
} from 'native-base';
import { BORDER_COLOR } from '../../constants';

const styles = StyleSheet.create({
  wrapper: {
    flexDirection: 'row',
    paddingTop: 12,
    paddingBottom: 12,
    borderBottomWidth: 1,
    borderBottomColor: BORDER_COLOR
  },
  last: {
    flexDirection: 'row',
    paddingTop: 12,
    paddingBottom: 12,
    borderBottomWidth: 0
  }
})

function Item(props) {
  const {
    children,
    touchable,
    last,
    ...others
  } = props

  if (touchable) {
    return(
      <TouchableNativeFeedback {...others}>
        <View style={last ? styles.last : styles.wrapper}>
          {children}
        </View>
      </TouchableNativeFeedback>
    )
  } else {
    return(
      <View style={last ? styles.last : styles.wrapper}>
        {children}
      </View>
    )
  }
}

Item.propTypes = {
  last: PropTypes.bool,
  touchable: PropTypes.bool
}

export default Item

{'repo_name': 'walljser/community_e_commerce', 'stars': '171', 'repo_language': 'JavaScript', 'file_name': 'types.js', 'mime_type': 'text/plain', 'hash': -7319699350905040163, 'source_dataset': 'data'}


/*
 * Musepack SV8 demuxer
 * Copyright (c) 2007 Konstantin Shishkov
 *
 * This file is part of FFmpeg.
 *
 * FFmpeg is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * FFmpeg is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with FFmpeg; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

#include "libavcodec/get_bits.h"
#include "libavcodec/unary.h"
#include "apetag.h"
#include "avformat.h"
#include "internal.h"
#include "avio_internal.h"

/// Two-byte MPC tag
#define MKMPCTAG(a, b) ((a) | ((b) << 8))

#define TAG_MPCK MKTAG('M','P','C','K')

/// Reserved MPC tags
enum MPCPacketTags{
    TAG_STREAMHDR   = MKMPCTAG('S','H'),
    TAG_STREAMEND   = MKMPCTAG('S','E'),

    TAG_AUDIOPACKET = MKMPCTAG('A','P'),

    TAG_SEEKTBLOFF  = MKMPCTAG('S','O'),
    TAG_SEEKTABLE   = MKMPCTAG('S','T'),

    TAG_REPLAYGAIN  = MKMPCTAG('R','G'),
    TAG_ENCINFO     = MKMPCTAG('E','I'),
};

static const int mpc8_rate[8] = { 44100, 48000, 37800, 32000, -1, -1, -1, -1 };

typedef struct MPCContext {
    int ver;
    int64_t header_pos;
    int64_t samples;

    int64_t apetag_start;
} MPCContext;

static inline int64_t bs_get_v(const uint8_t **bs)
{
    uint64_t v = 0;
    int br = 0;
    int c;

    do {
        c = **bs; (*bs)++;
        v <<= 7;
        v |= c & 0x7F;
        br++;
        if (br > 10)
            return -1;
    } while (c & 0x80);

    return v - br;
}

static int mpc8_probe(AVProbeData *p)
{
    const uint8_t *bs = p->buf + 4;
    const uint8_t *bs_end = bs + p->buf_size;
    int64_t size;

    if (p->buf_size < 16)
        return 0;
    if (AV_RL32(p->buf) != TAG_MPCK)
        return 0;
    while (bs < bs_end + 3) {
        int header_found = (bs[0] == 'S' && bs[1] == 'H');
        if (bs[0] < 'A' || bs[0] > 'Z' || bs[1] < 'A' || bs[1] > 'Z')
            return 0;
        bs += 2;
        size = bs_get_v(&bs);
        if (size < 2)
            return 0;
        if (size >= bs_end - bs + 2)
            return AVPROBE_SCORE_EXTENSION - 1; // seems to be valid MPC but no header yet
        if (header_found) {
            if (size < 11 || size > 28)
                return 0;
            if (!AV_RL32(bs)) //zero CRC is invalid
                return 0;
            return AVPROBE_SCORE_MAX;
        } else {
            bs += size - 2;
        }
    }
    return 0;
}

static inline int64_t gb_get_v(GetBitContext *gb)
{
    uint64_t v = 0;
    int bits = 0;
    while(get_bits1(gb) && bits < 64-7){
        v <<= 7;
        v |= get_bits(gb, 7);
        bits += 7;
    }
    v <<= 7;
    v |= get_bits(gb, 7);

    return v;
}

static void mpc8_get_chunk_header(AVIOContext *pb, int *tag, int64_t *size)
{
    int64_t pos;
    pos = avio_tell(pb);
    *tag = avio_rl16(pb);
    *size = ffio_read_varlen(pb);
    *size -= avio_tell(pb) - pos;
}

static void mpc8_parse_seektable(AVFormatContext *s, int64_t off)
{
    MPCContext *c = s->priv_data;
    int tag;
    int64_t size, pos, ppos[2];
    uint8_t *buf;
    int i, t, seekd, ret;
    GetBitContext gb;

    if (s->nb_streams == 0) {
        av_log(s, AV_LOG_ERROR, "No stream added before parsing seek table\n");
        return;
    }

    avio_seek(s->pb, off, SEEK_SET);
    mpc8_get_chunk_header(s->pb, &tag, &size);
    if(tag != TAG_SEEKTABLE){
        av_log(s, AV_LOG_ERROR, "No seek table at given position\n");
        return;
    }
    if (size > INT_MAX/10 || size<=0) {
        av_log(s, AV_LOG_ERROR, "Bad seek table size\n");
        return;
    }
    if(!(buf = av_malloc(size + AV_INPUT_BUFFER_PADDING_SIZE)))
        return;
    ret = avio_read(s->pb, buf, size);
    if (ret != size) {
        av_log(s, AV_LOG_ERROR, "seek table truncated\n");
        av_free(buf);
        return;
    }
    memset(buf+size, 0, AV_INPUT_BUFFER_PADDING_SIZE);

    init_get_bits(&gb, buf, size * 8);
    size = gb_get_v(&gb);
    if(size > UINT_MAX/4 || size > c->samples/1152){
        av_log(s, AV_LOG_ERROR, "Seek table is too big\n");
        return;
    }
    seekd = get_bits(&gb, 4);
    for(i = 0; i < 2; i++){
        pos = gb_get_v(&gb) + c->header_pos;
        ppos[1 - i] = pos;
        av_add_index_entry(s->streams[0], pos, i, 0, 0, AVINDEX_KEYFRAME);
    }
    for(; i < size; i++){
        t = get_unary(&gb, 1, 33) << 12;
        t += get_bits(&gb, 12);
        if(t & 1)
            t = -(t & ~1);
        pos = (t >> 1) + ppos[0]*2 - ppos[1];
        av_add_index_entry(s->streams[0], pos, i << seekd, 0, 0, AVINDEX_KEYFRAME);
        ppos[1] = ppos[0];
        ppos[0] = pos;
    }
    av_free(buf);
}

static void mpc8_handle_chunk(AVFormatContext *s, int tag, int64_t chunk_pos, int64_t size)
{
    AVIOContext *pb = s->pb;
    int64_t pos, off;

    switch(tag){
    case TAG_SEEKTBLOFF:
        pos = avio_tell(pb) + size;
        off = ffio_read_varlen(pb);
        mpc8_parse_seektable(s, chunk_pos + off);
        avio_seek(pb, pos, SEEK_SET);
        break;
    default:
        avio_skip(pb, size);
    }
}

static int mpc8_read_header(AVFormatContext *s)
{
    MPCContext *c = s->priv_data;
    AVIOContext *pb = s->pb;
    AVStream *st;
    int tag = 0;
    int64_t size, pos;

    c->header_pos = avio_tell(pb);
    if(avio_rl32(pb) != TAG_MPCK){
        av_log(s, AV_LOG_ERROR, "Not a Musepack8 file\n");
        return AVERROR_INVALIDDATA;
    }

    while(!avio_feof(pb)){
        pos = avio_tell(pb);
        mpc8_get_chunk_header(pb, &tag, &size);
        if (size < 0) {
            av_log(s, AV_LOG_ERROR, "Invalid chunk length\n");
            return AVERROR_INVALIDDATA;
        }
        if(tag == TAG_STREAMHDR)
            break;
        mpc8_handle_chunk(s, tag, pos, size);
    }
    if(tag != TAG_STREAMHDR){
        av_log(s, AV_LOG_ERROR, "Stream header not found\n");
        return AVERROR_INVALIDDATA;
    }
    pos = avio_tell(pb);
    avio_skip(pb, 4); //CRC
    c->ver = avio_r8(pb);
    if(c->ver != 8){
        av_log(s, AV_LOG_ERROR, "Unknown stream version %d\n", c->ver);
        return AVERROR_PATCHWELCOME;
    }
    c->samples = ffio_read_varlen(pb);
    ffio_read_varlen(pb); //silence samples at the beginning

    st = avformat_new_stream(s, NULL);
    if (!st)
        return AVERROR(ENOMEM);
    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
    st->codec->codec_id = AV_CODEC_ID_MUSEPACK8;
    st->codec->bits_per_coded_sample = 16;

    if (ff_get_extradata(st->codec, pb, 2) < 0)
        return AVERROR(ENOMEM);

    st->codec->channels = (st->codec->extradata[1] >> 4) + 1;
    st->codec->sample_rate = mpc8_rate[st->codec->extradata[0] >> 5];
    avpriv_set_pts_info(st, 32, 1152  << (st->codec->extradata[1]&3)*2, st->codec->sample_rate);
    st->start_time = 0;
    st->duration = c->samples / (1152 << (st->codec->extradata[1]&3)*2);
    size -= avio_tell(pb) - pos;
    if (size > 0)
        avio_skip(pb, size);

    if (pb->seekable) {
        int64_t pos = avio_tell(s->pb);
        c->apetag_start = ff_ape_parse_tag(s);
        avio_seek(s->pb, pos, SEEK_SET);
    }

    return 0;
}

static int mpc8_read_packet(AVFormatContext *s, AVPacket *pkt)
{
    MPCContext *c = s->priv_data;
    int tag;
    int64_t pos, size;

    while(!avio_feof(s->pb)){
        pos = avio_tell(s->pb);

        /* don't return bogus packets with the ape tag data */
        if (c->apetag_start && pos >= c->apetag_start)
            return AVERROR_EOF;

        mpc8_get_chunk_header(s->pb, &tag, &size);
        if (size < 0)
            return -1;
        if(tag == TAG_AUDIOPACKET){
            if(av_get_packet(s->pb, pkt, size) < 0)
                return AVERROR(ENOMEM);
            pkt->stream_index = 0;
            pkt->duration     = 1;
            return 0;
        }
        if(tag == TAG_STREAMEND)
            return AVERROR(EIO);
        mpc8_handle_chunk(s, tag, pos, size);
    }
    return AVERROR_EOF;
}

static int mpc8_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
{
    AVStream *st = s->streams[stream_index];
    int index = av_index_search_timestamp(st, timestamp, flags);

    if(index < 0) return -1;
    if (avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET) < 0)
        return -1;
    ff_update_cur_dts(s, st, st->index_entries[index].timestamp);
    return 0;
}

AVInputFormat ff_mpc8_demuxer = {
    .name           = "mpc8",
    .long_name      = NULL_IF_CONFIG_SMALL("Musepack SV8"),
    .priv_data_size = sizeof(MPCContext),
    .read_probe     = mpc8_probe,
    .read_header    = mpc8_read_header,
    .read_packet    = mpc8_read_packet,
    .read_seek      = mpc8_read_seek,
};

{'repo_name': 'artclarke/humble-video', 'stars': '450', 'repo_language': 'C', 'file_name': 'head', 'mime_type': 'text/x-shellscript', 'hash': 99166637301067293, 'source_dataset': 'data'}


using System;

namespace Ametista.Api.Model
{
    public class GetCardListResponse
    {
        public string CardHolder { get; set; }
        public DateTime ExpirationDate { get; set; }
        public DateTime? HighestChargeDate { get; set; }
        public decimal? HighestTransactionAmount { get; set; }
        public Guid? HighestTransactionId { get; set; }
        public Guid Id { get; set; }
        public string Number { get; set; }
    }
}

{'repo_name': 'fals/cqrs-clean-eventual-consistency', 'stars': '203', 'repo_language': 'C#', 'file_name': 'docker-run.sh', 'mime_type': 'text/plain', 'hash': -2097672413807457417, 'source_dataset': 'data'}


; RUN: llvm-as %s -o %t.bc
; RUN: llvm-c-test --test-callsite-attributes < %t.bc
; This used to segfault

define void @Y() {
    ret void
}

define void @X() {
    call void @X()
    ret void
}

{'repo_name': 'emscripten-core/emscripten-fastcomp', 'stars': '169', 'repo_language': 'LLVM', 'file_name': 'coro-split-dbg.ll', 'mime_type': 'text/plain', 'hash': 8688240476571618316, 'source_dataset': 'data'}


# babel-plugin-transform-es2015-parameters

> Compile ES2015 default and rest parameters to ES5

This plugin transforms ES2015 parameters to ES5, this includes:

- Destructuring parameters
- Default parameters
- Rest parameters

## Installation

```sh
npm install --save-dev babel-plugin-transform-es2015-parameters
```

## Caveats

Default parameters desugar into `let` declarations to retain proper semantics. If this is
not supported in your environment then you'll need the
[transform-block-scoping](http://babeljs.io/docs/plugins/transform-es2015-block-scoping) plugin.

## Usage

### Via `.babelrc` (Recommended)

**.babelrc**

```json
{
  "plugins": ["transform-es2015-parameters"]
}
```

### Via CLI

```sh
babel --plugins transform-es2015-parameters script.js
```

### Via Node API

```javascript
require("babel-core").transform("code", {
  plugins: ["transform-es2015-parameters"]
});
```

{'repo_name': 'sx1989827/DOClever', 'stars': '2669', 'repo_language': 'JavaScript', 'file_name': 'parse.js', 'mime_type': 'text/plain', 'hash': -9222606804539978945, 'source_dataset': 'data'}


<?php
/**
 * Zend Framework
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://framework.zend.com/license/new-bsd
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@zend.com so we can send you a copy immediately.
 *
 * @category   Zend
 * @package    Zend_Controller
 * @subpackage Zend_Controller_Action_Helper
 * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 * @version    $Id: AutoCompleteDojo.php 23775 2011-03-01 17:25:24Z ralph $
 */

/**
 * @see Zend_Controller_Action_Helper_AutoComplete_Abstract
 */
require_once 'Zend/Controller/Action/Helper/AutoComplete/Abstract.php';

/**
 * Create and send Dojo-compatible autocompletion lists
 *
 * @uses       Zend_Controller_Action_Helper_AutoComplete_Abstract
 * @category   Zend
 * @package    Zend_Controller
 * @subpackage Zend_Controller_Action_Helper
 * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */
class Zend_Controller_Action_Helper_AutoCompleteDojo extends Zend_Controller_Action_Helper_AutoComplete_Abstract
{
    /**
     * Validate data for autocompletion
     *
     * Stub; unused
     *
     * @param  mixed $data
     * @return boolean
     */
    public function validateData($data)
    {
        return true;
    }

    /**
     * Prepare data for autocompletion
     *
     * @param  mixed   $data
     * @param  boolean $keepLayouts
     * @return string
     */
    public function prepareAutoCompletion($data, $keepLayouts = false)
    {
        if (!$data instanceof Zend_Dojo_Data) {
            require_once 'Zend/Dojo/Data.php';
            $items = array();
            foreach ($data as $key => $value) {
                $items[] = array('label' => $value, 'name' => $value);
            }
            $data = new Zend_Dojo_Data('name', $items);
        }

        if (!$keepLayouts) {
            require_once 'Zend/Controller/Action/HelperBroker.php';
            Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->setNoRender(true);

            require_once 'Zend/Layout.php';
            $layout = Zend_Layout::getMvcInstance();
            if ($layout instanceof Zend_Layout) {
                $layout->disableLayout();
            }
        }

        $response = Zend_Controller_Front::getInstance()->getResponse();
        $response->setHeader('Content-Type', 'application/json');

        return $data->toJson();
    }
}

{'repo_name': 'OrayDev/tudu-web', 'stars': '249', 'repo_language': 'PHP', 'file_name': 'tudu.conf', 'mime_type': 'text/plain', 'hash': -3625941546141733996, 'source_dataset': 'data'}


<!--

Copyright 2008-2014 Clipperz Srl - All rights reserved.

This file is part of Clipperz's Javascript Crypto Library.

The Javascript Crypto Library provides web developers with an extensive
and efficient set of cryptographic functions.
For further information about its features and functionalities please
refer to https://clipperz.is

* The Javascript Crypto Library is free software: you can redistribute
  it and/or modify it under the terms of the BSD 3-Clause License
  as published by the Free Software Foundation.

* You should have received a copy of the BSD 3-Clause License
  along with the Javascript Crypto Library in the LICENSE.TXT file.
  If not, see <http://www.gnu.org/licenses/>.

-->

<html>
<head>
	<title>Clipperz.* - tests</title>
	<script type="text/javascript" src="../../../other_libraries/MochiKit/MochiKit.js"></script>
	<script type="text/javascript" src="../../SimpleTest/TestRunner.js"></script>
</head>
<body>
<script>
TestRunner.runTests(
	'Async.html',
	'Base.html',
	'ByteArray.html'
);
</script>
</body>
</html>

{'repo_name': 'clipperz/javascript-crypto-library', 'stars': '270', 'repo_language': 'JavaScript', 'file_name': 'Utils.js', 'mime_type': 'text/plain', 'hash': -1275374235845190525, 'source_dataset': 'data'}


syntax module CStyleComments
{
  using Whitespaces;

  [ExplicitSpaces] syntax SingleLineComment = Start="//" Body=(!NewLine Any)* End=NewLine?;
  [ExplicitSpaces] syntax MultiLineComment  = Start="/*" Body=(!"*/" Any)*    End="*/";
}

{'repo_name': 'JetBrains/Nitra', 'stars': '547', 'repo_language': 'Nemerle', 'file_name': 'TupleFields-syntax.nitra', 'mime_type': 'text/plain', 'hash': -6953697815019311995, 'source_dataset': 'data'}


Changelog
=========

Report issues to [GitHub].

[GitHub]: https://github.com/android-ndk/ndk/issues

Announcements
-------------

 * `ndk-build` will default to using Clang in r13. GCC will be removed in a
   later release.
 * `make-standalone-toolchain.sh` will be removed in r13. Make sure
   `make_standalone_toolchain.py` suits your needs.

r12b
----

 * `ndk-gdb.py` has been fixed: https://github.com/android-ndk/ndk/issues/118
 * NdkCameraMetadataTags.h has been updated to no longer contain the invalid
   enum value.
 * A bug in `ndk-build` that resulting in spurious warnings for static libraries
   using libc++ has been fixed:
   https://android-review.googlesource.com/#/c/238146/
 * The OpenSLES headers have been updated for android-24.

NDK
---
 * Removed support for the armeabi-v7a-hard ABI. See the explanation in the
   [documentation](https://github.com/android-ndk/ndk/blob/master/docs/HardFloatAbi.md).
 * Removed all sysroots for pre-GB platform levels. We dropped support for them
   in r11, but neglected to actually remove them.
 * Exception handling when using `c++_shared` on ARM32 now mostly works (see
   [Known Issues](#known-issues)). The unwinder will now be linked into each
   linked object rather than into libc++ itself.
 * Default compiler flags have been pruned:
   https://github.com/android-ndk/ndk/issues/27.
     * Full changes here: https://android-review.googlesource.com/#/c/207721/5.
 * Added a Python implementation of standalone toolchains:
   `build/tools/make_standalone_toolchain.py`.
     * Windows users: you no longer need Cygwin to use this feature.
     * We'll be removing the bash flavor in r13, so test the new one now.
 * `-fno-limit-debug-info` has been enabled by default for Clang debug builds.
   This should improve debugability with LLDB.
 * `--build-id` is now enabled by default.
     * This will be shown in native crash reports so you can easily identify
       which version of your code was running.
 * `NDK_USE_CYGPATH` should no longer cause problems with libgcc:
   http://b.android.com/195486.
 * `-Wl,--warn-shared-textrel` and`-Wl,--fatal-warnings` are now enabled by
   default. If you have shared text relocations, your app will not load on
   Marshmallow or later (and have never been allowed for 64-bit apps).
 * Precompiled headers should work better:
   https://github.com/android-ndk/ndk/issues/14 and
   https://github.com/android-ndk/ndk/issues/16.
 * Unreachable ARM (non-thumb) STL libraries have been removed.
 * Added Vulkan support to android-24.
 * Added Choreographer API to android-24.
 * Added `libcamera2` APIs for devices with
   `INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED` or above (see [Camera
   Characteristics]).

[Camera Characteristics]: https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.html#INFO_SUPPORTED_HARDWARE_LEVEL

Clang
-----

 * Clang has been updated to 3.8svn (r256229, build 2812033).
 * `__thread` should work for real this time.

GCC
---

 * Synchronized with the ChromeOS GCC @ `google/gcc-4_9` r227810.
 * Backported coverage sanitizer patch from ToT (r231296).
 * Fixed libatomic to not use ifuncs:
   https://github.com/android-ndk/ndk/issues/31.

Binutils
--------

 * "Erratum 843419 found and fixed" info messages are silenced.
 * Introduced option '--long-plt' to fix internal linker error when linking huge
   arm32 binaries.
 * Fixed wrong run time stubs for AArch64. This was causing jump addresses to be
   calculated incorrectly for very large DSOs.
 * Introduced default option '--no-apply-dynamic' to work around a dynamic
   linker bug for earlier Android releases.
 * NDK r11 KI for `dynamic_cast` not working with Clang, x86, `stlport_static`
   and optimization has been fixed.

GDB
---

 * Updated to GDB 7.11: https://www.gnu.org/software/gdb/news/.
 * Some bugfixes for `ndk-gdb.py`.

Known Issues
------------

 * This is not intended to be a comprehensive list of all outstanding bugs.
 * x86 ASAN still does not work. See discussion on
   https://android-review.googlesource.com/#/c/186276/
 * Exception unwinding with `c++_shared` still does not work for ARM on
   Gingerbread or Ice Cream Sandwich.
 * Bionic headers and libraries for Marshmallow and N are not yet exposed
   despite the presence of android-24. Those platforms are still the Lollipop
   headers and libraries (not a regression from r11).
 * RenderScript tools are not present (not a regression from r11):
   https://github.com/android-ndk/ndk/issues/7.
 * The `clang.exe` and `clang++.exe` in the 32-bit Windows package are actually
   64-bit. The 32-bit executable is named `clang_32.exe`.

{'repo_name': 'android/ndk', 'stars': '944', 'repo_language': 'None', 'file_name': 'Changelog-r17-beta1.md', 'mime_type': 'text/plain', 'hash': -4771236300980052836, 'source_dataset': 'data'}


#include "LineObject.h"

#include "guts/Conversions.h"
#include <QtGlobal>

LineObject::LineObject(const Position &endA,
                       const Position &endB,
                       qreal thickness,
                       MapGraphicsObject *parent) :
    MapGraphicsObject(false, parent),
    _a(endA), _b(endB)
{
    _thickness = qBound<qreal>(0.0, thickness, 5.0);
    this->updatePositionFromEndPoints();
}

LineObject::~LineObject()
{
}

//pure-virtual from MapGraphicsObject
QRectF LineObject::boundingRect() const
{
    const qreal avgLat = (_a.latitude() + _b.latitude()) / 2.0;
    const qreal lonPerMeter = Conversions::degreesLonPerMeter(avgLat);
    const qreal latPerMeter = Conversions::degreesLatPerMeter(avgLat);

    const qreal widthLon = qAbs<qreal>(_a.longitude() - _b.longitude());
    const qreal heightlat = qAbs<qreal>(_a.latitude() - _b.latitude());

    const qreal widthMeters = qMax<qreal>(widthLon / lonPerMeter, 5.0);
    const qreal heightMeters = qMax<qreal>(heightlat / latPerMeter, 5.0);

    const QRectF toRet(-1.0 * widthMeters,
                       -1.0 * heightMeters,
                       2.0 * widthMeters,
                       2.0 * heightMeters);

    return toRet;
}

//pure-virtual from MapGraphicsObject
void LineObject::paint(QPainter *painter,
                       const QStyleOptionGraphicsItem *option,
                       QWidget *widget)
{
    Q_UNUSED(option);
    Q_UNUSED(widget);

    painter->setRenderHint(QPainter::Antialiasing, true);
    QPen pen = painter->pen();
    pen.setWidthF(_thickness);
    painter->setPen(pen);

    const qreal avgLat = (_a.latitude() + _b.latitude()) / 2.0;
    const qreal lonPerMeter = Conversions::degreesLonPerMeter(avgLat);
    const qreal latPerMeter = Conversions::degreesLatPerMeter(avgLat);

    const QPointF center = this->pos();
    const QPointF offsetA = _a.lonLat() - center;
    const QPointF offsetB = _b.lonLat() - center;

    const QPointF metersA(offsetA.x() / lonPerMeter,
                          offsetA.y() / latPerMeter);
    const QPointF metersB(offsetB.x() / lonPerMeter,
                          offsetB.y() / latPerMeter);

    painter->drawLine(metersA, metersB);
}

qreal LineObject::thickness() const
{
    return _thickness;
}

void LineObject::setThickness(qreal nThick)
{
    _thickness = qBound<qreal>(0.0, nThick, 5.0);
    this->redrawRequested();
}

//public slot
void LineObject::setEndPointA(const Position &pos)
{
    _a = pos;
    this->updatePositionFromEndPoints();
    this->redrawRequested();
}

//public slot
void LineObject::setEndPointB(const Position &pos)
{
    _b = pos;
    this->updatePositionFromEndPoints();
    this->redrawRequested();
}

//public slot
void LineObject::setEndPoints(const Position &a,
                              const Position &b)
{
    _a = a;
    _b = b;
    this->updatePositionFromEndPoints();
    this->redrawRequested();
}

//private slot
void LineObject::updatePositionFromEndPoints()
{
    const qreal avgLon = (_a.longitude() + _b.longitude()) / 2.0;
    const qreal avgLat = (_a.latitude() + _b.latitude()) / 2.0;
    this->setPos(QPointF(avgLon, avgLat));
}

{'repo_name': 'raptorswing/MapGraphics', 'stars': '105', 'repo_language': 'C++', 'file_name': 'MainWindow.h', 'mime_type': 'text/x-c++', 'hash': -1091807296101631639, 'source_dataset': 'data'}


package bookmarks

import (
	"github.com/stretchr/testify/assert"
	"testing"
)

func TestBookmarkSlice_Match(t *testing.T) {
	const heartSymbol = "❤"
	const bugSymbol = "🐛"

	test := assert.New(t)
	bookmarkSlice := BookmarkSlice{
		Bookmark{
			Name: "Golang",
			URL:  "https://golang.org",
		},
		Bookmark{
			Name: heartSymbol,
			URL:  "https://unicode-table.com/en/1F5A4/",
		},
		Bookmark{
			Name: bugSymbol,
			URL:  "https://unicode-table.com/en/1F41B/",
		},
		Bookmark{
			Name: "Rust",
			URL:  "https://www.rust-lang.org",
		},
	}

	test.Len(bookmarkSlice.Match("Go"), 1)
	test.Len(bookmarkSlice.Match("Rust"), 1)
	test.Len(bookmarkSlice.Match(heartSymbol), 1)
	test.Len(bookmarkSlice.Match(bugSymbol), 1)
	test.Len(bookmarkSlice.Match("Java"), 0)
	test.Len(bookmarkSlice.Match("golang.org"), 1)
}

func TestBookmarkSlice_Sort(t *testing.T) {
	test := assert.New(t)
	bookmarkSlice := BookmarkSlice{
		Bookmark{
			Name: "Rust",
			URL:  "https://www.rust-lang.org",
		},
		Bookmark{
			Name: "Golang",
			URL:  "https://golang.org",
		},
	}.Sort()

	test.Equal(Bookmark{
		Name: "Golang",
		URL:  "https://golang.org",
	}, bookmarkSlice[0])
}

{'repo_name': 'mdreizin/chrome-bookmarks-alfred-workflow', 'stars': '216', 'repo_language': 'Go', 'file_name': 'main.go', 'mime_type': 'text/x-c', 'hash': -3612285624190800372, 'source_dataset': 'data'}


/*
 *  SDMMD_USBmuxListener.h
 *  SDMMobileDevice
 *
 * Copyright (c) 2014, Samantha Marshall
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
 * following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer
 * 		in the documentation and/or other materials provided with the distribution.
 *
 * 3. Neither the name of Samantha Marshall nor the names of its contributors may be used to endorse or promote products derived from this
 * 		software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 */

#ifndef _SDM_MD_USBMUXLISTENER_H_
#define _SDM_MD_USBMUXLISTENER_H_

#include "SDMMD_USBMuxListener_Class.h"
#include "SDMMD_Error.h"
#include "SDMMD_AMDevice.h"
#include "SDMMD_USBMuxListener_Types.h"

#pragma mark -
#pragma mark Functions
#pragma mark -

sdmmd_return_t SDMMD_USBMuxConnectByPort(SDMMD_AMDeviceRef device, uint32_t port, uint32_t *socketConn);

SDMMD_USBMuxListenerRef SDMMD_USBMuxCreate();
void SDMMD_USBMuxStartListener(SDMMD_USBMuxListenerRef *listener);

struct USBMuxPacket *SDMMD_USBMuxCreatePacketEmpty(void);
struct USBMuxPacket *SDMMD_USBMuxCreatePacketType(SDMMD_USBMuxPacketMessageType type, CFDictionaryRef payload);
void USBMuxPacketRelease(struct USBMuxPacket *packet);

#endif

{'repo_name': 'samdmarshall/SDMMobileDevice', 'stars': '520', 'repo_language': 'C', 'file_name': 'test.h', 'mime_type': 'text/x-c', 'hash': 1472511368460849953, 'source_dataset': 'data'}


package functions

import "honnef.co/go/tools/ir"

type Loop struct{ *ir.BlockSet }

func FindLoops(fn *ir.Function) []Loop {
	if fn.Blocks == nil {
		return nil
	}
	tree := fn.DomPreorder()
	var sets []Loop
	for _, h := range tree {
		for _, n := range h.Preds {
			if !h.Dominates(n) {
				continue
			}
			// n is a back-edge to h
			// h is the loop header
			if n == h {
				set := Loop{ir.NewBlockSet(len(fn.Blocks))}
				set.Add(n)
				sets = append(sets, set)
				continue
			}
			set := Loop{ir.NewBlockSet(len(fn.Blocks))}
			set.Add(h)
			set.Add(n)
			for _, b := range allPredsBut(n, h, nil) {
				set.Add(b)
			}
			sets = append(sets, set)
		}
	}
	return sets
}

func allPredsBut(b, but *ir.BasicBlock, list []*ir.BasicBlock) []*ir.BasicBlock {
outer:
	for _, pred := range b.Preds {
		if pred == but {
			continue
		}
		for _, p := range list {
			// TODO improve big-o complexity of this function
			if pred == p {
				continue outer
			}
		}
		list = append(list, pred)
		list = allPredsBut(pred, but, list)
	}
	return list
}

{'repo_name': 'hashicorp/vault', 'stars': '16436', 'repo_language': 'Go', 'file_name': 'NOTICE.md', 'mime_type': 'text/plain', 'hash': 3838590122318986885, 'source_dataset': 'data'}


/*
 * packet-gcsna.c
 *
 * Wireshark - Network traffic analyzer
 * By Gerald Combs <gerald@wireshark.org>
 * Copyright 1998 Gerald Combs
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 *
 * Ref GCSNA: 3GPP2 C.S0097 v2.0
 */

# include "config.h"

#include <epan/packet.h>
#include <epan/expert.h>

void proto_reg_handoff_gcsna(void);
void proto_register_gcsna(void);

 /* gcsna Handle for the dissection */
static dissector_handle_t gcsna_handle;
static dissector_handle_t cdma2k_handle;

/* Function handlers for each message/information fields */
static void gcsna_message_decode(proto_item *item, tvbuff_t *tvb, proto_tree *tree, guint *offset, proto_tree *mainTree, guint16 *noerror, packet_info *pinfo);
static void gcsna_message_GCSNA1xCircuitService(proto_item *item, tvbuff_t *tvb, packet_info *pinfo, proto_tree *mainTree, proto_tree *tree, guint *offset);
static void gcsna_message_GCSNAL2Ack(proto_item *item, tvbuff_t *tvb, proto_tree *tree, guint *offset);
static void gcsna_message_GCSNAServiceReject(proto_item *item, tvbuff_t *tvb, proto_tree *tree, guint *offset);

/*Initialize all the header parameters that are to be displayed*/
int proto_gcsna = -1;
static int hf_gcsna_msghdr = -1;
static int hf_gcsna_msgid = -1;
static int hf_gcsna_rejSequence = -1;
static int hf_gcsna_cause = -1;
static int hf_gcsna_ackSequence = -1;
static int hf_gcsna_recordType = -1;
static int hf_gcsna_1xProtocolRevision = -1;
static int hf_gcsna_invalidMessageId = -1;
static int hf_gcsna_l2ack = -1;
static int hf_gcsna_servicereject = -1;
static int hf_gcsna_gcsna_option = -1;
static int hf_gcsna_gcsnaClass = -1;
static int hf_gcsna_gcsnaClassRev = -1;
static int hf_gcsna_altGCSNAOption = -1;
static int hf_gcsna_altGCSNAOptionIncluded = -1;
static int hf_gcsna_NumaltGCSNAOption = -1;
static int hf_gcsna_ackRequired = -1;
static int hf_gcsna_stopDupDetect = -1;
static int hf_gcsna_msgSequence = -1;
static int hf_gcsna_tlacEncapsulated = -1;
static int hf_gcsna_NumTLACEncapsulated1xL3PDU = -1;
static int hf_gcsna_tlacReserved = -1;
static int hf_gcsna_iwsidIncluded = -1;
static int hf_gcsna_iwsidValue = -1;
static int hf_gcsna_unsupported_reject_seq = -1;

/* Toggle sub-tree items */
static gint ett_gcsna_msghdr = -1;
static gint ett_gcsna_subtree = -1;
static gint ett_gcsna_option = -1;

static expert_field ei_gcsna_error = EI_INIT;

#define GCSNA1XCIRCUITSERVICE 0x01
#define GCSNAL2ACK       0x02
#define GCSNASERVICEREJECT    0x03

/* Msg Types */
static const value_string gcsna_message_types[] = {
    { 0x01, "GCSNA 1X Circuitservice" },
    { 0x02, "GCSNA L2 Ack"},
    { 0x03, "GCSNA Servicereject"},
    { 0, NULL },
};

/* Cause Types */
static const value_string gcsna_cause_types[] = {
    { 0, "Invalid GCSNAOption" },
    { 1, "Invalid 1xProtocolRevision" },
    { 2, "Invalid GCSNAOption and 1xProtocolRevision"},
    { 3, "Invalid Message Id"},
    { 4, "GCSNA 1xParameters provisioning is not supported" },
    { 5, "Unsupported RecordType in GCSNA 1xParameters message"},
    { 0, NULL },
};

/*
    GCSNA Class GCSNA ClassRevision 1x Service
    +----------+-------------------+--------------------------------+
    |          |         0         | Release 8 1xCSFB from E-UTRAN  |
    |          +-------------------+--------------------------------+
    |    0     |         1         | Release 9 e1xCSFB from E-UTRAN |
    |          +-------------------+--------------------------------+
    |          |         2         | C.S0097-A supported eCSFB      |
    +----------+-------------------+--------------------------------+
    |    1     |         0         | SRVCC from E-UTRAN             |
    +----------+-------------------+--------------------------------+

*/
static const value_string gcsna_option_values[] = {
    { 0, "Release 8 1xCSFB from E-UTRAN" },
    { 1, "Release 9 e1xCSFB from E-UTRAN" },
    { 2, "C.S0097-A supported eCSFB"},
    { 8, "SRVCC from E-UTRAN"},
    { 0, NULL },
};

static const value_string gcsna_tru_false_values[] = {
    { 0, "False" },
    { 1, "True" },
    { 0, NULL },
};

/* Decoder for all the information elements of A21 Message Type */
static void
gcsna_message_decode(proto_item *item, tvbuff_t *tvb, proto_tree *tree, guint *offset, proto_tree *mainTree, guint16 *noerror, packet_info *pinfo)
{
    guint16 msgId = -1;
    msgId = tvb_get_guint8(tvb, *offset);
    *offset += 1;

    switch (msgId)
    {
    case GCSNA1XCIRCUITSERVICE:
    {
        gcsna_message_GCSNA1xCircuitService(item, tvb, pinfo, mainTree, tree, offset);
        break;
    }

    case GCSNAL2ACK:
    {
        gcsna_message_GCSNAL2Ack(item, tvb, tree, offset);
        break;
    }

    case GCSNASERVICEREJECT:
    {
        gcsna_message_GCSNAServiceReject(item, tvb, tree, offset);
        break;
    }

    default:
    {
        *noerror = 0;
        break;
    }
    }
}

static void
gcsna_message_GCSNA1xCircuitService(proto_item *item, tvbuff_t *tvb, packet_info *pinfo, proto_tree *mainTree, proto_tree *tree, guint *offset)
{
    guint16 alt_gcsna_incl = 0, num_alt_gcsna_opt = -1, iws_incl = 0;
    guint8 num_res;
    guint bit_offset = *offset * 8;
    proto_tree *subtree = NULL;
    tvbuff_t *new_tvb;

    /* GCSNAOption 8 bits */
    item = proto_tree_add_item(tree, hf_gcsna_gcsna_option, tvb, *offset, 1, ENC_BIG_ENDIAN);
    subtree = proto_item_add_subtree(item, ett_gcsna_option);
    proto_tree_add_bits_item(subtree, hf_gcsna_gcsnaClass, tvb, bit_offset, 5, ENC_BIG_ENDIAN);
    bit_offset += 5;
    proto_tree_add_bits_item(subtree, hf_gcsna_gcsnaClassRev, tvb, bit_offset, 3, ENC_BIG_ENDIAN);
    bit_offset += 3;

    alt_gcsna_incl = tvb_get_bits8(tvb, bit_offset, 1);
    proto_tree_add_bits_item(tree, hf_gcsna_altGCSNAOptionIncluded, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
    bit_offset += 1;
    if (alt_gcsna_incl)
    {
        num_alt_gcsna_opt = tvb_get_bits8(tvb, bit_offset, 8);
        proto_tree_add_bits_item(tree, hf_gcsna_NumaltGCSNAOption, tvb, bit_offset, 8, ENC_BIG_ENDIAN);
        bit_offset += 8;

        while (num_alt_gcsna_opt != 0)
        {
            proto_tree_add_bits_item(tree, hf_gcsna_altGCSNAOption, tvb, bit_offset, 8, ENC_BIG_ENDIAN);
            bit_offset += 8;
            num_alt_gcsna_opt--;
        }
    }

    iws_incl = tvb_get_bits8(tvb, bit_offset, 1);
    proto_tree_add_bits_item(tree, hf_gcsna_iwsidIncluded, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
    bit_offset++;

    if (iws_incl)
    {
        proto_tree_add_bits_item(tree, hf_gcsna_iwsidValue, tvb, bit_offset, 16, ENC_BIG_ENDIAN);
        bit_offset += 16;
    }

    proto_tree_add_bits_item(tree, hf_gcsna_ackRequired, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
    bit_offset++;
    proto_tree_add_bits_item(tree, hf_gcsna_stopDupDetect, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
    bit_offset++;
    proto_tree_add_bits_item(tree, hf_gcsna_msgSequence, tvb, bit_offset, 6, ENC_BIG_ENDIAN);
    bit_offset += 6;

    proto_tree_add_bits_item(tree, hf_gcsna_NumTLACEncapsulated1xL3PDU, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
    bit_offset += 2;

    /* The sender shall include reserved bits to make this message integral number of octets up to TLACEncapsulated1xL3PDU field.
     * The sender shall set all bits in this field to '0'. The receiver shall ignore this field.
     */

     /* calculate number of reserved bits */
    num_res = 8 - (bit_offset & 0x3);
    proto_tree_add_bits_item(tree, hf_gcsna_tlacReserved, tvb, bit_offset, num_res, ENC_BIG_ENDIAN);
    bit_offset = bit_offset + num_res;
    *offset = bit_offset >> 3;

    proto_tree_add_item(tree, hf_gcsna_tlacEncapsulated, tvb, *offset, -1, ENC_NA);

    if (cdma2k_handle) {
        new_tvb = tvb_new_subset_length_caplen(tvb, *offset, -1, -1);
        call_dissector(cdma2k_handle, new_tvb, pinfo, mainTree);
    }
    /* set the offset to the end of the message */
    *offset += tvb_reported_length_remaining(tvb, *offset);

}

static void gcsna_message_GCSNAL2Ack(proto_item *item, tvbuff_t *tvb, proto_tree *tree, guint *offset)
{
    proto_tree *subtree = NULL;

    item = proto_tree_add_item(tree, hf_gcsna_l2ack, tvb, *offset, 1, ENC_NA);
    subtree = proto_item_add_subtree(item, ett_gcsna_subtree);

    proto_tree_add_bits_item(subtree, hf_gcsna_ackSequence, tvb, *offset * 8, 6, ENC_BIG_ENDIAN);
    *offset += 1;
}

static void gcsna_message_GCSNAServiceReject(proto_item *item, tvbuff_t *tvb, proto_tree *tree, guint *offset)
{
    guint16 cause_val = -1, num_fields = -1, l_offset = -1;
    proto_tree *subtree = NULL;

    item = proto_tree_add_item(tree, hf_gcsna_servicereject, tvb, *offset, 1, ENC_NA);
    subtree = proto_item_add_subtree(item, ett_gcsna_subtree);

    l_offset = *offset * 8;
    proto_tree_add_bits_item(subtree, hf_gcsna_rejSequence, tvb, l_offset, 6, ENC_BIG_ENDIAN);
    l_offset += 6;
    proto_tree_add_bits_item(subtree, hf_gcsna_cause, tvb, l_offset, 8, ENC_BIG_ENDIAN);
    cause_val = tvb_get_bits8(tvb, *offset * 8 + 6, 8);
    l_offset += 8;

    switch (cause_val)
    {
    case 0:
    case 2:
    {
        num_fields = tvb_get_bits8(tvb, l_offset, 8);
        l_offset += 8;

        while (num_fields > 0)
        {
            proto_tree_add_bits_item(subtree, hf_gcsna_gcsnaClass, tvb, l_offset, 5, ENC_BIG_ENDIAN);
            l_offset += 5;
            proto_tree_add_bits_item(subtree, hf_gcsna_gcsnaClassRev, tvb, l_offset, 3, ENC_BIG_ENDIAN);
            l_offset += 3;
            num_fields--;
        }

        if (cause_val == 2)
        {
            proto_tree_add_bits_item(subtree, hf_gcsna_1xProtocolRevision, tvb, l_offset, 8, ENC_BIG_ENDIAN);
            l_offset += 8;
        }

        break;
    }

    case 1:
    {
        proto_tree_add_bits_item(subtree, hf_gcsna_1xProtocolRevision, tvb, l_offset, 8, ENC_BIG_ENDIAN);
        l_offset += 8;
        break;
    }

    case 3:
    {
        proto_tree_add_bits_item(subtree, hf_gcsna_invalidMessageId, tvb, l_offset, 8, ENC_BIG_ENDIAN);
        l_offset += 8;
        break;
    }

    /*This Cause Value is not supported in IWS Stack*/
    case 5:
    {
        num_fields = tvb_get_bits8(tvb, l_offset, 8);
        l_offset += 8;

        while (num_fields > 0)
        {
            proto_tree_add_bits_item(subtree, hf_gcsna_recordType, tvb, l_offset, 8, ENC_BIG_ENDIAN);
            l_offset += 8;
            num_fields--;
        }
        break;
    }

    default:
    {
        proto_tree_add_item(subtree, hf_gcsna_unsupported_reject_seq, tvb, l_offset, -1, ENC_NA);
        break;
    }
    }

    if (l_offset % 8 == 0)
    {
        *offset = (l_offset / 8);
    } else
    {
        *offset = (l_offset / 8) + 1;
    }

}

/*Method called when the dissection starts.....Starting point*/
static int
dissect_gcsna(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
{

    /* Initialization*/
    proto_tree *gcsna_msghdr_tree_start = NULL;

    proto_item *item = NULL;

    guint32 offset = 0;
    guint16 noerror = 1;

    /*Add the protocol name to display*/
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "gcsna");
    col_add_fstr(pinfo->cinfo, COL_INFO, "[gcsna]");

    item = proto_tree_add_item(tree, hf_gcsna_msghdr, tvb, 0, -1, ENC_NA);
    gcsna_msghdr_tree_start = proto_item_add_subtree(item, ett_gcsna_msghdr);

    if (tree)
    {
        proto_tree_add_item(gcsna_msghdr_tree_start, hf_gcsna_msgid, tvb, offset, 1, ENC_BIG_ENDIAN);

        while (tvb_captured_length_remaining(tvb, offset) != 0 && noerror == 1)
            gcsna_message_decode(item, tvb, gcsna_msghdr_tree_start, &offset, tree, &noerror, pinfo);

        if (noerror == 0)
        {
            expert_add_info(pinfo, item, &ei_gcsna_error);
        }
    }
    return tvb_reported_length(tvb);
}

/*Register gcsna to be accessed by other dissectors/plugins*/
void
proto_register_gcsna(void)
{
    static hf_register_info hf[] = {
            { &hf_gcsna_servicereject,
            { "GCSNA SERVICEREJECT", "gcsna.servicereject", FT_NONE, BASE_NONE,NULL, 0x0, NULL, HFILL } },
            /*{ & hf_gcsna_msgid,
            { "GCSNA Message Type", "gcsna.MsgType", FT_UINT8, BASE_HEX_DEC, VALS(A21_Message_Types), 0x0, NULL, HFILL } },*/
            { &hf_gcsna_l2ack,
            { "L2ACK", "gcsna.l2ack", FT_NONE, BASE_NONE,NULL, 0x0, NULL, HFILL } },
            { &hf_gcsna_msghdr,
            { "General Circuit Services Notification Application Protocol", "gcsna.msghdr", FT_NONE, BASE_NONE,NULL, 0x0, NULL, HFILL } },
            { &hf_gcsna_NumTLACEncapsulated1xL3PDU,
            { "NumTLACEncapsulated1xL3PDU", "gcsna.NumTLACEncapsulated1xL3PDU", FT_UINT8, BASE_HEX_DEC,NULL, 0x0, NULL, HFILL } },
            { &hf_gcsna_tlacReserved,
            { "Reserved", "gcsna.tlacReserved", FT_UINT8, BASE_HEX_DEC,NULL, 0x0, NULL, HFILL } },
            { &hf_gcsna_tlacEncapsulated,
            { "TLAC Encapsulated", "gcsna.tlacEncapsulated", FT_BYTES, BASE_NONE,NULL, 0x0, NULL, HFILL } },
            { &hf_gcsna_msgSequence,
            { "Msg Sequence", "gcsna.msgSequence", FT_UINT8, BASE_HEX_DEC,NULL, 0x0, NULL, HFILL } },
            { &hf_gcsna_stopDupDetect,
            { "Stop Dup Detect", "gcsna.stopDupDetect", FT_UINT8, BASE_HEX_DEC,NULL, 0x0, NULL, HFILL } },
            { &hf_gcsna_ackRequired,
            { "Ack Required", "gcsna.ackRequired", FT_UINT8, BASE_DEC,VALS(gcsna_tru_false_values), 0x0, NULL, HFILL } },
            { &hf_gcsna_altGCSNAOptionIncluded,
            { "AlternativeGCSNAOption_INCL", "gcsna.altGCSNAOptionIncluded", FT_UINT8, BASE_DEC,VALS(gcsna_tru_false_values), 0x0, NULL, HFILL } },
            { &hf_gcsna_altGCSNAOption,
            { "Alternate GCSNA Option", "gcsna.altGCSNAOption", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
            { &hf_gcsna_gcsna_option,
            { "GCSNA Option", "gcsna.Option", FT_UINT8, BASE_HEX, VALS(gcsna_option_values), 0x0, NULL, HFILL } },
            { &hf_gcsna_NumaltGCSNAOption,
            { "NumAlternativeGCSNAOptions", "gcsna.NumaltGCSNAOption", FT_UINT8, BASE_HEX_DEC,NULL, 0x0, NULL, HFILL } },
            { &hf_gcsna_iwsidValue,
            { "IWS_ID", "gcsna.iwsidValue", FT_UINT16, BASE_HEX_DEC,NULL, 0x0, NULL, HFILL } },
            { &hf_gcsna_iwsidIncluded,
            { "IWSIDIncl", "gcsna.iwsidIncluded", FT_UINT8, BASE_DEC,VALS(gcsna_tru_false_values), 0x0, NULL, HFILL } },
            { &hf_gcsna_gcsnaClassRev,
            { "GCSNA Class revision", "gcsna.ClassRev", FT_UINT8, BASE_HEX_DEC,NULL, 0x0, NULL, HFILL } },
            { &hf_gcsna_gcsnaClass,
            { "GCSNA Class", "gcsna.Class", FT_UINT8, BASE_HEX_DEC,NULL, 0x0, NULL, HFILL } },
            { &hf_gcsna_invalidMessageId,
            { "InvalidMessageId", "gcsna.invalidMessageId", FT_UINT8, BASE_HEX_DEC,NULL, 0x0, NULL, HFILL } },
            { &hf_gcsna_1xProtocolRevision,
            { "1xProtocolRevision", "gcsna.1xProtocolRevision", FT_UINT8, BASE_HEX_DEC,NULL, 0x0, NULL, HFILL } },
            { &hf_gcsna_recordType,
            { "Record Type", "gcsna.recordType", FT_UINT8, BASE_HEX_DEC,NULL, 0x0, NULL, HFILL } },
            { &hf_gcsna_ackSequence,
            { "Ack Sequence", "gcsna.ackSequence", FT_UINT8, BASE_HEX_DEC,NULL, 0x0, NULL, HFILL } },
            { &hf_gcsna_cause,
            { "Cause", "gcsna.cause", FT_UINT8, BASE_HEX_DEC,VALS(gcsna_cause_types), 0x0, NULL, HFILL } },
            { &hf_gcsna_rejSequence,
            { "Reject Sequence", "gcsna.rejSequence", FT_UINT8, BASE_HEX_DEC,NULL, 0x0, NULL, HFILL } },
            { &hf_gcsna_msgid,
            { "GCSNA Message Type", "gcsna.msgId", FT_UINT8, BASE_HEX_DEC,VALS(gcsna_message_types), 0x0, NULL, HFILL } },
            { &hf_gcsna_unsupported_reject_seq,
            { "Invalid / Unsupported GCSNA Message Reject Sequence", "gcsna.unsupportedrejectseq", FT_NONE, BASE_NONE, NULL,  0x0, NULL, HFILL } }
    };

    static gint *ett[] = {
            &ett_gcsna_msghdr,
            &ett_gcsna_subtree,
            &ett_gcsna_option
    };

    static ei_register_info ei[] = {
        { &ei_gcsna_error, { "gcsna.error", PI_PROTOCOL, PI_ERROR, "Violation of protocol specs (e.g. invalid information element)", EXPFILL }},
    };

    expert_module_t* expert_gcsna;

    proto_gcsna = proto_register_protocol(
        "GCSNA",    /* name */
        "GCSNA",    /* short name */
        "gcsna"     /* abbrev */
    );

    register_dissector("gcsna", dissect_gcsna, proto_gcsna);

    proto_register_field_array(proto_gcsna, hf, array_length(hf));
    proto_register_subtree_array(ett, array_length(ett));

    expert_gcsna = expert_register_protocol(proto_gcsna);
    expert_register_field_array(expert_gcsna, ei, array_length(ei));

}

void
proto_reg_handoff_gcsna(void)
{
    static int once = 1;

    if (once == 1)
    {
        cdma2k_handle = find_dissector("cdma2k");
        gcsna_handle = create_dissector_handle(dissect_gcsna, proto_gcsna);
        once = 0;
    }
}

{'repo_name': 'wireshark/wireshark', 'stars': '2789', 'repo_language': 'C', 'file_name': 'packet-mpeg-audio-template.c', 'mime_type': 'text/x-c', 'hash': -45634280121255790, 'source_dataset': 'data'}