// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef BASE_MESSAGE_PUMP_UV_H_
#define BASE_MESSAGE_PUMP_UV_H_
#pragma once

#include "base/message_pump.h"
#include "base/time.h"
#include "base/base_export.h"
#include "third_party/libuv/include/uv.h"

namespace base {

class BASE_EXPORT MessagePumpUV : public MessagePump {
 public:
  MessagePumpUV();
  virtual ~MessagePumpUV();

  // MessagePump methods:
  virtual void Run(Delegate* delegate) OVERRIDE;
  virtual void Quit() OVERRIDE;
  virtual void ScheduleWork() OVERRIDE;
  virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time) OVERRIDE;

 private:
  // This flag is set to false when Run should return.
  bool keep_running_;

  struct uv_async_s wakeup_event_;

  TimeTicks delayed_work_time_;

  DISALLOW_COPY_AND_ASSIGN(MessagePumpUV);
};

}  // namespace base

#endif  // BASE_MESSAGE_PUMP_UV_H_

// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef BASE_MESSAGE_PUMP_UV_H_
#define BASE_MESSAGE_PUMP_UV_H_
#pragma once

#include "base/message_pump.h"
#include "base/time.h"
#include "base/base_export.h"
#include "third_party/libuv/include/uv.h"

namespace base {

class BASE_EXPORT MessagePumpUV : public MessagePump {
 public:
  MessagePumpUV();

  // MessagePump methods:
  virtual void Run(Delegate* delegate) OVERRIDE;
  virtual void Quit() OVERRIDE;
  virtual void ScheduleWork() OVERRIDE;
  virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time) OVERRIDE;

 private:
  virtual ~MessagePumpUV();

  // This flag is set to false when Run should return.
  bool keep_running_;

  struct uv_async_s wakeup_event_;

  TimeTicks delayed_work_time_;

  DISALLOW_COPY_AND_ASSIGN(MessagePumpUV);
};

}  // namespace base

#endif  // BASE_MESSAGE_PUMP_UV_H_

Put destructor to private according to chromium style


//
//  APIConstant.h
//  PHPHub
//
//  Created by Aufree on 9/30/15.
//  Copyright (c) 2015 ESTGroup. All rights reserved.
//

#define APIAccessTokenURL [NSString stringWithFormat:@"%@%@", APIBaseURL, @"/oauth/access_token"]
#define QiniuUploadTokenIdentifier @"QiniuUploadTokenIdentifier"

#if DEBUG
#define APIBaseURL      @"https://staging_api.phphub.org"
#else
#define APIBaseURL      @"https://api.phphub.org"
#endif

#define PHPHubHost      @"phphub.org"
#define PHPHubUrl       @"https://phphub.org/"
#define GitHubURL       @"https://github.com/"
#define TwitterURL      @"https://twitter.com/"
#define ProjectURL      @"https://github.com/phphub/phphub-ios"
#define AboutPageURL    @"https://phphub.org/about"
#define ESTGroupURL     @"http://est-group.org"
#define PHPHubGuide     @"https://phphub.org/helps/qr-login-guide"
#define PHPHubTopicURL  @"https://phphub.org/topics/"
#define SinaRedirectURL @"http://sns.whalecloud.com/sina2/callback"

//
//  APIConstant.h
//  PHPHub
//
//  Created by Aufree on 9/30/15.
//  Copyright (c) 2015 ESTGroup. All rights reserved.
//

#define APIAccessTokenURL [NSString stringWithFormat:@"%@%@", APIBaseURL, @"/oauth/access_token"]
#define QiniuUploadTokenIdentifier @"QiniuUploadTokenIdentifier"

#if DEBUG
#define APIBaseURL      @"https://staging_api.phphub.org"
#else
#define APIBaseURL      @"https://api.phphub.org"
#endif

#define PHPHubHost      @"phphub.org"
#define PHPHubUrl       @"https://phphub.org/"
#define GitHubURL       @"https://github.com/"
#define TwitterURL      @"https://twitter.com/"
#define ProjectURL      @"https://github.com/phphub/phphub-ios"
#define AboutPageURL    @"https://phphub.org/about"
#define ESTGroupURL     @"http://est-group.org"
#define PHPHubGuide     @"http://7xnqwn.com1.z0.glb.clouddn.com/index.html"
#define PHPHubTopicURL  @"https://phphub.org/topics/"
#define SinaRedirectURL @"http://sns.whalecloud.com/sina2/callback"

Change scan to login guide url

Change scan to login guide url


/**
 * Mutex management astraction layer
 */
#ifndef EPYX_MUTEX_H
#define EPYX_MUTEX_H

#include <pthread.h>
#include "exception.h"

namespace Epyx
{
    class Mutex
    {
    private:
        pthread_mutex_t mutex;

    public:
        inline Mutex ()
        {
            int status = pthread_mutex_init (&(this->mutex), NULL);
            if (status)
                throw FailException("Mutex", "pthread_mutex init error");
        }

        inline ~Mutex ()
        {
            int status = pthread_mutex_destroy (&(this->mutex));
            if (status)
                throw FailException("Mutex", "pthread_mutex destroy error");
        }

        inline void lock ()
        {
            int status = pthread_mutex_lock (&(this->mutex));
            if (status)
                throw FailException("Mutex", "pthread_mutex lock error");
        }

        inline void unlock ()
        {
            int status = pthread_mutex_unlock (&(this->mutex));
            if (status)
                throw FailException("Mutex", "pthread_mutex unlock error");
        }
    };
}

#endif /* EPYX_THREAD_H */

/**
 * Mutex management astraction layer
 */
#ifndef EPYX_MUTEX_H
#define EPYX_MUTEX_H

#include <pthread.h>
#include "exception.h"

namespace Epyx
{
    class Mutex
    {
    private:
        pthread_mutex_t mutex;

        // Disable copy construction and assignment.
        Mutex (const Mutex&);
        const Mutex &operator = (const Mutex&);

    public:
        inline Mutex ()
        {
            int status = pthread_mutex_init (&(this->mutex), NULL);
            if (status)
                throw FailException("Mutex", "pthread_mutex init error");
        }

        inline ~Mutex ()
        {
            int status = pthread_mutex_destroy (&(this->mutex));
            if (status)
                throw FailException("Mutex", "pthread_mutex destroy error");
        }

        inline void lock ()
        {
            int status = pthread_mutex_lock (&(this->mutex));
            if (status)
                throw FailException("Mutex", "pthread_mutex lock error");
        }

        inline void unlock ()
        {
            int status = pthread_mutex_unlock (&(this->mutex));
            if (status)
                throw FailException("Mutex", "pthread_mutex unlock error");
        }
    };
}

#endif /* EPYX_THREAD_H */

Disable copy on Mutex objects

Disable copy on Mutex objects


#define GET_CLASS_INFO_EXTENDS(extends, ...)    \
    extends

#define GET_CLASS_INFO_IMPLEMENTS(x, y, implements...)   \
    implements

#define GET_CLASS_INFO_NB_IMPLEMENTS(x, nb, ...)        \
    nb

#define GET_CLASS_INFO(what, extends, nbInter, interfaces...)       \
    GET_CLASS_INFO_ ## what(extends, nbInter, ##interfaces)

#define CLASS_INFO_String(what)                 \
    GET_CLASS_INFO(what, Object, 1, toString)

#define CLASS_INFO(name, what)                  \
    CLASS_INFO_ ## name(what)

CLASS_INFO(String, EXTENDS)
CLASS_INFO(String, IMPLEMENTS)
CLASS_INFO(String, NB_IMPLEMENTS)

#define GET_CLASS_INFO_EXTENDS(extends, ...)    \
    extends

#define GET_CLASS_INFO_IMPLEMENTS(x, y, implements...)   \
    implements

#define GET_CLASS_INFO_NB_IMPLEMENTS(x, nb, ...)        \
    nb

#define CLASS_INFO_String(what)                 \
    GET_CLASS_INFO_ ## what(Object, 2, toString, Serializable)

#define CLASS_INFO(name, what)                  \
    CLASS_INFO_ ## name(what)

CLASS_INFO(String, EXTENDS)
CLASS_INFO(String, NB_IMPLEMENTS)
CLASS_INFO(String, IMPLEMENTS)

Improve new file in future

Improve new file in future


/* Copyright 2015 The TensorFlow Authors. 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.
==============================================================================*/

#ifndef TENSORFLOW_PLATFORM_REGEXP_H_
#define TENSORFLOW_PLATFORM_REGEXP_H_

#include "tensorflow/core/platform/platform.h"
#include "tensorflow/core/platform/types.h"

#if defined(PLATFORM_GOOGLE) || defined(PLATFORM_GOOGLE_ANDROID) || \
    defined(GOOGLE_RE2)
#include "tensorflow/core/platform/google/build_config/re2.h"
namespace tensorflow {
typedef ::StringPiece RegexpStringPiece;
}  // namespace tensorflow

#else

#include "re2/re2.h"
namespace tensorflow {
typedef re2::StringPiece RegexpStringPiece;
}  // namespace tensorflow

#endif

#endif  // TENSORFLOW_PLATFORM_REGEXP_H_

/* Copyright 2015 The TensorFlow Authors. 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.
==============================================================================*/

#ifndef TENSORFLOW_PLATFORM_REGEXP_H_
#define TENSORFLOW_PLATFORM_REGEXP_H_

#include "absl/strings/string_view.h"
#include "tensorflow/core/platform/platform.h"
#include "tensorflow/core/platform/types.h"

#if defined(PLATFORM_GOOGLE) || defined(PLATFORM_GOOGLE_ANDROID) || \
    defined(GOOGLE_RE2)
#include "tensorflow/core/platform/google/build_config/re2.h"
namespace tensorflow {
typedef absl::string_view RegexpStringPiece;
}  // namespace tensorflow

#else

#include "re2/re2.h"
namespace tensorflow {
typedef re2::StringPiece RegexpStringPiece;
}  // namespace tensorflow

#endif

#endif  // TENSORFLOW_PLATFORM_REGEXP_H_

Migrate ::StringPiece to absl::string_view. PiperOrigin-RevId: 222828687


#pragma once

#include "drake/drakeOptimization_export.h"

#include "drake/solvers/MathematicalProgram.h"

namespace drake {
namespace solvers {

class DRAKEOPTIMIZATION_EXPORT LinearSystemSolver :
      public MathematicalProgramSolverInterface  {
 public:
  // This solver is implemented in various pieces depending on if
  // Ipopt was available during compilation.
  bool available() const override;
  SolutionResult Solve(OptimizationProblem& prog) const override;
};

}  // namespace solvers
}  // namespace drake

#pragma once

#include "drake/drakeOptimization_export.h"

#include "drake/solvers/MathematicalProgram.h"

namespace drake {
namespace solvers {

class DRAKEOPTIMIZATION_EXPORT LinearSystemSolver :
      public MathematicalProgramSolverInterface  {
 public:
  bool available() const override;
  SolutionResult Solve(OptimizationProblem& prog) const override;
};

}  // namespace solvers
}  // namespace drake

Remove errant comment from copypasta

Remove errant comment from copypasta


/*
 * Copyright (c) 2014-2015, NVIDIA CORPORATION
 * Copyright (c) 2015, Nuno Subtil <subtil@gmail.com>
 * Copyright (c) 2015, Roche Molecular Systems Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *    * Redistributions of source code must retain the above copyright
 *      notice, this list of conditions and the following disclaimer.
 *    * 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.
 *    * Neither the name of the copyright holders 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 HOLDERS 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.
 */

#pragma once

#include "../types.h"

namespace lift {

// perform a binary search on a sorted array
// returns the index of any element in the array that is equal to val, or -1 if not found
template <typename T>
CUDA_HOST_DEVICE uint32 binary_search(const T *data, uint32 size, const T val)
{
    uint32 first = 0;
    uint32 last = size;

    while(last - first > 0)
    {
        uint32 i = first + ((last - first) / 2);

        if (data[i] == val)
            return i;

        if (data[i] < val)
        {
            if (i == first)
            {
                first++;
            } else {
                first = i;
            }
        } else {
            if (i == last)
            {
                last--;
            } else {
                last = i;
            }
        }
    }

    return uint32(-1);
}

} // namespace lift

Add basic binary search implementation

algorithms: Add basic binary search implementation


/*
 * QLogic iSCSI HBA Driver
 * Copyright (c)  2003-2010 QLogic Corporation
 *
 * See LICENSE.qla4xxx for copyright and licensing details.
 */

#define QLA4XXX_DRIVER_VERSION	"5.02.00-k15"

/*
 * QLogic iSCSI HBA Driver
 * Copyright (c)  2003-2010 QLogic Corporation
 *
 * See LICENSE.qla4xxx for copyright and licensing details.
 */

#define QLA4XXX_DRIVER_VERSION	"5.02.00-k16"

Update driver version to 5.02.00-k16

[SCSI] qla4xxx: Update driver version to 5.02.00-k16

Signed-off-by: Vikas Chaudhary <c251871a64d7d31888eace0406cb3d4c419d5f73@qlogic.com>
Signed-off-by: James Bottomley <1acebbdca565c7b6b638bdc23b58b5610d1a56b8@Parallels.com>


/*
 * QLogic iSCSI HBA Driver
 * Copyright (c)  2003-2012 QLogic Corporation
 *
 * See LICENSE.qla4xxx for copyright and licensing details.
 */

#define QLA4XXX_DRIVER_VERSION	"5.02.00-k20"

/*
 * QLogic iSCSI HBA Driver
 * Copyright (c)  2003-2012 QLogic Corporation
 *
 * See LICENSE.qla4xxx for copyright and licensing details.
 */

#define QLA4XXX_DRIVER_VERSION	"5.03.00-k0"

Update driver version to 5.03.00-k0

[SCSI] qla4xxx: Update driver version to 5.03.00-k0

Signed-off-by: Vikas Chaudhary <c251871a64d7d31888eace0406cb3d4c419d5f73@qlogic.com>
Signed-off-by: James Bottomley <1acebbdca565c7b6b638bdc23b58b5610d1a56b8@Parallels.com>


#include <pthread.h>

struct __anonstruct_PQUEUE_63 {
   int closed ;
   pthread_mutex_t mtx ;
};
typedef struct __anonstruct_PQUEUE_63 PQUEUE;

PQUEUE pqb;

int pqueue_init(PQUEUE *qp)
{
  qp->closed = 0;
  pthread_mutex_init(& qp->mtx, NULL);
  return (0);
}

void pqueue_close(PQUEUE *qp )
{
  pthread_mutex_lock(& qp->mtx);
  qp->closed = 1;
  pthread_mutex_unlock(& qp->mtx);
  return;
}

int pqueue_put(PQUEUE *qp)
{
  pthread_mutex_lock(& qp->mtx);
  if (qp->closed) {
    // pfscan actually has a bug and is missing the following unlock at early return
    // pthread_mutex_unlock(& qp->mtx);

    return (0);
  }
  pthread_mutex_unlock(& qp->mtx);
  return (1);
}

void *worker(void *arg )
{
  return NULL;
}

int main(int argc , char **argv )
{
  pthread_t tid;

  PQUEUE *qp = &pqb;
  pqueue_init(& pqb);
  pthread_create(& tid, NULL, & worker, NULL);

  for (int i = 1; i < argc; i++) {
    pqueue_put(& pqb);
  }

  pqueue_close(& pqb);
  return 0;
}

Add minimal pfscan regression test due to combine problem


//PARAM: --enable ana.int.def_exc
#include<assert.h>

int main() {
  unsigned int top;
  unsigned int x;
  top = 7;
  if (top == 3){
    return 0;
  }

  x = top * 1073741824u;
  assert(x != 3221225472u); // UNKNOWN!
  return 0;
}

Add failing test case for multiplication with DefExc


#include <stdio.h>
#include <stdlib.h>
#include "chplcomm.h"
#include "chplexit.h"
#include "chplmem.h"
#include "chplrt.h"
#include "gdb.h"

#undef exit

static void _chpl_exit_common(int status, int all) {
  fflush(stdout);
  fflush(stderr);
  if (status != 0) {
    gdbShouldBreakHere();
  }
  if (all) {
    exitChplThreads();         // tear down the threads
  }
  if (all) {
    _chpl_comm_barrier("_chpl_comm_exit_all");
    _chpl_comm_exit_all(status);
  } else {
    _chpl_comm_exit_any(status);
  }
  exit(status);
}

void _chpl_exit_all(int status) {
  printFinalMemStat(0, 0);   // print the final memory statistics
  _chpl_exit_common(status, 1);
}

void _chpl_exit_any(int status) {
  _chpl_exit_common(status, 0);
}

#include <stdio.h>
#include <stdlib.h>
#include "chplcomm.h"
#include "chplexit.h"
#include "chplmem.h"
#include "chplrt.h"
#include "gdb.h"

#undef exit

static void _chpl_exit_common(int status, int all) {
  fflush(stdout);
  fflush(stderr);
  if (status != 0) {
    gdbShouldBreakHere();
  }
  if (all) {
    _chpl_comm_barrier("_chpl_comm_exit_all");
    exitChplThreads();         // tear down the threads
    _chpl_comm_exit_all(status);
  } else {
    _chpl_comm_exit_any(status);
  }
  exit(status);
}

void _chpl_exit_all(int status) {
  printFinalMemStat(0, 0);   // print the final memory statistics
  _chpl_exit_common(status, 1);
}

void _chpl_exit_any(int status) {
  _chpl_exit_common(status, 0);
}

Move a call to exitChplThreads() to after the final barrier

When it was before the barrier, all nodes except 0 called it very early, but
it should only be called at the very end of execution.

git-svn-id: 88467cb1fb04b8a755be7e1ee1026be4190196ef@15138 3a8e244f-b0f2-452b-bcba-4c88e055c3ca


/*
 *  Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

#ifndef WEBRTC_EXPERIMENTS_H_
#define WEBRTC_EXPERIMENTS_H_

#include "webrtc/typedefs.h"

namespace webrtc {
struct RemoteBitrateEstimatorMinRate {
  RemoteBitrateEstimatorMinRate() : min_rate(30000) {}
  RemoteBitrateEstimatorMinRate(uint32_t min_rate) : min_rate(min_rate) {}

  uint32_t min_rate;
};

struct SkipEncodingUnusedStreams {
  SkipEncodingUnusedStreams() : enabled(false) {}
  explicit SkipEncodingUnusedStreams(bool set_enabled)
    : enabled(set_enabled) {}
  virtual ~SkipEncodingUnusedStreams() {}

  const bool enabled;
};

struct AimdRemoteRateControl {
  AimdRemoteRateControl() : enabled(false) {}
  explicit AimdRemoteRateControl(bool set_enabled)
    : enabled(set_enabled) {}
  virtual ~AimdRemoteRateControl() {}

  const bool enabled;
};
}  // namespace webrtc
#endif  // WEBRTC_EXPERIMENTS_H_

/*
 *  Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

#ifndef WEBRTC_EXPERIMENTS_H_
#define WEBRTC_EXPERIMENTS_H_

#include "webrtc/typedefs.h"

namespace webrtc {
struct RemoteBitrateEstimatorMinRate {
  RemoteBitrateEstimatorMinRate() : min_rate(30000) {}
  RemoteBitrateEstimatorMinRate(uint32_t min_rate) : min_rate(min_rate) {}

  uint32_t min_rate;
};

struct AimdRemoteRateControl {
  AimdRemoteRateControl() : enabled(false) {}
  explicit AimdRemoteRateControl(bool set_enabled)
    : enabled(set_enabled) {}
  virtual ~AimdRemoteRateControl() {}

  const bool enabled;
};
}  // namespace webrtc
#endif  // WEBRTC_EXPERIMENTS_H_

Remove no longer used SkipEncodingUnusedStreams.

R=andrew@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/18829004

git-svn-id: 917f5d3ca488f358c4d40eaec14422cf392ccec9@6753 4adac7df-926f-26a2-2b94-8c16560cd09d


#ifndef PSTDALIGN_H
#define PSTDALIGN_H

#ifndef __alignas_is_defined
#ifndef __cplusplus

#if ((__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 7)) || defined(__IBMC__)
#undef PORTABLE_C11_STDALIGN_MISSING
#define PORTABLE_C11_STDALIGN_MISSING
#endif

#if (defined(__STDC__) && __STDC__ && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) && \
    !defined(PORTABLE_C11_STDALIGN_MISSING)
/* C11 or newer */
#include <stdalign.h>

#else

#if defined(__GNUC__) || defined (__IBMC__) || defined(__clang__)
#define _Alignas(t) __attribute__((__aligned__(t)))
#define _Alignof(t) __alignof__(t)
#elif defined(_MSC_VER)
#define _Alignas(t) __declspec (align(t))
#define _Alignof(t) __alignof(t)
#define alignas _Alignas
#define alignof _Alignof

#define __alignas_is_defined 1
#define __alignof_is_defined 1

#else
#error please update pstdalign.h with support for current compiler
#endif

#endif /* __STDC__ */

#endif /* __cplusplus */
#endif /* __alignas__is_defined */
#endif /* PSTDALIGN_H */

#ifndef PSTDALIGN_H
#define PSTDALIGN_H

#ifndef __alignas_is_defined
#ifndef __cplusplus

#if ((defined(__GNUC__) && ((__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 7))) || defined(__IBMC__))
#undef PORTABLE_C11_STDALIGN_MISSING
#define PORTABLE_C11_STDALIGN_MISSING
#endif

#if (defined(__STDC__) && __STDC__ && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) && \
    !defined(PORTABLE_C11_STDALIGN_MISSING)
/* C11 or newer */
#include <stdalign.h>

#else

#if defined(__GNUC__) || defined (__IBMC__) || defined(__clang__)
#define _Alignas(t) __attribute__((__aligned__(t)))
#define _Alignof(t) __alignof__(t)
#elif defined(_MSC_VER)
#define _Alignas(t) __declspec (align(t))
#define _Alignof(t) __alignof(t)
#define alignas _Alignas
#define alignof _Alignof

#define __alignas_is_defined 1
#define __alignof_is_defined 1

#else
#error please update pstdalign.h with support for current compiler
#endif

#endif /* __STDC__ */

#endif /* __cplusplus */
#endif /* __alignas__is_defined */
#endif /* PSTDALIGN_H */

Check for GCC before checking version

Check for GCC before checking version


#include_next <string.h>

#ifndef LIBCRYPTOCOMPAT_STRING_H
#define LIBCRYPTOCOMPAT_STRING_H

#include <sys/types.h>

#ifdef __sun
/* Some functions historically defined in string.h were placed in strings.h by
 * SUS. Use the same hack as OS X and FreeBSD use to work around on Solaris.
 */
#include <strings.h>
#endif

size_t strlcpy(char *dst, const char *src, size_t siz);

size_t strlcat(char *dst, const char *src, size_t siz);

void explicit_bzero(void *, size_t);

int timingsafe_bcmp(const void *b1, const void *b2, size_t n);

int timingsafe_memcmp(const void *b1, const void *b2, size_t len);

#ifdef __pnacl__
inline int strncasecmp(const char *str1, const char *str2, size_t n) {
  size_t i = 0;
  for(; str1[i] == str2[i] &&
        str1[i] != '\0' && str2[i] != '\0' &&
        i < n; ++i) { }
  return (int)(str1[i] - str2[i]);
}
inline int strcasecmp(const char *str1, const char *str2) {
  size_t i = 0;
  for(; str1[i] == str2[i] &&
        str1[i] != '\0' && str2[i] != '\0'; ++i) { }
  return (int)(str1[i] - str2[i]);
}
#endif /* __pnacl__ */

#endif

#include_next <string.h>

#ifndef LIBCRYPTOCOMPAT_STRING_H
#define LIBCRYPTOCOMPAT_STRING_H

#include <sys/types.h>

#ifdef __sun
/* Some functions historically defined in string.h were placed in strings.h by
 * SUS. Use the same hack as OS X and FreeBSD use to work around on Solaris.
 */
#include <strings.h>
#endif

size_t strlcpy(char *dst, const char *src, size_t siz);

size_t strlcat(char *dst, const char *src, size_t siz);

void explicit_bzero(void *, size_t);

int timingsafe_bcmp(const void *b1, const void *b2, size_t n);

int timingsafe_memcmp(const void *b1, const void *b2, size_t len);

#endif

Fix multiple def errors for strcasecmp && strncasecmp.


/*************************************************************************/
/* Copyright (c) 2004                                                    */
/* Daniel Sleator, David Temperley, and John Lafferty                    */
/* Copyright (c) 2014 Linas Vepstas                                      */
/* All rights reserved                                                   */
/*                                                                       */
/* Use of the link grammar parsing system is subject to the terms of the */
/* license set forth in the LICENSE file included with this software.    */
/* This license allows free redistribution and use in source and binary  */
/* forms, with or without modification, subject to certain conditions.   */
/*                                                                       */
/*************************************************************************/

#include "dict-api.h"
#include "structures.h"

/* The structure below stores a list of dictionary word files. */
struct Word_file_struct
{
	Word_file * next;
	const char *file;    /* the file name */
	bool changed;        /* TRUE if this file has been changed */
};

void free_Word_file(Word_file * wf);

Dict_node * read_word_file(Dictionary dict, Dict_node * dn, char * filename);

/*************************************************************************/
/* Copyright (c) 2004                                                    */
/* Daniel Sleator, David Temperley, and John Lafferty                    */
/* Copyright (c) 2014 Linas Vepstas                                      */
/* All rights reserved                                                   */
/*                                                                       */
/* Use of the link grammar parsing system is subject to the terms of the */
/* license set forth in the LICENSE file included with this software.    */
/* This license allows free redistribution and use in source and binary  */
/* forms, with or without modification, subject to certain conditions.   */
/*                                                                       */
/*************************************************************************/

#include "dict-api.h"
#include "structures.h"

/* The structure below stores a list of dictionary word files. */
struct Word_file_struct
{
	Word_file * next;
	const char *file;    /* the file name */
	bool changed;        /* TRUE if this file has been changed (XXX unused) */
};

void free_Word_file(Word_file * wf);

Dict_node * read_word_file(Dictionary dict, Dict_node * dn, char * filename);

Add a comment that "changed" is unused.

Word_file_struct: Add a comment that "changed" is unused.


/*
Copyright (c) 2013 Daniele Bartolini, Michele Rossi
Copyright (c) 2012 Daniele Bartolini, Simone Boscaratto

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/

#pragma once

#include "string_utils.h"

namespace crown
{

/// Helper for parsing command line.
struct CommandLine
{
	CommandLine(int argc, char** argv)
		: _argc(argc)
		, _argv(argv)
	{
	}

	int find_argument(const char* longopt, char shortopt)
	{
		for (int i = 0; i < _argc; i++)
		{
			if ((shortopt != '\0' && string::strlen(_argv[i]) > 1 && _argv[i][0] == '-' && _argv[i][1] == shortopt) ||
				(string::strlen(_argv[i]) > 2 && _argv[i][0] == '-' && _argv[i][1] == '-' && string::strcmp(&_argv[i][2], longopt) == 0))
			{
				return i;
			}
		}

		return _argc;
	}

	const char* get_parameter(const char* longopt, char shortopt = '\0')
	{
		int argc = find_argument(longopt, shortopt);
		return argc < _argc ? _argv[argc + 1] : NULL;
	}

	bool has_argument(const char* longopt, char shortopt = '\0')
	{
		return find_argument(longopt, shortopt) < _argc;
	}

private:

	int _argc;
	char** _argv;
};

} // namespace crown

Add CommandLine for easier command line parsing


/*
 * Copyright (c) 2013 Red Hat.
 *
 * 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 program 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 General Public License
 * for more details.
 */
#ifndef AVAHI_H
#define AVAHI_H

typedef struct __pmServerPresence __pmServerPresence;

void __pmServerAvahiAdvertisePresence(__pmServerPresence *) _PCP_HIDDEN;
void __pmServerAvahiUnadvertisePresence(__pmServerPresence *) _PCP_HIDDEN;

int __pmAvahiDiscoverServices(const char *, int, char ***) _PCP_HIDDEN;

#endif /* AVAHI_H */

/*
 * Copyright (c) 2013 Red Hat.
 *
 * 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 program 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 General Public License
 * for more details.
 */
#ifndef AVAHI_H
#define AVAHI_H

void __pmServerAvahiAdvertisePresence(__pmServerPresence *) _PCP_HIDDEN;
void __pmServerAvahiUnadvertisePresence(__pmServerPresence *) _PCP_HIDDEN;

int __pmAvahiDiscoverServices(const char *, int, char ***) _PCP_HIDDEN;

#endif /* AVAHI_H */

Remove a duplicate definition of __pmServerPresence


#include <stdio.h>
#include <stdlib.h>

const int N = 1e4;

void
isort(int *ns, int n)
{
    int i, j, key;

    for(i = 1; i < n; i++) {
        key = ns[i];
        for(j = i-1; j >= 0 && key < ns[j]; j--)
            ns[j+1] = ns[j];
        ns[j+1] = key;
    }
}

int
main(void)
{
    int i;
    int *ns = malloc(sizeof(int)*N);
    for(i = 0; i < N; i++) {
        ns[i] = N-i;
    }

    isort(ns, N);

    for(i = 0; i < N; i++) {
        if(ns[i] != i+1) {
            fprintf(stderr, "Index %d is %d, expected %d.\n", i, ns[i], i+1);
            exit(EXIT_FAILURE);
        }
    }

    return EXIT_SUCCESS;
}

Add C implementation of insertion sort.

Add C implementation of insertion sort.


/*
 * linux/include/asm-arm/arch-iop3xx/timex.h
 *
 * IOP3xx architecture timex specifications
 */
#include <linux/config.h>

#if defined(CONFIG_ARCH_IQ80321) || defined(CONFIG_ARCH_IQ31244)

#define CLOCK_TICK_RATE IOP321_TICK_RATE

#elif defined(CONFIG_ARCH_IQ80331) || defined(CONFIG_MACH_IQ80332)

#define CLOCK_TICK_RATE IOP331_TICK_RATE

#else

#error "No IOP3xx timex information for this architecture"

#endif

/*
 * linux/include/asm-arm/arch-iop3xx/timex.h
 *
 * IOP3xx architecture timex specifications
 */
#include <linux/config.h>
#include <asm/hardware.h>

#if defined(CONFIG_ARCH_IQ80321) || defined(CONFIG_ARCH_IQ31244)

#define CLOCK_TICK_RATE IOP321_TICK_RATE

#elif defined(CONFIG_ARCH_IQ80331) || defined(CONFIG_MACH_IQ80332)

#define CLOCK_TICK_RATE IOP331_TICK_RATE

#else

#error "No IOP3xx timex information for this architecture"

#endif

[ARM] 3173/1: Fix to allow 2.6.15-rc2 to compile for IOP3xx boards

Patch from Adam Brooks

Fixes an issue in 2.6.15-rc2 that prevented compilation of kernels for IOP3xx boards.

Signed-off-by: Adam Brooks <09361c82a05d8914f37dd480ca8e6220ace11550@intel.com>
Signed-off-by: Russell King <f6aa0246ff943bfa8602cdf60d40c481b38ed232@arm.linux.org.uk>


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>

#include <saneopt.h>

void test_no_arg() {
  char** argv;

  saneopt_t* opt = saneopt_init(0, argv);
  assert(saneopt_get(opt, "no-option") == NULL);

  free(opt);
}

void test_no_value() {
  char** argv = malloc(1 * sizeof(char*));

  argv[0] = "--option";

  saneopt_t* opt = saneopt_init(1, argv);
  assert(strcmp(saneopt_get(opt, "option"), "") == 0);

  free(argv);
  free(opt);
}

void test_value() {
  char** argv = malloc(4 * sizeof(char*));

  argv[0] = "--option";
  argv[1] = "value";
  argv[2] = "--next-option";
  argv[3] = "--third-option";

  saneopt_t* opt = saneopt_init(4, argv);
  assert(strcmp(saneopt_get(opt, "option"), "value") == 0);
  assert(strcmp(saneopt_get(opt, "next-option"), "") == 0);
  assert(strcmp(saneopt_get(opt, "third-option"), "") == 0);

  free(argv);
  free(opt);
}

int main(int argc, char** argv) {
  test_no_arg();
  test_no_value();
  test_value();

  return 0;
}

Add a bunch of tests

[test] Add a bunch of tests


#include <stdio.h>
#include <sys/sysinfo.h>
#include <stdint.h>

uint64_t get_memory_size()
{
	struct sysinfo info;
	sysinfo( &info );
	printf("total ram %lu, mem units %lu\n", (size_t)info.totalram, (size_t)info.mem_unit);
	return (size_t)info.totalram * (size_t)info.mem_unit;
}

int main(int argc, char* argv[])
{
	uint64_t total_memory = get_memory_size();
	printf("Total physical memory: %lu\n", total_memory);
	return 0;
}

Add memory size info example

Add memory size info example


//
//  IGIdenticon.h
//  IGIdenticon
//
//  Created by Evgeniy Yurtaev on 29/07/15.
//  Copyright (c) 2015 Evgeniy Yurtaev. All rights reserved.
//

#import "IGImageGenerator.h"
#import "IGSimpleIdenticon.h"
#import "IGGitHubIdenticon.h"
#import "IGHashFunctions.h"

Add header which imports all files

Add header which imports all files


/* include files for the package output */

#include "CDatum.h"
#include "COutput.h"
#include "COutputLine.h"
#include "COutputList.h"
#include "COutputEvent.h"
#include "CNodeO.h"
#include "CUDFunction.h"
#include "CUDFunctionDB.h"

Add 3 new classes about User Defined Functions


//
//  log_thread.h
//

#ifndef log_thread_h
#define log_thread_h

#include "queue_atomic.h"

struct log_thread;
typedef std::shared_ptr<log_thread> log_thread_ptr;

#define LOG_BUFFER_SIZE 1024

struct log_thread : std::thread
{
    static const bool               debug;
    static const int                flush_interval_msecs;

    FILE*                           file;
    const size_t                    num_buffers;
    queue_atomic<char*>             log_buffers_free;
    queue_atomic<char*>             log_buffers_inuse;
    time_t                          last_time;
    std::atomic<bool>               running;
    std::atomic<bool>               writer_waiting;
    std::thread                     thread;
    std::mutex                      log_mutex;
    std::condition_variable         log_cond;
    std::condition_variable         writer_cond;

    log_thread(int fd, size_t num_buffers);
    virtual ~log_thread();

    void shutdown();
    void create_buffers();
    void delete_buffers();
    void log(time_t current_time, const char* message);
    void write_logs();
    void mainloop();
};

#endif

//
//  log_thread.h
//

#ifndef log_thread_h
#define log_thread_h

#include "queue_atomic.h"

struct log_thread;
typedef std::shared_ptr<log_thread> log_thread_ptr;

#define LOG_BUFFER_SIZE 1024

struct log_thread : std::thread
{
    static const bool               debug;
    static const int                flush_interval_msecs;

    FILE*                           file;
    const size_t                    num_buffers;
    queue_atomic<char*>             log_buffers_free;
    queue_atomic<char*>             log_buffers_inuse;
    time_t                          last_time;
    std::atomic<bool>               running;
    std::atomic<bool>               writer_waiting;
    std::mutex                      log_mutex;
    std::condition_variable         log_cond;
    std::condition_variable         writer_cond;
    std::thread                     thread;

    log_thread(int fd, size_t num_buffers);
    virtual ~log_thread();

    void shutdown();
    void create_buffers();
    void delete_buffers();
    void log(time_t current_time, const char* message);
    void write_logs();
    void mainloop();
};

#endif

Fix thread initialisation race (thread sanitizer)


// Copyright 2020 The IREE Authors
//
// Licensed under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

// This files defines a helper to trigger the registration of dialects to
// the system.

#ifndef IREE_TOOLS_INIT_XLA_DIALECTS_H_
#define IREE_TOOLS_INIT_XLA_DIALECTS_H_

#include "mlir-hlo/Dialect/mhlo/IR/chlo_ops.h"
#include "mlir-hlo/Dialect/mhlo/IR/hlo_ops.h"
#include "mlir-hlo/Dialect/mhlo/IR/lhlo_ops.h"
#include "mlir/IR/Dialect.h"

namespace mlir {

// Add all the XLA dialects to the provided registry.
inline void registerXLADialects(DialectRegistry &registry) {
  // clang-format off
  registry.insert<mlir::chlo::HloClientDialect,
                  mlir::lmhlo::LmhloDialect,
                  mlir::mhlo::MhloDialect>();
  // clang-format on
}

}  // namespace mlir

#endif  // IREE_TOOLS_INIT_XLA_DIALECTS_H_

// Copyright 2020 The IREE Authors
//
// Licensed under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

// This files defines a helper to trigger the registration of dialects to
// the system.

#ifndef IREE_TOOLS_INIT_XLA_DIALECTS_H_
#define IREE_TOOLS_INIT_XLA_DIALECTS_H_

#include "mlir-hlo/Dialect/mhlo/IR/chlo_ops.h"
#include "mlir-hlo/Dialect/mhlo/IR/hlo_ops.h"
#include "mlir/IR/Dialect.h"

namespace mlir {

// Add all the XLA dialects to the provided registry.
inline void registerXLADialects(DialectRegistry &registry) {
  // clang-format off
  registry.insert<mlir::chlo::HloClientDialect,
                  mlir::mhlo::MhloDialect>();
  // clang-format on
}

}  // namespace mlir

#endif  // IREE_TOOLS_INIT_XLA_DIALECTS_H_

Move the lhlo dialect into its own directory.

Also remove it from registerAllMhloDialects and make registrations explicit.

PiperOrigin-RevId: 412411838


#include <iostream>
#include <vector>
#include <string>

#include "erosion.h"
#include "dilation.h"
#include "opening.h"
#include "closing.h"
#include "gradient.h"

/** run: A macro to call a function. */
#define run( function, ctype, dim ) \
if ( operation == #function ) \
{ \
  if ( componentType == #ctype && Dimension == dim ) \
  { \
    typedef itk::Image< ctype, dim > ImageType; \
    if ( type == "grayscale" ) \
    { \
      function##Grayscale< ImageType >( inputFileName, outputFileName, radius, boundaryCondition, useCompression ); \
      supported = true; \
    } \
    else if ( type == "binary" ) \
    { \
      function##Binary< ImageType >( inputFileName, outputFileName, radius, bin, useCompression ); \
      supported = true; \
    } \
    else if ( type == "parabolic" ) \
    { \
      function##Parabolic< ImageType >( inputFileName, outputFileName, radius, useCompression ); \
      supported = true; \
    } \
  } \
}

/** run2: A macro to call a function. */
#define run2( function, ctype, dim ) \
if ( operation == #function ) \
{ \
  if ( componentType == #ctype && Dimension == dim ) \
  { \
    typedef itk::Image< ctype, dim > ImageType; \
    function< ImageType >( inputFileName, outputFileName, radius, algorithm, useCompression ); \
    supported = true; \
  } \
}

Fix backslash warning from missing blank line at end of file


//===-- interception_linux.h ------------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file is a part of AddressSanitizer, an address sanity checker.
//
// Windows-specific interception methods.
//===----------------------------------------------------------------------===//

#ifdef _WIN32

#if !defined(INCLUDED_FROM_INTERCEPTION_LIB)
# error "interception_win.h should be included from interception library only"
#endif

#ifndef INTERCEPTION_WIN_H
#define INTERCEPTION_WIN_H

namespace __interception {

// returns true if the old function existed, false on failure.
bool OverrideFunction(uptr old_func, uptr new_func, uptr *orig_old_func);
}  // namespace __interception

#if defined(_DLL)
# define INTERCEPT_FUNCTION_WIN(func) \
    ::__interception::GetRealFunctionAddress( \
        #func, (::__interception::uptr*)&REAL(func))
#else
# define INTERCEPT_FUNCTION_WIN(func) \
    ::__interception::OverrideFunction( \
        (::__interception::uptr)func, \
        (::__interception::uptr)WRAP(func), \
        (::__interception::uptr*)&REAL(func))
#endif

#define INTERCEPT_FUNCTION_VER_WIN(func, symver) \
    INTERCEPT_FUNCTION_WIN(func)

#endif  // INTERCEPTION_WIN_H
#endif  // _WIN32

//===-- interception_linux.h ------------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file is a part of AddressSanitizer, an address sanity checker.
//
// Windows-specific interception methods.
//===----------------------------------------------------------------------===//

#ifdef _WIN32

#if !defined(INCLUDED_FROM_INTERCEPTION_LIB)
# error "interception_win.h should be included from interception library only"
#endif

#ifndef INTERCEPTION_WIN_H
#define INTERCEPTION_WIN_H

namespace __interception {

// returns true if the old function existed, false on failure.
bool OverrideFunction(uptr old_func, uptr new_func, uptr *orig_old_func);
}  // namespace __interception

#if defined(_DLL)
# error Not implemented yet
#else
# define INTERCEPT_FUNCTION_WIN(func) \
    ::__interception::OverrideFunction( \
        (::__interception::uptr)func, \
        (::__interception::uptr)WRAP(func), \
        (::__interception::uptr*)&REAL(func))
#endif

#define INTERCEPT_FUNCTION_VER_WIN(func, symver) \
    INTERCEPT_FUNCTION_WIN(func)

#endif  // INTERCEPTION_WIN_H
#endif  // _WIN32

[ASan/Win] Remove one more reference to __interception::GetRealFunctionAddress (follow-up to r215707)

git-svn-id: c199f293c43da69278bea8e88f92242bf3aa95f7@215722 91177308-0d34-0410-b5e6-96231b3b80d8


#ifndef PYLOGGER_H
#define PYLOGGER_H

#include "Python.h"
#include <string>
#include "cantera/base/logger.h"

namespace Cantera
{

/// Logger for Python.
/// @ingroup textlogs
class Py_Logger : public Logger
{
public:
    Py_Logger() {
        PyRun_SimpleString("import sys");
    }
    virtual ~Py_Logger() {}

    virtual void write(const std::string& s) {
        std::string ss = "sys.stdout.write(\"\"\"";
        ss += s;
        ss += "\"\"\")";
        PyRun_SimpleString(ss.c_str());
        PyRun_SimpleString("sys.stdout.flush()");
    }

    virtual void error(const std::string& msg) {
        std::string err = "raise \""+msg+"\"";
        PyRun_SimpleString((char*)err.c_str());
    }
};
}

#endif

#ifndef PYLOGGER_H
#define PYLOGGER_H

#include "Python.h"
#include <string>
#include "cantera/base/logger.h"

namespace Cantera
{

/// Logger for Python.
/// @ingroup textlogs
class Py_Logger : public Logger
{
public:
    Py_Logger() {
        PyRun_SimpleString("import sys");
    }
    virtual ~Py_Logger() {}

    virtual void write(const std::string& s) {
        std::string ss = "sys.stdout.write(\"\"\"";
        ss += s;
        ss += "\"\"\")";
        PyRun_SimpleString(ss.c_str());
        PyRun_SimpleString("sys.stdout.flush()");
    }

    virtual void error(const std::string& msg) {
        std::string err = "raise Exception(\"\"\""+msg+"\"\"\")";
        PyRun_SimpleString(err.c_str());
    }
};
}

#endif

Fix Py_Logger to raise instances of Exception instead of strings

Raising string exceptions was removed in Python 2.6

git-svn-id: e76dbe14710aecee1ad27675521492cea2578c83@1932 02a645c2-efd0-11dd-984d-ab748d24aa7e


/*
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * 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.
 */

#pragma once

#include <fmt/compile.h>

// Fallback to runtime format string processing for compatibility with fmt 6.x.
#ifndef FMT_COMPILE
#define FMT_COMPILE(format_str) format_str
#endif

/*
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * 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.
 */

#pragma once

#include <fmt/compile.h>

#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ <= 8
// Forcefully disable compiled format strings for GCC 8 & below until fmt is
// updated to do this automatically.
#undef FMT_COMPILE
#endif

// Fallback to runtime format string processing for compatibility with fmt 6.x.
#ifndef FMT_COMPILE
#define FMT_COMPILE(format_str) format_str
#endif

Disable compiled format for GCC 8 & below

Summary: As per title, as fmt doesn't currently handle them well.

Reviewed By: vitaut

Differential Revision: D26004515

fbshipit-source-id: dbbd1e6550fa10c4a6fcb0fc5597887c9411ca70


/*
 * Copyright 2014, NICTA
 *
 * This software may be distributed and modified according to the terms of
 * the BSD 2-Clause license. Note that NO WARRANTY is provided.
 * See "LICENSE_BSD2.txt" for details.
 *
 * @TAG(NICTA_BSD)
 */

#include <camkes.h>
#include <stdio.h>
#include <string.h>
#include <sel4/sel4.h>

int run(void) {
    char *shello = "hello world";

    printf("Starting...\n");
    printf("-----------\n");

    strcpy((void*)DataOut, shello);
    while(!*((char*)DataIn))
        seL4_Yield();
    printf("%s read %s\n", get_instance_name(), (char*)DataIn);
    return 0;
}

/*
 * Copyright 2014, NICTA
 *
 * This software may be distributed and modified according to the terms of
 * the BSD 2-Clause license. Note that NO WARRANTY is provided.
 * See "LICENSE_BSD2.txt" for details.
 *
 * @TAG(NICTA_BSD)
 */

#include <camkes.h>
#include <stdio.h>
#include <string.h>

int run(void) {
    char *shello = "hello world";

    printf("Starting...\n");
    printf("-----------\n");

    strcpy((void*)DataOut, shello);
    while(!*((volatile char*)DataIn));
    printf("%s read %s\n", get_instance_name(), (char*)DataIn);
    return 0;
}

Remove casting away of volatile and explicit call to seL4_Yield.

This commit removes some bad style in this example. In particular, calling a
seL4 system call directly from a CAmkES component is not intended. Additionally
this example cast away the volatility of the dataport pointer. From what I can
see, the only reason the compiler did not optimise away the repeated read of
this pointer was because the loop contained a system call with a contained
unrestricted memory clobber.

Related to JIRA CAMKES-436


#include "visibility.h"
#include "objc/runtime.h"
#include "gc_ops.h"
#include "class.h"
#include <stdlib.h>
#include <stdio.h>

static id allocate_class(Class cls, size_t extraBytes)
{
	intptr_t *addr = calloc(cls->instance_size + extraBytes + sizeof(intptr_t), 1);
	return (id)(addr + 1);
}

static void free_object(id obj)
{
	free((void*)(((intptr_t)obj) - 1));
}

static void *alloc(size_t size)
{
	return calloc(size, 1);
}

PRIVATE struct gc_ops gc_ops_none =
{
	.allocate_class = allocate_class,
	.free_object    = free_object,
	.malloc         = alloc,
	.free           = free
};
PRIVATE struct gc_ops *gc = &gc_ops_none;

PRIVATE BOOL isGCEnabled = NO;

#ifndef ENABLE_GC
PRIVATE void enableGC(BOOL exclusive)
{
	fprintf(stderr, "Attempting to enable garbage collection, but your"
			"Objective-C runtime was built without garbage collection"
			"support\n");
	abort();
}
#endif

#include "visibility.h"
#include "objc/runtime.h"
#include "gc_ops.h"
#include "class.h"
#include <stdlib.h>
#include <stdio.h>

static id allocate_class(Class cls, size_t extraBytes)
{
	intptr_t *addr = calloc(cls->instance_size + extraBytes + sizeof(intptr_t), 1);
	return (id)(addr + 1);
}

static void free_object(id obj)
{
	free((void*)(((intptr_t*)obj) - 1));
}

static void *alloc(size_t size)
{
	return calloc(size, 1);
}

PRIVATE struct gc_ops gc_ops_none =
{
	.allocate_class = allocate_class,
	.free_object    = free_object,
	.malloc         = alloc,
	.free           = free
};
PRIVATE struct gc_ops *gc = &gc_ops_none;

PRIVATE BOOL isGCEnabled = NO;

#ifndef ENABLE_GC
PRIVATE void enableGC(BOOL exclusive)
{
	fprintf(stderr, "Attempting to enable garbage collection, but your"
			"Objective-C runtime was built without garbage collection"
			"support\n");
	abort();
}
#endif

Fix bug spotted by Justin Hibbits.

Fix bug spotted by Justin Hibbits.


/*
 *
 * Copyright 2018 gRPC authors.
 *
 * 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.
 *
 */

#ifndef GRPC_CORE_LIB_SECURITY_SECURITY_CONNECTOR_LOAD_SYSTEM_ROOTS_H
#define GRPC_CORE_LIB_SECURITY_SECURITY_CONNECTOR_LOAD_SYSTEM_ROOTS_H

namespace grpc_core {

// Returns a slice containing roots from the OS trust store
grpc_slice LoadSystemRootCerts();

}  // namespace grpc_core

#endif /* GRPC_CORE_LIB_SECURITY_SECURITY_CONNECTOR_LOAD_SYSTEM_ROOTS_H */

Add newline to end of header

Add newline to end of header


#ifndef __SPU_H__
#define __SPU_H__

typedef enum {
    NONE,
    VOLUME,
    COMPRESSOR,
    DISTORTION,
    OVERDRIVE,
    DELAY,
    REVERB,
    FLANGER,
    EQULIZER,
    BACK,
    EFFECT_TYPE_NUM
} EffectType_t;

void SignalProcessingUnit(void const * argument);

void attachNewEffect(uint32_t stage, EffectType_t effectType);
void demolishEffect(uint32_t stage);

#endif //__SPU_H__

#ifndef __SPU_H__
#define __SPU_H__

typedef enum {
    NONE,
    VOLUME,
    COMPRESSOR,
    DISTORTION,
    OVERDRIVE,
    DELAY,
    REVERB,
    FLANGER,
    EQULIZER,
    EFFECT_TYPE_NUM
} EffectType_t;

void SignalProcessingUnit(void const * argument);

void attachEffect(uint32_t stage, EffectType_t effectType);
const char *cvtToEffectName(EffectType_t ee);

#endif //__SPU_H__

Add Function to get avaliable Effect name


#include "siphash.h"
#include <stdio.h>

int main(void)
{
        uint64_t k0 = 0x0706050403020100ull;
        uint64_t k1 = 0x0f0e0d0c0b0a0908ull;

        uint8_t msg[] = {0x00, 0x01, 0x02, 0x03, 0x04,
                         0x05, 0x06, 0x07, 0x08, 0x09,
                         0x0a, 0x0b, 0x0c, 0x0d, 0x0e};

        uint64_t s = siphash24(k0, k1, msg, sizeof(msg));

        printf("SipHash-2-4 test: 0x%016llx (expected 0x%016llx)\n", s, 0xa129ca6149be45e5ull);

        return 0;
}

Fix test key initialization to be endian-neutral

Signed-off-by: Gregory Petrosyan <60f6837da39a129899062fdb5e652b06dce7deb5@gmail.com>


#ifndef LB_MATRIX_INCLUDED
	typedef struct {
		double* data;
		unsigned int num_rows;
		unsigned int num_cols;
	} Matrix;
	Matrix lb_create_matrix(double* data, unsigned int num_rows, unsigned int num_cols);
	Matrix lb_allocate_matrix(unsigned int num_rows, unsigned int num_cols);

	#define lb_mat_element_ptr(A,i,j) (A.data + j * A.num_cols + i)
	#define lb_mat_element(A,i,j) A.data[j * A.num_cols + i]
	#define lb_mat_row_element(A,row,offset) A.data[offset + row * A.num_cols]
	#define lb_mat_col_element(A,col,offset) A.data[col + offset * A.num_cols]
	#define lb_vec_element_ptr(v,j) v.data + j;
	void lbmm(Matrix A, Matrix B, Matrix result);
	void lbma(Matrix A, Matrix B, Matrix result);
	#define LB_MATRIX_INCLUDED
#endif

#ifndef LB_MATRIX_INCLUDED
	typedef struct {
		double* data;
		unsigned int num_rows;
		unsigned int num_cols;
	} Matrix;
	Matrix lb_create_matrix(double* data, unsigned int num_rows, unsigned int num_cols);
	Matrix lb_allocate_matrix(unsigned int num_rows, unsigned int num_cols);

	#define lb_mat_element_ptr(A,i,j) (A.data + j * A.num_cols + i)
	#define lb_mat_element(A,i,j) A.data[j * A.num_cols + i]
	#define lb_mat_row_element(A,i,j) A.data[i * A.num_cols + j]
	#define lb_mat_col_element(A,i,j) A.data[j * A.num_cols + i]
	#define lb_vec_element_ptr(v,j) v.data + j;
	void lbmm(Matrix A, Matrix B, Matrix result);
	void lbma(Matrix A, Matrix B, Matrix result);
	#define LB_MATRIX_INCLUDED
#endif

Clarify row and column iterators

Clarify row and column iterators


#include <ctype.h>
#include <stdio.h>

#include "debug.h"

#ifndef NDEBUG

const char * const col[] = {MAG, RED, YEL, CYN, BLU, GRN};

regex_t _comp;

// Initialize the regular expression used for restricting debug output
static void __attribute__((constructor)) premain()
{
    if (regcomp(&_comp, DCOMPONENT, REG_EXTENDED | REG_ICASE | REG_NOSUB))
        die("may not be a valid regexp: %s", DCOMPONENT);
}

// And free is again
static void __attribute__((destructor)) postmain() { regfree(&_comp); }

// Print a hexdump of the given block
void hexdump(const void * const ptr, const size_t len)
{
    const uint8_t * const buf = ptr;
    for (uint8_t i = 0; i < len; i += 16) {
        fprintf(stderr, "%06x: ", i);
        for (uint8_t j = 0; j < 16; j++) {
            if (i + j < len)
                fprintf(stderr, "%02hhx ", buf[i + j]);
            else
                fprintf(stderr, "   ");
            fprintf(stderr, " ");
        }
        for (uint8_t j = 0; j < 16; j++) {
            if (i + j < len)
                fprintf(stderr, "%c", isprint(buf[i + j]) ? buf[i + j] : '.');
        }
        fprintf(stderr, "\n");
    }
}

#endif

#include <ctype.h>
#include <stdio.h>

#include "debug.h"

#ifndef NDEBUG

const char * const col[] = {MAG, RED, YEL, CYN, BLU, GRN};

regex_t _comp;

// Initialize the regular expression used for restricting debug output
static void __attribute__((constructor)) premain()
{
    if (regcomp(&_comp, DCOMPONENT, REG_EXTENDED | REG_ICASE | REG_NOSUB))
        die("may not be a valid regexp: %s", DCOMPONENT);
}

// And free is again
static void __attribute__((destructor)) postmain() { regfree(&_comp); }

// Print a hexdump of the given block
void hexdump(const void * const ptr, const size_t len)
{
    const uint8_t * const buf = ptr;
    for (size_t i = 0; i < len; i += 16) {
        fprintf(stderr, "%06lx: ", i);
        for (size_t j = 0; j < 16; j++) {
            if (i + j < len)
                fprintf(stderr, "%02hhx ", buf[i + j]);
            else
                fprintf(stderr, "   ");
            fprintf(stderr, " ");
        }
        for (size_t j = 0; j < 16; j++) {
            if (i + j < len)
                fprintf(stderr, "%c", isprint(buf[i + j]) ? buf[i + j] : '.');
        }
        fprintf(stderr, "\n");
    }
}

#endif

Fix overflow bug introduced in f6b3328f

Fix overflow bug introduced in f6b3328f


// RUN: %clang_cc1 -emit-llvm %s  -o /dev/null

struct foo { int X; };
struct bar { int Y; };

extern int Func(struct foo*) __asm__("Func64");
extern int Func64(struct bar*);

int Func(struct foo *F) {
  return 1;
}

int Func64(struct bar* B) {
  return 0;
}

int test() {
  Func(0);    /* should be renamed to call Func64 */
  Func64(0);
}

// RUN: %clang_cc1 -emit-llvm %s -triple x86_64-apple-darwin -o /dev/null

struct foo { int X; };
struct bar { int Y; };

extern int Func(struct foo*) __asm__("Func64");
extern int Func64(struct bar*);

int Func(struct foo *F) {
  return 1;
}

int Func64(struct bar* B) {
  return 0;
}

int test() {
  Func(0);    /* should be renamed to call Func64 */
  Func64(0);
}

Make this darwin only for now while investigating to clear up x86_64
Release+Asserts linux tests.

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@136223 91177308-0d34-0410-b5e6-96231b3b80d8


// RUN: clang -fsyntax-only %s -verify

x(a) int a; {return a;}
y(b) int b; {return a;} // expected-error {{use of undeclared identifier}}

// PR2332
a(a)int a;{a=10;return a;}

Test from PR2332; bug already fixed by r51311.

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@51316 91177308-0d34-0410-b5e6-96231b3b80d8


#pragma once

#define GLFW_INCLUDE_GLU

#if __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdocumentation"
#endif

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpadded"

# include <GLFW/glfw3.h>

#pragma GCC diagnostic pop

#if __clang__
#pragma clang diagnostic pop
#endif

#pragma once

#define GLFW_INCLUDE_GLU

#if __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdocumentation"
#pragma clang diagnostic ignored "-Wdocumentation-unknown-command"
#endif

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpadded"

# include <GLFW/glfw3.h>

#pragma GCC diagnostic pop

#if __clang__
#pragma clang diagnostic pop
#endif

Disable another warning in GLFW.

Disable another warning in GLFW.


// RUN: not %clang_cc1_only -c %s -o - > /dev/null
// PR 1603
void func()
{
   const int *arr;
   arr[0] = 1;  // expected-error {{assignment of read-only location}}
}

struct foo {
  int bar;
};
struct foo sfoo = { 0 };

int func2()
{
  const struct foo *fp;
  fp = &sfoo;
  fp[0].bar = 1;  // expected-error {{ assignment of read-only member}}
  return sfoo.bar;
}

// RUN: %clang_cc1 -fsyntax-only -verify %s
// PR 1603
void func()
{
   const int *arr;
   arr[0] = 1;  // expected-error {{read-only variable is not assignable}}
}

struct foo {
  int bar;
};
struct foo sfoo = { 0 };

int func2()
{
  const struct foo *fp;
  fp = &sfoo;
  fp[0].bar = 1;  // expected-error {{read-only variable is not assignable}}
  return sfoo.bar;
}

Fix a test that hasn't worked since 2007

Due to a missing -verify, 2007-10-01-BuildArrayRef.c was a no-op.

The message was changed 5 years ago so also update the test to reflect the new wording.

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@196729 91177308-0d34-0410-b5e6-96231b3b80d8


#ifndef MAP_H
#define MAP_H

#include <vector>
#include <map>

#include "DelaunayTriangulation.h"
#include "Structure.h"
#include "QuadTree.h"

#endif

#ifndef MAP_H
#define MAP_H

#include <vector>
#include <map>

#include "DelaunayTriangulation.h"
#include "Structure.h"
#include "QuadTree.h"

using pCenterQT = QuadTree<Center*>;

// Forward Declaration
class Vector2;
namespace Noise
{
	namespace Module
	{
		class Perlin;
	}
}

#endif

Define alias type, forward declaration

Define alias type, forward declaration


//
//  LYRUIMediaAttachment.h
//  LayerSample
//
//  Created by Kevin Coleman on 9/12/14.
//  Copyright (c) 2014 Layer, Inc. All rights reserved.
//

#import <UIKit/UIKit.h>

/**
 @abstract The `LYRUIMediaAttachment` class configures the appropriate size
 for an NSTextAttachment to comfortably fit inside of a LYRUIMessageInputToolbar
 */
@interface LYRUIMediaAttachment : NSTextAttachment

@end

//
//  LYRUIMediaAttachment.h
//  LayerSample
//
//  Created by Kevin Coleman on 9/12/14.
//  Copyright (c) 2014 Layer, Inc. All rights reserved.
//

#import <UIKit/UIKit.h>

/**
 @abstract The `LYRUIMediaAttachment` class configures the appropriate size
 for an NSTextAttachment to comfortably fit inside of a `LYRUIMessageInputToolbar`.
 */
@interface LYRUIMediaAttachment : NSTextAttachment

@end

Add missing backticks and period in media attachment header comment.


#import "BTAnalyticsService.h"
#import "BTAPIClient.h"
#import "BTClientMetadata.h"
#import "BTClientToken.h"
#import "BTHTTP.h"
#import "BTJSON.h"

NS_ASSUME_NONNULL_BEGIN

@class BTPaymentMethodNonce;

@interface BTAPIClient ()

@property (nonatomic, copy, nullable) NSString *tokenizationKey;
@property (nonatomic, strong, nullable) BTClientToken *clientToken;
@property (nonatomic, strong) BTHTTP *http;
@property (nonatomic, strong) BTHTTP *configurationHTTP;

/*!
 @brief Client metadata that is used for tracking the client session
*/
@property (nonatomic, readonly, strong) BTClientMetadata *metadata;

/*!
 @brief Exposed for testing analytics
*/
@property (nonatomic, strong) BTAnalyticsService *analyticsService;

/*!
 @brief Sends this event and all queued analytics events. Used by internal clients.
*/
- (void)sendAnalyticsEvent:(NSString *)eventName;

/*!
 @brief Queues an analytics event to be sent.
 */
- (void)queueAnalyticsEvent:(NSString *)eventName;

/*!
 @brief An internal initializer to toggle whether to send an analytics event during initialization.
 @discussion This prevents copyWithSource:integration: from sending a duplicate event. It can also be used to suppress excessive network chatter during testing.
*/

- (nullable instancetype)initWithAuthorization:(NSString *)authorization sendAnalyticsEvent:(BOOL)sendAnalyticsEvent;

@end

NS_ASSUME_NONNULL_END

#import "BTAnalyticsService.h"
#import "BTAPIClient.h"
#import "BTClientMetadata.h"
#import "BTClientToken.h"
#import "BTHTTP.h"
#import "BTJSON.h"

NS_ASSUME_NONNULL_BEGIN

@class BTPaymentMethodNonce;

@interface BTAPIClient ()

@property (nonatomic, copy, nullable) NSString *tokenizationKey;
@property (nonatomic, strong, nullable) BTClientToken *clientToken;
@property (nonatomic, strong) BTHTTP *http;
@property (nonatomic, strong) BTHTTP *configurationHTTP;

/*!
 @brief Client metadata that is used for tracking the client session
*/
@property (nonatomic, readonly, strong) BTClientMetadata *metadata;

/*!
 @brief Exposed for testing analytics
*/
@property (nonatomic, strong) BTAnalyticsService *analyticsService;

/*!
 @brief Sends this event and all queued analytics events. Use `queueAnalyticsEvent` for low priority events.
*/
- (void)sendAnalyticsEvent:(NSString *)eventName;

/*!
 @brief Queues an analytics event to be sent.
 */
- (void)queueAnalyticsEvent:(NSString *)eventName;

/*!
 @brief An internal initializer to toggle whether to send an analytics event during initialization.
 @discussion This prevents copyWithSource:integration: from sending a duplicate event. It can also be used to suppress excessive network chatter during testing.
*/

- (nullable instancetype)initWithAuthorization:(NSString *)authorization sendAnalyticsEvent:(BOOL)sendAnalyticsEvent;

@end

NS_ASSUME_NONNULL_END

Update header documentation for BTAPIClient-Internal


// SKIP PARAM: --set solver td3 --enable ana.int.interval  --set ana.base.arrays.domain partitioned  --set ana.activated "['base','threadid','threadflag','expRelation','mallocWrapper','apron']" --set ana.base.privatization none --set ana.apron.privatization dummy
// Example from https://www-apr.lip6.fr/~mine/publi/article-mine-HOSC06.pdf
void main(void) {
  int X = 0;
  int N = rand();
  if(N < 0) { N = 0; }

  while(X < N) {
    X++;
  }

  assert(X-N == 0);
  assert(X == N);

  if(X == N) {
    N = 8;
  } else {
    // is dead code but if that is detected or not depends on what we do in branch
    // currently we can't detect this
    N = 42;
  }
}

// SKIP PARAM: --set solver td3 --enable ana.int.interval  --set ana.base.arrays.domain partitioned  --set ana.activated "['base','threadid','threadflag','expRelation','mallocWrapper','apron']" --set ana.base.privatization none --set ana.apron.privatization dummy
// Example from https://www-apr.lip6.fr/~mine/publi/article-mine-HOSC06.pdf
void main(void) {
  int X = 0;
  int N = rand();
  if(N < 0) { N = 0; }

  while(X < N) {
    X++;
  }

  assert(X-N == 0);
  assert(X == N);

  if(X == N) {
    N = 8;
  } else {
    // dead code
    N = 42;
  }

  assert(N == 8);
}

Make assert in 36/01 stronger

Make assert in 36/01 stronger


//
//  CDAUtilities.h
//  ContentfulSDK
//
//  Created by Boris Bügling on 04/03/14.
//
//

#import <ContentfulDeliveryAPI/CDAClient.h>
#import <Foundation/Foundation.h>

NSString* CDACacheFileNameForQuery(CDAClient* client, CDAResourceType resourceType, NSDictionary* query);
NSString* CDACacheFileNameForResource(CDAResource* resource);
NSArray* CDAClassGetSubclasses(Class parentClass);
void CDADecodeObjectWithCoder(id object, NSCoder* aDecoder);
void CDAEncodeObjectWithCoder(id object, NSCoder* aCoder);
BOOL CDAIsNoNetworkError(NSError* error);

//
//  CDAUtilities.h
//  ContentfulSDK
//
//  Created by Boris Bügling on 04/03/14.
//
//

#import <ContentfulDeliveryAPI/CDAClient.h>
#import <Foundation/Foundation.h>

NSString* CDACacheDirectory();
NSString* CDACacheFileNameForQuery(CDAClient* client, CDAResourceType resourceType, NSDictionary* query);
NSString* CDACacheFileNameForResource(CDAResource* resource);
NSArray* CDAClassGetSubclasses(Class parentClass);
void CDADecodeObjectWithCoder(id object, NSCoder* aDecoder);
void CDAEncodeObjectWithCoder(id object, NSCoder* aCoder);
BOOL CDAIsNoNetworkError(NSError* error);

Make the cache directory accessor public.


//
//  PHYGeometry.h
//  PHYKit
//
//  Created by Nora Trapp on 8/1/13.
//  Copyright (c) 2013 Nora Trapp. All rights reserved.
//

#import <Box2D/Common/b2Math.h>

#define kPointsToMeterRatio     (32)

#define PointsToMeters(points)  (points / kPointsToMeterRatio)
#define MetersToPoints(meters)  (meters * kPointsToMeterRatio)
#define CGPointTob2Vec2(point)  (b2Vec2(PointsToMeters(point.x), PointsToMeters(point.y)))
#define b2Vec2ToCGPoint(vector) (CGPointMake(MetersToPoints(vector.x), MetersToPoints(vector.y)))

//
//  PHYGeometry.h
//  PHYKit
//
//  Created by Nora Trapp on 8/1/13.
//  Copyright (c) 2013 Nora Trapp. All rights reserved.
//

#import <Box2D/Common/b2Math.h>

#define kPointsToMeterRatio     (32.0)

#define PointsToMeters(points)  (points / kPointsToMeterRatio)
#define MetersToPoints(meters)  (meters * kPointsToMeterRatio)
#define CGPointTob2Vec2(point)  (b2Vec2(PointsToMeters(point.x), PointsToMeters(point.y)))
#define b2Vec2ToCGPoint(vector) (CGPointMake(MetersToPoints(vector.x), MetersToPoints(vector.y)))

Change PointsToMeters ratio to a float, so we doing floating point math


#include "kernel/log.h"
#include "normalize.h"
#include "../reinterpret.h"
#include <math.h>

static double _finite(int64_t i)
{
    const double ln2[] = { 0x1.62e42fefa4p-1, -0x1.8432a1b0e2634p-43 };

    int64_t exponent = (i - 0x3FE6A09E667F3BCD) >> 52;
    double x = reinterpret(double, i - (exponent << 52)) - 1;
    double z = x / (x + 2);
    double h = 0.5 * x * x;

    return z * (h + _kernel_log(z)) + exponent * ln2[1] - h + x + exponent * ln2[0];
}

double log(double x)
{
    int64_t i = reinterpret(int64_t, x);

    if (i <= 0)
        return i << 1 == 0 ? -INFINITY : NAN;

    if (i < 0x7FF0000000000000)
        return _finite(_normalize(i));

    return x;
}

#include "kernel/log.h"
#include "normalize.h"
#include "../reinterpret.h"
#include <math.h>

static double _finite(int64_t i)
{
    const double ln2[] = { 0x1.62e42fefa4p-1, -0x1.8432a1b0e2634p-43 };

    int64_t exponent = (i - 0x3FE6A09E667F3BCD) >> 52;
    double x = reinterpret(double, i - (exponent << 52)) - 1;
    double z = x / (x + 2);
    double h = 0.5 * x * x;

    return exponent * ln2[1] + z * (h + _kernel_log(z)) - h + x + exponent * ln2[0];
}

double log(double x)
{
    int64_t i = reinterpret(int64_t, x);

    if (i <= 0)
        return i << 1 == 0 ? -INFINITY : NAN;

    if (i < 0x7FF0000000000000)
        return _finite(_normalize(i));

    return x;
}

Reorder terms by expected size, though this does not affect calculation


// SKIP PARAM: --enable exp.solver.td3.restart.wpoint.enabled --enable exp.solver.td3.abort

#include<stdlib.h>
struct a {
  int b;
} c(), *f;

int g;
void d();
void e();

int main() {
  void *h = calloc(1, sizeof(struct a));
  f = h;
  d(e);
  while (1) {
    g = c;
    if (c)
      break;
    f->b = 0;
  }
  d(h);
}

Add minimized test where abort fails.

Add minimized test where abort fails.


#ifdef E_TYPEDEFS
#else
# ifndef E_SMART_MONITOR_H
#  define E_SMART_MONITOR_H

Evas_Object *e_smart_monitor_add(Evas *evas);
void e_smart_monitor_crtc_set(Evas_Object *obj, Ecore_X_Randr_Crtc crtc, Evas_Coord cx, Evas_Coord cy, Evas_Coord cw, Evas_Coord ch);
void e_smart_monitor_output_set(Evas_Object *obj, Ecore_X_Randr_Output output);
void e_smart_monitor_grid_set(Evas_Object *obj, Evas_Object *grid);
void e_smart_monitor_background_set(Evas_Object *obj, Evas_Coord dx, Evas_Coord dy);

# endif
#endif

#ifdef E_TYPEDEFS
#else
# ifndef E_SMART_MONITOR_H
#  define E_SMART_MONITOR_H

Evas_Object *e_smart_monitor_add(Evas *evas);
void e_smart_monitor_crtc_set(Evas_Object *obj, Ecore_X_Randr_Crtc crtc, Evas_Coord cx, Evas_Coord cy, Evas_Coord cw, Evas_Coord ch);
void e_smart_monitor_output_set(Evas_Object *obj, Ecore_X_Randr_Output output);
void e_smart_monitor_grid_set(Evas_Object *obj, Evas_Object *grid, Evas_Coord gx, Evas_Coord gy, Evas_Coord gw, Evas_Coord gh);
void e_smart_monitor_virtual_size_set(Evas_Object *obj, Evas_Coord vw, Evas_Coord vh);
void e_smart_monitor_background_set(Evas_Object *obj, Evas_Coord dx, Evas_Coord dy);

# endif
#endif

Change monitor_grid_set function to also accept the grid geometry
(used for virtual-->canvas coordinate functions).

Signed-off-by: Christopher Michael <cp.michael@samsung.com>

SVN revision: 84169


// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com

#include "../lpng_v163/png.h"

Convert all files on the master branch to unix line endings.

Luckily, it's just one file.

BUG=none
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1281923004 .


#ifndef _CONDOR_SYSCALLS_H
#define _CONDOR_SYSCALLS_H

#if defined( AIX32)
#	include "syscall.aix32.h"
#else
#	include <syscall.h>
#endif

typedef int BOOL;

static const int 	SYS_LOCAL = 1;
static const int 	SYS_REMOTE = 0;
static const int	SYS_RECORDED = 2;
static const int	SYS_MAPPED = 2;

static const int	SYS_UNRECORDED = 0;
static const int	SYS_UNMAPPED = 0;

#if defined(__cplusplus)
extern "C" {
#endif

int SetSyscalls( int mode );
int GetSyscallMode();
BOOL LocalSysCalls();
BOOL RemoteSysCalls();
BOOL MappingFileDescriptors();
int REMOTE_syscall( int syscall_num, ... );

#if defined(OSF1) || defined(HPUX9)
	int syscall( int, ... );
#endif

#if defined(__cplusplus)
}
#endif

#endif

#ifndef _CONDOR_SYSCALLS_H
#define _CONDOR_SYSCALLS_H

#if defined( AIX32)
#	include "syscall.aix32.h"
#else
#	include <syscall.h>
#endif

typedef int BOOL;

static const int 	SYS_LOCAL = 1;
static const int 	SYS_REMOTE = 0;
static const int	SYS_RECORDED = 2;
static const int	SYS_MAPPED = 2;

static const int	SYS_UNRECORDED = 0;
static const int	SYS_UNMAPPED = 0;

#if defined(__cplusplus)
extern "C" {
#endif

int SetSyscalls( int mode );
int GetSyscallMode();
BOOL LocalSysCalls();
BOOL RemoteSysCalls();
BOOL MappingFileDescriptors();
int REMOTE_syscall( int syscall_num, ... );

#if defined(OSF1) || defined(HPUX9) || defined(SUNOS41)
	int syscall( int, ... );
#endif

#if defined(__cplusplus)
}
#endif

#endif

Add SUNOS41 to an existing conditional compilation directive.


#include "k2pktdef.h"

#define	TRACE2_STA_LEN	7
#define	TRACE2_CHAN_LEN	9  /* 4 bytes plus padding for loc and version */
#define	TRACE2_NET_LEN	9
#define TRACE2_LOC_LEN   3

#define K2INFO_TYPE_STRING "TYPE_K2INFO_PACKET"

typedef struct {
    char    net[TRACE2_NET_LEN];     /* Network name */
    char    sta[TRACE2_STA_LEN];     /* Site name */
    qint16  	data_type;		/* see K2INFO_TYPE #defines below */
    quint32	epoch_sent;	/* local time sent */
    quint16  reserved[5];		/* reserved for future use */
} K2INFO_HEADER;

#define K2INFO_TYPE_HEADER    1		/* k2 header params */
#define K2INFO_TYPE_STATUS    2		/* k2 regular status packet */
#define K2INFO_TYPE_ESTATUS   3		/* k2 extended status packet (old) */
#define K2INFO_TYPE_E2STATUS  4		/* k2 extended status packet v2 */
#define K2INFO_TYPE_COMM      5		/* k2ew packet processing stats */

#define MAX_K2INFOBUF_SIZ 4096

typedef union {
    qint8    msg[MAX_K2INFOBUF_SIZ];
	K2INFO_HEADER k2info;
} K2infoPacket;

#include "k2pktdef.h"

#define	TRACE2_STA_LEN	7
#define	TRACE2_CHAN_LEN	9  /* 4 bytes plus padding for loc and version */
#define	TRACE2_NET_LEN	9
#define TRACE2_LOC_LEN   3
#define K2_TIME_CONV ((unsigned long)315532800)

#define K2INFO_TYPE_STRING "TYPE_K2INFO_PACKET"

typedef struct {
    char    net[TRACE2_NET_LEN];     /* Network name */
    char    sta[TRACE2_STA_LEN];     /* Site name */
    qint16  	data_type;		/* see K2INFO_TYPE #defines below */
    quint32	epoch_sent;	/* local time sent */
    quint16  reserved[5];		/* reserved for future use */
} K2INFO_HEADER;

#define K2INFO_TYPE_HEADER    1		/* k2 header params */
#define K2INFO_TYPE_STATUS    2		/* k2 regular status packet */
#define K2INFO_TYPE_ESTATUS   3		/* k2 extended status packet (old) */
#define K2INFO_TYPE_E2STATUS  4		/* k2 extended status packet v2 */
#define K2INFO_TYPE_COMM      5		/* k2ew packet processing stats */

#define MAX_K2INFOBUF_SIZ 4096

typedef union {
    qint8    msg[MAX_K2INFOBUF_SIZ];
	K2INFO_HEADER k2info;
} K2infoPacket;

Make 64Bit Friendly, NonStatic for Ubuntu 14.04 delete unneeded files


/*
 * $Id$
 *
 * Copyright (c) 2010-2011, Juniper Networks, Inc.
 * All rights reserved.
 * This SOFTWARE is licensed under the LICENSE provided in the
 * ../Copyright file. By downloading, installing, copying, or otherwise
 * using the SOFTWARE, you agree to be bound by the terms of that
 * LICENSE.
 */

/**
 * Called from the debugger when we want to profile a script.
 *
 * @docp document pointer for the script
 * @returns TRUE is there was a problem
 */
int
slaxProfOpen (xmlDocPtr docp);

/**
 * Called when we enter a instruction.
 *
 * @docp document pointer
 * @inst instruction (slax/xslt code) pointer
 */
void
slaxProfEnter (xmlNodePtr inst);

/**
 * Called when we exit an instruction
 */
void
slaxProfExit (void);

#if 0
typedef int (*slaxProfCallback_t)(void *, const char *fmt, ...);
#endif

/**
 * Report the results
 */
void
slaxProfReport (int);

/**
 * Clear all values
 */
void
slaxProfClear (void);

/**
 * Done (free resources)
 */
void
slaxProfClose (void);

/*
 * Copyright (c) 2010-201e, Juniper Networks, Inc.
 * All rights reserved.
 * This SOFTWARE is licensed under the LICENSE provided in the
 * ../Copyright file. By downloading, installing, copying, or otherwise
 * using the SOFTWARE, you agree to be bound by the terms of that
 * LICENSE.
 */

/**
 * Called from the debugger when we want to profile a script.
 *
 * @docp document pointer for the script
 * @returns TRUE is there was a problem
 */
int
slaxProfOpen (xmlDocPtr docp);

/**
 * Called when we enter a instruction.
 *
 * @docp document pointer
 * @inst instruction (slax/xslt code) pointer
 */
void
slaxProfEnter (xmlNodePtr inst);

/**
 * Called when we exit an instruction
 */
void
slaxProfExit (void);

#if 0
typedef int (*slaxProfCallback_t)(void *, const char *fmt, ...);
#endif

/**
 * Report the results
 */
void
slaxProfReport (int);

/**
 * Clear all values
 */
void
slaxProfClear (void);

/**
 * Done (free resources)
 */
void
slaxProfClose (void);

Drop $Id$ and update copyright

Drop $Id$ and update copyright


#import "IDPBlock.h"
#import "IDPBufferArray.h"
#import "IDPKVOContext.h"
#import "IDPKVOMutableArray.h"
#import "IDPKeyPathObserver.h"
#import "IDPMachTimer.h"
#import "IDPMutableArray.h"
#import "IDPMutableDictionary.h"
#import "IDPOCContext.h"
#import "IDPOCImplementation.h"
#import "IDPOCStack.h"
#import "NSObject+IDPOCExtensionsPrivate.h"
#import "IDPReference.h"
#import "IDPRetainingReference.h"
#import "IDPWeakReference.h"
#import "IDPRetainingDictionary.h"
#import "IDPStackArray.h"
#import "IDPURLConnection.h"
#import "IDPURLRequest.h"
#import "IDPWeakArray.h"
#import "IDPSingletonModel.h"

Add to header file IDPSingletonModel.

Add to header file IDPSingletonModel.


/*
 * This file is part of Kotaka, a mud library for DGD
 * http://github.com/shentino/kotaka
 *
 * Copyright (C) 2012  Raymond Jennings
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program 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 Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#include <kotaka/paths.h>
#include <text/paths.h>

inherit LIB_BIN;

void main(string args)
{
	object user;
	object painter;
	object gc;

	int x, y, b;

	user = query_user();

	painter = new_object(LWO_PAINTER);
	painter->set_size(16, 8);
	gc = painter->create_gc();
	gc->set_clip(0, 0, 15, 7);
	b = random(128);

	for (y = 0; y < 8; y++) {
		for (x = 0; x < 16; x++) {
			gc->set_color((x + y * 16) ^ b);
			gc->move_pen(x, y);
			gc->draw("X");
		}
	}

	send_out(implode(painter->render_color(), "\n") + "\n");
}

Add color testing command with random order, to uncover subtle bugs


//===--- SmallPtrSetVector.h ----------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//

#ifndef SWIFT_BASIC_SMALLPTRSETVECTOR_H
#define SWIFT_BASIC_SMALLPTRSETVECTOR_H

#include "swift/Basic/LLVM.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"

namespace swift {

/// A SetVector that performs no allocations if smaller than a certain
/// size. Uses a SmallPtrSet/SmallVector internally.
template <typename T, unsigned VectorSize, unsigned SetSize = VectorSize>
class SmallPtrSetVector : public llvm::SetVector<T, SmallVector<T, VectorSize>,
                                                 SmallPtrSet<T, SetSize>> {
public:
  SmallPtrSetVector() = default;

  /// Initialize a SmallPtrSetVector with a range of elements
  template <typename It> SmallPtrSetVector(It Start, It End) {
    this->insert(Start, End);
  }
};

} // namespace swift

namespace std {

/// Implement std::swap in terms of SmallSetVector swap.
///
/// This matches llvm's implementation for SmallSetVector.
template <typename T, unsigned VectorSize, unsigned SetSize = VectorSize>
inline void swap(swift::SmallPtrSetVector<T, VectorSize, SetSize> &LHS,
                 swift::SmallPtrSetVector<T, VectorSize, SetSize> &RHS) {
  LHS.swap(RHS);
}

} // end namespace std

#endif

[sil] Add a variant of SmallSetVector that uses SmallPtrSet internally instead of SmallDenseSet.


// Copyright 2014 The open-vcdiff Authors. All Rights Reserved.
// Author: Mostyn Bramley-Moore
//
// 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.

#ifndef OPEN_VCDIFF_UNIQUE_PTR_H_
#define OPEN_VCDIFF_UNIQUE_PTR_H_

// std::auto_ptr is deprecated in C++11, in favor of std::unique_ptr.
// Since C++11 is not widely available yet, the macro below is used to
// select the best available option.

#include <memory>

#if __cplusplus >= 201103L
// C++11
#define UNIQUE_PTR std::unique_ptr
#else
#define UNIQUE_PTR std::auto_ptr
#endif

#endif  // OPEN_VCDIFF_UNIQUE_PTR_H_

// Copyright 2014 The open-vcdiff Authors. All Rights Reserved.
// Author: Mostyn Bramley-Moore
//
// 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.

#ifndef OPEN_VCDIFF_UNIQUE_PTR_H_
#define OPEN_VCDIFF_UNIQUE_PTR_H_

// std::auto_ptr is deprecated in C++11, in favor of std::unique_ptr.
// Since C++11 is not widely available yet, the macro below is used to
// select the best available option.

#include <memory>

#if __cplusplus >= 201103L && !defined(OPEN_VCDIFF_USE_AUTO_PTR) // C++11
#define UNIQUE_PTR std::unique_ptr
#else
#define UNIQUE_PTR std::auto_ptr
#endif  // __cplusplus >= 201103L && !defined(OPEN_VCDIFF_USE_AUTO_PTR)

#endif  // OPEN_VCDIFF_UNIQUE_PTR_H_

Add an option to force use of auto_ptr for legacy STL implementations.


//
// Created by gravypod on 9/20/17.
//

#include "files.h"

#include <sys/stat.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>

long int fsize(const char *filename)
{
    struct stat st;

    if (stat(filename, &st) == 0)
        return st.st_size;

    return -1;
}

char* read_file(const char* filename)
{
    const size_t file_size = (size_t) fsize(filename);
    FILE *f;

    if (file_size == -1 || !(f = fopen(filename, "rb"))) {
        return NULL;
    }

    size_t data_left = file_size;
    char *buffer = malloc(file_size + 1);
    char *tmp    = buffer;

    while (data_left > 0)
    {
        const size_t len = fread((void *) tmp, sizeof(char), sizeof(buffer), f);
        data_left -= len;
        tmp       += len;
    }
    buffer[file_size] = 0;

    fclose(f);

    return buffer;
}

//
// Created by gravypod on 9/20/17.
//

#include "files.h"

#include <sys/stat.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>

long int fsize(const char *filename)
{
    struct stat st;

    if (stat(filename, &st) == 0)
        return st.st_size;

    return -1;
}

char* read_file(const char* filename)
{
    long int reported_size = fsize(filename);
    FILE *f;

    if (reported_size == -1 || !(f = fopen(filename, "rb"))) {
        return NULL;
    }

    const size_t file_size = (size_t) reported_size;
    size_t data_left = file_size;
    char *buffer = malloc(file_size + 1);
    char *tmp    = buffer;

    while (data_left > 0)
    {
        const size_t len = fread((void *) tmp, sizeof(char), sizeof(buffer), f);
        data_left -= len;
        tmp       += len;
    }
    buffer[file_size] = 0;

    fclose(f);

    return buffer;
}

Make sure file stat actually finished. Don't check a size_t for neg.


#include <vector>

enum GHCMnemonic {
  MOV,
  INC,
  DEC,
  ADD,
  SUB,
  MUL,
  DIV,
  AND,
  OR,
  XOR,
  JLT,
  JEQ,
  JGT,
  INT,
  HLT
};

enum GHCRegister {
  A = 0,
  B,
  C,
  D,
  E,
  F,
  G,
  H,
  PC
};

enum GHCArgumentType {
  Constant,
  Register,
  Memory
};

struct GHCArgument {
  GHCArgumentType type;
  unsigned int id;
};

struct GHCInstruction {
  GHCMnemonic mnemonic;
  std::vector<GHCArgument> arguments;
};

#include <vector>

enum GHCMnemonic {
  MOV,
  INC,
  DEC,
  ADD,
  SUB,
  MUL,
  DIV,
  AND,
  OR,
  XOR,
  JLT,
  JEQ,
  JGT,
  INT,
  HLT
};

enum GHCRegister {
  A = 0,
  B,
  C,
  D,
  E,
  F,
  G,
  H,
  PC
};

enum GHCArgumentType {
  Constant,
  Register,
  Memory
};

struct GHCArgument {
  GHCArgumentType type;
  bool as_address;
  unsigned int id;
};

struct GHCInstruction {
  GHCMnemonic mnemonic;
  std::vector<GHCArgument> arguments;
};

Add as_address on mnemonic argument.

Add as_address on mnemonic argument.


#ifndef _ANSI_COLORS
#define _ANSI_COLORS

#define ANSI_COLOR_RED     "\x1b[31m"
#define ANSI_COLOR_GREEN   "\x1b[32m"
#define ANSI_COLOR_YELLOW  "\x1b[33m"
#define ANSI_COLOR_BLUE    "\x1b[34m"
#define ANSI_COLOR_MAGENTA "\x1b[35m"
#define ANSI_COLOR_CYAN    "\x1b[36m"
#define ANSI_COLOR_RESET   "\x1b[0m"

#endif

Add ansi colors file header

Add ansi colors file header


/* libunwind - a platform-independent unwind library
   Copyright (C) 2001-2002 Hewlett-Packard Co
	Contributed by David Mosberger-Tang <davidm@hpl.hp.com>

This file is part of libunwind.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */

#include "unwind_i.h"

int
unw_is_signal_frame (unw_cursor_t *cursor)
{
  struct ia64_cursor *c = (struct ia64_cursor *) cursor;
  struct ia64_state_record sr;
  int ret;

  /* Crude and slow, but we need to peek ahead into the unwind
     descriptors to find out if the current IP is inside the signal
     trampoline.  */
  ret = ia64_create_state_record (c, &sr);
  if (ret < 0)
    return ret;

  return sr.is_signal_frame;
}

(unw_is_signal_frame): Use "is_signal_frame" instead of IA64_FLAG_SIGTRAMP flag bit.

2002/12/11 12:26:26-08:00 mostang.com!davidm
Rename: src/ia64/Lis_signal_frame.c -> src/ia64/Gis_signal_frame.c

(Logical change 1.30)


/* Very simple example for parse buf example */
#include <string.h>
#include <stdlib.h>
#include "confuse.h"

int main(void)
{
	cfg_t *cfg;
	cfg_opt_t arg_opts[] = {
		CFG_STR("value", "default", CFGF_NONE),
		CFG_END()
	};
	cfg_opt_t opts[] = {
		CFG_INT("delay", 3, CFGF_NONE),
		CFG_STR("message", "This is a message", CFGF_NONE),
		CFG_SEC("argument", arg_opts, CFGF_MULTI | CFGF_TITLE),
		CFG_END()
	};

	char *buf =
		" delay = 3\n"
		"# message = 'asdfasfasfd tersf'\n"
		" argument one { value = bar }\n"
		" argument two { value=foo}\n";

	cfg = cfg_init(opts, 0);
	if (cfg_parse_buf(cfg, buf) != CFG_SUCCESS) {
		fprintf(stderr, "Failed parsing configuration: %s\n", strerror(errno));
		exit(1);
	}
	cfg_print(cfg, stdout);

	return cfg_free(cfg);
}

/* Very simple example for parse buf example */
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include "confuse.h"

int main(void)
{
	cfg_t *cfg;
	cfg_opt_t arg_opts[] = {
		CFG_STR("value", "default", CFGF_NONE),
		CFG_END()
	};
	cfg_opt_t opts[] = {
		CFG_INT("delay", 3, CFGF_NONE),
		CFG_STR("message", "This is a message", CFGF_NONE),
		CFG_SEC("argument", arg_opts, CFGF_MULTI | CFGF_TITLE),
		CFG_END()
	};

	char *buf =
		" delay = 3\n"
		"# message = 'asdfasfasfd tersf'\n"
		" argument one { value = bar }\n"
		" argument two { value=foo}\n";

	cfg = cfg_init(opts, 0);
	if (cfg_parse_buf(cfg, buf) != CFG_SUCCESS) {
		fprintf(stderr, "Failed parsing configuration: %s\n", strerror(errno));
		exit(1);
	}
	cfg_print(cfg, stdout);

	return cfg_free(cfg);
}

Add missing errno.h include for Linux/UNIX

Signed-off-by: Joachim Nilsson <583c295fd7602c168ad814279bbc3894ba65f5d6@gmail.com>


/*
 * kisskiss.h
 *
 * Tim "diff" Strazzere <strazz@gmail.com>
 */

#include <stdlib.h>
#include <stdio.h>
#include <sys/ptrace.h>
#include <dirent.h>
#include <fcntl.h> // open / O_RDONLY

static const char* odex_magic = "dey\n036";
static const char* static_safe_location = "/data/local/tmp/";
static const char* suffix = ".dumped_odex";

typedef struct {
  uint32_t start;
  uint32_t end;
} memory_region;

uint32_t get_clone_pid(uint32_t service_pid);
uint32_t get_process_pid(const char* target_package_name);
char *determine_filter(uint32_t clone_pid, int memory_fd);
int find_magic_memory(uint32_t clone_pid, int memory_fd, memory_region *memory, char* extra_filter);
int peek_memory(int memory_file, uint32_t address);
int dump_memory(int memory_fd, memory_region *memory, const char* file_name);
int attach_get_memory(uint32_t pid);

/*
 * kisskiss.h
 *
 * Tim "diff" Strazzere <strazz@gmail.com>
 */

#include <stdlib.h>
#include <stdio.h>
#include <sys/ptrace.h>
#include <dirent.h>
#include <fcntl.h> // open / O_RDONLY
#include <unistd.h> // close
#include <errno.h> // perror
#include <string.h> // strlen

static const char* odex_magic = "dey\n036";
static const char* static_safe_location = "/data/local/tmp/";
static const char* suffix = ".dumped_odex";

typedef struct {
  uint64_t start;
  uint64_t end;
} memory_region;

uint32_t get_clone_pid(uint32_t service_pid);
uint32_t get_process_pid(const char* target_package_name);
char *determine_filter(uint32_t clone_pid, int memory_fd);
int find_magic_memory(uint32_t clone_pid, int memory_fd, memory_region *memory, char* extra_filter);
int peek_memory(int memory_file, uint32_t address);
int dump_memory(int memory_fd, memory_region *memory, const char* file_name);
int attach_get_memory(uint32_t pid);

Reduce implicit calls, add fix for large memory sections


// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef NET_SPDY_SPDY_HTTP_UTILS_H_
#define NET_SPDY_SPDY_HTTP_UTILS_H_
#pragma once

#include "net/spdy/spdy_framer.h"

namespace net {

class HttpResponseInfo;
class HttpRequestInfo;

// Convert a SpdyHeaderBlock into an HttpResponseInfo.
// |headers| input parameter with the SpdyHeaderBlock.
// |info| output parameter for the HttpResponseInfo.
// Returns true if successfully converted.  False if there was a failure
// or if the SpdyHeaderBlock was invalid.
bool SpdyHeadersToHttpResponse(const spdy::SpdyHeaderBlock& headers,
                               HttpResponseInfo* response);

// Create a SpdyHeaderBlock for a Spdy SYN_STREAM Frame from
// a HttpRequestInfo block.
void CreateSpdyHeadersFromHttpRequest(const HttpRequestInfo& info,
                                      spdy::SpdyHeaderBlock* headers,
                                      bool direct);

}  // namespace net

#endif  // NET_SPDY_SPDY_HTTP_UTILS_H_

// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef NET_SPDY_SPDY_HTTP_UTILS_H_
#define NET_SPDY_SPDY_HTTP_UTILS_H_
#pragma once

#include "net/spdy/spdy_framer.h"

namespace net {

class HttpResponseInfo;
struct HttpRequestInfo;

// Convert a SpdyHeaderBlock into an HttpResponseInfo.
// |headers| input parameter with the SpdyHeaderBlock.
// |info| output parameter for the HttpResponseInfo.
// Returns true if successfully converted.  False if there was a failure
// or if the SpdyHeaderBlock was invalid.
bool SpdyHeadersToHttpResponse(const spdy::SpdyHeaderBlock& headers,
                               HttpResponseInfo* response);

// Create a SpdyHeaderBlock for a Spdy SYN_STREAM Frame from
// a HttpRequestInfo block.
void CreateSpdyHeadersFromHttpRequest(const HttpRequestInfo& info,
                                      spdy::SpdyHeaderBlock* headers,
                                      bool direct);

}  // namespace net

#endif  // NET_SPDY_SPDY_HTTP_UTILS_H_

Change forward declaration of HttpRequestInfo from class to struct to
fix build breakage.

BUG=none
TEST=none

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@59584 0039d316-1c4b-4281-b951-d872f2087c98


#define MP3ID3_TITLELEN NAMELEN
#define MP3ID3_ARTISTLEN AUTHORLEN
#define MP3ID3_ALBUMLEN 30
#define MP3ID3_YEARLEN 4
#define MP3ID3_COMMENTLEN 30

typedef struct {
  int present:1;
  char title[MP3ID3_TITLELEN+1];
  char artist[MP3ID3_ARTISTLEN+1];
  char album[MP3ID3_ALBUMLEN+1];
  char year[MP3ID3_YEARLEN+1];
  char comment[MP3ID3_COMMENTLEN+1];
  char genre[31];
} t_id3tag;

int mserv_mp3info_readlen(const char *fname, int *bitrate_ret,
			  t_id3tag *id3tag);

#define MP3ID3_TITLELEN 30
#define MP3ID3_ARTISTLEN 30
#define MP3ID3_ALBUMLEN 30
#define MP3ID3_YEARLEN 4
#define MP3ID3_COMMENTLEN 30

typedef struct {
  int present:1;
  char title[MP3ID3_TITLELEN+1];
  char artist[MP3ID3_ARTISTLEN+1];
  char album[MP3ID3_ALBUMLEN+1];
  char year[MP3ID3_YEARLEN+1];
  char comment[MP3ID3_COMMENTLEN+1];
  char genre[31];
} t_id3tag;

int mserv_mp3info_readlen(const char *fname, int *bitrate_ret,
			  t_id3tag *id3tag);

Fix mp3 field size constants so that the ID3 information gets parsed correctly.


// Filename: config_lui.h
// Created by:  tobspr (28Aug14)
//

#ifndef CONFIG_LUI_H
#define CONFIG_LUI_H

#include "pandabase.h"
#include "notifyCategoryProxy.h"
#include "dconfig.h"

#define EXPCL_LUI EXPORT_CLASS
#define EXPTP_LUI EXPORT_TEMPL

ConfigureDecl(config_lui, EXPCL_LUI, EXPTP_LUI);
NotifyCategoryDecl(lui, EXPCL_LUI, EXPTP_LUI);

extern EXPCL_LUI void init_lui();

#ifdef INTERROGATE
// Interrogate can't handle this
#define unordered_map pmap
#endif

#endif

// Filename: config_lui.h
// Created by:  tobspr (28Aug14)
//

#ifndef CONFIG_LUI_H
#define CONFIG_LUI_H

#include "pandabase.h"
#include "notifyCategoryProxy.h"
#include "dconfig.h"

#define EXPCL_LUI EXPORT_CLASS
#define EXPTP_LUI EXPORT_TEMPL

ConfigureDecl(config_lui, EXPCL_LUI, EXPTP_LUI);
NotifyCategoryDecl(lui, EXPCL_LUI, EXPTP_LUI);

extern EXPCL_LUI void init_lui();

using namespace std;

#endif

Fix build with modern Panda headers

Fix build with modern Panda headers

Panda3D now no longer defines `using namespace std;` (see panda3d/panda3d#335) which the LUI code relied on;

Panda3D headers provide unordered_map so the #define is actually preventing that header from being parsed correctly.


/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
/*
 * Copyright (C) 2008 Collabora Ltd.
 *
 * This library 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.
 *
 * This library 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 this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 * Authors: Cosimo Cecchi <cosimo.cecchi@collabora.co.uk>
 */

#ifndef __EMPATHY_TYPES_H__
#define __EMPATHY_TYPES_H__

typedef struct _EmpathyContactList      EmpathyContactList;

typedef struct _EmpathyContactMonitor      EmpathyContactMonitor;

#endif /* __EMPATHY_TYPES_H__ */

Add newline at end of file

Add newline at end of file

From: Olivier Crête <olivier.crete@collabora.co.uk>
Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>

svn path=/trunk/; revision=2439


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

#include "phonebook_opt.h"

/* FILL YOUR OWN IMPLEMENTATION HERE! */
entry *findName(char lastname[], entry *pHead)
{
    while (pHead != NULL) {
        if (strcasecmp(lastname, pHead->lastName) == 0)
            return pHead;
        pHead = pHead->pNext;
    }
    return NULL;
}

entry *append(char lastName[], entry *e)
{
    /* allocate memory for the new entry and put lastName */
    e->pNext = (entry *) malloc(sizeof(entry));
    e = e->pNext;
    strcpy(e->lastName, lastName);
    e->pNext = NULL;

    return e;
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <assert.h>

#include "phonebook_opt.h"

entry *findName(char lastname[], entry *pHead)
{
    while (pHead != NULL) {
        if (strcasecmp(lastname, pHead->lastName) == 0)
            return pHead;
        pHead = pHead->pNext;
    }
    return NULL;
}

entry *append(char lastName[], entry *e)
{
    /* check whther entry is null or not */
    assert(e != NULL && "[error] entry is null");

    /* allocate memory for the new entry and put lastName */
    e->pNext = (entry *) malloc(sizeof(entry));
    e = e->pNext;
    strcpy(e->lastName, lastName);
    e->pNext = NULL;

    return e;
}

Delete todo comments and add assert to avoid null entry

Delete the todo comments before the function findName.
Use assert to avoid the condition of null pointer in the begining of
function append.