/*
 * Copyright 2018 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef GrVkVulkan_DEFINED
#define GrVkVulkan_DEFINED

#include "SkTypes.h"

#ifdef VULKAN_CORE_H_
#error "Skia's private vulkan header must be included before any other vulkan header."
#endif

#include "../../third_party/vulkan/vulkan/vulkan_core.h"

#ifdef SK_BUILD_FOR_ANDROID
#ifdef VULKAN_ANDROID_H_
#error "Skia's private vulkan android header must be included before any other vulkan header."
#endif
// This is needed to get android extensions for external memory
#include "../../third_party/vulkan/vulkan/vulkan_android.h"
#endif

#endif

/*
 * Copyright 2018 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef GrVkVulkan_DEFINED
#define GrVkVulkan_DEFINED

#include "SkTypes.h"

#ifdef VULKAN_CORE_H_
#error "Skia's private vulkan header must be included before any other vulkan header."
#endif

#include "../../../include/third_party/vulkan/vulkan/vulkan_core.h"

#ifdef SK_BUILD_FOR_ANDROID
#ifdef VULKAN_ANDROID_H_
#error "Skia's private vulkan android header must be included before any other vulkan header."
#endif
// This is needed to get android extensions for external memory
#include "../../../include/third_party/vulkan/vulkan/vulkan_android.h"
#endif

#endif

Fix path to vulkan header.

Fix path to vulkan header.

Bug: skia:
Change-Id: I47cb8f67b378a51cefcb82864eda467ff6b48a7e
Reviewed-on: https://skia-review.googlesource.com/c/176969
Commit-Queue: Greg Daniel <39df0a804564ccb6cf75f18db79653821f37c1c5@google.com>
Commit-Queue: Mike Klein <14574f09dfa9b4e14759b88c3426a495a0e627b0@google.com>
Auto-Submit: Greg Daniel <39df0a804564ccb6cf75f18db79653821f37c1c5@google.com>
Reviewed-by: Mike Klein <14574f09dfa9b4e14759b88c3426a495a0e627b0@google.com>


/*************************************************
* PBKDF1 Header File                             *
* (C) 1999-2007 Jack Lloyd                       *
*************************************************/

#ifndef BOTAN_PBKDF1_H__
#define BOTAN_PBKDF1_H__

#include <botan/s2k.h>
#include <botan/base.h>

namespace Botan {

/*************************************************
* PKCS #5 PBKDF1                                 *
*************************************************/
class BOTAN_DLL PKCS5_PBKDF1 : public S2K
   {
   public:
      std::string name() const;
      S2K* clone() const;

      PKCS5_PBKDF1(HashFunction* hash_in) : hash(hash_in) {}
      PKCS5_PBKDF1(const PKCS5_PBKDF1& other) : hash(other.hash->clone()) {}
      ~PKCS5_PBKDF1() { delete hash; }
   private:
      OctetString derive(u32bit, const std::string&,
                          const byte[], u32bit, u32bit) const;

      HashFunction* hash;
   };

}

#endif

/*************************************************
* PBKDF1 Header File                             *
* (C) 1999-2007 Jack Lloyd                       *
*************************************************/

#ifndef BOTAN_PBKDF1_H__
#define BOTAN_PBKDF1_H__

#include <botan/s2k.h>
#include <botan/base.h>

namespace Botan {

/*************************************************
* PKCS #5 PBKDF1                                 *
*************************************************/
class BOTAN_DLL PKCS5_PBKDF1 : public S2K
   {
   public:
      std::string name() const;
      S2K* clone() const;

      PKCS5_PBKDF1(HashFunction* hash_in) : hash(hash_in) {}
      PKCS5_PBKDF1(const PKCS5_PBKDF1& other) :
         S2K(), hash(other.hash->clone()) {}

      ~PKCS5_PBKDF1() { delete hash; }
   private:
      OctetString derive(u32bit, const std::string&,
                          const byte[], u32bit, u32bit) const;

      HashFunction* hash;
   };

}

#endif

Fix warning in PBKDF1 copy constructor

Fix warning in PBKDF1 copy constructor


#ifndef AppIconOverlay_config_h
#define AppIconOverlay_config_h

#define DEBUG 1

#define DEFAULT_MIN_FONT_SIZE 6.0
#define DEFAULT_MAX_FONT_SIZE 18.0
#define DEFAULT_FONT_TO_USE "Arial-BoldMT"

#endif

#ifndef AppIconOverlay_config_h
#define AppIconOverlay_config_h

#define DEBUG 1

#define DEFAULT_MIN_FONT_SIZE 6.0
#define DEFAULT_MAX_FONT_SIZE 18.0
#define DEFAULT_FONT_TO_USE @"Arial-BoldMT"

#endif

Convert default font name into an NSString


/*
 *  Copyright (c) 2010 The WebM 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.
 */

#include "vpx_ports/config.h"
#include "vp8/decoder/onyxd_int.h"

#include "vp8/common/opencl/vp8_opencl.h"
#include "vp8_decode_cl.h"

extern void vp8_dequantize_b_cl(BLOCKD*);
extern void vp8_dequant_dc_idct_add_cl(short*, short*, unsigned char*,
                               unsigned char*, int, int, int Dc);

void vp8_arch_opencl_decode_init(VP8D_COMP *pbi)
{

    if (cl_initialized == CL_SUCCESS){
        cl_decode_init();
    }

}

/*
 *  Copyright (c) 2010 The WebM 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.
 */

#include "vpx_ports/config.h"
#include "vp8/decoder/onyxd_int.h"

#include "vp8/common/opencl/vp8_opencl.h"
#include "vp8_decode_cl.h"

void vp8_arch_opencl_decode_init(VP8D_COMP *pbi)
{

    if (cl_initialized == CL_SUCCESS){
        cl_decode_init();
    }

}

Remove unused external function definitions.


/*
    Title:  No return header.
    Author: David C.J. Matthews

    Copyright (c) 2006, 2015 David C.J. Matthews

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License version 2.1 as published by the Free Software Foundation.

    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

*/

#ifndef _NORETURN_H
#define _NORETURN_H

/* The exception functions don't return but instead raise exceptions.  This macro
   tells the compiler about this and prevents spurious errors.  */
#if (defined(_MSC_EXTENSIONS) && (_MSC_VER >= 1200))
#define NORETURNFN(x) __declspec(noreturn) x
#elif defined(__GNUC__) || defined(__attribute__)
#define NORETURNFN(x)   x __attribute__((noreturn))
#else
#define NORETURNFN(x)
#endif

#endif

/*
    Title:  No return header.
    Author: David C.J. Matthews

    Copyright (c) 2006, 2015 David C.J. Matthews

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License version 2.1 as published by the Free Software Foundation.

    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

*/

#ifndef _NORETURN_H
#define _NORETURN_H

/* The exception functions don't return but instead raise exceptions.  This macro
   tells the compiler about this and prevents spurious errors.  */
#if (defined(_MSC_EXTENSIONS) && (_MSC_VER >= 1200))
#define NORETURNFN(x) __declspec(noreturn) x
#elif defined(__GNUC__) || defined(__attribute__)
#define NORETURNFN(x)   x __attribute__((noreturn))
#else
#define NORETURNFN(x) x
#endif

#endif

Fix no-return for non-GCC and non-VS.

Fix no-return for non-GCC and non-VS.


#ifndef Fl_Value_Slider2_H
#define Fl_Value_Slider2_H

#include "Fl/Fl_Slider.H"

class Fl_Value_Slider2 : public Fl_Slider {
    uchar textfont_, textsize_;
    unsigned textcolor_;
public:
    void draw();
    int handle(int);
    Fl_Value_Slider2(int x,int y,int w,int h, const char *l = 0);
    Fl_Font textfont() const {return (Fl_Font)textfont_;}
    void textfont(uchar s) {textfont_ = s;}
    uchar textsize() const {return textsize_;}
    void textsize(uchar s) {textsize_ = s;}
    Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
    void textcolor(unsigned s) {textcolor_ = s;}
};

#endif

#ifndef Fl_Value_Slider2_H
#define Fl_Value_Slider2_H

#include <FL/Fl_Slider.H>

class Fl_Value_Slider2 : public Fl_Slider {
    uchar textfont_, textsize_;
    unsigned textcolor_;
public:
    void draw();
    int handle(int);
    Fl_Value_Slider2(int x,int y,int w,int h, const char *l = 0);
    Fl_Font textfont() const {return (Fl_Font)textfont_;}
    void textfont(uchar s) {textfont_ = s;}
    uchar textsize() const {return textsize_;}
    void textsize(uchar s) {textsize_ = s;}
    Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
    void textcolor(unsigned s) {textcolor_ = s;}
};

#endif

Fix include statement of FLTK header such that it compiles with FLTK 1.3 without requiring backwards compatible link creation.


//===-- problems/Problem14.h ------------------------------------*- C++ -*-===//
//
// ProjectEuler.net solutions by Will Mitchell
//
// This file is distributed under the MIT License. See LICENSE for details.
//
//===----------------------------------------------------------------------===//
///
/// \file
/// \brief Problem 14: Longest Collatz sequence
///
//===----------------------------------------------------------------------===//
#ifndef PROBLEMS_PROBLEM14_H
#define PROBLEMS_PROBLEM14_H

#include <string>
#include <vector>

#include "../Problem.h"

namespace problems {
class Problem14 : public Problem {
public:
  Problem14() : start(0), length(0), solved(false) {}
  ~Problem14() = default;
  std::string answer();
  std::string description() const;
  void solve();

  // Simple brute force solution
  unsigned long long bruteForce(const unsigned long long limit) const;
  // Simple brute force solution with memoization
  unsigned long long
  faster(const unsigned long long limit,
         const std::vector<unsigned long long>::size_type cacheSize) const;

private:
  /// Cached answer
  unsigned long long start;
  /// Cached answer
  mutable unsigned long long length;
  /// If cached answer is valid
  bool solved;
};
}

#endif

//===-- problems/Problem14.h ------------------------------------*- C++ -*-===//
//
// ProjectEuler.net solutions by Will Mitchell
//
// This file is distributed under the MIT License. See LICENSE for details.
//
//===----------------------------------------------------------------------===//
///
/// \file
/// \brief Problem 14: Longest Collatz sequence
///
//===----------------------------------------------------------------------===//
#ifndef PROBLEMS_PROBLEM14_H
#define PROBLEMS_PROBLEM14_H

#include <string>
#include <vector>

#include "../Problem.h"

namespace problems {
class Problem14 : public Problem {
public:
  Problem14() : start(0), length(0), solved(false) {}
  ~Problem14() = default;
  std::string answer();
  std::string description() const;
  void solve();

  /// Simple brute force solution
  unsigned long long bruteForce(const unsigned long long limit) const;
  /// Simple brute force solution with memoization
  unsigned long long
  faster(const unsigned long long limit,
         const std::vector<unsigned long long>::size_type cacheSize) const;

private:
  /// Cached answer
  unsigned long long start;
  /// Cached answer
  mutable unsigned long long length;
  /// If cached answer is valid
  bool solved;
};
}

#endif

Add another / to a couple comments in Problem 14 to make intended Doxygen comments visible as such.


//PARAM: --enable ana.int.enums --disable ana.int.def_exc
int main(){
    int top = rand();
    int x,y;

    if(top){
        x = 1;
    } else{
        x = 0;
    }

    assert(x<2);
    return 0;
}

//PARAM: --enable ana.int.enums --disable ana.int.def_exc
int main(){
    int top = rand();
    int x,y;

    if(top){
        x = 1;
    } else{
        x = 0;
    }

    assert(x < 2);
    assert(x < 1); // UNKNOWN!
    assert(x < 0); // FAIL

    assert(x <= 2);
    assert(x <= 1);
    assert(x <= 0); // UNKNOWN!
    assert(x <= -1); //FAIL

    assert(x > -1);
    assert(x > 0); //UNKNOWN!
    assert(x > 1); //FAIL

    assert(x >= -1);
    assert(x >= 0);
    assert(x >= 1); //UNKNOWN!
    assert(x >= 2); //FAIL
    return 0;
}

Add more assert statements to test case

Add more assert statements to test case


/*
 * folder_free.c -- free a folder/message structure
 *
 * This code is Copyright (c) 2002, by the authors of nmh.  See the
 * COPYRIGHT file in the root directory of the nmh distribution for
 * complete copyright information.
 */

#include <h/mh.h>

void
folder_free (struct msgs *mp)
{
    size_t i;
    bvector_t *v;

    if (!mp)
	return;

    if (mp->foldpath)
	free (mp->foldpath);

    /* free the sequence names */
    for (i = 0; i < svector_size (mp->msgattrs); i++)
	free (svector_at (mp->msgattrs, i));
    svector_free (mp->msgattrs);

    for (i = 0, v = mp->msgstats; i < mp->num_msgstats; ++i, ++v) {
	bvector_free (*v);
    }
    free (mp->msgstats);

    /* Close/free the sequence file if it is open */

    if (mp->seqhandle)
    	lkfclosedata (mp->seqhandle, mp->seqname);

    if (mp->seqname)
    	free (mp->seqname);

    bvector_free (mp->attrstats);
    free (mp);			/* free main folder structure */
}

/*
 * folder_free.c -- free a folder/message structure
 *
 * This code is Copyright (c) 2002, by the authors of nmh.  See the
 * COPYRIGHT file in the root directory of the nmh distribution for
 * complete copyright information.
 */

#include <h/mh.h>
#include <h/utils.h>

void
folder_free (struct msgs *mp)
{
    size_t i;
    bvector_t *v;

    if (!mp)
	return;

    mh_xfree(mp->foldpath);

    /* free the sequence names */
    for (i = 0; i < svector_size (mp->msgattrs); i++)
	free (svector_at (mp->msgattrs, i));
    svector_free (mp->msgattrs);

    for (i = 0, v = mp->msgstats; i < mp->num_msgstats; ++i, ++v) {
	bvector_free (*v);
    }
    free (mp->msgstats);

    /* Close/free the sequence file if it is open */

    if (mp->seqhandle)
    	lkfclosedata (mp->seqhandle, mp->seqname);

    mh_xfree(mp->seqname);

    bvector_free (mp->attrstats);
    free (mp);			/* free main folder structure */
}

Replace `if (p) free(p)' with `mh_xfree(p)'.


/*
 * BRLTTY - A background process providing access to the console screen (when in
 *          text mode) for a blind person using a refreshable braille display.
 *
 * Copyright (C) 1995-2012 by The BRLTTY Developers.
 *
 * BRLTTY comes with ABSOLUTELY NO WARRANTY.
 *
 * This is free software, placed 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. Please see the file LICENSE-GPL for details.
 *
 * Web Page: http://mielke.cc/brltty/
 *
 * This software is maintained by Dave Mielke <dave@mielke.cc>.
 */

#include "prologue.h"

#include <locale.h>
#include <wchar.h>

#include "charset_internal.h"

wint_t
convertCharToWchar (char c) {
  return (unsigned char)c;
}

int
convertWcharToChar (wchar_t wc) {
  return wc & 0XFF;
}

const char *
getLocaleCharset (void) {
  return nl_langinfo(CODESET);
}

int
registerCharacterSet (const char *charset) {
  return grub_strcasecmp(charset, "UTF-8") == 0;
}

Add the grub-specific charset functions. (dm)

git-svn-id: 30a5f035a20f1bc647618dbad7eea2a951b61b7c@6219 91a5dbb7-01b9-0310-9b5f-b28072856b6e


#include <sys/types.h>			/* for namser.h */
#include <arpa/nameser.h>		/* for BYTE_ORDER */
#include <process.h>			/* for execv */
#include <ioctl.h>				/* for unix.h */
#include <unix.h>
#include <sys/select.h>			/* for select */

#define HAS_TEST_AND_SET

#undef HAVE_GETRUSAGE

#define strncasecmp strnicmp

#ifndef					NAN
#ifndef					__nan_bytes
#define __nan_bytes								{ 0, 0, 0, 0, 0, 0, 0xf8, 0x7f }
#endif   /* __nan_bytes */
extern unsigned char __nan[8];

#define							   NAN	   (*(const double *) __nan)
#endif   /* NAN */

typedef u_short ushort;

typedef unsigned char slock_t;

extern int	isnan(double dsrc);

extern double rint(double x);

extern char *crypt(const char *, const char *);

extern long random(void);
extern void srandom(unsigned int seed);

#include <sys/types.h>			/* for namser.h */
#include <arpa/nameser.h>		/* for BYTE_ORDER */
#include <process.h>			/* for execv */
#include <ioctl.h>				/* for unix.h */
#include <unix.h>
#include <sys/select.h>			/* for select */

#define HAS_TEST_AND_SET

#undef HAVE_GETRUSAGE

#define strncasecmp strnicmp

#ifndef					NAN
#ifndef					__nan_bytes
#define __nan_bytes								{ 0, 0, 0, 0, 0, 0, 0xf8, 0x7f }
#endif   /* __nan_bytes */
extern unsigned char __nan[8];

#define							   NAN	   (*(const double *) __nan)
#endif   /* NAN */

typedef u_short ushort;

typedef unsigned char slock_t;

extern int	isnan(double dsrc);

extern char *crypt(const char *, const char *);

extern long random(void);
extern void srandom(unsigned int seed);

Remove rint() prototype from QNX.

Remove rint() prototype from QNX.


int main(int argc, char **argv) {
  lldb_enable_attach();
  int to_complete = 0;
  return to_complete;
}

int main(int argc, char **argv) {
  int to_complete = 0;
  return to_complete;
}

[lldb][NFC] Remove unnecessary lldb_enable_attach in TestMultilineCompletion

We don't actually need to call this for this test.

git-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@370623 91177308-0d34-0410-b5e6-96231b3b80d8


// Copyright (c) 2008 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_PROXY_PROXY_RESOLVER_MAC_H_
#define NET_PROXY_PROXY_RESOLVER_MAC_H_
#pragma once

#include <string>

#include "googleurl/src/gurl.h"
#include "net/base/net_errors.h"
#include "net/proxy/proxy_resolver.h"

namespace net {

// Implementation of ProxyResolver that uses the Mac CFProxySupport to implement
// proxies.
class ProxyResolverMac : public ProxyResolver {
 public:
  ProxyResolverMac() : ProxyResolver(false /*expects_pac_bytes*/) {}

  // ProxyResolver methods:
  virtual int GetProxyForURL(const GURL& url,
                             ProxyInfo* results,
                             CompletionCallback* callback,
                             RequestHandle* request,
                             const BoundNetLog& net_log);

  virtual void CancelRequest(RequestHandle request) {
    NOTREACHED();
  }

  virtual int SetPacScript(
      const scoped_refptr<ProxyResolverScriptData>& script_data,
      CompletionCallback* /*callback*/) {
    script_data_ = script_data_;
    return OK;
  }

 private:
  scoped_refptr<ProxyResolverScriptData> script_data_;
};

}  // namespace net

#endif  // NET_PROXY_PROXY_RESOLVER_MAC_H_

// Copyright (c) 2008 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_PROXY_PROXY_RESOLVER_MAC_H_
#define NET_PROXY_PROXY_RESOLVER_MAC_H_
#pragma once

#include <string>

#include "googleurl/src/gurl.h"
#include "net/base/net_errors.h"
#include "net/proxy/proxy_resolver.h"

namespace net {

// Implementation of ProxyResolver that uses the Mac CFProxySupport to implement
// proxies.
class ProxyResolverMac : public ProxyResolver {
 public:
  ProxyResolverMac() : ProxyResolver(false /*expects_pac_bytes*/) {}

  // ProxyResolver methods:
  virtual int GetProxyForURL(const GURL& url,
                             ProxyInfo* results,
                             CompletionCallback* callback,
                             RequestHandle* request,
                             const BoundNetLog& net_log);

  virtual void CancelRequest(RequestHandle request) {
    NOTREACHED();
  }

  virtual int SetPacScript(
      const scoped_refptr<ProxyResolverScriptData>& script_data,
      CompletionCallback* /*callback*/) {
    script_data_ = script_data;
    return OK;
  }

 private:
  scoped_refptr<ProxyResolverScriptData> script_data_;
};

}  // namespace net

#endif  // NET_PROXY_PROXY_RESOLVER_MAC_H_

Fix a typo, that could cause a crash on mac.

BUG=50717
TBR=rvargas
TEST=Set system proxy settings to use a custom PAC script, then launch TestShell.app -- should not crash.
Review URL: http://codereview.chromium.org/3023030

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


/* ISC license. */

/* MT-unsafe */

#include <skalibs/stralloc.h>
#include <skalibs/skamisc.h>
#include <skalibs/djbunix.h>

int sarealpath (stralloc *sa, char const *path)
{
  return sarealpath_tmp(sa, path, &satmp) ;
}

/* ISC license. */

/* MT-unsafe */

#include <skalibs/stralloc.h>
#include <skalibs/skamisc.h>
#include <skalibs/djbunix.h>

 BUG

int sarealpath (stralloc *sa, char const *path)
{
  return sarealpath_tmp(sa, path, &satmp) ;
}

Make build crash early on purpose (to test test suite...)


#ifndef TACHYON_TEST_UTILS_MOCK_QUEUE_H_
#define TACHYON_TEST_UTILS_MOCK_QUEUE_H_

#include <stdint.h>

#include "gmock/gmock.h"

#include "lib/queue_interface.h"

namespace tachyon {
namespace testing {

// Mock class for queues.
template <class T>
class MockQueue : public QueueInterface<T> {
 public:
  MOCK_METHOD1_T(Enqueue, bool(const T &item));
  MOCK_METHOD1_T(EnqueueBlocking, bool(const T &item));

  MOCK_METHOD1_T(DequeueNext, bool(T *item));
  MOCK_METHOD1_T(DequeueNextBlocking, void(T *item));

  MOCK_CONST_METHOD0_T(GetOffset, int());
  MOCK_METHOD0_T(FreeQueue, void());

  MOCK_CONST_METHOD0_T(GetNumConsumers, uint32_t());
};

}  // namespace testing
}  // namespace tachyon

#endif  // TACHYON_TEST_UTILS_MOCK_QUEUE_H_

#ifndef TACHYON_TEST_UTILS_MOCK_QUEUE_H_
#define TACHYON_TEST_UTILS_MOCK_QUEUE_H_

#include <stdint.h>

#include "gmock/gmock.h"

#include "lib/queue_interface.h"

namespace tachyon {
namespace testing {

// Mock class for queues.
template <class T>
class MockQueue : public QueueInterface<T> {
 public:
  MOCK_METHOD1_T(Enqueue, bool(const T &item));
  MOCK_METHOD1_T(EnqueueBlocking, bool(const T &item));

  MOCK_METHOD1_T(DequeueNext, bool(T *item));
  MOCK_METHOD1_T(DequeueNextBlocking, void(T *item));

  MOCK_METHOD1_T(PeekNext, bool(T *item));
  MOCK_METHOD1_T(PeekNextBlocking, void(T *item));

  MOCK_CONST_METHOD0_T(GetOffset, int());
  MOCK_METHOD0_T(FreeQueue, void());

  MOCK_CONST_METHOD0_T(GetNumConsumers, uint32_t());
};

}  // namespace testing
}  // namespace tachyon

#endif  // TACHYON_TEST_UTILS_MOCK_QUEUE_H_

Add peek methods to mock queue.

Add peek methods to mock queue.


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

#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <sys/stat.h>

#pragma GCC diagnostic ignored "-Wnonnull"

#define KNOWN_FILE_SIZE 30

int main(int argc, char** argv) {
  struct stat st;
  struct stat64 st64;

  if (2 != argc) {
    printf("Usage: sel_ldr test_stat.nexe test_stat_data\n");
    return 1;
  }
  st.st_size = 0;
  st64.st_size = 0;

  assert(-1 == stat(NULL, &st));
  assert(EFAULT == errno);
  assert(-1 == stat(".", NULL));
  assert(EFAULT == errno);
  errno = 0;
  assert(0 == stat(argv[1], &st));
  assert(0 == errno);
  assert(KNOWN_FILE_SIZE == st.st_size);

  assert(-1 == stat64(NULL, &st64));
  assert(EFAULT == errno);
  assert(-1 == stat64(".", NULL));
  assert(EFAULT == errno);
  errno = 0;
  assert(0 == stat64(argv[1], &st64));
  assert(0 == errno);
  assert(KNOWN_FILE_SIZE == st64.st_size);

  return 0;
}

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

#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <sys/stat.h>

#pragma GCC diagnostic ignored "-Wnonnull"

#define KNOWN_FILE_SIZE 30

int main(int argc, char** argv) {
  struct stat st;

  if (2 != argc) {
    printf("Usage: sel_ldr test_stat.nexe test_stat_data\n");
    return 1;
  }
  st.st_size = 0;

  assert(-1 == stat(NULL, &st));
  assert(EFAULT == errno);
  assert(-1 == stat(".", NULL));
  assert(EFAULT == errno);
  errno = 0;
  assert(0 == stat(argv[1], &st));
  assert(0 == errno);
  assert(KNOWN_FILE_SIZE == st.st_size);

  return 0;
}

Remove test for obsolete function stat64.

BUG=
TEST=run_stat_test
Review URL: http://codereview.chromium.org/6300006

git-svn-id: 721b910a23eff8a86f00c8fd261a7587cddf18f8@4152 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2


#ifndef LIB_MART_COMMON_GUARD_TMP_H
#define LIB_MART_COMMON_GUARD_TMP_H
/**
* tmp.h (mart-common)
*
* Copyright (C) 2015-2017: Michael Balszun <michael.balszun@mytum.de>
*
* This software may be modified and distributed under the terms
* of the MIT license. See either the LICENSE file in the library's root
* directory or http://opensource.org/licenses/MIT for details.
*
* @author: Michael Balszun <michael.balszun@mytum.de>
* @brief: template meta programming helpers
*
*/

/* ######## INCLUDES ######### */
/* Standard Library Includes */

/* Proprietary Library Includes */
#include "../cpp_std/type_traits.h"
#include "../cpp_std/utility.h"

/* Project Includes */
/* ~~~~~~~~ INCLUDES ~~~~~~~~~ */

namespace mart {
namespace tmp {

template<class T, std::size_t N>
struct c_array {
	const T t[N];
	constexpr T operator[](size_t i) const {
		return t[i];
	}
	static constexpr size_t size() { return N; }
};

template<class T, T ... Is, template<class, T...> class sequence>
constexpr c_array<T, sizeof...(Is)> to_carray(sequence<T, Is...>) {
	return { {Is...}};

}

// watch out: on gcc, you can't use parameters itself to generate the returntype, but have to create a new value of the type

namespace detail_cartesian_value_product {
template<
	template<class ... > class Comb,
	class V1, class V2,
	template< V1, V2 > class T,
	class List1,
	class List2,
	std::size_t ... Is
>
auto impl(List1, List2, mart::index_sequence<Is...>)
-> Comb < T <
	to_carray(List1{})[Is / List2::size()],
	to_carray(List2{})[Is % List2::size()]
	> ...
>;

}

template<
	template<class ... > class Comb,
	class V1, class V2,
	template< V1, V2 > class T,
	class List1,
	class List2
>
auto cartesian_value_product(List1 l1, List2 l2 )
-> decltype(detail_cartesian_value_product::impl<Comb,V1,V2,T>(l1, l2, mart::make_index_sequence<List1::size()*List2::size()>{}));

}
}

#endif

[Merge] Add cartesian_value_product template meta function


//
//  main.c
//  secure-notes-exporter
//
//  Created by Greg Hurrell on 5/9/14.
//  Copyright (c) 2014 Greg Hurrell. All rights reserved.
//

#include <CoreFoundation/CoreFoundation.h>
#include <Security/Security.h>

int main(int argc, const char * argv[])
{
    // create query
    CFStringRef keys[] = { kSecReturnAttributes, kSecMatchLimit, kSecClass };
    CFTypeRef values[] = { kCFBooleanTrue, kSecMatchLimitAll, kSecClassGenericPassword };
    CFDictionaryRef query = CFDictionaryCreate(
        kCFAllocatorDefault,
        (const void **)keys,
        (const void **)values,
        3,
        &kCFTypeDictionaryKeyCallBacks,
        &kCFTypeDictionaryValueCallBacks
    );

    // get search results
    CFArrayRef items = nil;
    OSStatus status = SecItemCopyMatching(query, (CFTypeRef *)&items);
    CFRelease(query);
    assert(status == 0);
    CFShow(items);
    CFRelease(items);
    return 0;
}

//
//  main.c
//  secure-notes-exporter
//
//  Created by Greg Hurrell on 5/9/14.
//  Copyright (c) 2014 Greg Hurrell. All rights reserved.
//

#include <CoreFoundation/CoreFoundation.h>
#include <Security/Security.h>

void printItem(const void *value, void *context) {
    CFDictionaryRef dictionary = value;
    CFNumberRef itemType = CFDictionaryGetValue(dictionary, kSecAttrType);
    CFNumberRef noteType = (CFNumberRef)context;
    if (!itemType || !CFEqual(itemType, noteType)) {
        // not a note
        return;
    }

    CFShow(noteType);
}

int main(int argc, const char * argv[])
{
    // create query
    CFStringRef keys[] = { kSecReturnAttributes, kSecMatchLimit, kSecClass };
    CFTypeRef values[] = { kCFBooleanTrue, kSecMatchLimitAll, kSecClassGenericPassword };
    CFDictionaryRef query = CFDictionaryCreate(
        kCFAllocatorDefault,
        (const void **)keys,
        (const void **)values,
        3,
        &kCFTypeDictionaryKeyCallBacks,
        &kCFTypeDictionaryValueCallBacks
    );

    // get search results
    CFArrayRef items = nil;
    OSStatus status = SecItemCopyMatching(query, (CFTypeRef *)&items);
    CFRelease(query);
    assert(status == 0);

    // iterate over "Secure Note" items
    CFRange range = CFRangeMake(0, CFArrayGetCount(items));
    SInt32 note = 'note';
    CFNumberRef noteRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &note);
    CFArrayApplyFunction(items, range, printItem, (void *)noteRef);
    CFRelease(noteRef);
    CFRelease(items);
    return 0;
}

Print something about "Secure Notes" while iterating

I couldn't find a constant for 'note' and there are probably more
idiomatic ways to do this, but this is what I have.

Signed-off-by: Greg Hurrell <79e2475f81a6317276bf7cbb3958b20d289b78df@hurrell.net>


//===- Mem2Reg.h - The -mem2reg pass, a wrapper around the Utils lib ------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This pass is a simple pass wrapper around the PromoteMemToReg function call
// exposed by the Utils library.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_TRANSFORMS_UTILS_MEM2REG_H
#define LLVM_TRANSFORMS_UTILS_MEM2REG_H

#include "llvm/IR/Function.h"
#include "llvm/IR/PassManager.h"

namespace llvm {
class PromotePass : public PassInfoMixin<PromotePass> {
public:
  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
};
}

#endif // LLVM_TRANSFORMS_UTILS_MEM2REG_H

Add EOL at EOF to appease source utils like unifdef

<rdar://problem/32511256>

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@305225 91177308-0d34-0410-b5e6-96231b3b80d8


/*
 *  Bug in duk_is_primitive() prior to Duktape 1.3.0: returns 1 for invalid
 *  index.
 *
 *  https://github.com/svaarala/duktape/issues/337
 */

/*===
*** test_1 (duk_safe_call)
0
final top: 0
==> rc=0, result='undefined'
*** test_2 (duk_safe_call)
0
final top: 0
==> rc=0, result='undefined'
*** test_3 (duk_safe_call)
1
0
final top: 1
==> rc=0, result='undefined'
===*/

static duk_ret_t test_1(duk_context *ctx) {
	printf("%ld\n", (long) duk_is_primitive(ctx, -1));

	printf("final top: %ld\n", (long) duk_get_top(ctx));
	return 0;
}

static duk_ret_t test_2(duk_context *ctx) {
	printf("%ld\n", (long) duk_is_primitive(ctx, DUK_INVALID_INDEX));

	printf("final top: %ld\n", (long) duk_get_top(ctx));
	return 0;
}

static duk_ret_t test_3(duk_context *ctx) {
	duk_push_null(ctx);

	printf("%ld\n", (long) duk_is_primitive(ctx, 0));  /* valid */
	printf("%ld\n", (long) duk_is_primitive(ctx, 1));  /* invalid */

	printf("final top: %ld\n", (long) duk_get_top(ctx));
	return 0;
}

void test(duk_context *ctx) {
	TEST_SAFE_CALL(test_1);
	TEST_SAFE_CALL(test_2);
	TEST_SAFE_CALL(test_3);
}

Add bug testcase for GH-337

Add bug testcase for GH-337


#include<pthread.h>
#include<assert.h>
int counter = 0;
pthread_mutex_t lock1;

void* producer(void* param) {
    pthread_mutex_lock(&lock1);
    counter = 0;
    pthread_mutex_unlock(&lock1);
}

void* consumer(void* param) {
    pthread_mutex_lock(&lock1);
    int bla = counter >= 0;
    // This should not produce a warning about the privatization being unsound
    assert(counter >= 0);
    pthread_mutex_unlock(&lock1);
}

int main() {
    pthread_t thread;
    pthread_t thread2;
    pthread_create(&thread,NULL,producer,NULL);
    pthread_create(&thread2,NULL,consumer,NULL);
}

//PARAM: --disable warn.assert
#include<pthread.h>
#include<assert.h>
int counter = 0;
pthread_mutex_t lock1;

void* producer(void* param) {
    pthread_mutex_lock(&lock1);
    counter = 0;
    pthread_mutex_unlock(&lock1);
}

void* consumer(void* param) {
    pthread_mutex_lock(&lock1);
    int bla = counter >= 0;
    // This should not produce a warning about the privatization being unsound
    assert(counter >= 0); //NOWARN
    pthread_mutex_unlock(&lock1);
}

int main() {
    pthread_t thread;
    pthread_t thread2;
    pthread_create(&thread,NULL,producer,NULL);
    pthread_create(&thread2,NULL,consumer,NULL);
}

Modify test 02/86 so it fails if spurious warning is produced


/*
 * Copyright (C) 2019 Inria
 *
 * This file is subject to the terms and conditions of the GNU Lesser
 * General Public License v2.1. See the file LICENSE in the top level
 * directory for more details.
 */

/**
 * @ingroup     boards_nrf52832-mdk
 * @{
 *
 * @file
 * @brief       Peripheral configuration for the nRF52832-MDK
 *
 * @author      Alexandre Abadie <alexandre.abadie@inria.fr>
 *
 */

#ifndef PERIPH_CONF_H
#define PERIPH_CONF_H

#include "periph_cpu.h"
#include "cfg_clock_32_1.h"
#include "cfg_i2c_default.h"
#include "cfg_rtt_default.h"
#include "cfg_spi_default.h"
#include "cfg_timer_default.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @name    UART configuration
 * @{
 */
#define UART_NUMOF          (1U)
#define UART_PIN_RX         GPIO_PIN(0,19)
#define UART_PIN_TX         GPIO_PIN(0,20)
/** @} */

#ifdef __cplusplus
}
#endif

#endif /* PERIPH_CONF_H */

/*
 * Copyright (C) 2019 Inria
 *
 * This file is subject to the terms and conditions of the GNU Lesser
 * General Public License v2.1. See the file LICENSE in the top level
 * directory for more details.
 */

/**
 * @ingroup     boards_nrf52832-mdk
 * @{
 *
 * @file
 * @brief       Peripheral configuration for the nRF52832-MDK
 *
 * @author      Alexandre Abadie <alexandre.abadie@inria.fr>
 *
 */

#ifndef PERIPH_CONF_H
#define PERIPH_CONF_H

#include "periph_cpu.h"
#include "cfg_clock_32_1.h"
#include "cfg_i2c_default.h"
#include "cfg_rtt_default.h"
#include "cfg_spi_default.h"
#include "cfg_timer_default.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @name    UART configuration
 * @{
 */
#define UART_NUMOF          (1U)
#define UART_PIN_RX         GPIO_PIN(0,19)
#define UART_PIN_TX         GPIO_PIN(0,20)
/** @} */

/**
 * @brief Enable the internal DC/DC converter
 */
#define NRF5X_ENABLE_DCDC

#ifdef __cplusplus
}
#endif

#endif /* PERIPH_CONF_H */

nrf52832-mdk: Enable the nRF52 built-in DC/DC converter


#ifndef VAST_CONCEPT_PARSEABLE_VAST_HTTP_H
#define VAST_CONCEPT_PARSEABLE_VAST_HTTP_H

#include <algorithm>
#include <cctype>
#include <string>

#include "vast/concept/parseable/core.h"
#include "vast/concept/parseable/string.h"
#include "vast/concept/parseable/numeric/real.h"
#include "vast/concept/parseable/vast/uri.h"
#include "vast/http.h"
#include "vast/uri.h"
#include "vast/util/string.h"

namespace vast {

struct http_header_parser : parser<http_header_parser> {
  using attribute = http::header;

  static auto make() {
    auto to_upper = [](std::string name) {
      std::transform(name.begin(), name.end(), name.begin(), ::toupper);
      return name;
    };
    using namespace parsers;
    auto name = +(printable - ':') ->* to_upper;
    auto value = +printable;
    auto ws = *' '_p;
    return name >> ':' >> ws >> value;
  }

  template <typename Iterator>
  bool parse(Iterator& f, Iterator const& l, unused_type) const {
    static auto p = make();
    return p.parse(f, l, unused);
  }

  template <typename Iterator>
  bool parse(Iterator& f, Iterator const& l, http::header& a) const {
    static auto p = make();
    a.name.clear();
    a.value.clear();
    auto t = std::tie(a.name, a.value);
    return p.parse(f, l, t);
  }
};

template <>
struct parser_registry<http::header> {
  using type = http_header_parser;
};

struct http_request_parser : parser<http_request_parser> {
  using attribute = http::request;

  static auto make() {
    using namespace parsers;
    auto crlf = "\r\n";
    auto word = +(printable - ' ');
    auto method = word;
    auto uri = make_parser<vast::uri>();
    auto proto = +alpha;
    auto version = parsers::real;
    auto header = make_parser<http::header>() >> crlf;
    auto body = *printable;
    auto request
      =   method >> ' ' >> uri >> ' ' >> proto >> '/' >> version >> crlf
      >>  *header >> crlf
      >>  body;
      ;
    return request;
  }

  template <typename Iterator>
  bool parse(Iterator& f, Iterator const& l, unused_type) const {
    static auto p = make();
    return p.parse(f, l, unused);
  }

  template <typename Iterator>
  bool parse(Iterator& f, Iterator const& l, http::request& a) const {
    static auto p = make();
    auto t =
      std::tie(a.method, a.uri, a.protocol, a.version, a.headers, a.body);
    return p.parse(f, l, t);
  }
};

template <>
struct parser_registry<http::request> {
  using type = http_request_parser;
};

} // namespace vast

#endif

Add HTTP parsers which got lost during last merge


/****************************************************************************
 * Simple definitions to aid platform portability
 *  Author:  Bill Forster
 *  License: MIT license. Full text of license is in associated file LICENSE
 *  Copyright 2010-2014, Bill Forster <billforsternz at gmail dot com>
 ****************************************************************************/
#ifndef PORTABILITY_H
#define PORTABILITY_H
#include <stdint.h>     // int32_t etc.

// Windows
#ifdef WIN32
#include <Windows.h>
#include <string.h>
#define strcmpi _strcmpi
#define THC_WINDOWS         // Triple Happy Chess, Windows specific code
#define WINDOWS_FIX_LATER   // Windows only fix later on Mac

// Mac
#else
unsigned long GetTickCount();
typedef unsigned char byte;
int strcmpi( const char *s, const char *t ); // return 0 if case insensitive match
#define THC_MAC             // Triple Happy Chess, Mac specific code
#define MAC_FIX_LATER       // Things not yet done on the Mac
#endif

//#define DebugPrintfInner printf //temp

#endif // PORTABILITY_H

/****************************************************************************
 * Simple definitions to aid platform portability
 *  Author:  Bill Forster
 *  License: MIT license. Full text of license is in associated file LICENSE
 *  Copyright 2010-2014, Bill Forster <billforsternz at gmail dot com>
 ****************************************************************************/
#ifndef PORTABILITY_H
#define PORTABILITY_H
#include <stdint.h>     // int32_t etc.

//CHOOSE ONE:
//#define TARRASCH_UNIX 1
//#define TARRASCH_WINDOWS 1
//#define TARRASCH_OSX 1

#ifdef WIN32
   #define TARRASCH_WINDOWS 1
#else
   #define TARRASCH_UNIX 1
#endif

#include <stdint.h>     // int32_t etc.

#if TARRASCH_UNIX
   #include <string.h>
   typedef uint8_t byte;
   #define THC_MAC
   #define MAC_FIX_LATER
   unsigned long GetTickCount();
   int strcmpi(const char *s, const char *t);
#elif TARRASCH_WINDOWS
   #include <Windows.h>
   #include <string.h>
   #define strcmpi _strcmpi
   #define THC_WINDOWS         // Triple Happy Chess, Windows specific code
   #define WINDOWS_FIX_LATER   // Windows only fix later on Mac
#elif TARRASCH_OSX
   unsigned long GetTickCount();
   typedef unsigned char byte;
   int strcmpi( const char *s, const char *t ); // return 0 if case insensitive match
   #define THC_MAC             // Triple Happy Chess, Mac specific code
   #define MAC_FIX_LATER       // Things not yet done on the Mac
#else
   #error Unknown Platform!
#endif

//#define DebugPrintfInner printf //temp

#endif // PORTABILITY_H

Change over to KostaKow's version of this


#ifndef POLLING_THREAD_H
#define POLLING_THREAD_H

#include <cstdint>
#include <chrono>
#include <map>
#include <uv.h>

#include "../thread.h"
#include "../status.h"
#include "../result.h"
#include "polled_root.h"

const std::chrono::milliseconds DEFAULT_POLL_INTERVAL = std::chrono::milliseconds(500);
const uint_fast64_t DEFAULT_POLL_THROTTLE = 1000;

class PollingThread : public Thread {
public:
  PollingThread(uv_async_t *main_callback);
  ~PollingThread();

  void collect_status(Status &status) override;

private:
  Result<> body() override;

  Result<> cycle();

  Result<OfflineCommandOutcome> handle_offline_command(const CommandPayload *command) override;

  Result<CommandOutcome> handle_add_command(const CommandPayload *command) override;

  Result<CommandOutcome> handle_remove_command(const CommandPayload *payload) override;

  std::chrono::milliseconds poll_interval;
  uint_fast64_t poll_throttle;

  std::map<ChannelID, PolledRoot> roots;
};

#endif

#ifndef POLLING_THREAD_H
#define POLLING_THREAD_H

#include <cstdint>
#include <chrono>
#include <map>
#include <uv.h>

#include "../thread.h"
#include "../status.h"
#include "../result.h"
#include "polled_root.h"

const std::chrono::milliseconds DEFAULT_POLL_INTERVAL = std::chrono::milliseconds(100);
const uint_fast64_t DEFAULT_POLL_THROTTLE = 1000;

class PollingThread : public Thread {
public:
  PollingThread(uv_async_t *main_callback);
  ~PollingThread();

  void collect_status(Status &status) override;

private:
  Result<> body() override;

  Result<> cycle();

  Result<OfflineCommandOutcome> handle_offline_command(const CommandPayload *command) override;

  Result<CommandOutcome> handle_add_command(const CommandPayload *command) override;

  Result<CommandOutcome> handle_remove_command(const CommandPayload *payload) override;

  std::chrono::milliseconds poll_interval;
  uint_fast64_t poll_throttle;

  std::map<ChannelID, PolledRoot> roots;
};

#endif

Drop the default polling interval to 100ms


#ifndef __CORE_SET__
#define __CORE_SET__

#include <set>

class CoreSet : public std::set<int>
{
public:
    int getPrevCore(int coreId) {
        auto curr = this->find(coreId);
        assert(curr != this->end());
        curr--;
        // This was the first element, start over
        if (curr == this->end())
            curr--;
        return *curr;
    }

    int getNextCore(int coreId) {
        auto curr = this->find(coreId);
        assert(curr != this->end());
        curr++;
        // This was the last element, start over
        if (curr == this->end())
            curr = this->begin();
        return *curr;
    }
};

#endif

#ifndef __CORE_SET__
#define __CORE_SET__

#include "assert.h"
#include <set>

class CoreSet : public std::set<int>
{
public:
    int getPrevCore(int coreId) {
        auto curr = this->find(coreId);
        assert(curr != this->end());
        curr--;
        // This was the first element, start over
        if (curr == this->end())
            curr--;
        return *curr;
    }

    int getNextCore(int coreId) {
        auto curr = this->find(coreId);
        assert(curr != this->end());
        curr++;
        // This was the last element, start over
        if (curr == this->end())
            curr = this->begin();
        return *curr;
    }
};

#endif

Add a missing header include for assert.h


//===========================================
//  Lumina-DE source code
//  Copyright (c) 2012, Ken Moore
//  Available under the 3-clause BSD license
//  See the LICENSE file for full details
//===========================================
#ifndef _LUMINA_DESKTOP_GLOBALS_H
#define _LUMINA_DESKTOP_GLOBALS_H

class SYSTEM{
public:
	//Current Username
	static QString user(){ return QString(getlogin()); }
	//Current Hostname
	static QString hostname(){
	  char name[50];
	  gethostname(name,sizeof(name));
	  return QString(name);
	}
	//Shutdown the system
	static void shutdown(){ system("(shutdown -p now) &"); }
	//Restart the system
	static void restart(){ system("(shutdown -r now) &"); }
};

/*
class LUMINA{
public:
	static QIcon getIcon(QString iconname);
	static QIcon getFileIcon(QString filename);
};
*/

#endif

//===========================================
//  Lumina-DE source code
//  Copyright (c) 2012, Ken Moore
//  Available under the 3-clause BSD license
//  See the LICENSE file for full details
//===========================================
#ifndef _LUMINA_DESKTOP_GLOBALS_H
#define _LUMINA_DESKTOP_GLOBALS_H

#include <unistd.h>

class SYSTEM{
public:
	//Current Username
	static QString user(){ return QString(getlogin()); }
	//Current Hostname
	static QString hostname(){
	  char name[50];
	  gethostname(name,sizeof(name));
	  return QString(name);
	}
	//Shutdown the system
	static void shutdown(){ system("(shutdown -p now) &"); }
	//Restart the system
	static void restart(){ system("(shutdown -r now) &"); }
};

/*
class LUMINA{
public:
	static QIcon getIcon(QString iconname);
	static QIcon getFileIcon(QString filename);
};
*/

#endif

Fix up the Lumina compilation on 10.x

Fix up the Lumina compilation on 10.x


# 1 "wchar1.c"
# 1 "testharness.h" 1
extern int printf(const char *, ...);
extern void exit(int);

# 1 "wchar1.c" 2

# 1 "/usr/include/stddef.h" 1 3

# 1 "/usr/include/machine/ansi.h" 1 3

typedef	int __attribute__((__mode__(__DI__)))		 __int64_t;
typedef	unsigned int __attribute__((__mode__(__DI__)))	__uint64_t;

typedef	__signed char		   __int8_t;
typedef	unsigned char		  __uint8_t;
typedef	short			  __int16_t;
typedef	unsigned short		 __uint16_t;
typedef	int			  __int32_t;
typedef	unsigned int		 __uint32_t;

typedef	int			 __intptr_t;
typedef	unsigned int		__uintptr_t;

typedef union {
	char		__mbstate8[128];
	__int64_t	_mbstateL;
} __mbstate_t;

# 41 "/usr/include/stddef.h" 2 3

typedef	int 	ptrdiff_t;

typedef	int  	rune_t;

typedef	unsigned int 	size_t;

typedef	int  	wchar_t;

# 2 "wchar1.c" 2

int main() {
  wchar_t *wbase = L"Hello" L", world";
  char * w = (char *)wbase;
  char * s =  "Hello" ", world";
  int i;

  for (i=0; i < 10; i++) {
    if (w[i * sizeof(wchar_t)] != s[i]) {
      { printf("Error %d\n",  1 ); exit( 1 ); } ;
    }
    if (w[i * sizeof(wchar_t)+ 1] != 0) {
      { printf("Error %d\n",  2 ); exit( 2 ); } ;
    }
  }
  { printf("Success\n"); exit(0); } ;
}

Test reported by Axel, our FreeBSD user. This file is the postprocessed
result from a FreeBSD machine. This command fails:

../bin/cilly small1/wchar1_freebsd.c

IGNORE


#ifndef NEWSBOAT_FILEURLREADER_H_
#define NEWSBOAT_FILEURLREADER_H_

#include <string>

#include "urlreader.h"

namespace newsboat {

class FileUrlReader : public UrlReader {
public:
	explicit FileUrlReader(const std::string& file = "");

	nonstd::optional<std::string> reload() override;
	std::string get_source() override;

	/// \brief Write URLs back to the input file.
	///
	/// This method is used after importing feeds from OPML.
	nonstd::optional<std::string> write_config();

private:
	const std::string filename;
};

}

#endif /* NEWSBOAT_FILEURLREADER_H_ */

#ifndef NEWSBOAT_FILEURLREADER_H_
#define NEWSBOAT_FILEURLREADER_H_

#include <string>

#include "urlreader.h"

namespace newsboat {

class FileUrlReader : public UrlReader {
public:
	explicit FileUrlReader(const std::string& file = "");

	/// \brief Load URLs from the urls file.
	///
	/// \return A non-value on success, an error message otherwise.
	nonstd::optional<std::string> reload() override;

	std::string get_source() override;

	/// \brief Write URLs back to the urls file.
	///
	/// \return A non-value on success, an error message otherwise.
	nonstd::optional<std::string> write_config();

private:
	const std::string filename;
};

}

#endif /* NEWSBOAT_FILEURLREADER_H_ */

Document return value of FileUrlReader's reload() and write_config()


/*
// Copyright (c) 2019 Intel Corporation
//
// 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 OC_CLOCK_UTIL_H
#define OC_CLOCK_UTIL_H

#include "oc_config.h"
size_t oc_clock_time_rfc3339(char *out_buf, size_t out_buf_len);

size_t oc_clock_encode_time_rfc3339(oc_clock_time_t time, char *out_buf,
                                    size_t out_buf_len);

oc_clock_time_t oc_clock_parse_time_rfc3339(const char *in_buf,
                                            size_t in_buf_len);

#endif /* OC_CLOCK_UTIL_H */

/*
// Copyright (c) 2019 Intel Corporation
//
// 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 OC_CLOCK_UTIL_H
#define OC_CLOCK_UTIL_H

#include "oc_config.h"
#include <stddef.h>

size_t oc_clock_time_rfc3339(char *out_buf, size_t out_buf_len);

size_t oc_clock_encode_time_rfc3339(oc_clock_time_t time, char *out_buf,
                                    size_t out_buf_len);

oc_clock_time_t oc_clock_parse_time_rfc3339(const char *in_buf,
                                            size_t in_buf_len);

#endif /* OC_CLOCK_UTIL_H */

Fix unknown type name 'size_t' error

Fix unknown type name 'size_t' error

freertos build fails complaining that size_t is an unknown type.
'size_t' is defined in stddef.h so is is included in the
oc_clock_util header file to resolve the error.

Change-Id: I9cfe5daa7850ca33f920be6b276609ee659584c1
Signed-off-by: George Nash <acbdc39d528a4315fe0b532d55c50ae46f5c1667@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/27890
Tested-by: IoTivity Jenkins <6267f6022d49a8a37a7fe97da24aebfab797522c@iotivity.org>
Reviewed-by: Kishen Maloor <c62ddea3cd661a9268bff15f07fc2229cdc9ac02@intel.com>


// REQUIRES: clang-driver
// REQUIRES: powerpc-registered-target
// REQUIRES: nvptx-registered-target

//
// Verify that CUDA device commands do not get OpenMP flags.
//
// RUN: %clang -no-canonical-prefixes -### -x cuda -target powerpc64le-linux-gnu -std=c++11 --cuda-gpu-arch=sm_35 -fopenmp=libomp %s 2>&1 \
// RUN: | FileCheck %s --check-prefix NO-OPENMP-FLAGS-FOR-CUDA-DEVICE
//
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE:      clang{{.*}}" "-cc1" "-triple" "nvptx64-nvidia-cuda"
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NOT:  -fopenmp
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: ptxas" "-m64"
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: fatbinary" "--cuda" "-64"
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: clang{{.*}}" "-cc1" "-triple" "powerpc64le-unknown-linux-gnu"
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE:      -fopenmp
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: {{ld(.exe)?"}} {{.*}}"-m" "elf64lppc"

// REQUIRES: clang-driver
// REQUIRES: powerpc-registered-target
// REQUIRES: nvptx-registered-target

//
// Verify that CUDA device commands do not get OpenMP flags.
//
// RUN: %clang -no-canonical-prefixes -### -x cuda -target powerpc64le-linux-gnu -std=c++11 --cuda-gpu-arch=sm_35 -fopenmp=libomp %s 2>&1 \
// RUN: | FileCheck %s --check-prefix NO-OPENMP-FLAGS-FOR-CUDA-DEVICE
//
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE:      clang{{.*}}" "-cc1" "-triple" "nvptx64-nvidia-cuda"
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NOT:  -fopenmp
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: ptxas" "-m64"
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: fatbinary"{{( "--cuda")?}} "-64"
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: clang{{.*}}" "-cc1" "-triple" "powerpc64le-unknown-linux-gnu"
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE:      -fopenmp
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: {{ld(.exe)?"}} {{.*}}"-m" "elf64lppc"

Revise test case due to the change from CUDA 10+.

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


#ifndef LINUXFFBEFFECTFACTORY_H
#define LINUXFFBEFFECTFACTORY_H

#include "globals.h"
#include "linuxffbconditioneffect.h"
#include "linuxffbconstanteffect.h"
#include "ffbnulleffect.h"
#include "linuxffbperiodiceffect.h"
#include "linuxffbrampeffect.h"
#include "linuxffbrumbleeffect.h"

class LinuxFFBEffectFactory
{
public:
  static std::shared_ptr<FFBEffect> createEffect(FFBEffectTypes type);

private:
  LinuxFFBEffectFactory() {};

};

#endif // LINUXFFBEFFECTFACTORY_H

#ifndef LINUXFFBEFFECTFACTORY_H
#define LINUXFFBEFFECTFACTORY_H

#include "globals.h"
#include "linuxffbconditioneffect.h"
#include "linuxffbconstanteffect.h"
#include "ffbnulleffect.h"
#include "linuxffbperiodiceffect.h"
#include "linuxffbrampeffect.h"
#include "linuxffbrumbleeffect.h"

class LinuxFFBEffectFactory
{
public:
  static std::shared_ptr<FFBEffect> createEffect(FFBEffectTypes type);

  LinuxFFBEffectFactory() = delete;
};

#endif // LINUXFFBEFFECTFACTORY_H

Use deleted instead of private constructors


@class CLPlacemark;
@class TRTemperature;

@interface TRWeatherUpdate : NSObject

@property (nonatomic, copy, readonly) NSString *city;
@property (nonatomic, copy, readonly) NSString *state;
@property (nonatomic, copy, readonly) NSString *conditionsDescription;
@property (nonatomic, readonly) TRTemperature *currentTemperature;
@property (nonatomic, readonly) TRTemperature *currentHigh;
@property (nonatomic, readonly) TRTemperature *currentLow;
@property (nonatomic, readonly) TRTemperature *yesterdaysTemperature;
@property (nonatomic, readonly) CGFloat windSpeed;
@property (nonatomic, readonly) CGFloat windBearing;
@property (nonatomic, readonly) NSDate *date;
@property (nonatomic, copy, readonly) NSArray *dailyForecasts;

- (instancetype)initWithPlacemark:(CLPlacemark *)placemark currentConditionsJSON:(id)currentConditionsJSON yesterdaysConditionsJSON:(id)yesterdaysConditionsJSON;

@end

#import "TRAnalyticsEvent.h"

@interface TRWeatherUpdate (TRAnalytics) <TRAnalyticsEvent>

@end

Fix compiler error about undeclared type


/*-
 * Copyright (c) 2010 Jilles Tjoelker
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
 *
 * $FreeBSD$
 */

#include	<sys/select.h>

#include	<err.h>
#include	<stdio.h>
#include	<unistd.h>

/*
 * Check that pipes can be selected for writing in the reverse direction.
 */
int
main(int argc, char *argv[])
{
	int pip[2];
	fd_set set;
	int n;

	if (pipe(pip) == -1)
		err(1, "FAIL: pipe");

	FD_ZERO(&set);
	FD_SET(pip[0], &set);
	n = select(pip[1] + 1, NULL, &set, NULL, &(struct timeval){ 0, 0 });
	if (n != 1)
		errx(1, "FAIL: select initial reverse direction");

	n = write(pip[0], "x", 1);
	if (n != 1)
		err(1, "FAIL: write reverse direction");

	FD_ZERO(&set);
	FD_SET(pip[0], &set);
	n = select(pip[1] + 1, NULL, &set, NULL, &(struct timeval){ 0, 0 });
	if (n != 1)
		errx(1, "FAIL: select reverse direction after write");

	printf("PASS\n");

	return (0);
}

Add a test for r228510.

Add a test for r228510.


#ifndef TE_AUXILIARY_H
#define TE_AUXILIARY_H

struct SDL_Rect;

namespace te
{

    struct Vector2i;
    class Rectangle;

    bool checkCollision(const SDL_Rect& a, const SDL_Rect& b);
    bool checkCollision(const Rectangle& a, const Rectangle& b);

    SDL_Rect getIntersection(const SDL_Rect& a, const SDL_Rect& b);
    SDL_Rect getIntersection(const Rectangle& a, const Rectangle& b);

    Vector2i getCenter(const SDL_Rect& rect);
    Vector2i getCenter(const Rectangle& rect);

    void handlePaddleCollision(Rectangle& ball, const Rectangle& paddle, float dt, float velocityScalar = 200.f);
    void handleWallCollision(Rectangle& ball, const Rectangle& wall, float dt);
}

#endif

#ifndef TE_AUXILIARY_H
#define TE_AUXILIARY_H

#include <map>

struct SDL_Rect;

namespace te
{

    struct Vector2i;
    class Rectangle;

    bool checkCollision(const SDL_Rect& a, const SDL_Rect& b);
    bool checkCollision(const Rectangle& a, const Rectangle& b);

    SDL_Rect getIntersection(const SDL_Rect& a, const SDL_Rect& b);
    SDL_Rect getIntersection(const Rectangle& a, const Rectangle& b);

    Vector2i getCenter(const SDL_Rect& rect);
    Vector2i getCenter(const Rectangle& rect);

    void handlePaddleCollision(Rectangle& ball, const Rectangle& paddle, float dt, float velocityScalar = 200.f);
    void handleWallCollision(Rectangle& ball, const Rectangle& wall, float dt);

    template <class K, class V>
    void insertOrAssign(std::map<K,V>& map, std::pair<K, V>&& kvPair)
    {
        auto it = map.find(kvPair.first);
        if (it == map.end())
        {
            map.insert(std::move(kvPair));
        }
        else
        {
            it->second = std::move(kvPair.second);
        }
    }

    template <class K, class V>
    void insertOrAssign(std::map<K, V>& map, const std::pair<K, V>& kvPair)
    {
        auto it = map.find(kvPair.first);
        if (it != map.end())
        {
            map.insert(kvPair);
        }
        else
        {
            it->second = kvPair.second;
        }
    }
}

#endif

Add insertOrAssign helper for maps

Add insertOrAssign helper for maps


// 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 WEBKIT_GLUE_FORM_DATA_H__
#define WEBKIT_GLUE_FORM_DATA_H__

#include <vector>

#include "base/string_util.h"
#include "googleurl/src/gurl.h"
#include "webkit/glue/form_field.h"

namespace webkit_glue {

// Holds information about a form to be filled and/or submitted.
struct FormData {
  // The name of the form.
  string16 name;
  // GET or POST.
  string16 method;
  // The URL (minus query parameters) containing the form.
  GURL origin;
  // The action target of the form.
  GURL action;
  // true if this form was submitted by a user gesture and not javascript.
  bool user_submitted;
  // A vector of all the input fields in the form.
  std::vector<FormField> fields;

  // Used by FormStructureTest.
  inline bool operator==(const FormData& form) const {
    return (name == form.name &&
            StringToLowerASCII(method) == StringToLowerASCII(form.method) &&
            origin == form.origin &&
            action == form.action &&
            user_submitted == form.user_submitted &&
            fields == form.fields);
  }
};

}  // namespace webkit_glue

#endif  // WEBKIT_GLUE_FORM_DATA_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 WEBKIT_GLUE_FORM_DATA_H__
#define WEBKIT_GLUE_FORM_DATA_H__

#include <vector>

#include "base/string_util.h"
#include "googleurl/src/gurl.h"
#include "webkit/glue/form_field.h"

namespace webkit_glue {

// Holds information about a form to be filled and/or submitted.
struct FormData {
  // The name of the form.
  string16 name;
  // GET or POST.
  string16 method;
  // The URL (minus query parameters) containing the form.
  GURL origin;
  // The action target of the form.
  GURL action;
  // true if this form was submitted by a user gesture and not javascript.
  bool user_submitted;
  // A vector of all the input fields in the form.
  std::vector<FormField> fields;

  FormData() : user_submitted(false) {}

  // Used by FormStructureTest.
  inline bool operator==(const FormData& form) const {
    return (name == form.name &&
            StringToLowerASCII(method) == StringToLowerASCII(form.method) &&
            origin == form.origin &&
            action == form.action &&
            user_submitted == form.user_submitted &&
            fields == form.fields);
  }
};

}  // namespace webkit_glue

#endif  // WEBKIT_GLUE_FORM_DATA_H__

AutoFill: Add a default constructor for FormData. There are too many places
that create FormDatas, and we shouldn't need to initialize user_submitted for
each call site.

BUG=50423
TEST=none

Review URL: http://codereview.chromium.org/3074023

git-svn-id: http://src.chromium.org/svn/trunk/src@54641 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

Former-commit-id: a7f3d5712d54ae80ca6a2a747522f8ae65c0ed98


extern "C" {
#include <sys/types.h>
}

class Instrument {
public:
	float start;
	float dur;
	int cursamp;
	int chunksamps;
	int endsamp;
	int nsamps;
	unsigned long chunkstart;

	int sfile_on; 		// a soundfile is open (for closing later)
	int fdIndex;            // index into unix input file desc. table
	int inputchans;
	double inputsr;
	off_t fileOffset;       // current offset in file for this inst
	int mytag;              // for note tagging/rtupdate()

	Instrument();
	virtual ~Instrument();
	virtual int init(float*, short);
	virtual int run();

	virtual float getstart();
	virtual float getdur();
	virtual int getendsamp();
	virtual void setendsamp(int);
	virtual void setchunk(int);
	virtual void setchunkstart(int);
private:
	void gone(); // decrements reference to input soundfile
};

extern void heapify(Instrument *Iptr);
extern void heapSched(Instrument *Iptr);
extern int rtsetoutput(float, float, Instrument*);
extern int rtsetinput(float, Instrument*);
extern int rtaddout(float*);
extern int rtbaddout(float*, int);
extern "C" int rtgetin(float*, Instrument*, int);
extern float rtupdate(int, int); // tag, p-field for return value

#include <sys/types.h>

class Instrument {
public:
	float start;
	float dur;
	int cursamp;
	int chunksamps;
	int endsamp;
	int nsamps;
	unsigned long chunkstart;

	int sfile_on; 		// a soundfile is open (for closing later)
	int fdIndex;            // index into unix input file desc. table
	int inputchans;
	double inputsr;
	off_t fileOffset;       // current offset in file for this inst
	int mytag;              // for note tagging/rtupdate()

	Instrument();
	virtual ~Instrument();
	virtual int init(float*, short);
	virtual int run();

	virtual float getstart();
	virtual float getdur();
	virtual int getendsamp();
	virtual void setendsamp(int);
	virtual void setchunk(int);
	virtual void setchunkstart(int);
private:
	void gone(); // decrements reference to input soundfile
};

extern void heapify(Instrument *Iptr);
extern void heapSched(Instrument *Iptr);
extern int rtsetoutput(float, float, Instrument*);
extern int rtsetinput(float, Instrument*);
extern int rtaddout(float*);
extern int rtbaddout(float*, int);
extern int rtgetin(float*, Instrument*, int);
extern float rtupdate(int, int); // tag, p-field for return value

Remove apparently uneccessary extern C stuff


// RUN: clang -checker-simple -verify %s

#include <stdlib.h>

int f1(int * p) {

  // This branch should be infeasible
  // because __imag__ p is 0.
  if (!p && __imag__ (intptr_t) p)
    *p = 1; // no-warning

  // If p != 0 then this branch is feasible; otherwise it is not.
  if (__real__ (intptr_t) p)
    *p = 1; // no-warning

  *p = 2; // expected-warning{{Dereference of null pointer}}
}

// RUN: clang -checker-simple -verify %s

#include <stdint.h>

int f1(int * p) {

  // This branch should be infeasible
  // because __imag__ p is 0.
  if (!p && __imag__ (intptr_t) p)
    *p = 1; // no-warning

  // If p != 0 then this branch is feasible; otherwise it is not.
  if (__real__ (intptr_t) p)
    *p = 1; // no-warning

  *p = 2; // expected-warning{{Dereference of null pointer}}
}

Include stdint.h instead of stdio.h.

Include stdint.h instead of stdio.h.

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


/* This file is part of Metallic, a C++ library for WebAssembly.
 *
 * Copyright (C) 2017 Chen-Pang He <chen.pang.he@jdh8.org>
 *
 * This Source Code Form is subject to the terms of the Mozilla
 * Public License v. 2.0. If a copy of the MPL was not distributed
 * with this file, You can obtain one at http://mozilla.org/MPL/2.0/
 */
#include "isunorderedq.h"

int __cmptf2(long double x, long double y)
{
    __int128 a = *(__int128*)&x;
    __int128 b = *(__int128*)&y;

    if ((a|b) << 1 == 0)
        return 0;

    if (isunorderedq(x, y))
        return 1;

    int sign = (a & b) >> 127;

    return ((a > b) - (a < b) + sign) ^ sign;
}

Add compare function of quadruple precision


/*
 * The Homework Database
 *
 * Authors:
 *    Oliver Sharma and Joe Sventek
 *     {oliver, joe}@dcs.gla.ac.uk
 *
 * (c) 2009. All rights reserved.
 */
#ifndef OCLIB_UTIL_H
#define OCLIB_UTIL_H

#include "config.h"
#include "logdefs.h"

#include <stdio.h>

/* -------- [MESSAGE] -------- */
#ifdef NMSG
#define MSG (void)
#else
#define MSG printf("DBSERVER> "); printf
#endif

#endif

/*
 * Copyright (c) 2013, Court of the University of Glasgow
 * 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 University of Glasgow nor the names of its
 *   contributors may be used to endorse or promote products derived from this
 *   software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

/*
 * The Homework Database
 *
 * Authors:
 *    Oliver Sharma and Joe Sventek
 *     {oliver, joe}@dcs.gla.ac.uk
 *
 */
#ifndef OCLIB_UTIL_H
#define OCLIB_UTIL_H

#include "config.h"
#include "logdefs.h"

#include <stdio.h>

/* -------- [MESSAGE] -------- */
#ifdef NMSG
#define MSG (void)
#else
#define MSG printf("DBSERVER> "); printf
#endif

#endif

Add BSD 3-clause open source header

Add BSD 3-clause open source header


#include "couv-private.h"

static int couv_hrtime(lua_State *L) {
  lua_pushnumber(L, uv_hrtime() / 1e9);
  return 1;
}

static const struct luaL_Reg functions[] = {
  { "hrtime", couv_hrtime },
  { NULL, NULL }
};

int luaopen_couv_native(lua_State *L) {
  lua_createtable(L, 0, ARRAY_SIZE(functions) - 1);
  couvL_setfuncs(L, functions, 0);

  luaopen_couv_loop(L);

  luaopen_couv_buffer(L);
  luaopen_couv_fs(L);
  luaopen_couv_ipaddr(L);

  luaopen_couv_handle(L);
  luaopen_couv_pipe(L);
  luaopen_couv_stream(L);
  luaopen_couv_tcp(L);
  luaopen_couv_timer(L);
  luaopen_couv_tty(L);
  luaopen_couv_udp(L);

  return 1;
}

#include "couv-private.h"

static int couv_hrtime(lua_State *L) {
  lua_pushnumber(L, uv_hrtime());
  return 1;
}

static const struct luaL_Reg functions[] = {
  { "hrtime", couv_hrtime },
  { NULL, NULL }
};

int luaopen_couv_native(lua_State *L) {
  lua_createtable(L, 0, ARRAY_SIZE(functions) - 1);
  couvL_setfuncs(L, functions, 0);

  luaopen_couv_loop(L);

  luaopen_couv_buffer(L);
  luaopen_couv_fs(L);
  luaopen_couv_ipaddr(L);

  luaopen_couv_handle(L);
  luaopen_couv_pipe(L);
  luaopen_couv_stream(L);
  luaopen_couv_tcp(L);
  luaopen_couv_timer(L);
  luaopen_couv_tty(L);
  luaopen_couv_udp(L);

  return 1;
}

Change return value of hrtime from seconds to nano seconds.


#include "v3p_f2c.h"
#ifdef __cplusplus
extern "C" {
#endif

#ifdef KR_headers
integer pow_ii(ap, bp) integer *ap, *bp;
#else
integer pow_ii(integer *ap, integer *bp)
#endif
{
        integer pow, x, n;
        unsigned long u;

        x = *ap;
        n = *bp;

        if (n <= 0) {
                if (n == 0 || x == 1)
                        return 1;
                if (x != -1)
                        return x == 0 ? 1/x : 0;
                n = -n;
                }
        u = n;
        for(pow = 1; ; )
                {
                if(u & 01)
                        pow *= x;
                if(u >>= 1)
                        x *= x;
                else
                        break;
                }
        return(pow);
        }
#ifdef __cplusplus
}
#endif

#include "v3p_f2c.h"
#ifdef __cplusplus
extern "C" {
#endif

/* The divide by zero below appears to be perhaps on purpose to create
   a numerical exception.  */
#ifdef _MSC_VER
# pragma warning (disable: 4723) /* potential divide by 0 */
#endif

#ifdef KR_headers
integer pow_ii(ap, bp) integer *ap, *bp;
#else
integer pow_ii(integer *ap, integer *bp)
#endif
{
        integer pow, x, n;
        unsigned long u;

        x = *ap;
        n = *bp;

        if (n <= 0) {
                if (n == 0 || x == 1)
                        return 1;
                if (x != -1)
                        return x == 0 ? 1/x : 0;
                n = -n;
                }
        u = n;
        for(pow = 1; ; )
                {
                if(u & 01)
                        pow *= x;
                if(u >>= 1)
                        x *= x;
                else
                        break;
                }
        return(pow);
        }
#ifdef __cplusplus
}
#endif

COMP: Disable divide by zero warning for VS6 to avoid modifying function implementation.


//
//  OAuthManager.h
//
//  Created by Ari Lerner on 5/31/16.
//  Copyright © 2016 Facebook. All rights reserved.
//

#import <Foundation/Foundation.h>

#if __has_include("RCTBridgeModule.h")
    #import "RCTBridgeModule.h"
#else
    #import <React/RCTBridgeModule.h>
#endif

#if __has_include("RCTLinkingManager.h")
    #import "RCTLinkingManager.h"
#else
    #import <React/RCTLinkingManager.h>
#endif

@class OAuthClient;

static NSString *kAuthConfig = @"OAuthManager";

@interface OAuthManager : NSObject <RCTBridgeModule, UIWebViewDelegate>

+ (instancetype) sharedManager;
+ (BOOL)setupOAuthHandler:(UIApplication *)application;

+ (BOOL)handleOpenUrl:(UIApplication *)application openURL:(NSURL *)url
    sourceApplication:(NSString *)sourceApplication annotation:(id)annotation;

- (BOOL) _configureProvider:(NSString *) name andConfig:(NSDictionary *) config;
- (NSDictionary *) getConfigForProvider:(NSString *)name;

@property (nonatomic, strong) NSDictionary *providerConfig;
@property (nonatomic, strong) NSArray *callbackUrls;

@end

//
//  OAuthManager.h
//
//  Created by Ari Lerner on 5/31/16.
//  Copyright © 2016 Facebook. All rights reserved.
//

#import <Foundation/Foundation.h>

#if __has_include(<React/RCTBridgeModule.h>)
    #import <React/RCTBridgeModule.h>
#else
    #import "RCTBridgeModule.h"
#endif

#if __has_include(<React/RCTLinkingManager.h>)
    #import <React/RCTLinkingManager.h>
#else
    #import "RCTLinkingManager.h"
#endif

@class OAuthClient;

static NSString *kAuthConfig = @"OAuthManager";

@interface OAuthManager : NSObject <RCTBridgeModule, UIWebViewDelegate>

+ (instancetype) sharedManager;
+ (BOOL)setupOAuthHandler:(UIApplication *)application;

+ (BOOL)handleOpenUrl:(UIApplication *)application openURL:(NSURL *)url
    sourceApplication:(NSString *)sourceApplication annotation:(id)annotation;

- (BOOL) _configureProvider:(NSString *) name andConfig:(NSDictionary *) config;
- (NSDictionary *) getConfigForProvider:(NSString *)name;

@property (nonatomic, strong) NSDictionary *providerConfig;
@property (nonatomic, strong) NSArray *callbackUrls;

@end

Fix: Duplicate RCTMethodInfo while building iOS app


#ifndef TA_ADDDATASOURCEPARAM_PRIV_H
#define TA_ADDDATASOURCEPARAM_PRIV_H

/* The following is a private copy of the user provided
 * parameters for a TA_AddDataSource call.
 *
 * Code is in 'ta_data_interface.c'
 */
typedef struct
{
  TA_SourceId   id;
  TA_SourceFlag flags;
  TA_Period     period;

  TA_String *location;
  TA_String *info;
  TA_String *username;
  TA_String *password;
  TA_String *category;
  TA_String *country;
  TA_String *exchange;
  TA_String *type;
  TA_String *symbol;
} TA_AddDataSourceParamPriv;

/* Function to alloc/free a TA_AddDataSourceParamPriv. */
TA_AddDataSourceParamPriv *TA_AddDataSourceParamPrivAlloc( const TA_AddDataSourceParam *param );

TA_RetCode TA_AddDataSourceParamPrivFree( TA_AddDataSourceParamPriv *toBeFreed );

#endif

#ifndef TA_ADDDATASOURCEPARAM_PRIV_H
#define TA_ADDDATASOURCEPARAM_PRIV_H

/* The following is a private copy of the user provided
 * parameters for a TA_AddDataSource call.
 *
 * Code is in 'ta_data_interface.c'
 */
typedef struct
{
  TA_SourceId   id;
  TA_SourceFlag flags;
  TA_Period     period;

  TA_String *location;
  TA_String *info;
  TA_String *username;
  TA_String *password;
  TA_String *category;
  TA_String *country;
  TA_String *exchange;
  TA_String *type;
  TA_String *symbol;
  TA_String *name;
} TA_AddDataSourceParamPriv;

/* Function to alloc/free a TA_AddDataSourceParamPriv. */
TA_AddDataSourceParamPriv *TA_AddDataSourceParamPrivAlloc( const TA_AddDataSourceParam *param );

TA_RetCode TA_AddDataSourceParamPrivFree( TA_AddDataSourceParamPriv *toBeFreed );

#endif

Add "TA_String *name" to TA_AddDataSourceParamPriv

git-svn-id: 33305d871a58cfd02b407b81d5206d2a785211eb@541 159cb52c-178a-4f3c-8eb8-d0aff033d058


//
// C++ Interface: getdetailstask
//
// Description:
//
//
// Author: SUSE AG <>, (C) 2004
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef GETDETAILSTASK_H
#define GETDETAILSTASK_H

#include "gwerror.h"
#include "requesttask.h"

/**
This task fetches the details for a set of user IDs from the server.  Sometimes we get an event that only has a DN, and we need other details before showing the event to the user.

@author SUSE AG
*/
using namespace GroupWise;

class GetDetailsTask : public RequestTask
{
Q_OBJECT
public:
	GetDetailsTask( Task * parent );
	~GetDetailsTask();
	bool take( Transfer * transfer );
	void userDNs( const QStringList & userDNs );
signals:
	void gotContactUserDetails( const ContactDetails & );
protected:
	GroupWise::ContactDetails extractUserDetails( Field::MultiField * details );

};

#endif

//
// C++ Interface: getdetailstask
//
// Description:
//
//
// Author: SUSE AG <>, (C) 2004
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef GETDETAILSTASK_H
#define GETDETAILSTASK_H

#include "gwerror.h"
#include "requesttask.h"

/**
This task fetches the details for a set of user IDs from the server.  Sometimes we get an event that only has a DN, and we need other details before showing the event to the user.

@author SUSE AG
*/
using namespace GroupWise;

class GetDetailsTask : public RequestTask
{
Q_OBJECT
public:
	GetDetailsTask( Task * parent );
	~GetDetailsTask();
	bool take( Transfer * transfer );
	void userDNs( const QStringList & userDNs );
signals:
	void gotContactUserDetails( const GroupWise::ContactDetails & );
protected:
	GroupWise::ContactDetails extractUserDetails( Field::MultiField * details );

};

#endif

Fix broken signal connection CVS_SILENT

Fix broken signal connection
CVS_SILENT

svn path=/branches/groupwise_in_anger/kdenetwork/kopete/; revision=344030


AutoFill: Add a default constructor for FormData. There are too many places
that create FormDatas, and we shouldn't need to initialize user_submitted for
each call site.

BUG=50423
TEST=none

Review URL: http://codereview.chromium.org/3074023

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


#pragma once

#include "MeterWnd.h"

class Animation {
public:
    virtual bool Animate(MeterWnd *meterWnd) = 0;
    virtual void Reset(MeterWnd *meterWnd) = 0;
};

#pragma once

class MeterWnd;

class Animation {
public:
    virtual bool Animate(MeterWnd *meterWnd) = 0;
    virtual void Reset(MeterWnd *meterWnd) = 0;
};

Use forward declaration for MeterWnd

Use forward declaration for MeterWnd


/****************************************************
 * This is a test that will test barriers           *
 ****************************************************/
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <fcntl.h>

#include "carbon_user.h"
#include "capi.h"
#include "sync_api.h"

carbon_barrier_t my_barrier;

// Functions executed by threads
void* test_wait_barrier(void * threadid);

int main(int argc, char* argv[])  // main begins
{
   CarbonStartSim();
   const unsigned int num_threads = 5;
   carbon_thread_t threads[num_threads];

   barrierInit(&my_barrier, num_threads);

   for(unsigned int i = 0; i < num_threads; i++)
       threads[i] = CarbonSpawnThread(test_wait_barrier, (void *) i);

   for(unsigned int i = 0; i < num_threads; i++)
       CarbonJoinThread(threads[i]);

   printf("Finished running barrier test!.\n");

   CarbonStopSim();
   return 0;
} // main ends

void* test_wait_barrier(void *threadid)
{
   for (unsigned int i = 0; i < 50; i++)
      barrierWait(&my_barrier);

   return NULL;
}

/****************************************************
 * This is a test that will test barriers           *
 ****************************************************/
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <fcntl.h>

#include "carbon_user.h"
#include "capi.h"
#include "sync_api.h"

carbon_barrier_t my_barrier;

// Functions executed by threads
void* test_wait_barrier(void * threadid);

int main(int argc, char* argv[])  // main begins
{
   CarbonStartSim();
   const unsigned int num_threads = 5;
   carbon_thread_t threads[num_threads];

   CarbonBarrierInit(&my_barrier, num_threads);

   for(unsigned int i = 0; i < num_threads; i++)
       threads[i] = CarbonSpawnThread(test_wait_barrier, (void *) i);

   for(unsigned int i = 0; i < num_threads; i++)
       CarbonJoinThread(threads[i]);

   printf("Finished running barrier test!.\n");

   CarbonStopSim();
   return 0;
} // main ends

void* test_wait_barrier(void *threadid)
{
   for (unsigned int i = 0; i < 50; i++)
      CarbonBarrierWait(&my_barrier);

   return NULL;
}

Update barrier test to new api.

[tests] Update barrier test to new api.


#ifndef SRC_UTILS_PATH_HELPER_H_

#define SRC_UTILS_PATH_HELPER_H_

#include <QFile>
#include <QUrl>
#include <QDir>
#include <QCoreApplication>
#include <string>

inline QString absolutePathOfRelativeUrl(QUrl url)
{
  return QDir(QCoreApplication::applicationDirPath())
      .absoluteFilePath(url.toLocalFile());
}

inline std::string absolutePathOfRelativePath(std::string relativePath)
{
  return QDir(QCoreApplication::applicationDirPath())
      .absoluteFilePath(QString(relativePath.c_str()))
      .toStdString();
}

#endif  // SRC_UTILS_PATH_HELPER_H_

#ifndef SRC_UTILS_PATH_HELPER_H_

#define SRC_UTILS_PATH_HELPER_H_

#include <QFile>
#include <QUrl>
#include <QDir>
#include <QCoreApplication>
#include <string>
#include "./project_root.h"

inline QString relativeApplicationToProjectRootPath()
{
  return QDir(QCoreApplication::applicationDirPath())
      .relativeFilePath(QString(PROJECT_ROOT));
}

inline QString absolutePathOfRelativeUrl(QUrl url)
{
  return QDir(QCoreApplication::applicationDirPath())
      .absoluteFilePath(url.toLocalFile());
}

inline QString absolutePathOfProjectRelativePath(QString path)
{
  return QDir(QDir(QCoreApplication::applicationDirPath())
                  .absoluteFilePath(relativeApplicationToProjectRootPath()))
      .absoluteFilePath(path);
}

inline QString absolutePathOfProjectRelativeUrl(QUrl url)
{
  return absolutePathOfProjectRelativePath(url.toLocalFile());
}

inline std::string absolutePathOfRelativePath(std::string relativePath)
{
  return QDir(QCoreApplication::applicationDirPath())
      .absoluteFilePath(QString(relativePath.c_str()))
      .toStdString();
}

inline std::string absolutePathOfProjectRelativePath(std::string relativePath)
{
  return absolutePathOfProjectRelativePath(QString(relativePath.c_str()))
      .toStdString();
}

#endif  // SRC_UTILS_PATH_HELPER_H_

Add path helpers which handle paths relative to project root.


#ifndef NEOVIM_QT_TEST_COMMON
#define NEOVIM_QT_TEST_COMMON

// This is just a fix for QSignalSpy::wait
// http://stackoverflow.com/questions/22390208/google-test-mock-with-qt-signals
#define SPYWAIT(spy) (spy.count()>0||spy.wait())
#define SPYWAIT2(spy, time) (spy.count()>0||spy.wait(time))

#endif

#ifndef NEOVIM_QT_TEST_COMMON
#define NEOVIM_QT_TEST_COMMON

// This is just a fix for QSignalSpy::wait
// http://stackoverflow.com/questions/22390208/google-test-mock-with-qt-signals
bool SPYWAIT(QSignalSpy &spy, int timeout=10000)
{
	return spy.count()>0||spy.wait(timeout);
}

bool SPYWAIT2(QSignalSpy &spy, int timeout=5000)
{
	return spy.count()>0||spy.wait(timeout);
}

#endif

Fix bug in SPYWAIT helpers

Fix bug in SPYWAIT helpers

SPYWAIT was a macro that could evaluate an expression twice, which is
not what we want to do.


/*
 * Copyright 2014 Amazon.com, Inc. or its affiliates. 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.
 * A copy of the License is located at
 *
 *  http://aws.amazon.com/apache2.0
 *
 * or in the "license" file accompanying this file. This file 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.
 */

#include "s2n_test.h"
#include <stdlib.h>
#include <s2n.h>

int main(int argc, char **argv)
{
    struct s2n_connection *conn;

    BEGIN_TEST();

    EXPECT_NULL(conn = s2n_connection_new(S2N_CLIENT, &err));

    EXPECT_SUCCESS(setenv("S2N_ENABLE_INSECURE_CLIENT", "1", 0));
    EXPECT_NOT_NULL(conn = s2n_connection_new(S2N_CLIENT, &err));

    END_TEST();
}

Add a regression test for disabled client mode

Verify that client functionality does not work without setting the
magic environment variable.


// Copyright 2020 The Pigweed 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
//
//     https://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 "tx_api.h"

namespace pw::sync::backend {

struct NativeInterruptSpinLock {
  enum class State {
    kUnlocked = 1,
    kLockedFromInterrupt = 2,
    kLockedFromThread = 3,
  };
  State state;  // Used to detect recursion and interrupt context escapes.
  UINT saved_interrupt_mask;
  UINT saved_preemption_threshold;
};
using NativeInterruptSpinLockHandle = NativeInterruptSpinLock&;

}  // namespace pw::sync::backend

// Copyright 2020 The Pigweed 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
//
//     https://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 "tx_api.h"

namespace pw::sync::backend {

struct NativeInterruptSpinLock {
  enum class State {
    kUnlocked = 0,
    kLockedFromInterrupt = 1,
    kLockedFromThread = 2,
  };
  State state;  // Used to detect recursion and interrupt context escapes.
  UINT saved_interrupt_mask;
  UINT saved_preemption_threshold;
};
using NativeInterruptSpinLockHandle = NativeInterruptSpinLock&;

}  // namespace pw::sync::backend

Adjust ISL enum to make it bss eligible

pw_sync_threadx: Adjust ISL enum to make it bss eligible

Adjusts an enum's values to ensure that a value of 0 is used in the
constexpr constructor to ensure that the object is bss eligible
instead of requiring placement in data.

Change-Id: Ied32426852661b5b534b6e4682a0e52fa28a57ae
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/55027
Reviewed-by: Wyatt Hepler <cca3bedb37979eacd157a9bceb473582df8aea1e@google.com>
Pigweed-Auto-Submit: Ewout van Bekkum <638f134dbc68778d6b859fb04a64baea2b00b021@google.com>
Commit-Queue: Auto-Submit <14637eda5603879df170705285bf30f5996692f0@pigweed.google.com.iam.gserviceaccount.com>


// Copyright 2018 Eotvos Lorand University, Budapest, Hungary
//
// 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.

// This test case contains data identical to the included one.
#include "test_l2fwd_test.c"

Add content for test case setInvalid-1

Add content for test case setInvalid-1


#ifndef LACO_UTIL_H
#define LACO_UTIL_H

struct LacoState;

/**
 * Load a line into the lua stack to be evaluated later
 *
 * param          pointer to LacoState
 *
 * return -1 if there is no line input to load
 */
int laco_load_line(struct LacoState* laco);

/**
 * Called after laco_load_line, this evaluated the line as a function and
 * hands of the result for printing
 *
 * param          pointer to LacoState
 */
void laco_handle_line(struct LacoState* laco);

/**
 * Kills the loop with exiting message if specified
 *
 * param          pointer to LacoState
 * param          exit with status
 * param          error message
 */
void laco_kill(struct LacoState* laco, int status, const char* message);

/**
 * When there is a value on the lua stack, it will print out depending on
 * the type it is
 *
 * param          pointer to lua_State
 *
 * return LUA_ERRSYNTAX if the value has some error
 */
int laco_print_type(struct LacoState* laco);

/**
 * Prints out and pops off errors pushed into the lua stack
 *
 * param          pointer to lua_State
 * param          incoming lua stack status
 */
void laco_report_error(struct LacoState* laco, int status);

int laco_is_match(const char** matches, const char* test_string);

#endif /* LACO_UTIL_H */

#ifndef LACO_UTIL_H
#define LACO_UTIL_H

struct LacoState;

/**
 * Load a line into the lua stack to be evaluated later
 *
 * param          pointer to LacoState
 *
 * return -1 if there is no line input to load
 */
int laco_load_line(struct LacoState* laco);

/**
 * Called after laco_load_line, this evaluated the line as a function and
 * hands of the result for printing
 *
 * param          pointer to LacoState
 */
void laco_handle_line(struct LacoState* laco);

/**
 * Kills the loop with exiting message if specified
 *
 * param          pointer to LacoState
 * param          exit with status
 * param          error message
 */
void laco_kill(struct LacoState* laco, int status, const char* message);

/**
 * When there is a value on the lua stack, it will print out depending on
 * the type it is
 *
 * param          pointer to LacoState
 *
 * return LUA_ERRSYNTAX if the value has some error
 */
int laco_print_type(struct LacoState* laco);

/**
 * Prints out and pops off errors pushed into the lua stack
 *
 * param          pointer to LacoState
 * param          incoming lua stack status
 */
void laco_report_error(struct LacoState* laco, int status);

int laco_is_match(const char** matches, const char* test_string);

#endif /* LACO_UTIL_H */

Update documentation for pointer type change


#pragma once

#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <string.h>
#include <errno.h>

#define emsg(s, d)                                                             \
  fprintf(stderr, "%s(%d): %s %s\n", __func__, __LINE__, s, strerror(d))
#define err(s) emsg(s, errno)
#define err2(fmt, ...)                                                         \
  do {                                                                         \
    int errno_tmp__ = errno;                                                   \
    fprintf(stderr, "%s(%d): %s " fmt "\n", __func__, __LINE__,                \
            strerror(errno_tmp__), __VA_ARGS__);                               \
  } while (0)
#define errstring(s) fprintf(stderr, "%s(%d): %s\n", __func__, __LINE__, s)

void server_usage(void);
int get_accept_fds(const char *host, const char *port, int **fds);
int init_fdset(const int *const fds, size_t nfds, fd_set *fdset);
struct addrinfo *get_connect_addr(const char *host, const char *port);
int open_socket(const char *host, const char *port);
const char * hostname(struct sockaddr * sa, socklen_t length);

#pragma once

#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/select.h>
#include <netdb.h>
#include <string.h>
#include <errno.h>

#define emsg(s, d)                                                             \
  fprintf(stderr, "%s(%d): %s %s\n", __func__, __LINE__, s, strerror(d))
#define err(s) emsg(s, errno)
#define err2(fmt, ...)                                                         \
  do {                                                                         \
    int errno_tmp__ = errno;                                                   \
    fprintf(stderr, "%s(%d): %s " fmt "\n", __func__, __LINE__,                \
            strerror(errno_tmp__), __VA_ARGS__);                               \
  } while (0)
#define errstring(s) fprintf(stderr, "%s(%d): %s\n", __func__, __LINE__, s)

void server_usage(void);
int get_accept_fds(const char *host, const char *port, int **fds);
int init_fdset(const int *const fds, size_t nfds, fd_set *fdset);
struct addrinfo *get_connect_addr(const char *host, const char *port);
int open_socket(const char *host, const char *port);
const char * hostname(struct sockaddr * sa, socklen_t length);

Add missing include for fd_set declaration


#ifndef CONSTANTS_INCLUDED
#define WORDLENGTH 11
#define NUMWORDS 65536
#define WORDFILE "words.txt"
#define HEX_CHUNK_LENGTH 4
#define CONSTANTS_INCLUDED
#endif

#ifndef CONSTANTS_INCLUDED
#define WORDLENGTH 11
#define NUMWORDS 65536
#define WORDFILE "words.txt"
#define HEX_CHUNK_LENGTH 4
#define HEX_CHUNK_FORMAT "%04X"
#define CONSTANTS_INCLUDED
#endif

Add constant formatting string for creating hexadecimal chunks.


#ifndef NET_H
#define NET_H

typedef enum Command {GET_STATE = 'S',
    SHOOT = 'F', GET_MAP = 'M', ERROR = 'E'} Command;

#define PORTNUM 7979 /* Port Number */
#define MAXRCVLEN 128 /* Maximal Length of Received Value */

#endif /* NET_H */

#ifndef NET_H
#define NET_H

/*
 * command        args        reply
 *
 * GET_MAP        none        map_seed map_length map_height
 */
typedef enum Command {GET_STATE = 'S',
    SHOOT = 'F', GET_MAP = 'M', ERROR = 'E'} Command;

#define PORTNUM 7979 /* Port Number */
#define MAXRCVLEN 128 /* Maximal Length of Received Value */

#endif /* NET_H */

Add documentation for GET_MAP command

Add documentation for GET_MAP command


#ifndef CTCONFIG_H
#define CTCONFIG_H

//#define ENABLE_ASSERT_CHECKS
//#define CT_NODE_DEBUG
//#define ENABLE_INTEGRITY_CHECK
//#define ENABLE_COUNTERS
//#define ENABLE_PAGING
//#define SNAPPY_COMPRESSION

#endif // CTCONFIG_H

#ifndef CTCONFIG_H
#define CTCONFIG_H

//#define ENABLE_ASSERT_CHECKS
//#define CT_NODE_DEBUG
//#define ENABLE_INTEGRITY_CHECK
//#define ENABLE_COUNTERS
//#define ENABLE_PAGING
#define ENABLE_COMPRESSION
//#define SNAPPY_COMPRESSION

#endif // CTCONFIG_H

Add new option to enable/disable compression


extern unsigned int __bss_start__,__bss_end__;
extern unsigned int ___ctors, ___ctors_end;
extern char __end__;
static char *start_brk = &__end__;

extern void _Z4loopv();
extern void _Z5setupv();

void ___clear_bss()
{
	unsigned int *ptr =  &__bss_start__;
	while (ptr!=&__bss_end__) {
		*ptr = 0;
		ptr++;
	}
}

void ___do_global_ctors()
{
	unsigned int *ptr = &___ctors;
	while (ptr!=&___ctors_end) {
		((void(*)(void))(*ptr))();
		ptr++;
	}
}

void __cxa_pure_virtual()
{
	// Abort here.
}

void exit(){
}

#ifndef NOMAIN
int main(int argc, char **argv)
{
	_Z5setupv();
	while (1) {
		_Z4loopv();
	}
}
#endif

void __attribute__((noreturn)) _premain(void)
{
	___clear_bss();
	___do_global_ctors();
	main(0,0);
	while(1);
}

void *sbrk(int inc)
{
	start_brk+=inc;
	return start_brk;
}

extern unsigned int __bss_start__,__bss_end__;
extern unsigned int ___ctors, ___ctors_end;
extern char __end__;
static char *start_brk = &__end__;

extern void _Z4loopv();
extern void _Z5setupv();

void ___clear_bss()
{
	unsigned int *ptr =  &__bss_start__;
	while (ptr!=&__bss_end__) {
		*ptr = 0;
		ptr++;
	}
}

void ___do_global_ctors()
{
	unsigned int *ptr = &___ctors;
	while (ptr!=&___ctors_end) {
		((void(*)(void))(*ptr))();
		ptr++;
	}
}

void __cxa_pure_virtual()
{
	// Abort here.
}

void exit(){
}

#ifndef NOMAIN
int main(int argc, char **argv)
{
	_Z5setupv();
	while (1) {
		_Z4loopv();
	}
}
#endif

void __attribute__((noreturn)) _premain(void)
{
#ifndef NOCLEARBSS
    ___clear_bss();
#endif
	___do_global_ctors();
	main(0,0);
	while(1);
}

void *sbrk(int inc)
{
	start_brk+=inc;
	return start_brk;
}

Add conditional for BSS cleanup

Add conditional for BSS cleanup


#ifndef _PARSER_H_
#define _PARSER_H_

#include <Python.h>
#include "circular_buffer.h"

typedef enum {
    COMPLETE_DATA,
    MISSING_DATA,
    INVALID_DATA,
    PARSE_FATAL_ERROR,
} parse_result;

typedef enum {
    PART_CHOOSER,
    PART_SINGLE_SIZED,
    PART_COUNT,
    PART_INLINE,
    PART_SIZE,
    PART_PYSTRING,
    PART_PYINT,
    PART_ERROR,
} part_type;

typedef enum {
    TYPE_SINGLE_VALUE,
    TYPE_LIST_OF_SINGLE_VALUES,
    TYPE_LIST_OF_TUPLES
} result_type;

typedef struct {
    long parts_count, current_part, next_part_size;
    part_type expected_type;
    PyObject *result_root, *list;
    int result_type;
    Py_ssize_t list_length, list_filled;
} parser_state;

PyObject *parser_get_results();

parse_result parser_parse_part(parser_state *s, circular_buffer *buffer);
parse_result parser_parse_unit(parser_state *s, circular_buffer *buffer);

#endif // _PARSER_H_

#ifndef _PARSER_H_
#define _PARSER_H_

#include <Python.h>
#include "circular_buffer.h"

typedef enum {
    COMPLETE_DATA,
    MISSING_DATA,
    INVALID_DATA,
    PARSE_FATAL_ERROR,
} parse_result;

typedef enum {
    PART_CHOOSER,
    PART_SINGLE_SIZED,
    PART_COUNT,
    PART_INLINE,
    PART_SIZE,
    PART_PYSTRING,
    PART_PYINT,
    PART_ERROR,
} part_type;

typedef enum {
    TYPE_SINGLE_VALUE,
    TYPE_LIST_OF_SINGLE_VALUES,
    TYPE_LIST_OF_TUPLES
} result_type;

typedef struct {
    long parts_count, current_part, next_part_size;
    part_type expected_type;
    PyObject *result_root, *list;
    int result_type;
    Py_ssize_t list_length, list_filled;
} parser_state;

PyObject *parser_get_results(void);

parse_result parser_parse_part(parser_state *s, circular_buffer *buffer);
parse_result parser_parse_unit(parser_state *s, circular_buffer *buffer);

#endif // _PARSER_H_

Replace empty arguments definition with void for compatibility


#include <stdlib.h>
#include <gio/gio.h>

int
main (int argc, char *argv[])
{
  const gchar *envvar;
  gint pid_from_env;

  envvar = g_getenv ("GIO_LAUNCHED_DESKTOP_FILE_PID");
  g_assert (envvar != NULL);
  pid_from_env = atoi (envvar);
  g_assert_cmpint (pid_from_env, ==, getpid ());

  envvar = g_getenv ("GIO_LAUNCHED_DESKTOP_FILE");
  g_assert_cmpstr (envvar, ==, g_test_get_filename (G_TEST_DIST, "appinfo-test.desktop", NULL));

  return 0;
}

#include <stdlib.h>
#include <gio/gio.h>

int
main (int argc, char *argv[])
{
  const gchar *envvar;

  g_test_init (&argc, &argv, NULL);

  envvar = g_getenv ("GIO_LAUNCHED_DESKTOP_FILE");
  if (envvar != NULL)
    {
      gchar *expected;
      gint pid_from_env;

      expected = g_test_build_filename (G_TEST_DIST, "appinfo-test.desktop", NULL);
      g_assert_cmpstr (envvar, ==, expected);
      g_free (expected);

      envvar = g_getenv ("GIO_LAUNCHED_DESKTOP_FILE_PID");
      g_assert (envvar != NULL);
      pid_from_env = atoi (envvar);
      g_assert_cmpint (pid_from_env, ==, getpid ());
    }

  return 0;
}

Fix up the appinfo test

Fix up the appinfo test

One testcase was launching appinfo-test from a GAppInfo that
does not have a filename. In this case, the G_LAUNCHED_DESKTOP_FILE
envvar is not exported. Make appinfo-test deal with that, without
spewing warnings.

https://bugzilla.gnome.org/show_bug.cgi?id=711178