after
stringlengths
72
2.11k
before
stringlengths
21
1.55k
diff
stringlengths
85
2.31k
instruction
stringlengths
20
1.71k
license
stringclasses
13 values
repos
stringlengths
7
82.6k
commit
stringlengths
40
40
#include "gameboy.h" #include "memory.h" u8 select_rom_bank(u8 value) { u8 ret = value & 0x1F; switch (mode) { case ROM: break; case MBC1: switch (ret) { case 0: case 0x20: case 0x40: case 0x60: break; default: ret -= 1; } } return ret; } u8 select_ram_bank(u8 value) { return (value & 0x03); } u8 enable_ram(u8 value) { return ((value & 0x0A) != 0x0A) ? 0 : 1; }
#include "gameboy.h" #include "memory.h" u8 select_rom_bank(u8 value) { u8 ret = value & 0x1F; switch (mode) { case ROM: break; case MBC1: switch (ret) { case 0: case 0x20: case 0x40: case 0x60: break; default: ret -= 1; } } return ret; } u8 select_ram_bank(u8 value) { return (value & 0x03); } u8 enable_ram(u8 value) { u8 ram_enable; ram_enable = ((value & 0x0A) != 0x0A) ? 0 : 1; return ram_enable; }
--- +++ @@ -29,9 +29,5 @@ u8 enable_ram(u8 value) { - u8 ram_enable; - - ram_enable = ((value & 0x0A) != 0x0A) ? 0 : 1; - - return ram_enable; + return ((value & 0x0A) != 0x0A) ? 0 : 1; }
Simplify return of ram_enable value
mit
hoferm/tmpgb,hoferm/tmpgb
a9437115ceb0307d8481cbc36ed8dc66d2ebc38b
/** * @file BlynkSimpleTinyGSM.h * @author Volodymyr Shymanskyy * @license This project is released under the MIT License (MIT) * @copyright Copyright (c) 2015 Volodymyr Shymanskyy * @date Nov 2016 * @brief * */ #ifndef BlynkSimpleTinyGSM_h #define BlynkSimpleTinyGSM_h #include <Adapters/BlynkGsmClient.h> static BlynkArduinoClient _blynkTransport; BlynkSIM Blynk(_blynkTransport); #include <BlynkWidgets.h> #endif
/** * @file BlynkSimpleTinyGSM.h * @author Volodymyr Shymanskyy * @license This project is released under the MIT License (MIT) * @copyright Copyright (c) 2015 Volodymyr Shymanskyy * @date Nov 2016 * @brief * */ #ifndef BlynkSimpleTinyGSM_h #define BlynkSimpleTinyGSM_h #ifndef BLYNK_INFO_CONNECTION #define BLYNK_INFO_CONNECTION "TinyGSM" #endif #include <Adapters/BlynkGsmClient.h> static BlynkArduinoClient _blynkTransport; BlynkSIM Blynk(_blynkTransport); #include <BlynkWidgets.h> #endif
--- +++ @@ -11,10 +11,6 @@ #ifndef BlynkSimpleTinyGSM_h #define BlynkSimpleTinyGSM_h -#ifndef BLYNK_INFO_CONNECTION -#define BLYNK_INFO_CONNECTION "TinyGSM" -#endif - #include <Adapters/BlynkGsmClient.h> static BlynkArduinoClient _blynkTransport;
Move conn. type detection to Adataper
mit
blynkkk/blynk-library,blynkkk/blynk-library,blynkkk/blynk-library,blynkkk/blynk-library,blynkkk/blynk-library
41a35717e8ad8900b72dfc4d711954cb73096b50
typedef NS_ENUM(NSInteger, StatsSection) { StatsSectionGraph, StatsSectionPeriodHeader, StatsSectionEvents, StatsSectionPosts, StatsSectionReferrers, StatsSectionClicks, StatsSectionCountry, StatsSectionVideos, StatsSectionAuthors, StatsSectionSearchTerms, StatsSectionComments, StatsSectionTagsCategories, StatsSectionFollowers, StatsSectionPublicize, StatsSectionWebVersion, StatsSectionPostDetailsGraph, StatsSectionPostDetailsMonthsYears, StatsSectionPostDetailsAveragePerDay, StatsSectionPostDetailsRecentWeeks }; typedef NS_ENUM(NSInteger, StatsSubSection) { StatsSubSectionCommentsByAuthor = 100, StatsSubSectionCommentsByPosts, StatsSubSectionFollowersDotCom, StatsSubSectionFollowersEmail, StatsSubSectionNone };
typedef NS_ENUM(NSInteger, StatsSection) { StatsSectionGraph, StatsSectionPeriodHeader, StatsSectionEvents, StatsSectionPosts, StatsSectionReferrers, StatsSectionClicks, StatsSectionCountry, StatsSectionVideos, StatsSectionAuthors, StatsSectionSearchTerms, StatsSectionComments, StatsSectionTagsCategories, StatsSectionFollowers, StatsSectionPublicize, StatsSectionWebVersion }; typedef NS_ENUM(NSInteger, StatsSubSection) { StatsSubSectionCommentsByAuthor = 100, StatsSubSectionCommentsByPosts, StatsSubSectionFollowersDotCom, StatsSubSectionFollowersEmail, StatsSubSectionNone };
--- +++ @@ -13,7 +13,11 @@ StatsSectionTagsCategories, StatsSectionFollowers, StatsSectionPublicize, - StatsSectionWebVersion + StatsSectionWebVersion, + StatsSectionPostDetailsGraph, + StatsSectionPostDetailsMonthsYears, + StatsSectionPostDetailsAveragePerDay, + StatsSectionPostDetailsRecentWeeks }; typedef NS_ENUM(NSInteger, StatsSubSection) {
Add new sections for post details
mit
wordpress-mobile/WordPressCom-Stats-iOS,wordpress-mobile/WordPressCom-Stats-iOS
d84323ce8cd37c5b88a84e8a8ca2e80dc2b51acc
#define MICROPY_HW_BOARD_NAME "Arduino MKR1300" #define MICROPY_HW_MCU_NAME "samd21g18" #define MICROPY_PORT_A (0) #define MICROPY_PORT_B (0) #define MICROPY_PORT_C (0) #define CIRCUITPY_INTERNAL_NVM_SIZE 0 #define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000) #define DEFAULT_I2C_BUS_SCL (&pin_PA09) #define DEFAULT_I2C_BUS_SDA (&pin_PA08) #define DEFAULT_SPI_BUS_SCK (&pin_PA13) #define DEFAULT_SPI_BUS_MOSI (&pin_PA12) #define DEFAULT_SPI_BUS_MISO (&pin_PA15) #define DEFAULT_UART_BUS_RX (&pin_PB23) #define DEFAULT_UART_BUS_TX (&pin_PB22) // USB is always used internally so skip the pin objects for it. #define IGNORE_PIN_PA24 1 #define IGNORE_PIN_PA25 1
#define MICROPY_HW_BOARD_NAME "Arduino MKR1300" #define MICROPY_HW_MCU_NAME "samd21g18" #define MICROPY_PORT_A (PORT_PA24 | PORT_PA25) #define MICROPY_PORT_B (0) #define MICROPY_PORT_C (0) #include "internal_flash.h" #define CIRCUITPY_INTERNAL_NVM_SIZE 0 #define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000) #define DEFAULT_I2C_BUS_SCL (&pin_PA09) #define DEFAULT_I2C_BUS_SDA (&pin_PA08) #define DEFAULT_SPI_BUS_SCK (&pin_PA13) #define DEFAULT_SPI_BUS_MOSI (&pin_PA12) #define DEFAULT_SPI_BUS_MISO (&pin_PA15) #define DEFAULT_UART_BUS_RX (&pin_PB23) #define DEFAULT_UART_BUS_TX (&pin_PB22) // USB is always used internally so skip the pin objects for it. #define IGNORE_PIN_PA24 1 #define IGNORE_PIN_PA25 1
--- +++ @@ -1,11 +1,9 @@ #define MICROPY_HW_BOARD_NAME "Arduino MKR1300" #define MICROPY_HW_MCU_NAME "samd21g18" -#define MICROPY_PORT_A (PORT_PA24 | PORT_PA25) +#define MICROPY_PORT_A (0) #define MICROPY_PORT_B (0) #define MICROPY_PORT_C (0) - -#include "internal_flash.h" #define CIRCUITPY_INTERNAL_NVM_SIZE 0
Update MKR1300 board definition too
mit
adafruit/micropython,adafruit/micropython,adafruit/circuitpython,adafruit/micropython,adafruit/circuitpython,adafruit/circuitpython,adafruit/circuitpython,adafruit/circuitpython,adafruit/micropython,adafruit/micropython,adafruit/circuitpython
688f0e388bbb0ae4420c8e3145e83cb15d9b3829
// main.c // Main Program for HWP Media Center // // Author : Weipeng He <heweipeng@gmail.com> // Copyright (c) 2014, All rights reserved. #include "utils.h" #include <stdio.h> #include <curl/curl.h> size_t write_data(void *buffer, size_t size, size_t nmemb, void *dstr) { d_string* str = (d_string*) dstr; dstr_ncat(str, buffer, size * nmemb); return nmemb; } int main(int argc, char** argv) { CURL* curl; CURLcode res; curl = curl_easy_init(); if (curl) { curl_easy_setopt(curl, CURLOPT_URL, argv[1]); curl_easy_setopt(curl, CURLOPT_USERAGENT, "hwp"); d_string* content = dstr_alloc(); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data); curl_easy_setopt(curl, CURLOPT_WRITEDATA, content); res = curl_easy_perform(curl); if (res != CURLE_OK) { fprintf(stderr, "Failed to connect: %s\n", curl_easy_strerror(res)); } printf("size=%d, cap=%d\n%s", content->size, content->cap, content->str); dstr_free(content); curl_easy_cleanup(curl); } return 0; }
// main.c // Main Program for HWP Media Center // // Author : Weipeng He <heweipeng@gmail.com> // Copyright (c) 2014, All rights reserved. #include "utils.h" #include <stdio.h> #include <curl/curl.h> size_t write_data(void *buffer, size_t size, size_t nmemb, void *dstr) { d_string* str = (d_string*) dstr; dstr_ncat(str, buffer, size * nmemb); return nmemb; } int main(int argc, char** argv) { CURL* curl; CURLcode res; curl = curl_easy_init(); if (curl) { curl_easy_setopt(curl, CURLOPT_URL, argv[1]); d_string* content = dstr_alloc(); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data); curl_easy_setopt(curl, CURLOPT_WRITEDATA, content); res = curl_easy_perform(curl); if (res != CURLE_OK) { fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res)); } printf("size=%d, cap=%d\n%s", content->size, content->cap, content->str); dstr_free(content); curl_easy_cleanup(curl); } return 0; }
--- +++ @@ -23,6 +23,7 @@ if (curl) { curl_easy_setopt(curl, CURLOPT_URL, argv[1]); + curl_easy_setopt(curl, CURLOPT_USERAGENT, "hwp"); d_string* content = dstr_alloc(); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data); @@ -30,7 +31,7 @@ res = curl_easy_perform(curl); if (res != CURLE_OK) { - fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res)); + fprintf(stderr, "Failed to connect: %s\n", curl_easy_strerror(res)); } printf("size=%d, cap=%d\n%s", content->size, content->cap, content->str);
Add User-Agent to prevent from blocked by Douban.fm
mit
hwp/hmc,hwp/hmc
06c3836a83cf2a0e4bdedde721f29489f9523e56
/* * Copyright (c) 2016 Intel Corporation. * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_INCLUDE_FS_FS_INTERFACE_H_ #define ZEPHYR_INCLUDE_FS_FS_INTERFACE_H_ #ifdef __cplusplus extern "C" { #endif #if defined(CONFIG_FILE_SYSTEM_LITTLEFS) #define MAX_FILE_NAME 256 #elif defined(CONFIG_FAT_FILESYSTEM_ELM) #if defined(CONFIG_FS_FATFS_LFN) #define MAX_FILE_NAME CONFIG_FS_FATFS_MAX_LFN #else /* CONFIG_FS_FATFS_LFN */ #define MAX_FILE_NAME 12 /* Uses 8.3 SFN */ #endif /* CONFIG_FS_FATFS_LFN */ #else /* filesystem selection */ /* Use standard 8.3 when no filesystem is explicitly selected */ #define MAX_FILE_NAME 12 #endif /* filesystem selection */ struct fs_mount_t; /** * @brief File object representing an open file * * @param Pointer to FATFS file object structure * @param mp Pointer to mount point structure */ struct fs_file_t { void *filep; const struct fs_mount_t *mp; }; /** * @brief Directory object representing an open directory * * @param dirp Pointer to directory object structure * @param mp Pointer to mount point structure */ struct fs_dir_t { void *dirp; const struct fs_mount_t *mp; }; #ifdef __cplusplus } #endif #endif /* ZEPHYR_INCLUDE_FS_FS_INTERFACE_H_ */
/* * Copyright (c) 2016 Intel Corporation. * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_INCLUDE_FS_FS_INTERFACE_H_ #define ZEPHYR_INCLUDE_FS_FS_INTERFACE_H_ #ifdef __cplusplus extern "C" { #endif #if defined(CONFIG_FILE_SYSTEM_LITTLEFS) #define MAX_FILE_NAME 256 #else /* FAT_FS */ #define MAX_FILE_NAME 12 /* Uses 8.3 SFN */ #endif struct fs_mount_t; /** * @brief File object representing an open file * * @param Pointer to FATFS file object structure * @param mp Pointer to mount point structure */ struct fs_file_t { void *filep; const struct fs_mount_t *mp; }; /** * @brief Directory object representing an open directory * * @param dirp Pointer to directory object structure * @param mp Pointer to mount point structure */ struct fs_dir_t { void *dirp; const struct fs_mount_t *mp; }; #ifdef __cplusplus } #endif #endif /* ZEPHYR_INCLUDE_FS_FS_INTERFACE_H_ */
--- +++ @@ -13,9 +13,16 @@ #if defined(CONFIG_FILE_SYSTEM_LITTLEFS) #define MAX_FILE_NAME 256 -#else /* FAT_FS */ +#elif defined(CONFIG_FAT_FILESYSTEM_ELM) +#if defined(CONFIG_FS_FATFS_LFN) +#define MAX_FILE_NAME CONFIG_FS_FATFS_MAX_LFN +#else /* CONFIG_FS_FATFS_LFN */ #define MAX_FILE_NAME 12 /* Uses 8.3 SFN */ -#endif +#endif /* CONFIG_FS_FATFS_LFN */ +#else /* filesystem selection */ +/* Use standard 8.3 when no filesystem is explicitly selected */ +#define MAX_FILE_NAME 12 +#endif /* filesystem selection */ struct fs_mount_t;
fs: Set MAX_FILE_NAME appropiately with LFN and FATFS Try to define MAX_FILE_NAME to the appropriate max length based on the selected filesystm. Otherwise fallback to a standard filename of 12 (made up of 8.3 : <filename>.<extension>) Signed-off-by: Roman Vaughan <1620c2a00a7840d4515361aacd4b41348f2a8a7d@gmail.com>
apache-2.0
galak/zephyr,Vudentz/zephyr,finikorg/zephyr,galak/zephyr,nashif/zephyr,galak/zephyr,zephyrproject-rtos/zephyr,zephyrproject-rtos/zephyr,nashif/zephyr,Vudentz/zephyr,finikorg/zephyr,Vudentz/zephyr,finikorg/zephyr,Vudentz/zephyr,nashif/zephyr,Vudentz/zephyr,nashif/zephyr,zephyrproject-rtos/zephyr,nashif/zephyr,finikorg/zephyr,galak/zephyr,finikorg/zephyr,galak/zephyr,zephyrproject-rtos/zephyr,Vudentz/zephyr,zephyrproject-rtos/zephyr
42ee2e0938c7adec8da26ac544204d32f3af709b
#include <sqlite3.h> #include <stdio.h> static sqlite3 *db; int _mqtt_db_create_tables(void); int mqtt_db_open(const char *filename) { if(sqlite3_open(filename, &db) != SQLITE_OK){ fprintf(stderr, "Error: %s\n", sqlite3_errmsg(db)); return 1; } return _mqtt_db_create_tables(); } int mqtt_db_close(void) { sqlite3_close(db); db = NULL; return 0; } int _mqtt_db_create_tables(void) { int rc = 0; char *errmsg = NULL; if(sqlite3_exec(db, "CREATE TABLE IF NOT EXISTS clients(" "id TEXT, " "will INTEGER, will_retain INTEGER, will_qos " "will_topic TEXT, will_message TEXT)", NULL, NULL, &errmsg) != SQLITE_OK){ rc = 1; } if(errmsg) sqlite3_free(errmsg); if(sqlite3_exec(db, "CREATE TABLE IF NOT EXISTS subs(" "client_id TEXT, sub TEXT, qos INTEGER)", NULL, NULL, &errmsg) != SQLITE_OK){ rc = 1; } if(errmsg) sqlite3_free(errmsg); return rc; }
#include <sqlite3.h> #include <stdio.h> static sqlite3 *db; int _mqtt_db_create_tables(void); int mqtt_db_open(const char *filename) { if(sqlite3_open(filename, &db) != SQLITE_OK){ fprintf(stderr, "Error: %s\n", sqlite3_errmsg(db)); return 1; } return _mqtt_db_create_tables(); } int mqtt_db_close(void) { sqlite3_close(db); db = NULL; return 0; } int _mqtt_db_create_tables(void) { int rc; char *errmsg = NULL; rc = sqlite3_exec(db, "CREATE TABLE IF NOT EXISTS clients(" "id TEXT, " "will INTEGER, will_retain INTEGER, will_qos " "will_topic TEXT, will_message TEXT)", NULL, NULL, &errmsg); if(errmsg) sqlite3_free(errmsg); if(rc == SQLITE_OK){ return 0; }else{ return 1; } }
--- +++ @@ -25,23 +25,32 @@ int _mqtt_db_create_tables(void) { - int rc; + int rc = 0; char *errmsg = NULL; - rc = sqlite3_exec(db, + if(sqlite3_exec(db, "CREATE TABLE IF NOT EXISTS clients(" "id TEXT, " "will INTEGER, will_retain INTEGER, will_qos " "will_topic TEXT, will_message TEXT)", - NULL, NULL, &errmsg); + NULL, NULL, &errmsg) != SQLITE_OK){ + + rc = 1; + } if(errmsg) sqlite3_free(errmsg); - if(rc == SQLITE_OK){ - return 0; - }else{ - return 1; + if(sqlite3_exec(db, + "CREATE TABLE IF NOT EXISTS subs(" + "client_id TEXT, sub TEXT, qos INTEGER)", + NULL, NULL, &errmsg) != SQLITE_OK){ + + rc = 1; } + + if(errmsg) sqlite3_free(errmsg); + + return rc; }
Create db table for subscriptions.
bsd-3-clause
zlargon/mosquitto,zlargon/mosquitto,tempbottle/mosquitto,tempbottle/mosquitto,zlargon/mosquitto,tempbottle/mosquitto,zlargon/mosquitto,zlargon/mosquitto,tempbottle/mosquitto,tempbottle/mosquitto
228e64096902f6bcd14aca8be5333fc69cbc80bc
#ifndef FIX_STDIO_H #define FIX_STDIO_H #include <stdio.h> #if defined(__cplusplus) extern "C" { #endif /* For some reason the stdio.h on OSF1 fails to provide prototypes for popen() and pclose() if _POSIX_SOURCE is defined. */ #if defined(OSF1) #if defined(__STDC__) || defined(__cplusplus) FILE *popen( char *, char * ); int pclose( FILE *__stream ); #else FILE *popen(); int pclose(); #endif #endif /* OSF1 */ /* For some reason the stdio.h on Ultrix 4.3 fails to provide a prototype for pclose() if _POSIX_SOURCE is defined - even though it does provide a prototype for popen(). */ #if defined(ULTRIX43) #if defined(__STDC__) || defined(__cplusplus) int pclose( FILE *__stream ); #else int pclose(); #endif #endif /* ULTRIX43 */ #if defined(__cplusplus) } #endif #endif
#ifndef FIX_STDIO_H #define FIX_STDIO_H #include <stdio.h> /* For some reason the stdio.h on Ultrix 4.3 fails to provide a prototype for pclose() if _POSIX_SOURCE is defined - even though it does provide a prototype for popen(). */ #if defined(ULTRIX43) #if defined(__cplusplus) extern "C" { #endif #if defined(__STDC__) || defined(__cplusplus) int pclose( FILE *__stream ); #else int pclose(); #endif #if defined(__cplusplus) } #endif #endif /* ULTRIX43 */ #endif
--- +++ @@ -3,6 +3,25 @@ #include <stdio.h> + + +#if defined(__cplusplus) +extern "C" { +#endif + +/* + For some reason the stdio.h on OSF1 fails to provide prototypes + for popen() and pclose() if _POSIX_SOURCE is defined. +*/ +#if defined(OSF1) +#if defined(__STDC__) || defined(__cplusplus) + FILE *popen( char *, char * ); + int pclose( FILE *__stream ); +#else + FILE *popen(); + int pclose(); +#endif +#endif /* OSF1 */ /* For some reason the stdio.h on Ultrix 4.3 fails to provide a prototype @@ -10,21 +29,16 @@ provide a prototype for popen(). */ #if defined(ULTRIX43) - -#if defined(__cplusplus) -extern "C" { +#if defined(__STDC__) || defined(__cplusplus) + int pclose( FILE *__stream ); +#else + int pclose(); #endif - -#if defined(__STDC__) || defined(__cplusplus) -int pclose( FILE *__stream ); -#else -int pclose(); -#endif +#endif /* ULTRIX43 */ #if defined(__cplusplus) } #endif -#endif /* ULTRIX43 */ #endif
Add prototypes for popen()/pclose() for OSF1 machines.
apache-2.0
djw8605/htcondor,clalancette/condor-dcloud,bbockelm/condor-network-accounting,htcondor/htcondor,htcondor/htcondor,zhangzhehust/htcondor,neurodebian/htcondor,zhangzhehust/htcondor,djw8605/condor,mambelli/osg-bosco-marco,neurodebian/htcondor,neurodebian/htcondor,djw8605/condor,htcondor/htcondor,clalancette/condor-dcloud,djw8605/htcondor,djw8605/htcondor,neurodebian/htcondor,zhangzhehust/htcondor,djw8605/condor,clalancette/condor-dcloud,clalancette/condor-dcloud,clalancette/condor-dcloud,djw8605/condor,zhangzhehust/htcondor,mambelli/osg-bosco-marco,mambelli/osg-bosco-marco,zhangzhehust/htcondor,djw8605/condor,djw8605/htcondor,mambelli/osg-bosco-marco,bbockelm/condor-network-accounting,djw8605/condor,zhangzhehust/htcondor,mambelli/osg-bosco-marco,djw8605/htcondor,bbockelm/condor-network-accounting,djw8605/htcondor,mambelli/osg-bosco-marco,clalancette/condor-dcloud,bbockelm/condor-network-accounting,htcondor/htcondor,zhangzhehust/htcondor,bbockelm/condor-network-accounting,neurodebian/htcondor,neurodebian/htcondor,bbockelm/condor-network-accounting,djw8605/condor,mambelli/osg-bosco-marco,bbockelm/condor-network-accounting,htcondor/htcondor,neurodebian/htcondor,htcondor/htcondor,zhangzhehust/htcondor,mambelli/osg-bosco-marco,htcondor/htcondor,djw8605/condor,zhangzhehust/htcondor,djw8605/htcondor,neurodebian/htcondor,htcondor/htcondor,neurodebian/htcondor,clalancette/condor-dcloud,bbockelm/condor-network-accounting,djw8605/htcondor,djw8605/htcondor
3059f29d3aca2555583bd8c15e94a5840eaba11b
/* $OpenBSD: version.h,v 1.37 2003/04/01 10:56:46 markus Exp $ */ /* $FreeBSD$ */ #ifndef SSH_VERSION #define SSH_VERSION (ssh_version_get()) #define SSH_VERSION_BASE "OpenSSH_3.6.1p1" #define SSH_VERSION_ADDENDUM "FreeBSD-20030916" const char *ssh_version_get(void); void ssh_version_set_addendum(const char *add); #endif /* SSH_VERSION */
/* $OpenBSD: version.h,v 1.37 2003/04/01 10:56:46 markus Exp $ */ /* $FreeBSD$ */ #ifndef SSH_VERSION #define SSH_VERSION (ssh_version_get()) #define SSH_VERSION_BASE "OpenSSH_3.6.1p1" #define SSH_VERSION_ADDENDUM "FreeBSD-20030423" const char *ssh_version_get(void); void ssh_version_set_addendum(const char *add); #endif /* SSH_VERSION */
--- +++ @@ -5,7 +5,7 @@ #define SSH_VERSION (ssh_version_get()) #define SSH_VERSION_BASE "OpenSSH_3.6.1p1" -#define SSH_VERSION_ADDENDUM "FreeBSD-20030423" +#define SSH_VERSION_ADDENDUM "FreeBSD-20030916" const char *ssh_version_get(void); void ssh_version_set_addendum(const char *add);
Update the OpenSSH addendum string for the buffer handling fix.
bsd-3-clause
jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase
359ce984aa895a88248856bb338f7c5484da1443
/* This file is currently empty; I'm going to add new code here soon. Oct 27 1998. Martin */
#ifndef GNOME_PROPERTIES_H #define GNOME_PROPERTIES_H #include <libgnome/gnome-defs.h> BEGIN_GNOME_DECLS END_GNOME_DECLS #endif
--- +++ @@ -1,9 +1,3 @@ -#ifndef GNOME_PROPERTIES_H -#define GNOME_PROPERTIES_H -#include <libgnome/gnome-defs.h> - -BEGIN_GNOME_DECLS - -END_GNOME_DECLS - -#endif +/* This file is currently empty; I'm going to add new code here soon. + Oct 27 1998. Martin + */
Make this an empty file just with a comment in it.
lgpl-2.1
Distrotech/libgnomeui,Distrotech/libgnomeui,Distrotech/libgnomeui
f8ff178831e639a2d91e0eb03840ee60f3dda1d3
#ifndef CJET_PEER_TESTING_H #define CJET_PEER_TESTING_H #ifdef TESTING #ifdef __cplusplus extern "C" { #endif ssize_t fake_read(int fd, void *buf, size_t count); #ifdef __cplusplus } #endif #define READ \ fake_read #else #define READ \ read #endif #endif
#ifndef CJET_PEER_TESTING_H #define CJET_PEER_TESTING_H #ifdef TESTING #define READ \ fake_read #else #define READ \ read #endif #endif
--- +++ @@ -2,9 +2,21 @@ #define CJET_PEER_TESTING_H #ifdef TESTING + +#ifdef __cplusplus +extern "C" { +#endif +ssize_t fake_read(int fd, void *buf, size_t count); + +#ifdef __cplusplus +} +#endif + #define READ \ fake_read + #else + #define READ \ read #endif
Add "extern C" stuff for clean compile of tests.
mit
mloy/cjet,mloy/cjet,gatzka/cjet,mloy/cjet,mloy/cjet,mloy/cjet,gatzka/cjet,gatzka/cjet,gatzka/cjet,gatzka/cjet
237c7004130c08be3ea1a06d0e5ac76b1a153e5a
#include "sqldatabasestorage.h" CWF_BEGIN_NAMESPACE namespace DbStorage { static CWF::SqlDatabaseStorage _storage; static QString _secret; } CWF_END_NAMESPACE
#include "sqldatabasestorage.h" CWF_BEGIN_NAMESPACE namespace DbStorage { CPPWEBFRAMEWORKSHARED_EXPORT static CWF::SqlDatabaseStorage _storage; CPPWEBFRAMEWORKSHARED_EXPORT static QString _secret; } CWF_END_NAMESPACE
--- +++ @@ -3,8 +3,8 @@ CWF_BEGIN_NAMESPACE namespace DbStorage { - CPPWEBFRAMEWORKSHARED_EXPORT static CWF::SqlDatabaseStorage _storage; - CPPWEBFRAMEWORKSHARED_EXPORT static QString _secret; + static CWF::SqlDatabaseStorage _storage; + static QString _secret; } CWF_END_NAMESPACE
Remove the dll export flag
mit
HerikLyma/CPPWebFramework,HerikLyma/CPPWebFramework
8557aff3b74bb0bf240fcc05ae73ff05caf1ce97
#ifdef E_TYPEDEFS #else # ifndef E_SMART_MONITOR_H # define E_SMART_MONITOR_H Evas_Object *e_smart_monitor_add(Evas *evas); void e_smart_monitor_crtc_set(Evas_Object *obj, Ecore_X_Randr_Crtc crtc, Evas_Coord cx, Evas_Coord cy, Evas_Coord cw, Evas_Coord ch); void e_smart_monitor_output_set(Evas_Object *obj, Ecore_X_Randr_Output output); void e_smart_monitor_grid_set(Evas_Object *obj, Evas_Object *grid, Evas_Coord gx, Evas_Coord gy, Evas_Coord gw, Evas_Coord gh); void e_smart_monitor_grid_virtual_size_set(Evas_Object *obj, Evas_Coord vw, Evas_Coord vh); void e_smart_monitor_background_set(Evas_Object *obj, Evas_Coord dx, Evas_Coord dy); void e_smart_monitor_current_geometry_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h); # endif #endif
#ifdef E_TYPEDEFS #else # ifndef E_SMART_MONITOR_H # define E_SMART_MONITOR_H Evas_Object *e_smart_monitor_add(Evas *evas); void e_smart_monitor_crtc_set(Evas_Object *obj, Ecore_X_Randr_Crtc crtc, Evas_Coord cx, Evas_Coord cy, Evas_Coord cw, Evas_Coord ch); void e_smart_monitor_output_set(Evas_Object *obj, Ecore_X_Randr_Output output); void e_smart_monitor_grid_set(Evas_Object *obj, Evas_Object *grid, Evas_Coord gx, Evas_Coord gy, Evas_Coord gw, Evas_Coord gh); void e_smart_monitor_virtual_size_set(Evas_Object *obj, Evas_Coord vw, Evas_Coord vh); void e_smart_monitor_background_set(Evas_Object *obj, Evas_Coord dx, Evas_Coord dy); # endif #endif
--- +++ @@ -7,8 +7,9 @@ void e_smart_monitor_crtc_set(Evas_Object *obj, Ecore_X_Randr_Crtc crtc, Evas_Coord cx, Evas_Coord cy, Evas_Coord cw, Evas_Coord ch); void e_smart_monitor_output_set(Evas_Object *obj, Ecore_X_Randr_Output output); void e_smart_monitor_grid_set(Evas_Object *obj, Evas_Object *grid, Evas_Coord gx, Evas_Coord gy, Evas_Coord gw, Evas_Coord gh); -void e_smart_monitor_virtual_size_set(Evas_Object *obj, Evas_Coord vw, Evas_Coord vh); +void e_smart_monitor_grid_virtual_size_set(Evas_Object *obj, Evas_Coord vw, Evas_Coord vh); void e_smart_monitor_background_set(Evas_Object *obj, Evas_Coord dx, Evas_Coord dy); +void e_smart_monitor_current_geometry_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h); # endif #endif
Add function prototype for setting current geometry. Rename function prototype for grid virtual size set. Signed-off-by: Christopher Michael <cp.michael@samsung.com> SVN revision: 84195
bsd-2-clause
FlorentRevest/Enlightenment,rvandegrift/e,tasn/enlightenment,FlorentRevest/Enlightenment,rvandegrift/e,rvandegrift/e,tizenorg/platform.upstream.enlightenment,tasn/enlightenment,tizenorg/platform.upstream.enlightenment,tizenorg/platform.upstream.enlightenment,FlorentRevest/Enlightenment,tasn/enlightenment
c0d5cbad61bdde819a3d6c04e5b174fc85384343
/* string_funcs.h * Copyright (C) 2001-2003, The Perl Foundation. * SVN Info * $Id$ * Overview: * This is the api header for the string subsystem * Data Structure and Algorithms: * History: * Notes: * References: */ #ifndef PARROT_STRING_PRIMITIVES_H_GUARD #define PARROT_STRING_PRIMITIVES_H_GUARD #ifdef PARROT_IN_CORE /* Set the directory where ICU finds its data files (encodings, locales, etc.) */ PARROT_API void string_set_data_directory(const char *dir); /* Convert from any supported encoding, into our internal format */ PARROT_API void string_fill_from_buffer(Interp *interp, const void *buffer, UINTVAL len, const char *encoding_name, STRING *s); /* Utility method which knows how to uwind a single escape sequence */ typedef Parrot_UInt2 (*Parrot_unescape_cb)(Parrot_Int4 offset, void *context); PARROT_API Parrot_UInt4 string_unescape_one(Interp *interp, UINTVAL *offset, STRING *string); PARROT_API UINTVAL Parrot_char_digit_value(Interp *interp, UINTVAL character); #endif /* PARROT_IN_CORE */ #endif /* PARROT_STRING_PRIMITIVES_H_GUARD */ /* * Local variables: * c-file-style: "parrot" * End: * vim: expandtab shiftwidth=4: */
/* string_funcs.h * Copyright (C) 2001-2003, The Perl Foundation. * SVN Info * $Id$ * Overview: * This is the api header for the string subsystem * Data Structure and Algorithms: * History: * Notes: * References: */ #ifndef PARROT_STRING_PRIMITIVES_H_GUARD #define PARROT_STRING_PRIMITIVES_H_GUARD #ifdef PARROT_IN_CORE /* Set the directory where ICU finds its data files (encodings, locales, etc.) */ void string_set_data_directory(const char *dir); /* Convert from any supported encoding, into our internal format */ void string_fill_from_buffer(Interp *interp, const void *buffer, UINTVAL len, const char *encoding_name, STRING *s); /* Utility method which knows how to uwind a single escape sequence */ typedef Parrot_UInt2 (*Parrot_unescape_cb)(Parrot_Int4 offset, void *context); Parrot_UInt4 string_unescape_one(Interp *interp, UINTVAL *offset, STRING *string); UINTVAL Parrot_char_digit_value(Interp *interp, UINTVAL character); #endif /* PARROT_IN_CORE */ #endif /* PARROT_STRING_PRIMITIVES_H_GUARD */ /* * Local variables: * c-file-style: "parrot" * End: * vim: expandtab shiftwidth=4: */
--- +++ @@ -17,18 +17,18 @@ /* Set the directory where ICU finds its data files (encodings, locales, etc.) */ -void string_set_data_directory(const char *dir); +PARROT_API void string_set_data_directory(const char *dir); /* Convert from any supported encoding, into our internal format */ -void string_fill_from_buffer(Interp *interp, +PARROT_API void string_fill_from_buffer(Interp *interp, const void *buffer, UINTVAL len, const char *encoding_name, STRING *s); /* Utility method which knows how to uwind a single escape sequence */ typedef Parrot_UInt2 (*Parrot_unescape_cb)(Parrot_Int4 offset, void *context); -Parrot_UInt4 +PARROT_API Parrot_UInt4 string_unescape_one(Interp *interp, UINTVAL *offset, STRING *string); -UINTVAL +PARROT_API UINTVAL Parrot_char_digit_value(Interp *interp, UINTVAL character); #endif /* PARROT_IN_CORE */
Fix the build on Win32 by making linkage of various symbols consistent again. git-svn-id: 6e74a02f85675cec270f5d931b0f6998666294a3@18778 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
artistic-2.0
ashgti/parrot,ashgti/parrot,ashgti/parrot,ashgti/parrot,ashgti/parrot,ashgti/parrot,ashgti/parrot
72727bfb04499b60ca8ed91398fbabf0d88fe4cf
#pragma once //------------------------------------------------------------------------------ /** @file core/posix/precompiled.h Standard includes for POSIX platforms. NOTE: keep as many headers out of here as possible, at least on compilers which don't have pre-compiled-headers turned on. */ // this is a workaround when using clang with the GNU std lib, // this fails without __STRICT_ANSI__ because clang doesn't // know the __float128 type #if __clang__ && ORYOL_LINUX && !defined __STRICT_ANSI__ #define __STRICT_ANSI__ #endif #include <cstddef>
#pragma once //------------------------------------------------------------------------------ /** @file core/posix/precompiled.h Standard includes for POSIX platforms. NOTE: keep as many headers out of here as possible, at least on compilers which don't have pre-compiled-headers turned on. */ #ifdef __STRICT_ANSI__ #undef __STRICT_ANSI__ #endif #include <cstddef>
--- +++ @@ -7,8 +7,11 @@ NOTE: keep as many headers out of here as possible, at least on compilers which don't have pre-compiled-headers turned on. */ -#ifdef __STRICT_ANSI__ -#undef __STRICT_ANSI__ + +// this is a workaround when using clang with the GNU std lib, +// this fails without __STRICT_ANSI__ because clang doesn't +// know the __float128 type +#if __clang__ && ORYOL_LINUX && !defined __STRICT_ANSI__ +#define __STRICT_ANSI__ #endif - #include <cstddef>
Fix for compile error on Linux when using clang with GNU std c++ lib (__STRICT_ANSI__ is required)
mit
aonorin/oryol,floooh/oryol,aonorin/oryol,aonorin/oryol,aonorin/oryol,aonorin/oryol,aonorin/oryol,floooh/oryol,floooh/oryol,aonorin/oryol,floooh/oryol,floooh/oryol,floooh/oryol
030b5129d7f4693d8425740c0639a007c46902a7
#ifdef __cplusplus extern "C" { #endif typedef void* COptions; COptions newCOptions(const char*, const char*, const char*); #ifdef __cplusplus } #endif
typedef void* COptions; COptions newCOptions(const char*, const char*, const char*);
--- +++ @@ -1,2 +1,8 @@ -typedef void* COptions; -COptions newCOptions(const char*, const char*, const char*); +#ifdef __cplusplus +extern "C" { +#endif + typedef void* COptions; + COptions newCOptions(const char*, const char*, const char*); +#ifdef __cplusplus +} +#endif
Add back the C++ extern
mit
Julian/libopenzwave-cffi,Julian/libopenzwave-cffi,Julian/libopenzwave-cffi
6d53dd07a03c4bd24b9ca75cbbfe1c9fc3d4ff1f
#ifndef __JniHelpersCommon_h__ #define __JniHelpersCommon_h__ // Disable some annoying compiler warnings #if WIN32 #pragma warning(disable: 4996) // "Security" warnings for vsnprintf #endif #if WIN32 #define EXPORT __declspec(dllexport) #else #define EXPORT #endif #include <jni.h> #define kTypeInt "I" #define kTypeLong "J" #define kTypeFloat "F" #define kTypeDouble "D" #define kTypeBool "Z" #define kTypeByte "B" #define kTypeVoid "V" // Common Java classes #define kTypeJavaClass(x) "Ljava/lang/" #x ";" #define kTypeJavaException "Ljava/lang/Exception;" #define kTypeJavaString "Ljava/lang/String;" // Array builder macro #define kTypeArray(x) "[" x #endif // __JniHelpersCommon_h__
#ifndef __JniHelpersCommon_h__ #define __JniHelpersCommon_h__ // Disable some annoying compiler warnings #if WIN32 #pragma warning(disable: 4996) // "Security" warnings for vsnprintf #endif #if WIN32 #define EXPORT __declspec(dllexport) #else #define EXPORT #endif #include <jni.h> #define kTypeInt "I" #define kTypeLong "J" #define kTypeFloat "F" #define kTypeDouble "D" #define kTypeBool "Z" #define kTypeByte "B" #define kTypeVoid "V" // Common Java classes #define kTypeJavaClass(x) "Ljava/lang/" #x ";" #define kTypeJavaException "L/java/lang/Exception" #define kTypeJavaString "Ljava/lang/String" // Array builder macro #define kTypeArray(x) "[" x #endif // __JniHelpersCommon_h__
--- +++ @@ -24,8 +24,8 @@ // Common Java classes #define kTypeJavaClass(x) "Ljava/lang/" #x ";" -#define kTypeJavaException "L/java/lang/Exception" -#define kTypeJavaString "Ljava/lang/String" +#define kTypeJavaException "Ljava/lang/Exception;" +#define kTypeJavaString "Ljava/lang/String;" // Array builder macro #define kTypeArray(x) "[" x
Fix type signatures for some java bulit-ins
apache-2.0
spotify/JniHelpers,spotify/JniHelpers,spotify/JniHelpers,spotify/JniHelpers
10491403f35d32d63537fb6409fb6282d9e480d3
#ifndef __SODIUM_UTILS_H__ #define __SODIUM_UTILS_H__ #include <stddef.h> #include "export.h" #ifdef __cplusplus extern "C" { #endif #if defined(__cplusplus) || !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L # define _SODIUM_C99(X) #else # define _SODIUM_C99(X) X #endif unsigned char *_sodium_alignedcalloc(unsigned char ** const unaligned_p, const size_t len); SODIUM_EXPORT void sodium_memzero(void * const pnt, const size_t len); SODIUM_EXPORT int sodium_memcmp(const void * const b1_, const void * const b2_, size_t size); SODIUM_EXPORT char *sodium_bin2hex(char * const hex, const size_t hexlen, const unsigned char *bin, const size_t binlen); #ifdef __cplusplus } #endif #endif
#ifndef __SODIUM_UTILS_H__ #define __SODIUM_UTILS_H__ #include <stddef.h> #include "export.h" #ifdef __cplusplus extern "C" { #endif #ifndef __cplusplus # define _SODIUM_C99(X) X #else # define _SODIUM_C99(X) #endif unsigned char *_sodium_alignedcalloc(unsigned char ** const unaligned_p, const size_t len); SODIUM_EXPORT void sodium_memzero(void * const pnt, const size_t len); SODIUM_EXPORT int sodium_memcmp(const void * const b1_, const void * const b2_, size_t size); SODIUM_EXPORT char *sodium_bin2hex(char * const hex, const size_t hexlen, const unsigned char *bin, const size_t binlen); #ifdef __cplusplus } #endif #endif
--- +++ @@ -10,10 +10,10 @@ extern "C" { #endif -#ifndef __cplusplus +#if defined(__cplusplus) || !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L +# define _SODIUM_C99(X) +#else # define _SODIUM_C99(X) X -#else -# define _SODIUM_C99(X) #endif unsigned char *_sodium_alignedcalloc(unsigned char ** const unaligned_p,
Define _SODIUM_C99 as empty on retarded compilers, not only when using C++
isc
eburkitt/libsodium,CyanogenMod/android_external_dnscrypt_libsodium,tml/libsodium,soumith/libsodium,eburkitt/libsodium,mvduin/libsodium,CyanogenMod/android_external_dnscrypt_libsodium,zhuqling/libsodium,netroby/libsodium,pmienk/libsodium,eburkitt/libsodium,donpark/libsodium,GreatFruitOmsk/libsodium,optedoblivion/android_external_libsodium,mvduin/libsodium,SpiderOak/libsodium,rustyhorde/libsodium,kytvi2p/libsodium,HappyYang/libsodium,pmienk/libsodium,paragonie-scott/libsodium,Payshare/libsodium,akkakks/libsodium,SpiderOak/libsodium,paragonie-scott/libsodium,netroby/libsodium,JackWink/libsodium,donpark/libsodium,mvduin/libsodium,zhuqling/libsodium,akkakks/libsodium,paragonie-scott/libsodium,netroby/libsodium,pyparallel/libsodium,kytvi2p/libsodium,optedoblivion/android_external_libsodium,JackWink/libsodium,optedoblivion/android_external_libsodium,tml/libsodium,pyparallel/libsodium,Payshares/libsodium,JackWink/libsodium,Payshare/libsodium,soumith/libsodium,Payshare/libsodium,zhuqling/libsodium,donpark/libsodium,akkakks/libsodium,CyanogenMod/android_external_dnscrypt_libsodium,pmienk/libsodium,GreatFruitOmsk/libsodium,SpiderOak/libsodium,HappyYang/libsodium,pyparallel/libsodium,SpiderOak/libsodium,kytvi2p/libsodium,HappyYang/libsodium,Payshares/libsodium,soumith/libsodium,akkakks/libsodium,tml/libsodium,rustyhorde/libsodium,GreatFruitOmsk/libsodium,rustyhorde/libsodium,Payshares/libsodium,rustyhorde/libsodium
81321c880914cd7de46c1234d3cc73eaedd1350e
#include <stdio.h> #include <stdlib.h> #include <sysexits.h> #include <unistd.h> #include "choices.h" #include "config.h" #include "io.h" #include "ui.h" void usage(); void version(); int main(int argc,char **argv) { int ch; struct choices *cs; while ((ch = getopt(argc, argv, "hv")) != -1) switch (ch) { case 'v': version(); default: usage(); } argc -= optind; argv += optind; cs = get_choices(); put_choice(get_selected(cs)); choices_free(cs); return EX_OK; } void usage() { fprintf(stderr, "usage: pick [-h] [-v]\n"); fprintf(stderr, " -h display this help message and exit\n"); fprintf(stderr, " -v display the version and exit\n"); exit(EX_USAGE); } void version() { printf("%s\n", PACKAGE_VERSION); exit(EX_OK); }
#include <stdio.h> #include <stdlib.h> #include <sysexits.h> #include <unistd.h> #include "choices.h" #include "config.h" #include "io.h" #include "ui.h" void usage(); void version(); int main(int argc,char **argv) { int ch; struct choices *cs; while ((ch = getopt(argc, argv, "hv")) != -1) switch (ch) { case 'v': version(); default: usage(); } argc -= optind; argv += optind; cs = get_choices(); put_choice(get_selected(cs)); choices_free(cs); return EX_OK; } void usage() { fprintf(stderr, "usage: pick [-h]\n"); fprintf(stderr, " -h display this help message and exit\n"); fprintf(stderr, " -v display the version and exit\n"); exit(EX_USAGE); } void version() { printf("%s\n", PACKAGE_VERSION); exit(EX_OK); }
--- +++ @@ -37,7 +37,7 @@ void usage() { - fprintf(stderr, "usage: pick [-h]\n"); + fprintf(stderr, "usage: pick [-h] [-v]\n"); fprintf(stderr, " -h display this help message and exit\n"); fprintf(stderr, " -v display the version and exit\n"); exit(EX_USAGE);
Correct usage message option list.
mit
DBOTW/pick,prahlad37/pick,prahlad37/pick,GBuella/pick,temochka/pick,DBOTW/pick,thoughtbot/pick,temochka/pick,calleerlandsson/pick,DBOTW/pick,prahlad37/pick,thoughtbot/pick,thoughtbot/pick,calleerlandsson/pick,calleerlandsson/pick,thoughtbot/pick,GBuella/pick,prahlad37/pick
f4131aca5d93830c9559440d19cf66aa1838d10b
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include <arpa/inet.h> #include "idx.h" int main(int argc, char **argv){ if(argc<2){ printf("Usage: \n"); printf("readimages t10k-images-idx3-ubyte \n"); exit(1); } char *slabelfname = argv[1]; IDX3_DATA idxdata; if(!fread_idx3_file( slabelfname, &idxdata)){ printf("The datafile '%s' is not a valid IDX3 file.\n", slabelfname); exit(2); } //printf("Length: %d\n", idxdata.length); int i; int x; int y; int ibase; int rbase; unsigned char pxl; for(i=0;i<idxdata.nimages;i++){ ibase = i * idxdata.nrows * idxdata.ncols; printf("Image %05d ( %010d ):\n", i + 1, ibase); for(y=0;y<idxdata.nrows;y++){ rbase = ibase + y*idxdata.ncols; for(x=0;x<idxdata.ncols;x++){ // printf("DATA[%05d] = %02d\n", i, idxdata.data[i]); pxl = idxdata.data[ rbase + x ]; if(pxl){ printf("%02X", pxl); }else{ printf(" "); } } printf("\n"); } printf("========================================================\n"); } return 0; }
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include <arpa/inet.h> #include "idx.h" int main(int argc, char **argv){ if(argc<2){ printf("Usage: \n"); printf("readlabels t10k-labels-idx1-ubyte \n"); exit(1); } char *slabelfname = argv[1]; IDX1_DATA idxdata; if(!fread_idx1_file( slabelfname, &idxdata)){ printf("The datafile '%s' is not a valid IDX_1 file.\n", slabelfname); exit(2); } //printf("Length: %d\n", idxdata.length); int i; for(i=0;i<idxdata.length;i++){ // printf("DATA[%05d] = %02d\n", i, idxdata.data[i]); printf("%d\n", idxdata.data[i]); } return 0; }
--- +++ @@ -7,22 +7,42 @@ int main(int argc, char **argv){ if(argc<2){ printf("Usage: \n"); - printf("readlabels t10k-labels-idx1-ubyte \n"); + printf("readimages t10k-images-idx3-ubyte \n"); exit(1); } char *slabelfname = argv[1]; - IDX1_DATA idxdata; - if(!fread_idx1_file( slabelfname, &idxdata)){ - printf("The datafile '%s' is not a valid IDX_1 file.\n", slabelfname); + IDX3_DATA idxdata; + if(!fread_idx3_file( slabelfname, &idxdata)){ + printf("The datafile '%s' is not a valid IDX3 file.\n", slabelfname); exit(2); } //printf("Length: %d\n", idxdata.length); + int i; - for(i=0;i<idxdata.length;i++){ -// printf("DATA[%05d] = %02d\n", i, idxdata.data[i]); - printf("%d\n", idxdata.data[i]); + int x; + int y; + int ibase; + int rbase; + unsigned char pxl; + for(i=0;i<idxdata.nimages;i++){ + ibase = i * idxdata.nrows * idxdata.ncols; + printf("Image %05d ( %010d ):\n", i + 1, ibase); + for(y=0;y<idxdata.nrows;y++){ + rbase = ibase + y*idxdata.ncols; + for(x=0;x<idxdata.ncols;x++){ + // printf("DATA[%05d] = %02d\n", i, idxdata.data[i]); + pxl = idxdata.data[ rbase + x ]; + if(pxl){ + printf("%02X", pxl); + }else{ + printf(" "); + } + } + printf("\n"); + } + printf("========================================================\n"); } return 0;
Implement a simple ASCII text image dumper.
mit
spytheman/MNIST-idx1-and-idx3-file-readers
8114b3e7e5438de48b5cf1c1e2454debb6cf96cc
/* * Copyright (c) 2012, Nadir Sampaoli * See the LICENSE for more information */ #include "memory.h" #include <stdlib.h> #include <stdio.h> static uint8_t *memory_area; void allocmemory(void) { while(!memory_area) { memory_area = malloc(MEM_SIZE * sizeof(uint8_t)); } } inline uint8_t getmembyte(uint16_t addr) { return *(memory_area + addr); } inline uint16_t getmemword(uint16_t addr) { return (getmembyte(addr+1) << 8 | getmembyte(addr)); } void putmembyte(uint16_t addr, uint8_t byte) { // FIXME: must control if addr is readonly (TODO: implement MBC controllers) *(memory_area + addr) = byte; } void putmemword(uint16_t addr, uint16_t word) { putmembyte(addr, (word >> 8)); putmembyte(addr+1, (word & 0xFF)); }
/* * Copyright (c) 2012, Nadir Sampaoli * See the LICENSE for more information */ #include "memory.h" #include <stdlib.h> #include <stdio.h> static uint8_t *memory_area; void allocmemory(void) { while(!memory_area) { memory_area = malloc(MEM_SIZE * sizeof(uint8_t)); } } uint8_t getmembyte(uint16_t addr) { return *(memory_area + addr); } uint16_t getmemword(uint16_t addr) { return (getmembyte(addr+1) << 8 | getmembyte(addr)); } void putmembyte(uint16_t addr, uint8_t byte) { // FIXME: must control if addr is readonly (TODO: implement MBC controllers) *(memory_area + addr) = byte; } void putmemword(uint16_t addr, uint16_t word) { putmembyte(addr, (word >> 8)); putmembyte(addr+1, (word & 0xFF)); }
--- +++ @@ -16,12 +16,12 @@ } } -uint8_t getmembyte(uint16_t addr) +inline uint8_t getmembyte(uint16_t addr) { return *(memory_area + addr); } -uint16_t getmemword(uint16_t addr) +inline uint16_t getmemword(uint16_t addr) { return (getmembyte(addr+1) << 8 | getmembyte(addr)); }
Change "getmembyte" and "getmemword" to inline functions
mit
nadirs/dmgemu,nadirs/dmgemu,nadirs/dmgemu,nadirs/dmgemu
18ca3c88bfab828cf26f5a184cfa30ba012089e4
#include "e.h" #include "e_mod_main.h" #include "e_mod_config.h" #include "e_kbd_int.h" /* local variables */ static E_Kbd_Int *ki = NULL; EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Illume Keyboard" }; EAPI void * e_modapi_init(E_Module *m) { if (!il_kbd_config_init(m)) return NULL; ki = e_kbd_int_new(il_kbd_cfg->mod_dir, il_kbd_cfg->mod_dir, il_kbd_cfg->mod_dir); return m; } EAPI int e_modapi_shutdown(E_Module *m) { if (ki) { e_kbd_int_free(ki); ki = NULL; } il_kbd_config_shutdown(); return 1; } EAPI int e_modapi_save(E_Module *m) { return il_kbd_config_save(); }
#include "e.h" #include "e_mod_main.h" #include "e_mod_config.h" #include "e_kbd_int.h" /* local variables */ static E_Kbd_Int *ki = NULL; EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Illume Keyboard" }; EAPI void * e_modapi_init(E_Module *m) { if (!il_kbd_config_init(m)) return NULL; ki = e_kbd_int_new(mod_dir, mod_dir, mod_dir); return m; } EAPI int e_modapi_shutdown(E_Module *m) { if (ki) { e_kbd_int_free(ki); ki = NULL; } il_kbd_config_shutdown(); return 1; } EAPI int e_modapi_save(E_Module *m) { return il_kbd_config_save(); }
--- +++ @@ -13,7 +13,8 @@ { if (!il_kbd_config_init(m)) return NULL; - ki = e_kbd_int_new(mod_dir, mod_dir, mod_dir); + ki = e_kbd_int_new(il_kbd_cfg->mod_dir, + il_kbd_cfg->mod_dir, il_kbd_cfg->mod_dir); return m; }
Use correct module directory when making keyboard. Previous commit fixed compiler warnings also. git-svn-id: 6ac5796aeae0cef97fb47bcc287d4ce899c6fa6e@43875 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33
bsd-2-clause
jordemort/e17,jordemort/e17,jordemort/e17
aba2ec8c709b9bb5b2484e86d8f108b0ae0932d4
/* * Copyright (C) 2008-2013 The Communi Project * * This example is free, and not covered by the LGPL license. There is no * restriction applied to their modification, redistribution, using and so on. * You can study them, modify them, use them in your own program - either * completely or partially. */ #ifndef DOCUMENT_H #define DOCUMENT_H #include "textdocument.h" class IrcBuffer; class IrcMessage; class MessageFormatter; class Document : public TextDocument { Q_OBJECT public: Document(IrcBuffer* buffer); ~Document(); IrcBuffer* buffer() const; static Document* instance(IrcBuffer* buffer = 0); public slots: static void addBuffer(IrcBuffer* buffer); static void removeBuffer(IrcBuffer* buffer); private slots: void receiveMessage(IrcMessage* message); private: struct Private { IrcBuffer* buffer; MessageFormatter* formatter; } d; }; #endif // DOCUMENT_H
/* * Copyright (C) 2008-2013 The Communi Project * * This example is free, and not covered by the LGPL license. There is no * restriction applied to their modification, redistribution, using and so on. * You can study them, modify them, use them in your own program - either * completely or partially. */ #ifndef DOCUMENT_H #define DOCUMENT_H #include "textdocument.h" class IrcBuffer; class IrcMessage; class MessageFormatter; class Document : public TextDocument { Q_OBJECT public: Document(IrcBuffer* buffer); ~Document(); IrcBuffer* buffer() const; static Document* instance(IrcBuffer* buffer = 0); public slots: void addBuffer(IrcBuffer* buffer); void removeBuffer(IrcBuffer* buffer); private slots: void receiveMessage(IrcMessage* message); private: struct Private { IrcBuffer* buffer; MessageFormatter* formatter; } d; }; #endif // DOCUMENT_H
--- +++ @@ -29,8 +29,8 @@ static Document* instance(IrcBuffer* buffer = 0); public slots: - void addBuffer(IrcBuffer* buffer); - void removeBuffer(IrcBuffer* buffer); + static void addBuffer(IrcBuffer* buffer); + static void removeBuffer(IrcBuffer* buffer); private slots: void receiveMessage(IrcMessage* message);
Make Document::add() and remove() static
bsd-3-clause
jpnurmi/communi-desktop,sevanteri/communi-desktop,gdamjan/communi-desktop,communi/communi-desktop,communi/communi-desktop
8bf1dce53748298038119b458ea86a2e6b2ad15b
#include <stdio.h> int c; __thread int d; register int R1 __asm__ ("%" "r15"); int main(void) { c = 3; R1 = 5; d = 4; printf("C: %d\n", c); printf("D: %d\n", d); printf("R1: %d\n", R1); R1 *= 2; printf("R1: %d\n", R1); return 0; }
#include <stdio.h> int c; __thread int d; register int R1 __asm__ ("%" "i5"); int main(void) { c = 3; R1 = 5; d = 4; printf("C: %d\n", c); printf("D: %d\n", d); printf("R1: %d\n", R1); R1 *= 2; printf("R1: %d\n", R1); return 0; }
--- +++ @@ -2,7 +2,7 @@ int c; __thread int d; -register int R1 __asm__ ("%" "i5"); +register int R1 __asm__ ("%" "r15"); int main(void) {
Fix gcc global reg extension test to work. Had wrong register before.
bsd-3-clause
dterei/Scraps,dterei/Scraps,dterei/Scraps,dterei/Scraps,dterei/Scraps,dterei/Scraps,dterei/Scraps,dterei/Scraps,dterei/Scraps,dterei/Scraps,dterei/Scraps,dterei/Scraps
500aedded80bd387484abfe9a6d7b8b4b591015d
#ifndef _NPY_ARRAY_CONVERT_DATATYPE_H_ #define _NPY_ARRAY_CONVERT_DATATYPE_H_ NPY_NO_EXPORT PyObject * PyArray_CastToType(PyArrayObject *mp, PyArray_Descr *at, int fortran); NPY_NO_EXPORT int PyArray_CastTo(PyArrayObject *out, PyArrayObject *mp); NPY_NO_EXPORT PyArray_VectorUnaryFunc * PyArray_GetCastFunc(PyArray_Descr *descr, int type_num); NPY_NO_EXPORT int PyArray_CanCastSafely(int fromtype, int totype); NPY_NO_EXPORT Bool PyArray_CanCastTo(PyArray_Descr *from, PyArray_Descr *to); NPY_NO_EXPORT int PyArray_ObjectType(PyObject *op, int minimum_type); NPY_NO_EXPORT PyArrayObject ** PyArray_ConvertToCommonType(PyObject *op, int *retn); NPY_NO_EXPORT int PyArray_ValidType(int type); #endif
#ifndef _NPY_ARRAY_CONVERT_DATATYPE_H_ #define _NPY_ARRAY_CONVERT_DATATYPE_H_ NPY_NO_EXPORT PyObject * PyArray_CastToType(PyArrayObject *mp, PyArray_Descr *at, int fortran); #endif
--- +++ @@ -4,4 +4,25 @@ NPY_NO_EXPORT PyObject * PyArray_CastToType(PyArrayObject *mp, PyArray_Descr *at, int fortran); +NPY_NO_EXPORT int +PyArray_CastTo(PyArrayObject *out, PyArrayObject *mp); + +NPY_NO_EXPORT PyArray_VectorUnaryFunc * +PyArray_GetCastFunc(PyArray_Descr *descr, int type_num); + +NPY_NO_EXPORT int +PyArray_CanCastSafely(int fromtype, int totype); + +NPY_NO_EXPORT Bool +PyArray_CanCastTo(PyArray_Descr *from, PyArray_Descr *to); + +NPY_NO_EXPORT int +PyArray_ObjectType(PyObject *op, int minimum_type); + +NPY_NO_EXPORT PyArrayObject ** +PyArray_ConvertToCommonType(PyObject *op, int *retn); + +NPY_NO_EXPORT int +PyArray_ValidType(int type); + #endif
Add API for datatype conversion. git-svn-id: 77a43f9646713b91fea7788fad5dfbf67e151ece@6920 94b884b6-d6fd-0310-90d3-974f1d3f35e1
bsd-3-clause
Ademan/NumPy-GSoC,chadnetzer/numpy-gaurdro,teoliphant/numpy-refactor,jasonmccampbell/numpy-refactor-sprint,illume/numpy3k,Ademan/NumPy-GSoC,teoliphant/numpy-refactor,jasonmccampbell/numpy-refactor-sprint,teoliphant/numpy-refactor,Ademan/NumPy-GSoC,illume/numpy3k,efiring/numpy-work,efiring/numpy-work,jasonmccampbell/numpy-refactor-sprint,Ademan/NumPy-GSoC,efiring/numpy-work,chadnetzer/numpy-gaurdro,efiring/numpy-work,illume/numpy3k,teoliphant/numpy-refactor,chadnetzer/numpy-gaurdro,chadnetzer/numpy-gaurdro,illume/numpy3k,teoliphant/numpy-refactor,jasonmccampbell/numpy-refactor-sprint
2d3fb89f05d62306694fb4d2a9e45de86e737b0d
#pragma once #include "uitypes.h" #include <QtWidgets/QLabel> #include <QtWidgets/QToolButton> #include <QtCore/QParallelAnimationGroup> #include <QtWidgets/QScrollArea> #include <QtCore/QPropertyAnimation> class BINARYNINJAUIAPI ExpandableGroup : public QWidget { Q_OBJECT private: QToolButton* m_button; QLabel* m_title; QParallelAnimationGroup* m_animation; QScrollArea* m_content; int m_duration = 100; private Q_SLOTS: void toggled(bool expanded); public: explicit ExpandableGroup(QLayout* contentLayout, const QString& title = "", QWidget* parent = nullptr, bool expanded = false); void setupAnimation(QLayout* contentLayout); void setTitle(const QString& title) { m_title->setText(title); } void toggle(bool expanded); };
#pragma once #include "uitypes.h" #include <QtWidgets/QToolButton> #include <QtCore/QParallelAnimationGroup> #include <QtWidgets/QScrollArea> #include <QtCore/QPropertyAnimation> class BINARYNINJAUIAPI ExpandableGroup : public QWidget { Q_OBJECT private: QToolButton* m_button; QParallelAnimationGroup* m_animation; QScrollArea* m_content; int m_duration = 100; private Q_SLOTS: void toggled(bool expanded); public: explicit ExpandableGroup( QLayout* contentLayout, const QString& title = "", QWidget* parent = nullptr, bool expanded = false); void setupAnimation(QLayout* contentLayout); void setTitle(const QString& title) { m_button->setText(title); } void toggle(bool expanded); };
--- +++ @@ -1,6 +1,7 @@ #pragma once #include "uitypes.h" +#include <QtWidgets/QLabel> #include <QtWidgets/QToolButton> #include <QtCore/QParallelAnimationGroup> #include <QtWidgets/QScrollArea> @@ -12,6 +13,7 @@ private: QToolButton* m_button; + QLabel* m_title; QParallelAnimationGroup* m_animation; QScrollArea* m_content; int m_duration = 100; @@ -20,9 +22,8 @@ void toggled(bool expanded); public: - explicit ExpandableGroup( - QLayout* contentLayout, const QString& title = "", QWidget* parent = nullptr, bool expanded = false); + explicit ExpandableGroup(QLayout* contentLayout, const QString& title = "", QWidget* parent = nullptr, bool expanded = false); void setupAnimation(QLayout* contentLayout); - void setTitle(const QString& title) { m_button->setText(title); } + void setTitle(const QString& title) { m_title->setText(title); } void toggle(bool expanded); };
Fix UI arrow artifact in Cross References and Search widgets.
mit
Vector35/binaryninja-api,Vector35/binaryninja-api,Vector35/binaryninja-api,Vector35/binaryninja-api,Vector35/binaryninja-api,Vector35/binaryninja-api,Vector35/binaryninja-api
a5eb8bfdc1affa6d2330484800808c4d34f23103
#include <testharness.h> #include <stdio.h> void BuildWord(char * pchWord) { int i; char * pch = pchWord; /* original code: * while ((i = *pch++) != '\0') { } */ do { i = *pch; // printf("i = '%c'\n",i); pch++; } while (i != '\0'); printf("%s\n",pchWord); } int main() { char *test = "foo"; test++; test--; BuildWord(test); SUCCESS; }
#include <testharness.h> #include <stdio.h> void BuildWord(char * pchWord) { int i; char * pch = pchWord; /* original code: * while ((i = *pch++) != '\0') { } */ do { i = *pch; pch++; } while (i != '\0'); printf("%s\n",pchWord); } int main() { char *test = "foo"; BuildWord(test); SUCCESS; }
--- +++ @@ -11,6 +11,7 @@ do { i = *pch; + // printf("i = '%c'\n",i); pch++; } while (i != '\0'); @@ -20,6 +21,9 @@ int main() { char *test = "foo"; + test++; + test--; + BuildWord(test); SUCCESS;
Switch the world over to the new 'paper' solver. Local regression tests indicate that it shouldn't be that bad: new models and wrappers have been added to support it. INFERBOX=infer is now the new solver, INFERBOX=old gives the old behavior (will be removed later).
bsd-3-clause
samuelhavron/obliv-c,samuelhavron/obliv-c,samuelhavron/obliv-c,samuelhavron/obliv-c
c49c6113ab8ca9293cad0fc766c6b4bd90e22a75
#include <stdlib.h> #include <stdio.h> #include types.c #include <string.h> /* We can: Set something equal to something Function calls Function definitions Returning things -- delimiter '<' Printing things Iffing */ struct call parseCall(char* statement); struct function parseFunction(char* statement); char* fixSpacing(char* code) { char* fixedCode = malloc(sizeof(char) * (strlen(code) + 1)); fixedCode = strcpy(fixedCode, code); char* doubleSpace = strstr(fixedCode, " "); char* movingIndex; for( ; doubleSpace; doubleSpace = strstr(fixedCode, " ")) { for(movingIndex = doubleSpace; movingIndex&; movingIndex++) { movingIndex[0] = movingIndex[1]; } } return fixedCode; } char** spcTokenize(char* regCode) { int n = 0; int i; for(i = 0; regCode[i]; i++) { if(regCode[i] == ' ') { n++; } } char** spcTokens = malloc(sizeof(char*) * (n+1)); int k; for(i = 0; i < n+1; i++) { k = strchr(regCode, ' ') - regCode; regCode[k] = NULL; spcTokens[i] = regCode + k + 1; } }
#include <stdlib.h> #include <stdio.h> #include types.c #include <string.h> /* We can: Set something equal to something Function calls Function definitions Returning things -- delimiter '<' Printing things Iffing */ struct call parseCall(char* statement); struct function parseFunction(char* statement); char* fixSpacing(char* code) { char* fixedCode = calloc(sizeof(char), strlen(code) + 1); fixedCode = strcpy(fixedCode, code); char* doubleSpace = strstr(fixedCode, " "); char* movingIndex; for( ; doubleSpace; doubleSpace = strstr(fixedCode, " ")) { for(movingIndex = doubleSpace; movingIndex&; movingIndex++) { movingIndex[0] = movingIndex[1]; } } return fixedCode; } struct statement* parse(char* code) { char* regCode = fixSpacing(code); int n = 0; int i; for(i = 0; regCode[i]; i++) { if(regCode[i] == ' ') { n++; } } char** spcTokens = calloc(sizeof(char*), n+1);
--- +++ @@ -15,7 +15,7 @@ struct function parseFunction(char* statement); char* fixSpacing(char* code) { - char* fixedCode = calloc(sizeof(char), strlen(code) + 1); + char* fixedCode = malloc(sizeof(char) * (strlen(code) + 1)); fixedCode = strcpy(fixedCode, code); char* doubleSpace = strstr(fixedCode, " "); char* movingIndex; @@ -27,8 +27,7 @@ return fixedCode; } -struct statement* parse(char* code) { - char* regCode = fixSpacing(code); +char** spcTokenize(char* regCode) { int n = 0; int i; for(i = 0; regCode[i]; i++) { @@ -36,4 +35,11 @@ n++; } } - char** spcTokens = calloc(sizeof(char*), n+1); + char** spcTokens = malloc(sizeof(char*) * (n+1)); + int k; + for(i = 0; i < n+1; i++) { + k = strchr(regCode, ' ') - regCode; + regCode[k] = NULL; + spcTokens[i] = regCode + k + 1; + } +}
Refactor the space tokenizer to be its own function; parse() no longer exists.
mit
aacoppa/final,aacoppa/final
64c9fe48234cd49ae730f3d2f80a0b7eb3c6d897
/* * $Id$ * * Define the tags in the shared memory in a reusable format. * Whoever includes this get to define what the SLTM macro does. * */ SLTM(Debug) SLTM(CLI) SLTM(SessionOpen) SLTM(SessionReuse) SLTM(SessionClose) SLTM(ClientAddr) SLTM(HandlingPass) SLTM(HandlingPipe) SLTM(Request) SLTM(Response) SLTM(Status) SLTM(URL) SLTM(Protocol) SLTM(HD_Unknown) SLTM(HD_Lost) #define HTTPH(a, b, c, d, e, f, g) SLTM(b) #include "http_headers.h" #undef HTTPH
/* * $Id$ * * Define the tags in the shared memory in a reusable format. * Whoever includes this get to define what the SLTM macro does. * */ SLTM(Debug) SLTM(CLI) SLTM(SessionOpen) SLTM(SessionReuse) SLTM(SessionClose) SLTM(ClientAddr) SLTM(Request) SLTM(Response) SLTM(Status) SLTM(URL) SLTM(Protocol) SLTM(HD_Unknown) SLTM(HD_Lost) #define HTTPH(a, b, c, d, e, f, g) SLTM(b) #include "http_headers.h" #undef HTTPH
--- +++ @@ -12,6 +12,8 @@ SLTM(SessionReuse) SLTM(SessionClose) SLTM(ClientAddr) +SLTM(HandlingPass) +SLTM(HandlingPipe) SLTM(Request) SLTM(Response) SLTM(Status)
Add shmlog tags for pipe and pass handling git-svn-id: 7d4b18ab7d176792635d6a7a77dd8cbbea8e8daa@131 d4fa192b-c00b-0410-8231-f00ffab90ce4
bsd-2-clause
CartoDB/Varnish-Cache,wikimedia/operations-debs-varnish,ssm/pkg-varnish,wikimedia/operations-debs-varnish,wikimedia/operations-debs-varnish,CartoDB/Varnish-Cache,wikimedia/operations-debs-varnish,wikimedia/operations-debs-varnish,ssm/pkg-varnish,ssm/pkg-varnish,ssm/pkg-varnish,CartoDB/Varnish-Cache,ssm/pkg-varnish
396a83183195021106acb9262bd7b56242101f20
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* testpath.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: sle-guil <sle-guil@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2015/03/11 16:25:34 by sle-guil #+# #+# */ /* Updated: 2015/03/12 16:00:13 by sle-guil ### ########.fr */ /* */ /* ************************************************************************** */ #include "minishell.h" int testpath(char const *path) { int ret; ret = (access(path, F_OK) != -1) ? 1 : 0; ret += (access(path, X_OK) != -1) ? 8 : 0; return (ret); }
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* testpath.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: sle-guil <sle-guil@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2015/03/11 16:25:34 by sle-guil #+# #+# */ /* Updated: 2015/03/11 16:48:51 by sle-guil ### ########.fr */ /* */ /* ************************************************************************** */ #include "minishell.h" int testpath(char *path) { int ret; ft_putendl("boobs"); ret = (access(path, F_OK)) ? 1 : 0; ret += (access(path, R_OK)) ? 2 : 0; ret += (access(path, W_OK)) ? 4 : 0; ret += (access(path, X_OK)) ? 8 : 0; return (ret); }
--- +++ @@ -6,20 +6,17 @@ /* By: sle-guil <sle-guil@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2015/03/11 16:25:34 by sle-guil #+# #+# */ -/* Updated: 2015/03/11 16:48:51 by sle-guil ### ########.fr */ +/* Updated: 2015/03/12 16:00:13 by sle-guil ### ########.fr */ /* */ /* ************************************************************************** */ #include "minishell.h" -int testpath(char *path) +int testpath(char const *path) { int ret; - ft_putendl("boobs"); - ret = (access(path, F_OK)) ? 1 : 0; - ret += (access(path, R_OK)) ? 2 : 0; - ret += (access(path, W_OK)) ? 4 : 0; - ret += (access(path, X_OK)) ? 8 : 0; + ret = (access(path, F_OK) != -1) ? 1 : 0; + ret += (access(path, X_OK) != -1) ? 8 : 0; return (ret); }
Check dir have to be done
mit
SuliacLEGUILLOU/minishell
00e8765b3a2db414e655021fadf86f420c11d4a5
/* * Copyright (c) 2008, 2009, Wayne Meissner * * 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. * * The name of the author or authors may not 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 OWNER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef RBFFI_POINTER_H #define RBFFI_POINTER_H #ifdef __cplusplus extern "C" { #endif #include "AbstractMemory.h" extern void rbffi_Pointer_Init(VALUE moduleFFI); extern VALUE rbffi_Pointer_NewInstance(void* addr); extern VALUE rbffi_PointerClass; extern VALUE rbffi_NullPointerSingleton; #ifdef __cplusplus } #endif #endif /* RBFFI_POINTER_H */
#ifndef _POINTER_H #define _POINTER_H #ifdef __cplusplus extern "C" { #endif #include "AbstractMemory.h" extern void rbffi_Pointer_Init(VALUE moduleFFI); extern void rbffi_NullPointer_Init(VALUE moduleFFI); extern VALUE rbffi_Pointer_NewInstance(void* addr); extern VALUE rbffi_PointerClass; extern VALUE rbffi_NullPointerClass; extern VALUE rbffi_NullPointerSingleton; extern MemoryOps rbffi_NullPointerOps; #ifdef __cplusplus } #endif #endif /* _POINTER_H */
--- +++ @@ -1,6 +1,33 @@ +/* + * Copyright (c) 2008, 2009, Wayne Meissner + * + * 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. + * * The name of the author or authors may not 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 OWNER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ -#ifndef _POINTER_H -#define _POINTER_H +#ifndef RBFFI_POINTER_H +#define RBFFI_POINTER_H #ifdef __cplusplus extern "C" { @@ -9,17 +36,14 @@ #include "AbstractMemory.h" extern void rbffi_Pointer_Init(VALUE moduleFFI); -extern void rbffi_NullPointer_Init(VALUE moduleFFI); extern VALUE rbffi_Pointer_NewInstance(void* addr); extern VALUE rbffi_PointerClass; -extern VALUE rbffi_NullPointerClass; extern VALUE rbffi_NullPointerSingleton; -extern MemoryOps rbffi_NullPointerOps; #ifdef __cplusplus } #endif -#endif /* _POINTER_H */ +#endif /* RBFFI_POINTER_H */
Remove some leftover null pointer vars
bsd-3-clause
majioa/ffi,tduehr/ffi,sparkchaser/ffi,ferventcoder/ffi,majioa/ffi,mvz/ffi,yghannam/ffi,tduehr/ffi,sparkchaser/ffi,ferventcoder/ffi,tduehr/ffi,MikaelSmith/ffi,ffi/ffi,majioa/ffi,ffi/ffi,mvz/ffi,sparkchaser/ffi,sparkchaser/ffi,MikaelSmith/ffi,tduehr/ffi,mvz/ffi,yghannam/ffi,ferventcoder/ffi,MikaelSmith/ffi,mvz/ffi,yghannam/ffi,ferventcoder/ffi,yghannam/ffi,majioa/ffi,MikaelSmith/ffi,yghannam/ffi,ffi/ffi
4020b05b515c5a486de3224739e370dedfb5c005
/* * Copyright 2016 Chris Marshall * * 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 __QUICKAVRO_H #define __QUICKAVRO_H #ifdef __cplusplus extern "C" { #endif // Used when reading 'zig-zag' encoded values #define MAX_VARINT_SIZE 10 // Initial write buffer #define INITIAL_BUFFER_SIZE 1024 * 8 #ifdef __cplusplus } #endif #endif
/* * Copyright 2016 Chris Marshall * * 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 __QUICKAVRO_H #define __QUICKAVRO_H #ifdef __cplusplus extern "C" { #endif // Used when reading 'zig-zag' encoded values #define MAX_VARINT_SIZE 10 // Initial write buffer #define INITIAL_BUFFER_SIZE 1024 #ifdef __cplusplus } #endif #endif
--- +++ @@ -26,7 +26,7 @@ #define MAX_VARINT_SIZE 10 // Initial write buffer -#define INITIAL_BUFFER_SIZE 1024 +#define INITIAL_BUFFER_SIZE 1024 * 8 #ifdef __cplusplus
Increase initial buffer to 8192 bytes
apache-2.0
ChrisRx/quickavro,ChrisRx/quickavro
7f2afc7a1926bf85cf3b990ebe4ed1fc70968251
/** * @author Adam Grandquist */ #include "ReQL-ast.h" #ifndef _REQL_H #define _REQL_H struct _ReQL_Conn_s { int socket; int error; char *buf; unsigned int max_token; struct _ReQL_Cur_s **cursor; }; typedef struct _ReQL_Conn_s _ReQL_Conn_t; struct _ReQL_Cur_s { }; typedef struct _ReQL_Cur_s _ReQL_Cur_t; int _reql_connect(_ReQL_Conn_t *conn, unsigned char host_len, char *host, unsigned char port); int _reql_close_conn(_ReQL_Conn_t *conn); _ReQL_Cur_t *_reql_run(_ReQL_Op_t *query, _ReQL_Conn_t *conn, _ReQL_Op_t *kwargs); void _reql_next(_ReQL_Cur_t *cur); void _reql_close_cur(_ReQL_Cur_t *cur); #endif
/** * @author Adam Grandquist */ #include "ReQL-ast.h" #ifndef _REQL_H #define _REQL_H struct _ReQL_Conn_s { int socket; int error; char *buf; }; typedef struct _ReQL_Conn_s _ReQL_Conn_t; struct _ReQL_Cur_s { }; typedef struct _ReQL_Cur_s _ReQL_Cur_t; int _reql_connect(_ReQL_Conn_t *conn, unsigned char host_len, char *host, unsigned char port); int _reql_close_conn(_ReQL_Conn_t *conn); _ReQL_Cur_t *_reql_run(_ReQL_Op_t *query, _ReQL_Conn_t *conn, _ReQL_Op_t *kwargs); void _reql_next(_ReQL_Cur_t *cur); void _reql_close_cur(_ReQL_Cur_t *cur); #endif
--- +++ @@ -11,6 +11,8 @@ int socket; int error; char *buf; + unsigned int max_token; + struct _ReQL_Cur_s **cursor; }; typedef struct _ReQL_Conn_s _ReQL_Conn_t;
Add token counter and cursor array to connections.
apache-2.0
grandquista/ReQL-Core,grandquista/ReQL-Core,grandquista/ReQL-Core,grandquista/ReQL-Core
394a095665a5ac4f465d194b46da6bf77a340958
#define DUMMY 0 #define FUNC 1 #define PARAM 2 #define XFER_FUNC 3 #define ALLOC_FUNC 4 #define ACTION_PARAM 5 #define NOSUPP_FUNC 6 struct token { int tok_type; char *val; }; struct node { int node_type; char *type_name; char *id; int is_ptr; int is_const; int is_const_ptr; int is_mapped; int is_array; int is_ref; int in_param; int out_param; int extract; int pseudo; struct node *next; struct node *prev; struct node *param_list; struct node *action_func_list; }; #define XDR_FUNC id struct p_mode { int in; int out; }; union yystype { struct token tok; struct node *node; struct p_mode param_mode; int bool; }; #define YYSTYPE union yystype
#define DUMMY 0 #define FUNC 1 #define PARAM 2 #define XFER_FUNC 3 #define ALLOC_FUNC 4 #define ACTION_PARAM 5 #define NOSUPP_FUNC 6 struct token { int tok_type; char *val; }; struct node { int node_type; char *type_name; char *id; int is_ptr; int is_const; int is_const_ptr; int is_mapped; int is_array; int is_ref; int in_param; int out_param; int extract; struct node *next; struct node *prev; struct node *param_list; struct node *action_func_list; }; #define XDR_FUNC id struct p_mode { int in; int out; }; union yystype { struct token tok; struct node *node; struct p_mode param_mode; int bool; }; #define YYSTYPE union yystype
--- +++ @@ -5,6 +5,7 @@ #define ALLOC_FUNC 4 #define ACTION_PARAM 5 #define NOSUPP_FUNC 6 + struct token { int tok_type; @@ -24,6 +25,7 @@ int in_param; int out_param; int extract; + int pseudo; struct node *next; struct node *prev; struct node *param_list;
Add boolean node attirbute "pseudo" to describe whether a given system call is a "normal" one, or a "pseudo" call. This needs to be know by the receivers where normal syscalls can be invoked directly by their name, but pseudo calls must have hand written code to handle their functionality.
apache-2.0
djw8605/htcondor,htcondor/htcondor,clalancette/condor-dcloud,neurodebian/htcondor,neurodebian/htcondor,djw8605/condor,mambelli/osg-bosco-marco,neurodebian/htcondor,neurodebian/htcondor,bbockelm/condor-network-accounting,djw8605/condor,htcondor/htcondor,djw8605/htcondor,bbockelm/condor-network-accounting,djw8605/condor,htcondor/htcondor,djw8605/htcondor,clalancette/condor-dcloud,clalancette/condor-dcloud,djw8605/htcondor,clalancette/condor-dcloud,neurodebian/htcondor,djw8605/condor,djw8605/htcondor,zhangzhehust/htcondor,neurodebian/htcondor,htcondor/htcondor,mambelli/osg-bosco-marco,mambelli/osg-bosco-marco,zhangzhehust/htcondor,zhangzhehust/htcondor,zhangzhehust/htcondor,djw8605/condor,mambelli/osg-bosco-marco,zhangzhehust/htcondor,bbockelm/condor-network-accounting,htcondor/htcondor,djw8605/condor,neurodebian/htcondor,bbockelm/condor-network-accounting,bbockelm/condor-network-accounting,htcondor/htcondor,mambelli/osg-bosco-marco,djw8605/htcondor,neurodebian/htcondor,djw8605/htcondor,zhangzhehust/htcondor,djw8605/htcondor,neurodebian/htcondor,clalancette/condor-dcloud,htcondor/htcondor,bbockelm/condor-network-accounting,djw8605/condor,bbockelm/condor-network-accounting,djw8605/htcondor,bbockelm/condor-network-accounting,htcondor/htcondor,clalancette/condor-dcloud,djw8605/condor,mambelli/osg-bosco-marco,clalancette/condor-dcloud,zhangzhehust/htcondor,zhangzhehust/htcondor,mambelli/osg-bosco-marco,zhangzhehust/htcondor,mambelli/osg-bosco-marco
950cd3117ba5a838c2ccc29c3deed419f591ec52
// // ProfileViewController.h // PlayPlan // // Created by Zeacone on 15/11/8. // Copyright © 2015年 Zeacone. All rights reserved. // #import <UIKit/UIKit.h> #import "PlayPlan.h" @class ProfileViewController; @protocol MainDelegate <NSObject> - (void)dismissViewController:(ProfileViewController *)mainViewController; @end @interface ProfileViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> @end
// // ProfileViewController.h // PlayPlan // // Created by Zeacone on 15/11/8. // Copyright © 2015年 Zeacone. All rights reserved. // #import <UIKit/UIKit.h> #import "PlayPlan.h" @class ProfileViewController; @protocol MainDelegate <NSObject> - (void)dismissViewController:(MainViewController *)mainViewController; @end @interface ProfileViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> @end
--- +++ @@ -13,7 +13,7 @@ @protocol MainDelegate <NSObject> -- (void)dismissViewController:(MainViewController *)mainViewController; +- (void)dismissViewController:(ProfileViewController *)mainViewController; @end
Add delegate for profile view controller.
mit
Zeacone/PlayPlan,Zeacone/PlayPlan
df538417a40cde965fa2d16ceab38322b17a8097
// // HATransparentView.h // HATransparentView // // Created by Heberti Almeida on 13/09/13. // Copyright (c) 2013 Heberti Almeida. All rights reserved. // #import <UIKit/UIKit.h> @interface HATransparentView : UIView - (void)open; - (void)close; @end
// // HATransparentView.h // HATransparentView // // Created by Heberti Almeida on 13/09/13. // Copyright (c) 2013 Heberti Almeida. All rights reserved. // #import <UIKit/UIKit.h> @interface HATransparentView : UIView @property (strong, nonatomic) UIColor *color; @property (nonatomic) CGFloat *alpha; - (void)open; - (void)close; @end
--- +++ @@ -10,9 +10,6 @@ @interface HATransparentView : UIView -@property (strong, nonatomic) UIColor *color; -@property (nonatomic) CGFloat *alpha; - - (void)open; - (void)close;
Fix disabled interaction on device
mit
ernestopino/HATransparentView,hebertialmeida/HATransparentView,amannayak0007/HATransparentView
ac62d9b1e647fa02437ea49336460e32988138b0
#ifndef GrGLConfig_chrome_DEFINED #define GrGLConfig_chrome_DEFINED #define GR_SUPPORT_GLES2 1 // gl2ext.h will define these extensions macros but Chrome doesn't provide // prototypes. #define GL_OES_mapbuffer 0 #define GL_IMG_multisampled_render_to_texture 0 #include <GLES2/gl2.h> #include <GLES2/gl2ext.h> #define GR_GL_FUNC #define GR_GL_PROC_ADDRESS(X) &X // chrome always assumes BGRA #define GR_GL_32BPP_COLOR_FORMAT GR_BGRA // glGetError() forces a sync with gpu process on chrome #define GR_GL_CHECK_ERROR_START 0 // Using the static vb precludes batching rect-to-rect draws // because there are matrix changes between each one. // Chrome was getting top performance on Windows with // batched rect-to-rect draws. But there seems to be some // regression that now causes any dynamic VB data to perform // very poorly. In any event the static VB seems to get equal // perf to what batching was producing and it always seems to // be better on Linux. #define GR_STATIC_RECT_VB 1 #endif
#ifndef GrGLConfig_chrome_DEFINED #define GrGLConfig_chrome_DEFINED #define GR_SUPPORT_GLES2 1 // gl2ext.h will define these extensions macros but Chrome doesn't provide // prototypes. #define GL_OES_mapbuffer 0 #define GL_IMG_multisampled_render_to_texture 0 #include <GLES2/gl2.h> #include <GLES2/gl2ext.h> #define GR_GL_FUNC #define GR_GL_PROC_ADDRESS(X) &X // chrome always assumes BGRA #define GR_GL_32BPP_COLOR_FORMAT GR_BGRA // glGetError() forces a sync with gpu process on chrome #define GR_GL_CHECK_ERROR_START 0 #endif
--- +++ @@ -21,4 +21,14 @@ // glGetError() forces a sync with gpu process on chrome #define GR_GL_CHECK_ERROR_START 0 +// Using the static vb precludes batching rect-to-rect draws +// because there are matrix changes between each one. +// Chrome was getting top performance on Windows with +// batched rect-to-rect draws. But there seems to be some +// regression that now causes any dynamic VB data to perform +// very poorly. In any event the static VB seems to get equal +// perf to what batching was producing and it always seems to +// be better on Linux. +#define GR_STATIC_RECT_VB 1 + #endif
Make chrome use the static square vb when drawing rects. Review URL: http://codereview.appspot.com/4280053/
bsd-3-clause
csulmone/skia,csulmone/skia,csulmone/skia,csulmone/skia
c5949064707026e60dd7f370870fd76be5f2c78a
#ifndef __MACROS_H__ #define __MACROS_H__ /** * @file macros.h * * This file contains simple helper macros */ /** * @addtogroup internal_util_helper_macros "(internal) helper macros" * * This group contains helper macros for internal use only. * * @{ */ /** * Computes the maximum value of the two passed values * * @note Provides compile-time type checking by using temp variables before * doing the comparison. * * @note Opens own scope, so the temp variables do not show up outside of the * macro. */ #define MAX(x,y) \ ((__typeof__(x)) x > (__typeof__(x)) y ? \ (__typeof__(x)) x : (__typeof__(x)) y) /** * Computes the minimum value of the two passed values * * @note Provides compile-time type checking by using temp variables before * doing the comparison. * * @note Opens own scope, so the temp variables do not show up outside of the * macro. */ #define MIN(x,y) \ ({ __typeof__ (x) _x = (x); \ __typeof__ (y) _y = (y); \ _x < _y ? _x : _y; }) /** @} */ #endif //__MACROS_H__
#ifndef __MACROS_H__ #define __MACROS_H__ /** * @file macros.h * * This file contains simple helper macros */ /** * @addtogroup internal_util_helper_macros "(internal) helper macros" * * This group contains helper macros for internal use only. * * @{ */ /** * Computes the maximum value of the two passed values * * @note Provides compile-time type checking by using temp variables before * doing the comparison. * * @note Opens own scope, so the temp variables do not show up outside of the * macro. */ #define MAX(x,y) \ ({ __typeof__ (x) _x = (x); \ __typeof__ (y) _y = (y); \ _x > _y ? _x : _y; }) /** * Computes the minimum value of the two passed values * * @note Provides compile-time type checking by using temp variables before * doing the comparison. * * @note Opens own scope, so the temp variables do not show up outside of the * macro. */ #define MIN(x,y) \ ({ __typeof__ (x) _x = (x); \ __typeof__ (y) _y = (y); \ _x < _y ? _x : _y; }) /** @} */ #endif //__MACROS_H__
--- +++ @@ -24,10 +24,9 @@ * @note Opens own scope, so the temp variables do not show up outside of the * macro. */ -#define MAX(x,y) \ - ({ __typeof__ (x) _x = (x); \ - __typeof__ (y) _y = (y); \ - _x > _y ? _x : _y; }) +#define MAX(x,y) \ + ((__typeof__(x)) x > (__typeof__(x)) y ? \ + (__typeof__(x)) x : (__typeof__(x)) y) /** * Computes the minimum value of the two passed values
Modify MAX(x,y) to not contain a scope
lgpl-2.1
waysome/libreset,waysome/libreset
0476f5a59b5285fa625089167ef3b373525060b8
#pragma once #include <string> #include "random.h" #include "ray.h" #include "vector.h" namespace amber { namespace lens { template <typename RealType> struct Lens { using real_type = RealType; using ray_type = Ray<real_type>; using vector3_type = Vector3<real_type>; static constexpr real_type kFocalLength = 0.050; virtual ~Lens() {} virtual std::string to_string() const = 0; virtual ray_type sample_ray(const vector3_type&, Random&) const = 0; }; } }
#pragma once #include <string> #include "random.h" #include "ray.h" #include "vector.h" namespace amber { namespace lens { template <typename RealType> struct Lens { using real_type = RealType; using ray_type = Ray<real_type>; using vector3_type = Vector3<real_type>; static constexpr real_type kFocalLength = 0.050; virtual ~Lens() {} virtual std::string to_string() const; virtual ray_type sample_ray(const vector3_type&, Random&) const; }; } }
--- +++ @@ -19,8 +19,8 @@ virtual ~Lens() {} - virtual std::string to_string() const; - virtual ray_type sample_ray(const vector3_type&, Random&) const; + virtual std::string to_string() const = 0; + virtual ray_type sample_ray(const vector3_type&, Random&) const = 0; }; }
Fix a trivial bug that causes a compilation error with clang++ -O0
mit
etheriqa/amber
9e4acaef861510974200e2744263409dcecda4b4
// // OctoKit.h // OctoKit // // Created by Piet Brauer on 25/08/15. // Copyright (c) 2015 nerdish by nature. All rights reserved. // #import <Foundation/Foundation.h> //! Project version number for OctoKit. FOUNDATION_EXPORT double OctoKitVersionNumber; //! Project version string for OctoKit. FOUNDATION_EXPORT const unsigned char OctoKitVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import <OctoKit/PublicHeader.h>
// // OctoKit.h // OctoKit // // Created by Piet Brauer on 25/08/15. // Copyright (c) 2015 nerdish by nature. All rights reserved. // #import <UIKit/UIKit.h> //! Project version number for OctoKit. FOUNDATION_EXPORT double OctoKitVersionNumber; //! Project version string for OctoKit. FOUNDATION_EXPORT const unsigned char OctoKitVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import <OctoKit/PublicHeader.h>
--- +++ @@ -6,7 +6,7 @@ // Copyright (c) 2015 nerdish by nature. All rights reserved. // -#import <UIKit/UIKit.h> +#import <Foundation/Foundation.h> //! Project version number for OctoKit. FOUNDATION_EXPORT double OctoKitVersionNumber;
Use Foundation instead of UIKit
mit
nerdishbynature/octokit.swift,nerdishbynature/octokit.swift,nerdishbynature/octokit.swift,phatblat/octokit.swift,phatblat/octokit.swift
11fb3304ba88fa84e2349c08f73b4ffaf0a8fd89
#ifdef __CINT__ #pragma link off all globals; #pragma link off all classes; #pragma link off all functions; #pragma link C++ class AliQuarkoniaAcceptance+; #pragma link C++ class AliQuarkoniaEfficiency+; #pragma link C++ class AliAODRecoDecayHF+; #pragma link C++ class AliAODRecoDecayHF2Prong+; #pragma link C++ class AliAODRecoDecayHF3Prong+; #pragma link C++ class AliAODRecoDecayHF4Prong+; #pragma link C++ class AliAnalysisVertexingHF+; #pragma link C++ class AliAnalysisTaskVertexingHF+; #pragma link C++ class AliAODDimuon+; #pragma link C++ class AliAODEventInfo+; #pragma link C++ class AliAnalysisTaskMuonAODfromGeneral+; #pragma link C++ class AliAnalysisTaskSingleMu+; #endif
#ifdef __CINT__ #pragma link off all globals; #pragma link off all classes; #pragma link off all functions; #pragma link C++ class AliQuarkoniaAcceptance+; #pragma link C++ class AliQuarkoniaEfficiency+; #pragma link C++ class AliD0toKpi+; #pragma link C++ class AliD0toKpiAnalysis+; #pragma link C++ class AliBtoJPSItoEle+; #pragma link C++ class AliBtoJPSItoEleAnalysis+; #pragma link C++ class AliAODRecoDecayHF+; #pragma link C++ class AliAODRecoDecayHF2Prong+; #pragma link C++ class AliAODRecoDecayHF3Prong+; #pragma link C++ class AliAODRecoDecayHF4Prong+; #pragma link C++ class AliAnalysisVertexingHF+; #pragma link C++ class AliAnalysisTaskVertexingHF+; #pragma link C++ class AliAODDimuon+; #pragma link C++ class AliAODEventInfo+; #pragma link C++ class AliAnalysisTaskMuonAODfromGeneral+; #pragma link C++ class AliAnalysisTaskSingleMu+; #endif
--- +++ @@ -6,11 +6,6 @@ #pragma link C++ class AliQuarkoniaAcceptance+; #pragma link C++ class AliQuarkoniaEfficiency+; - -#pragma link C++ class AliD0toKpi+; -#pragma link C++ class AliD0toKpiAnalysis+; -#pragma link C++ class AliBtoJPSItoEle+; -#pragma link C++ class AliBtoJPSItoEleAnalysis+; #pragma link C++ class AliAODRecoDecayHF+; #pragma link C++ class AliAODRecoDecayHF2Prong+;
Move AliD0toKpi* and AliBtoJPSI* from libPWG3base to libPWG3 (Andrea)
bsd-3-clause
mkrzewic/AliRoot,alisw/AliRoot,ecalvovi/AliRoot,shahor02/AliRoot,ecalvovi/AliRoot,jgrosseo/AliRoot,coppedis/AliRoot,sebaleh/AliRoot,jgrosseo/AliRoot,ALICEHLT/AliRoot,mkrzewic/AliRoot,sebaleh/AliRoot,coppedis/AliRoot,alisw/AliRoot,sebaleh/AliRoot,jgrosseo/AliRoot,shahor02/AliRoot,miranov25/AliRoot,alisw/AliRoot,jgrosseo/AliRoot,sebaleh/AliRoot,ecalvovi/AliRoot,jgrosseo/AliRoot,shahor02/AliRoot,jgrosseo/AliRoot,coppedis/AliRoot,miranov25/AliRoot,jgrosseo/AliRoot,ALICEHLT/AliRoot,ecalvovi/AliRoot,ecalvovi/AliRoot,mkrzewic/AliRoot,alisw/AliRoot,ecalvovi/AliRoot,coppedis/AliRoot,miranov25/AliRoot,alisw/AliRoot,ALICEHLT/AliRoot,mkrzewic/AliRoot,miranov25/AliRoot,ALICEHLT/AliRoot,mkrzewic/AliRoot,miranov25/AliRoot,miranov25/AliRoot,coppedis/AliRoot,mkrzewic/AliRoot,coppedis/AliRoot,shahor02/AliRoot,miranov25/AliRoot,ecalvovi/AliRoot,shahor02/AliRoot,sebaleh/AliRoot,alisw/AliRoot,alisw/AliRoot,shahor02/AliRoot,miranov25/AliRoot,shahor02/AliRoot,ALICEHLT/AliRoot,ALICEHLT/AliRoot,coppedis/AliRoot,alisw/AliRoot,coppedis/AliRoot,sebaleh/AliRoot,mkrzewic/AliRoot,sebaleh/AliRoot,ALICEHLT/AliRoot
7bfdc0e00b77c05fe0de79da3eaa6b0009418926
// // NSURL+Pinmark.h // Pinmark // // Created by Kyle Stevens on 12/24/13. // Copyright (c) 2013 kilovolt42. All rights reserved. // #import <Foundation/Foundation.h> @interface NSURL (Pinmark) /** * Creates a dictionary of the query parameters in which fields are keys for the corresponding values. * Does not support array parameters at this time. * * @return A dictionary of query parameters. */ - (NSDictionary *)queryParameters; @end
// // NSURL+Pinmark.h // Pinmark // // Created by Kyle Stevens on 12/24/13. // Copyright (c) 2013 kilovolt42. All rights reserved. // #import <Foundation/Foundation.h> @interface NSURL (Pinmark) - (NSDictionary *)queryParameters; @end
--- +++ @@ -10,6 +10,12 @@ @interface NSURL (Pinmark) +/** + * Creates a dictionary of the query parameters in which fields are keys for the corresponding values. + * Does not support array parameters at this time. + * + * @return A dictionary of query parameters. + */ - (NSDictionary *)queryParameters; @end
Add documentation for NSURL category
mit
kilovolt42/Pinmarker,kilovolt42/Pinmarker,kilovolt42/Pinmarker
d484ae979059e596c9fb1d4fb02008f86b0e1bd6
#ifndef RESTRICTMACRO_H_ #define RESTRICTMACRO_H_ #ifdef COBRA_RESTRICT #define COBRA_RESTRICT_BREAK \ break; \ #define COBRA_RESTRICT_EXCEED_N_BREAK( EXP, NUM ) \ if (EXP > NUM) \ break; \ #define COBRA_RESTRICT_EXCEED_N_RETURN_FALSE( EXP, NUM ) \ if ( EXP > NUM ) \ return false; \ #else #define COBRA_RESTRICT_BREAK #define COBRA_RESTRICT_EXCEED_N_BREAK( EXP, NUM ) #define COBRA_RESTRICT_EXCEED_N_RETURN_FALSE( EXP, NUM ) #endif #endif /*RESTRICTMACRO_H_*/
#ifndef RESTRICTMACRO_H_ #define RESTRICTMACRO_H_ #ifdef COBRA_RESTRICT #define COBRA_RESTRICT_BREAK \ break; \ #define COBRA_RESTRICT_EXCEED_N_BREAK( EXP, NUM ) \ if (EXP > NUM) \ break; \ #define COBRA_RESTRICT_EXCEED_N_RETURN_FALSE( EXP, NUM ) \ if ( EXP > NUM ) \ return false; \ #else #define COBRA_RESTRICT_BREAK #define COBRA_RESTRICT_N_BREAK( EXP, NUM ) #define COBRA_RESTRICT_N_RETURN_FALSE( EXP, NUM ) #endif #endif /*RESTRICTMACRO_H_*/
--- +++ @@ -17,8 +17,8 @@ #else #define COBRA_RESTRICT_BREAK -#define COBRA_RESTRICT_N_BREAK( EXP, NUM ) -#define COBRA_RESTRICT_N_RETURN_FALSE( EXP, NUM ) +#define COBRA_RESTRICT_EXCEED_N_BREAK( EXP, NUM ) +#define COBRA_RESTRICT_EXCEED_N_RETURN_FALSE( EXP, NUM ) #endif
Fix compilation error of RestrictionMacro.h in sf1 if COBRA_RESTRICT is not defined.
apache-2.0
izenecloud/izenelib,izenecloud/izenelib,pombredanne/izenelib,pombredanne/izenelib,izenecloud/izenelib,izenecloud/izenelib,pombredanne/izenelib,pombredanne/izenelib
6bf6d60fb44205bab201688d949e3937ee8dbd26
#ifndef CPR_TYPES_H #define CPR_TYPES_H #include <map> #include <string> namespace cpr { class CaseInsenstiveCompare { public: bool operator()(const std::string& a, const std::string& b) const; private: static void char_to_lower(char& c); static std::string to_lower(const std::string& a); }; using Header = std::map<std::string, std::string, CaseInsenstiveCompare>; using Url = std::string; } #endif
#ifndef CPR_TYPES_H #define CPR_TYPES_H #include <map> #include <string> namespace cpr { class CaseInsenstiveCompare { public: bool operator()(const std::string& a, const std::string& b) const; private: static void char_to_lower(char& c); static std::string to_lower(const std::string& a); }; typedef std::map<std::string, std::string, CaseInsenstiveCompare> Header; typedef std::string Url; } #endif
--- +++ @@ -15,8 +15,8 @@ static std::string to_lower(const std::string& a); }; - typedef std::map<std::string, std::string, CaseInsenstiveCompare> Header; - typedef std::string Url; + using Header = std::map<std::string, std::string, CaseInsenstiveCompare>; + using Url = std::string; }
Use C++11 `using` instead of `typedef`
mit
skystrife/cpr,msuvajac/cpr,SuperV1234/cpr,SuperV1234/cpr,skystrife/cpr,msuvajac/cpr,whoshuu/cpr,whoshuu/cpr,msuvajac/cpr,skystrife/cpr,SuperV1234/cpr,whoshuu/cpr
062bc13039462e6f3f9baaea835ff9b863a18daf
#ifndef TE_OBSERVER_H #define TE_OBSERVER_H #include <vector> #include <memory> #include <cassert> namespace te { template <class EventType> class Observer { public: virtual ~Observer() {} virtual void onNotify(const EventType& evt) = 0; }; template <class EventType> class Notifier { public: virtual ~Notifier() {} void addObserver(std::shared_ptr<Observer<EventType>> newObserver) { assert(newObserver); if (std::find(mObservers.begin(), mObservers.end(), newObserver) == mObservers.end()) { mObservers.push_back(newObserver); } } protected: void notify(const EventType& evt) { std::for_each(std::begin(mObservers), std::end(mObservers), [&evt](std::shared_ptr<Observer<EventType>>& pObserver) { pObserver->onNotify(evt); }); } private: std::vector<std::shared_ptr<Observer<EventType>>> mObservers; }; } #endif
#ifndef TE_OBSERVER_H #define TE_OBSERVER_H namespace te { template <class EventType> class Observer { public: virtual ~Observer() {} virtual void onNotify(const EventType& evt) = 0; }; } #endif
--- +++ @@ -1,5 +1,9 @@ #ifndef TE_OBSERVER_H #define TE_OBSERVER_H + +#include <vector> +#include <memory> +#include <cassert> namespace te { @@ -10,6 +14,29 @@ virtual ~Observer() {} virtual void onNotify(const EventType& evt) = 0; }; + + template <class EventType> + class Notifier + { + public: + virtual ~Notifier() {} + void addObserver(std::shared_ptr<Observer<EventType>> newObserver) + { + assert(newObserver); + if (std::find(mObservers.begin(), mObservers.end(), newObserver) == mObservers.end()) { + mObservers.push_back(newObserver); + } + } + protected: + void notify(const EventType& evt) + { + std::for_each(std::begin(mObservers), std::end(mObservers), [&evt](std::shared_ptr<Observer<EventType>>& pObserver) { + pObserver->onNotify(evt); + }); + } + private: + std::vector<std::shared_ptr<Observer<EventType>>> mObservers; + }; } #endif
Add Notifier base class, complements Observer
mit
evinstk/TantechEngine,evinstk/TantechEngine,evinstk/TantechEngine,evinstk/TantechEngine,evinstk/TantechEngine,evinstk/TantechEngine
60ea97b28f20e5a191cdae6ff1bde978cdcad85e
//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; }
//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; }
--- +++ @@ -9,6 +9,22 @@ x = 0; } - assert(x<2); + 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
mit
goblint/analyzer,goblint/analyzer,goblint/analyzer,goblint/analyzer,goblint/analyzer
adebbe22c28891ccc25941d7679a9641972a7a25
/* The Halfling Project - A Graphics Engine and Projects * * The Halfling Project is the legal property of Adrian Astley * Copyright Adrian Astley 2013 */ #ifndef CRATE_DEMO_GRAPHICS_MANAGER_H #define CRATE_DEMO_GRAPHICS_MANAGER_H #include "common/graphics_manager_base.h" #include <d3d11.h> #include "DirectXMath.h" namespace CrateDemo { class GameStateManager; struct Vertex { DirectX::XMFLOAT3 pos; DirectX::XMFLOAT4 color; }; class GraphicsManager : public Common::GraphicsManagerBase { public: GraphicsManager(GameStateManager *gameStateManager); private: GameStateManager *m_gameStateManager; ID3D11RenderTargetView *m_renderTargetView; public: bool Initialize(int clientWidth, int clientHeight, HWND hwnd); void Shutdown(); void DrawFrame(); void OnResize(int newClientWidth, int newClientHeight); void GamePaused(); void GameUnpaused(); }; } // End of namespace CrateDemo #endif
/* The Halfling Project - A Graphics Engine and Projects * * The Halfling Project is the legal property of Adrian Astley * Copyright Adrian Astley 2013 */ #ifndef CRATE_DEMO_GRAPHICS_MANAGER_H #define CRATE_DEMO_GRAPHICS_MANAGER_H #include "common/graphics_manager_base.h" #include <d3d11.h> namespace CrateDemo { class GameStateManager; class GraphicsManager : public Common::GraphicsManagerBase { public: GraphicsManager(GameStateManager *gameStateManager); private: GameStateManager *m_gameStateManager; ID3D11RenderTargetView *m_renderTargetView; public: bool Initialize(int clientWidth, int clientHeight, HWND hwnd); void Shutdown(); void DrawFrame(); void OnResize(int newClientWidth, int newClientHeight); void GamePaused(); void GameUnpaused(); }; } // End of namespace CrateDemo #endif
--- +++ @@ -10,10 +10,17 @@ #include "common/graphics_manager_base.h" #include <d3d11.h> +#include "DirectXMath.h" namespace CrateDemo { class GameStateManager; + +struct Vertex { + DirectX::XMFLOAT3 pos; + DirectX::XMFLOAT4 color; +}; + class GraphicsManager : public Common::GraphicsManagerBase { public: GraphicsManager(GameStateManager *gameStateManager);
CRATE_DEMO: Create Vertex struct to hold vertex info
apache-2.0
RichieSams/thehalflingproject,RichieSams/thehalflingproject,RichieSams/thehalflingproject
69da97a9d0b256a4d9448bfa5f9569ac38156c1f
#pragma once #define NTDDI_VERSION 0x0A000007 // NTDDI_WIN10_19H1 #define _WIN32_WINNT 0x0A00 // _WIN32_WINNT_WIN10 #define WINVER 0x0A00 #include <ShellScalingApi.h> #include <Shlobj.h> #include <ShObjIdl.h> #include <Windows.h> #include <wrl.h> #undef min #undef max #include <algorithm> #include <unordered_map> namespace WRL { using namespace Microsoft::WRL; } #if _DEBUG #define Assert(x) do { if (!(x)) __debugbreak(); } while (false, false) #else #define Assert(x) do { if (false, false) (void)(x); } while (false, false) #endif
#pragma once #define NTDDI_VERSION 0x06010000 #define WINVER 0x0601 #define _WIN32_WINNT 0x0601 #include <ShellScalingApi.h> #include <Shlobj.h> #include <ShObjIdl.h> #include <Windows.h> #include <wrl.h> #undef min #undef max #include <algorithm> #include <unordered_map> namespace WRL { using namespace Microsoft::WRL; } #if _DEBUG #define Assert(x) do { if (!(x)) __debugbreak(); } while (false, false) #else #define Assert(x) do { if (false, false) (void)(x); } while (false, false) #endif
--- +++ @@ -1,8 +1,8 @@ #pragma once -#define NTDDI_VERSION 0x06010000 -#define WINVER 0x0601 -#define _WIN32_WINNT 0x0601 +#define NTDDI_VERSION 0x0A000007 // NTDDI_WIN10_19H1 +#define _WIN32_WINNT 0x0A00 // _WIN32_WINNT_WIN10 +#define WINVER 0x0A00 #include <ShellScalingApi.h> #include <Shlobj.h>
Drop support for Windows 7.
mit
TautvydasZilys/FileSystemSearch,TautvydasZilys/FileSystemSearch,TautvydasZilys/FileSystemSearch
352fd8a38a7ca9bed62801969d9e0188f6b7e3ad
#ifndef TEST_INTEROP_CXX_CLASS_INPUTS_ACCESS_SPECIFIERS_H #define TEST_INTEROP_CXX_CLASS_INPUTS_ACCESS_SPECIFIERS_H class PublicPrivate { public: int PublicMemberVar; static int PublicStaticMemberVar; void publicMemberFunc(); typedef int PublicTypedef; struct PublicStruct {}; enum PublicEnum { PublicEnumValue1 }; enum { PublicAnonymousEnumValue }; enum PublicClosedEnum { PublicClosedEnumValue1 } __attribute__((enum_extensibility(closed))); enum PublicOpenEnum { PublicOpenEnumValue1 } __attribute__((enum_extensibility(open))); enum PublicFlagEnum {} __attribute__((flag_enum)); private: int PrivateMemberVar; static int PrivateStaticMemberVar; void privateMemberFunc() {} typedef int PrivateTypedef; struct PrivateStruct {}; enum PrivateEnum { PrivateEnumValue1 }; enum { PrivateAnonymousEnumValue1 }; enum PrivateClosedEnum { PrivateClosedEnumValue1 } __attribute__((enum_extensibility(closed))); enum PrivateOpenEnum { PrivateOpenEnumValue1 } __attribute__((enum_extensibility(open))); enum PrivateFlagEnum {} __attribute__((flag_enum)); }; #endif
class PublicPrivate { public: int PublicMemberVar; static int PublicStaticMemberVar; void publicMemberFunc(); typedef int PublicTypedef; struct PublicStruct {}; enum PublicEnum { PublicEnumValue1 }; enum { PublicAnonymousEnumValue }; enum PublicClosedEnum { PublicClosedEnumValue1 } __attribute__((enum_extensibility(closed))); enum PublicOpenEnum { PublicOpenEnumValue1 } __attribute__((enum_extensibility(open))); enum PublicFlagEnum {} __attribute__((flag_enum)); private: int PrivateMemberVar; static int PrivateStaticMemberVar; void privateMemberFunc() {} typedef int PrivateTypedef; struct PrivateStruct {}; enum PrivateEnum { PrivateEnumValue1 }; enum { PrivateAnonymousEnumValue1 }; enum PrivateClosedEnum { PrivateClosedEnumValue1 } __attribute__((enum_extensibility(closed))); enum PrivateOpenEnum { PrivateOpenEnumValue1 } __attribute__((enum_extensibility(open))); enum PrivateFlagEnum {} __attribute__((flag_enum)); };
--- +++ @@ -1,3 +1,6 @@ +#ifndef TEST_INTEROP_CXX_CLASS_INPUTS_ACCESS_SPECIFIERS_H +#define TEST_INTEROP_CXX_CLASS_INPUTS_ACCESS_SPECIFIERS_H + class PublicPrivate { public: int PublicMemberVar; @@ -33,3 +36,5 @@ } __attribute__((enum_extensibility(open))); enum PrivateFlagEnum {} __attribute__((flag_enum)); }; + +#endif
Add header guards for test input headers
apache-2.0
harlanhaskins/swift,roambotics/swift,harlanhaskins/swift,gregomni/swift,JGiola/swift,stephentyrone/swift,allevato/swift,CodaFi/swift,rudkx/swift,gregomni/swift,JGiola/swift,jmgc/swift,apple/swift,jmgc/swift,rudkx/swift,atrick/swift,hooman/swift,tkremenek/swift,jckarter/swift,nathawes/swift,harlanhaskins/swift,roambotics/swift,harlanhaskins/swift,allevato/swift,aschwaighofer/swift,JGiola/swift,harlanhaskins/swift,stephentyrone/swift,CodaFi/swift,atrick/swift,xwu/swift,CodaFi/swift,rudkx/swift,ahoppen/swift,atrick/swift,nathawes/swift,stephentyrone/swift,roambotics/swift,benlangmuir/swift,allevato/swift,apple/swift,jmgc/swift,jckarter/swift,jckarter/swift,hooman/swift,xwu/swift,parkera/swift,CodaFi/swift,stephentyrone/swift,nathawes/swift,CodaFi/swift,allevato/swift,jckarter/swift,ahoppen/swift,glessard/swift,xwu/swift,parkera/swift,roambotics/swift,jckarter/swift,JGiola/swift,parkera/swift,rudkx/swift,stephentyrone/swift,aschwaighofer/swift,parkera/swift,atrick/swift,apple/swift,airspeedswift/swift,airspeedswift/swift,stephentyrone/swift,apple/swift,aschwaighofer/swift,jmgc/swift,hooman/swift,allevato/swift,apple/swift,jmgc/swift,parkera/swift,glessard/swift,aschwaighofer/swift,stephentyrone/swift,ahoppen/swift,jmgc/swift,tkremenek/swift,atrick/swift,airspeedswift/swift,airspeedswift/swift,allevato/swift,airspeedswift/swift,parkera/swift,tkremenek/swift,gregomni/swift,rudkx/swift,gregomni/swift,aschwaighofer/swift,atrick/swift,ahoppen/swift,harlanhaskins/swift,parkera/swift,benlangmuir/swift,hooman/swift,nathawes/swift,benlangmuir/swift,tkremenek/swift,xwu/swift,aschwaighofer/swift,jmgc/swift,tkremenek/swift,roambotics/swift,hooman/swift,harlanhaskins/swift,JGiola/swift,gregomni/swift,ahoppen/swift,xwu/swift,nathawes/swift,tkremenek/swift,hooman/swift,benlangmuir/swift,allevato/swift,JGiola/swift,jckarter/swift,gregomni/swift,parkera/swift,glessard/swift,aschwaighofer/swift,rudkx/swift,apple/swift,xwu/swift,xwu/swift,CodaFi/swift,airspeedswift/swift,glessard/swift,nathawes/swift,hooman/swift,nathawes/swift,glessard/swift,ahoppen/swift,benlangmuir/swift,benlangmuir/swift,tkremenek/swift,glessard/swift,airspeedswift/swift,roambotics/swift,CodaFi/swift,jckarter/swift
6c9ccbc59bb5d98785b5e45acd139704241ecebb
/* headers */ #include <stdlib.h> #include <time.h> #include "lattice.h" #include "clusters.h" #include "io_helpers.h" /* main body function */ int main(int argc, char ** argv) { int L; /* square lattice size */ double p; /* occupation probability of each lattice site */ int *lattice; /* lattice array */ unsigned int random_seed; /* random number generator seed */ /* read input arguments; if none provided fallback to default values */ if (argc == 3 || argc == 4) { L = atoi(argv[1]); p = atof(argv[2]); if (argc == 4) { random_seed = atoi(argv[3]); } else { random_seed = (unsigned int)time(NULL); } } else { L = 10; p = 0.4; random_seed = (unsigned int)time(NULL); } /* initialize random number generator seed */ srand(random_seed); /* allocate lattice */ lattice = allocate_lattice(L, L); /* populate lattice with given probability */ populate_lattice(p, lattice, L, L); /* print the generated lattice for visualization */ print_lattice(lattice, L, L, 1); /* label clusters and print result */ label_clusters(lattice, L, L); print_lattice(lattice, L, L, 1); /* free memory before leaving */ free(lattice); return 0; }
/* headers */ #include <stdlib.h> #include <time.h> #include "lattice.h" #include "clusters.h" #include "io_helpers.h" /* main body function */ int main(int argc, char ** argv) { int L; /* square lattice size */ double p; /* occupation probability of each lattice site */ int *lattice; /* lattice array */ /* read input arguments; if none provided fallback to default values */ if (argc == 3) { L = atoi(argv[1]); p = atof(argv[2]); } else { L = 10; p = 0.4; } /* initialize random number generator seed */ srand(time(NULL)); /* allocate lattice */ lattice = allocate_lattice(L, L); /* populate lattice with given probability */ populate_lattice(p, lattice, L, L); /* print the generated lattice for visualization */ print_lattice(lattice, L, L, 1); /* label clusters and print result */ label_clusters(lattice, L, L); print_lattice(lattice, L, L, 1); /* free memory before leaving */ free(lattice); return 0; }
--- +++ @@ -12,18 +12,25 @@ int L; /* square lattice size */ double p; /* occupation probability of each lattice site */ int *lattice; /* lattice array */ + unsigned int random_seed; /* random number generator seed */ /* read input arguments; if none provided fallback to default values */ - if (argc == 3) { + if (argc == 3 || argc == 4) { L = atoi(argv[1]); p = atof(argv[2]); + if (argc == 4) { + random_seed = atoi(argv[3]); + } else { + random_seed = (unsigned int)time(NULL); + } } else { L = 10; p = 0.4; + random_seed = (unsigned int)time(NULL); } /* initialize random number generator seed */ - srand(time(NULL)); + srand(random_seed); /* allocate lattice */ lattice = allocate_lattice(L, L);
[percolation] Allow passing RNG seed as program argument
mit
cerisola/fiscomp,cerisola/fiscomp,cerisola/fiscomp
8c47da315e5e6f11bb43c8fa66a2a66fbdaf7b9d
// 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 CHROME_GPU_GPU_CONFIG_H_ #define CHROME_GPU_GPU_CONFIG_H_ // This file declares common preprocessor configuration for the GPU process. #include "build/build_config.h" #if defined(OS_LINUX) && defined(ARCH_CPU_X86) // Only define GLX support for Intel CPUs for now until we can get the // proper dependencies and build setup for ARM. #define GPU_USE_GLX #endif #endif // CHROME_GPU_GPU_CONFIG_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 CHROME_GPU_GPU_CONFIG_H_ #define CHROME_GPU_GPU_CONFIG_H_ // This file declares common preprocessor configuration for the GPU process. #include "build/build_config.h" #if defined(OS_LINUX) && !defined(ARCH_CPU_X86) // Only define GLX support for Intel CPUs for now until we can get the // proper dependencies and build setup for ARM. #define GPU_USE_GLX #endif #endif // CHROME_GPU_GPU_CONFIG_H_
--- +++ @@ -9,7 +9,7 @@ #include "build/build_config.h" -#if defined(OS_LINUX) && !defined(ARCH_CPU_X86) +#if defined(OS_LINUX) && defined(ARCH_CPU_X86) // Only define GLX support for Intel CPUs for now until we can get the // proper dependencies and build setup for ARM.
Fix stupid error for Linux build. TEST=none BUG=none Review URL: http://codereview.chromium.org/555096 git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@37093 0039d316-1c4b-4281-b951-d872f2087c98
bsd-3-clause
ropik/chromium,adobe/chromium,yitian134/chromium,yitian134/chromium,ropik/chromium,Crystalnix/house-of-life-chromium,Crystalnix/house-of-life-chromium,adobe/chromium,gavinp/chromium,yitian134/chromium,Crystalnix/house-of-life-chromium,gavinp/chromium,adobe/chromium,adobe/chromium,yitian134/chromium,gavinp/chromium,Crystalnix/house-of-life-chromium,ropik/chromium,gavinp/chromium,Crystalnix/house-of-life-chromium,adobe/chromium,gavinp/chromium,Crystalnix/house-of-life-chromium,yitian134/chromium,gavinp/chromium,adobe/chromium,Crystalnix/house-of-life-chromium,gavinp/chromium,ropik/chromium,Crystalnix/house-of-life-chromium,ropik/chromium,Crystalnix/house-of-life-chromium,adobe/chromium,gavinp/chromium,ropik/chromium,ropik/chromium,yitian134/chromium,yitian134/chromium,Crystalnix/house-of-life-chromium,adobe/chromium,adobe/chromium,yitian134/chromium,ropik/chromium,ropik/chromium,yitian134/chromium,gavinp/chromium,yitian134/chromium,Crystalnix/house-of-life-chromium,adobe/chromium,gavinp/chromium,adobe/chromium
b22391787ec21c5d40e545a59ad5780ea8f03868
// rdar://6533411 // RUN: %clang -MD -MF %t.d -S -x c -o %t.o %s // RUN: grep '.*dependency-gen.*:' %t.d // RUN: grep 'dependency-gen.c' %t.d // RUN: %clang -S -M -x c %s -o %t.d // RUN: grep '.*dependency-gen.*:' %t.d // RUN: grep 'dependency-gen.c' %t.d // PR8974 // XFAIL: win32 // RUN: rm -rf %t.dir // RUN: mkdir -p %t.dir/a/b // RUN: echo > %t.dir/a/b/x.h // RUN: cd %t.dir // RUN: %clang -include a/b/x.h -MD -MF %t.d -S -x c -o %t.o %s // RUN: grep ' a/b/x\.h' %t.d
// rdar://6533411 // RUN: %clang -MD -MF %t.d -S -x c -o %t.o %s // RUN: grep '.*dependency-gen.*:' %t.d // RUN: grep 'dependency-gen.c' %t.d // RUN: %clang -S -M -x c %s -o %t.d // RUN: grep '.*dependency-gen.*:' %t.d // RUN: grep 'dependency-gen.c' %t.d // PR8974 // XFAIL: win32 // RUN: rm -rf %t.dir // RUN: mkdir %t.dir // RUN: echo > %t.dir/x.h // RUN: %clang -include %t.dir/x.h -MD -MF %t.d -S -x c -o %t.o %s // RUN: grep ' %t.dir/x.h' %t.d
--- +++ @@ -10,8 +10,9 @@ // PR8974 // XFAIL: win32 // RUN: rm -rf %t.dir -// RUN: mkdir %t.dir -// RUN: echo > %t.dir/x.h -// RUN: %clang -include %t.dir/x.h -MD -MF %t.d -S -x c -o %t.o %s -// RUN: grep ' %t.dir/x.h' %t.d +// RUN: mkdir -p %t.dir/a/b +// RUN: echo > %t.dir/a/b/x.h +// RUN: cd %t.dir +// RUN: %clang -include a/b/x.h -MD -MF %t.d -S -x c -o %t.o %s +// RUN: grep ' a/b/x\.h' %t.d
Tweak this test a bit further to make it easier on grep. Who knows what characters get dropped into the regular expression from %t. git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@126361 91177308-0d34-0410-b5e6-96231b3b80d8
apache-2.0
apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang
7acf4549932adde2961864023db47ebfde07440d
// Copyright (c) 2016-2019 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_POLICY_RBF_H #define BITCOIN_POLICY_RBF_H #include <txmempool.h> /** The rbf state of unconfirmed transactions */ enum class RBFTransactionState { /** Unconfirmed tx that does not signal rbf and is not in the mempool */ UNKNOWN, /** Either this tx or a mempool ancestor signals rbf */ REPLACEABLE_BIP125, /** Neither this tx nor a mempool ancestor signals rbf */ FINAL, }; /** * Determine whether an unconfirmed transaction is signaling opt-in to RBF * according to BIP 125 * This involves checking sequence numbers of the transaction, as well * as the sequence numbers of all in-mempool ancestors. * * @param tx The unconfirmed transaction * @param pool The mempool, which may contain the tx * * @return The rbf state */ RBFTransactionState IsRBFOptIn(const CTransaction& tx, const CTxMemPool& pool) EXCLUSIVE_LOCKS_REQUIRED(pool.cs); RBFTransactionState IsRBFOptInEmptyMempool(const CTransaction& tx); #endif // BITCOIN_POLICY_RBF_H
// Copyright (c) 2016-2019 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_POLICY_RBF_H #define BITCOIN_POLICY_RBF_H #include <txmempool.h> enum class RBFTransactionState { UNKNOWN, REPLACEABLE_BIP125, FINAL }; // Determine whether an in-mempool transaction is signaling opt-in to RBF // according to BIP 125 // This involves checking sequence numbers of the transaction, as well // as the sequence numbers of all in-mempool ancestors. RBFTransactionState IsRBFOptIn(const CTransaction& tx, const CTxMemPool& pool) EXCLUSIVE_LOCKS_REQUIRED(pool.cs); RBFTransactionState IsRBFOptInEmptyMempool(const CTransaction& tx); #endif // BITCOIN_POLICY_RBF_H
--- +++ @@ -7,16 +7,27 @@ #include <txmempool.h> +/** The rbf state of unconfirmed transactions */ enum class RBFTransactionState { + /** Unconfirmed tx that does not signal rbf and is not in the mempool */ UNKNOWN, + /** Either this tx or a mempool ancestor signals rbf */ REPLACEABLE_BIP125, - FINAL + /** Neither this tx nor a mempool ancestor signals rbf */ + FINAL, }; -// Determine whether an in-mempool transaction is signaling opt-in to RBF -// according to BIP 125 -// This involves checking sequence numbers of the transaction, as well -// as the sequence numbers of all in-mempool ancestors. +/** + * Determine whether an unconfirmed transaction is signaling opt-in to RBF + * according to BIP 125 + * This involves checking sequence numbers of the transaction, as well + * as the sequence numbers of all in-mempool ancestors. + * + * @param tx The unconfirmed transaction + * @param pool The mempool, which may contain the tx + * + * @return The rbf state + */ RBFTransactionState IsRBFOptIn(const CTransaction& tx, const CTxMemPool& pool) EXCLUSIVE_LOCKS_REQUIRED(pool.cs); RBFTransactionState IsRBFOptInEmptyMempool(const CTransaction& tx);
doc: Add doxygen comment to IsRBFOptIn
mit
MarcoFalke/bitcoin,AkioNak/bitcoin,GroestlCoin/GroestlCoin,dscotese/bitcoin,ElementsProject/elements,litecoin-project/litecoin,anditto/bitcoin,jamesob/bitcoin,EthanHeilman/bitcoin,jambolo/bitcoin,ajtowns/bitcoin,pataquets/namecoin-core,tecnovert/particl-core,sstone/bitcoin,domob1812/namecore,mm-s/bitcoin,jlopp/statoshi,AkioNak/bitcoin,EthanHeilman/bitcoin,ElementsProject/elements,namecoin/namecoin-core,ajtowns/bitcoin,achow101/bitcoin,mruddy/bitcoin,bitcoin/bitcoin,qtumproject/qtum,practicalswift/bitcoin,apoelstra/bitcoin,n1bor/bitcoin,mruddy/bitcoin,qtumproject/qtum,MeshCollider/bitcoin,jlopp/statoshi,pataquets/namecoin-core,lateminer/bitcoin,dscotese/bitcoin,ajtowns/bitcoin,yenliangl/bitcoin,AkioNak/bitcoin,prusnak/bitcoin,jamesob/bitcoin,achow101/bitcoin,andreaskern/bitcoin,bitcoinknots/bitcoin,kallewoof/bitcoin,mruddy/bitcoin,fanquake/bitcoin,cdecker/bitcoin,particl/particl-core,jambolo/bitcoin,practicalswift/bitcoin,MeshCollider/bitcoin,rnicoll/dogecoin,cdecker/bitcoin,MarcoFalke/bitcoin,GroestlCoin/bitcoin,namecoin/namecore,dscotese/bitcoin,prusnak/bitcoin,domob1812/namecore,prusnak/bitcoin,mm-s/bitcoin,practicalswift/bitcoin,rnicoll/bitcoin,namecoin/namecore,bitcoinsSG/bitcoin,cdecker/bitcoin,Sjors/bitcoin,ajtowns/bitcoin,GroestlCoin/GroestlCoin,jamesob/bitcoin,jonasschnelli/bitcoin,alecalve/bitcoin,anditto/bitcoin,GroestlCoin/bitcoin,jonasschnelli/bitcoin,pataquets/namecoin-core,bitcoinknots/bitcoin,JeremyRubin/bitcoin,mruddy/bitcoin,particl/particl-core,jlopp/statoshi,bitcoinsSG/bitcoin,anditto/bitcoin,AkioNak/bitcoin,mm-s/bitcoin,jamesob/bitcoin,MarcoFalke/bitcoin,fujicoin/fujicoin,practicalswift/bitcoin,jlopp/statoshi,prusnak/bitcoin,qtumproject/qtum,MeshCollider/bitcoin,pstratem/bitcoin,fanquake/bitcoin,alecalve/bitcoin,anditto/bitcoin,GroestlCoin/bitcoin,namecoin/namecore,apoelstra/bitcoin,litecoin-project/litecoin,particl/particl-core,namecoin/namecore,jonasschnelli/bitcoin,sstone/bitcoin,MarcoFalke/bitcoin,Xekyo/bitcoin,rnicoll/bitcoin,apoelstra/bitcoin,achow101/bitcoin,bitcoin/bitcoin,yenliangl/bitcoin,ElementsProject/elements,cdecker/bitcoin,sstone/bitcoin,pstratem/bitcoin,bitcoinsSG/bitcoin,kallewoof/bitcoin,rnicoll/dogecoin,namecoin/namecoin-core,instagibbs/bitcoin,rnicoll/bitcoin,yenliangl/bitcoin,lateminer/bitcoin,jlopp/statoshi,jambolo/bitcoin,tecnovert/particl-core,instagibbs/bitcoin,n1bor/bitcoin,domob1812/namecore,Xekyo/bitcoin,n1bor/bitcoin,JeremyRubin/bitcoin,pstratem/bitcoin,prusnak/bitcoin,namecoin/namecoin-core,bitcoin/bitcoin,jnewbery/bitcoin,domob1812/namecore,Xekyo/bitcoin,bitcoin/bitcoin,bitcoinknots/bitcoin,instagibbs/bitcoin,sstone/bitcoin,sipsorcery/bitcoin,yenliangl/bitcoin,apoelstra/bitcoin,dscotese/bitcoin,pstratem/bitcoin,achow101/bitcoin,particl/particl-core,kallewoof/bitcoin,anditto/bitcoin,qtumproject/qtum,MeshCollider/bitcoin,EthanHeilman/bitcoin,JeremyRubin/bitcoin,EthanHeilman/bitcoin,domob1812/bitcoin,apoelstra/bitcoin,pataquets/namecoin-core,ElementsProject/elements,particl/particl-core,bitcoinsSG/bitcoin,andreaskern/bitcoin,instagibbs/bitcoin,litecoin-project/litecoin,jnewbery/bitcoin,yenliangl/bitcoin,JeremyRubin/bitcoin,domob1812/bitcoin,lateminer/bitcoin,AkioNak/bitcoin,GroestlCoin/bitcoin,qtumproject/qtum,MarcoFalke/bitcoin,instagibbs/bitcoin,MarcoFalke/bitcoin,sstone/bitcoin,JeremyRubin/bitcoin,litecoin-project/litecoin,ajtowns/bitcoin,andreaskern/bitcoin,kallewoof/bitcoin,domob1812/bitcoin,sipsorcery/bitcoin,cdecker/bitcoin,mruddy/bitcoin,GroestlCoin/bitcoin,namecoin/namecore,pataquets/namecoin-core,jnewbery/bitcoin,n1bor/bitcoin,Xekyo/bitcoin,ElementsProject/elements,jnewbery/bitcoin,bitcoinsSG/bitcoin,kallewoof/bitcoin,jamesob/bitcoin,particl/particl-core,mm-s/bitcoin,andreaskern/bitcoin,jlopp/statoshi,alecalve/bitcoin,pstratem/bitcoin,achow101/bitcoin,litecoin-project/litecoin,domob1812/namecore,Sjors/bitcoin,Sjors/bitcoin,rnicoll/dogecoin,tecnovert/particl-core,apoelstra/bitcoin,cdecker/bitcoin,tecnovert/particl-core,ElementsProject/elements,andreaskern/bitcoin,Sjors/bitcoin,dscotese/bitcoin,achow101/bitcoin,rnicoll/bitcoin,rnicoll/dogecoin,EthanHeilman/bitcoin,lateminer/bitcoin,GroestlCoin/bitcoin,GroestlCoin/GroestlCoin,rnicoll/dogecoin,alecalve/bitcoin,tecnovert/particl-core,lateminer/bitcoin,alecalve/bitcoin,fanquake/bitcoin,AkioNak/bitcoin,litecoin-project/litecoin,pataquets/namecoin-core,n1bor/bitcoin,Xekyo/bitcoin,dscotese/bitcoin,sipsorcery/bitcoin,practicalswift/bitcoin,rnicoll/bitcoin,andreaskern/bitcoin,bitcoinknots/bitcoin,bitcoin/bitcoin,tecnovert/particl-core,jambolo/bitcoin,domob1812/namecore,mm-s/bitcoin,prusnak/bitcoin,Xekyo/bitcoin,sipsorcery/bitcoin,lateminer/bitcoin,qtumproject/qtum,bitcoin/bitcoin,fanquake/bitcoin,fujicoin/fujicoin,fujicoin/fujicoin,fujicoin/fujicoin,sipsorcery/bitcoin,namecoin/namecoin-core,namecoin/namecoin-core,qtumproject/qtum,bitcoinknots/bitcoin,fujicoin/fujicoin,jambolo/bitcoin,jnewbery/bitcoin,practicalswift/bitcoin,n1bor/bitcoin,fanquake/bitcoin,ajtowns/bitcoin,namecoin/namecore,mruddy/bitcoin,GroestlCoin/GroestlCoin,fujicoin/fujicoin,MeshCollider/bitcoin,domob1812/bitcoin,jamesob/bitcoin,GroestlCoin/GroestlCoin,jambolo/bitcoin,Sjors/bitcoin,kallewoof/bitcoin,pstratem/bitcoin,fanquake/bitcoin,EthanHeilman/bitcoin,alecalve/bitcoin,rnicoll/bitcoin,sstone/bitcoin,jonasschnelli/bitcoin,GroestlCoin/GroestlCoin,namecoin/namecoin-core,JeremyRubin/bitcoin,sipsorcery/bitcoin,bitcoinsSG/bitcoin,anditto/bitcoin,mm-s/bitcoin,domob1812/bitcoin,MeshCollider/bitcoin,yenliangl/bitcoin,domob1812/bitcoin,instagibbs/bitcoin,jonasschnelli/bitcoin
fa9ee52556f493e4a896e2570ca1a3102d777d9a
// // MCKNetworkMock.h // mocka // // Created by Markus Gasser on 26.10.2013. // Copyright (c) 2013 konoma GmbH. All rights reserved. // #import <Foundation/Foundation.h> @class MCKNetworkMock; @class MCKNetworkRequestMatcher; @class MCKMockingContext; typedef MCKNetworkRequestMatcher*(^MCKNetworkActivity)(id url); @interface MCKNetworkMock : NSObject #pragma mark - Initialization - (instancetype)initWithMockingContext:(MCKMockingContext *)context; #pragma mark - Network Control @property (nonatomic, readonly, getter = isEnabled) BOOL enabled; - (void)disable; - (void)enable; - (void)startObservingNetworkCalls; #pragma mark - Stubbing and Verification DSL @property (nonatomic, readonly) MCKNetworkActivity GET; @property (nonatomic, readonly) MCKNetworkActivity PUT; @property (nonatomic, readonly) MCKNetworkActivity POST; @property (nonatomic, readonly) MCKNetworkActivity DELETE; @end #define MCKNetwork (id)_mck_getNetworkMock(self, __FILE__, __LINE__) #ifndef MCK_DISABLE_NICE_SYNTAX #define Network MCKNetwork #endif extern MCKNetworkMock* _mck_getNetworkMock(id testCase, const char *fileName, NSUInteger lineNumber);
// // MCKNetworkMock.h // mocka // // Created by Markus Gasser on 26.10.2013. // Copyright (c) 2013 konoma GmbH. All rights reserved. // #import <Foundation/Foundation.h> @class MCKNetworkMock; @class MCKNetworkRequestMatcher; @class MCKMockingContext; typedef MCKNetworkRequestMatcher*(^MCKNetworkActivity)(id url); @interface MCKNetworkMock : NSObject #pragma mark - Initialization - (instancetype)initWithMockingContext:(MCKMockingContext *)context; #pragma mark - Network Control @property (nonatomic, readonly, getter = isEnabled) BOOL enabled; - (void)disable; - (void)enable; - (void)startObservingNetworkCalls; #pragma mark - Stubbing and Verification DSL @property (nonatomic, readonly) MCKNetworkActivity GET; @property (nonatomic, readonly) MCKNetworkActivity PUT; @property (nonatomic, readonly) MCKNetworkActivity POST; @property (nonatomic, readonly) MCKNetworkActivity DELETE; @end #define MCKNetwork _mck_getNetworkMock(self, __FILE__, __LINE__) #ifndef MCK_DISABLE_NICE_SYNTAX #define Network MCKNetwork #endif extern MCKNetworkMock* _mck_getNetworkMock(id testCase, const char *fileName, NSUInteger lineNumber);
--- +++ @@ -42,7 +42,7 @@ @end -#define MCKNetwork _mck_getNetworkMock(self, __FILE__, __LINE__) +#define MCKNetwork (id)_mck_getNetworkMock(self, __FILE__, __LINE__) #ifndef MCK_DISABLE_NICE_SYNTAX #define Network MCKNetwork #endif
Make the network mock play nice with stubCall (…)
mit
frenetisch-applaudierend/mocka,frenetisch-applaudierend/mocka
98b8a0eb22fbc4012f9c9ac0a793a4822822f208
#ifdef HAVE_CONFIG_H #include "config.h" #endif #include <orc/orc.h> #include <stdio.h> int main (int argc, char *argv[]) { long offset; int expected_offset; int error = 0; offset = ((long) ((unsigned char *) &((OrcProgram*) 0)->code_exec)); if (sizeof(void *) == 4) { expected_offset = 8360; } else { expected_offset = 9688; } if (offset != expected_offset) { printf("ABI bug: OrcProgram->code_exec should be at offset %ld instead of %d\n", offset, expected_offset); error = 1; } return error; }
#ifdef HAVE_CONFIG_H #include "config.h" #endif #include <orc/orc.h> #include <stdio.h> int main (int argc, char *argv[]) { int offset; int expected_offset; int error = 0; offset = ((int) ((unsigned char *) &((OrcProgram*) 0)->code_exec)); if (sizeof(void *) == 4) { expected_offset = 8360; } else { expected_offset = 9688; } if (offset != expected_offset) { printf("ABI bug: OrcProgram->code_exec should be at offset %d instead of %d\n", offset, expected_offset); error = 1; } return error; }
--- +++ @@ -10,11 +10,11 @@ int main (int argc, char *argv[]) { - int offset; + long offset; int expected_offset; int error = 0; - offset = ((int) ((unsigned char *) &((OrcProgram*) 0)->code_exec)); + offset = ((long) ((unsigned char *) &((OrcProgram*) 0)->code_exec)); if (sizeof(void *) == 4) { expected_offset = 8360; @@ -23,7 +23,7 @@ } if (offset != expected_offset) { - printf("ABI bug: OrcProgram->code_exec should be at offset %d instead of %d\n", + printf("ABI bug: OrcProgram->code_exec should be at offset %ld instead of %d\n", offset, expected_offset); error = 1; }
tests: Fix compilation of the ABI test on 64 bit architectures Casting a pointer to a plain int will cause a compiler error, use long instead.
bsd-3-clause
MOXfiles/orc,Distrotech/orc,ahmedammar/platform_external_gst_liborc,jpakkane/orc,jpakkane/orc,ahmedammar/platform_external_gst_liborc,MOXfiles/orc,ijsf/OpenWebRTC-orc,okuoku/nmosh-orc,MOXfiles/orc,Distrotech/orc,okuoku/nmosh-orc,mojaves/orc,Distrotech/orc,ijsf/OpenWebRTC-orc,mojaves/orc,ijsf/OpenWebRTC-orc,jpakkane/orc,mojaves/orc,okuoku/nmosh-orc
42150430ce7cbcee73173c7b8302c24f2efbae76
#ifndef MCLISP_ALLOC_H_ #define MCLISP_ALLOC_H_ #include <array> #include <cstddef> #include <list> #include "cons.h" namespace mclisp { class ConsAllocator { public: typedef std::size_t size_type; ConsAllocator(); ConsCell* Allocate(); std::list<ConsCell*> Allocate(size_type n); void Deallocate(ConsCell* p); inline size_type max_size() const { return free_list_.size(); } inline const ConsCell* oob_pointer() const { return &heap_.front() - 1; } static constexpr size_type max_heap_size() { return kMaxHeapSize; } private: static constexpr size_type kMaxHeapSize = 15000; std::list<ConsCell*> free_list_; std::array<ConsCell, kMaxHeapSize> heap_; }; namespace Alloc { void Init(); void Shutdown(); const mclisp::ConsCell* AtomMagic(); mclisp::ConsCell* Allocate(); } // namespace Alloc } // namespace mclisp #endif // MCLISP_ALLOC_H_
#ifndef MCLISP_ALLOC_H_ #define MCLISP_ALLOC_H_ #include <array> #include <cstddef> #include <list> #include "cons.h" namespace mclisp { class ConsAllocator { public: typedef std::size_t size_type; ConsAllocator(); ConsCell* Allocate(); std::list<ConsCell*> Allocate(size_type n); void Deallocate(ConsCell* p); inline size_type max_size() const { return free_list_.size(); } inline const ConsCell* oob_pointer() const { return &heap_.front() - 1; } static constexpr size_type max_heap_size() { return kMaxHeapSize; } private: static constexpr size_type kMaxHeapSize = 1500; std::list<ConsCell*> free_list_; std::array<ConsCell, kMaxHeapSize> heap_; }; namespace Alloc { void Init(); void Shutdown(); const mclisp::ConsCell* AtomMagic(); mclisp::ConsCell* Allocate(); } // namespace Alloc } // namespace mclisp #endif // MCLISP_ALLOC_H_
--- +++ @@ -25,7 +25,7 @@ static constexpr size_type max_heap_size() { return kMaxHeapSize; } private: - static constexpr size_type kMaxHeapSize = 1500; + static constexpr size_type kMaxHeapSize = 15000; std::list<ConsCell*> free_list_; std::array<ConsCell, kMaxHeapSize> heap_;
Increase max heap size to 15,000 ConsCells. Unit tests were running out of heap, due to GC not being implemented yet. Also, 15,000 is the value mentioned by McCarthy in the paper.
mit
appleby/mccarthy-lisp,appleby/mccarthy-lisp,appleby/mccarthy-lisp,appleby/mccarthy-lisp,appleby/mccarthy-lisp
6d0c9b749aad4a1801783d4a170542139792ebdd
#ifndef __MOTORS_H_ #define __MOTORS_H_ #include <Servo.h> #define MIDPOINT 90 class Motors { private: Servo port, vertical, starbord; int port_pin, vertical_pin, starbord_pin; public: Motors(int p_pin, int v_pin, int s_pin); void reset(); void go(int p, int v, int s); void stop(); }; #endif
#ifndef __MOTORS_H_ #define __MOTORS_H_ #include <Servo.h> #define MIDPOINT 128 class Motors { private: Servo port, vertical, starbord; int port_pin, vertical_pin, starbord_pin; public: Motors(int p_pin, int v_pin, int s_pin); void reset(); void go(int p, int v, int s); void stop(); }; #endif
--- +++ @@ -3,7 +3,7 @@ #include <Servo.h> -#define MIDPOINT 128 +#define MIDPOINT 90 class Motors { private:
Set MIDPOINT to 90 instead of 128 (servo lib goes from 0 to 180)
mit
kavi87/openrov-cockpit,chaudhryjunaid/openrov-cockpit,chaudhryjunaid/openrov-cockpit,BrianAdams/openrov-cockpit,OpenROV/openrov-cockpit,kavi87/openrov-cockpit,BenjaminTsai/openrov-cockpit,BenjaminTsai/openrov-cockpit,spiderkeys/openrov-cockpit,BrianAdams/openrov-cockpit,spiderkeys/openrov-cockpit,BrianAdams/openrov-cockpit,BenjaminTsai/openrov-cockpit,spiderkeys/openrov-cockpit,johan--/openrov-cockpit,kavi87/openrov-cockpit,chaudhryjunaid/openrov-cockpit,OpenROV/openrov-cockpit,johan--/openrov-cockpit,BrianAdams/openrov-cockpit,BrianAdams/openrov-cockpit,OpenROV/openrov-cockpit,spiderkeys/openrov-cockpit,kavi87/openrov-cockpit,kavi87/openrov-cockpit,spiderkeys/openrov-cockpit,BenjaminTsai/openrov-cockpit,chaudhryjunaid/openrov-cockpit,johan--/openrov-cockpit,BenjaminTsai/openrov-cockpit,johan--/openrov-cockpit,chaudhryjunaid/openrov-cockpit,johan--/openrov-cockpit
6c02e1f26430e9fdc68f04c974d49b02816b40a5
#ifndef ENTRY_H #define ENTRY_H #include <string> #include <memory> namespace diaryengine { class Entry { public: Entry(); ~Entry(); void setTitle(std::string title); std::string title(); private: struct Implementation; std::unique_ptr<Implementation> _inside; }; } #endif // ENTRY_H
#ifndef ENTRY_H #define ENTRY_H #include <string> #include <memory> namespace diaryengine { class Entry { public: Entry(); ~Entry(); void setTitle(std::string title); std::string title(); private: struct Implementation; std::unique_ptr<Implementation> inside_; }; } #endif // ENTRY_H
--- +++ @@ -16,7 +16,7 @@ private: struct Implementation; - std::unique_ptr<Implementation> inside_; + std::unique_ptr<Implementation> _inside; }; }
Rename the implementation pointer to respect naming convention
bsd-3-clause
Acce0ss/diary-engine
9e8f0fbbc0448faff7072b7f8fd66b031f9abc80
#include <mruby.h> #include <mruby/compile.h> #include <windows.h> #include <stdlib.h> #include <stdlib.h> #ifdef _WIN32 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) #else int main(int argc, char **argv) #endif { mrb_state *mrb; mrbc_context *c; mrb_value v; FILE *fp; fp = fopen("init_minigame.rb", "rb"); if (fp == NULL) { fputs("Couldn't load 'init_minigame.rb'", stderr); return EXIT_FAILURE; } mrb = mrb_open(); if (mrb == NULL) { fputs("Invalid mrb_state, exiting mruby", stderr); return EXIT_FAILURE; } c = mrbc_context_new(mrb); v = mrb_load_file_cxt(mrb, fp, c); fclose(fp); mrbc_context_free(mrb, c); if (mrb->exc && !mrb_undef_p(v)) mrb_print_error(mrb); return EXIT_SUCCESS; }
#include <mruby.h> #include <mruby/compile.h> #include <stdio.h> #include <stdlib.h> int main(int argc, char **argv) { mrb_state *mrb; mrbc_context *c; mrb_value v; FILE *fp; fp = fopen("init_minigame.rb", "rb"); if (fp == NULL) { fputs("Couldn't load 'init_minigame.rb'", stderr); return EXIT_FAILURE; } mrb = mrb_open(); if (mrb == NULL) { fputs("Invalid mrb_state, exiting mruby", stderr); return EXIT_FAILURE; } c = mrbc_context_new(mrb); v = mrb_load_file_cxt(mrb, fp, c); fclose(fp); mrbc_context_free(mrb, c); if (mrb->exc && !mrb_undef_p(v)) mrb_print_error(mrb); return EXIT_SUCCESS; }
--- +++ @@ -1,11 +1,17 @@ #include <mruby.h> #include <mruby/compile.h> -#include <stdio.h> +#include <windows.h> +#include <stdlib.h> #include <stdlib.h> +#ifdef _WIN32 +int WINAPI +WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) +#else int main(int argc, char **argv) +#endif { mrb_state *mrb; mrbc_context *c;
Add WinMain for windows platform
mit
bggd/mruby-minigame,bggd/mruby-minigame
09f760a42b52975948e9c92acb3506295a3e783d
#ifndef OS_COMMON_H_ #define OS_COMMON_H_ #include <stddef.h> #include <fcntl.h> #include <io.h> #include <stdio.h> #include <sys/time.h> /* * MinGW lfind() and friends use `unsigned int *` where they should use a * `size_t *` according to the man page. */ typedef unsigned int lfind_size_t; // timeradd doesn't exist on MinGW #ifndef timeradd #define timeradd timeradd static inline void timeradd(struct timeval *a, struct timeval *b, struct timeval *result) { result->tv_sec = a->tv_sec + b->tv_sec; result->tv_usec = a->tv_usec + b->tv_usec; result->tv_sec += result->tv_usec / 1000000; result->tv_usec %= 1000000; } #endif struct param_state; char *os_find_self(const char *); FILE *os_fopen(const char *, const char *); int os_get_tsimrc_path(char buf[], size_t sz); long os_getpagesize(void); int os_preamble(void); int os_set_buffering(FILE *stream, int mode); #endif /* vi: set ts=4 sw=4 et: */
#ifndef OS_COMMON_H_ #define OS_COMMON_H_ #include <stddef.h> #include <fcntl.h> #include <io.h> #include <stdio.h> /* * MinGW lfind() and friends use `unsigned int *` where they should use a * `size_t *` according to the man page. */ typedef unsigned int lfind_size_t; // timeradd doesn't exist on MinGW #ifndef timeradd #define timeradd(a, b, result) \ do { \ (result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \ (result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \ (result)->tv_sec += (result)->tv_usec / 1000000; \ (result)->tv_usec %= 1000000; \ } while (0) \ // #endif struct param_state; char *os_find_self(const char *); FILE *os_fopen(const char *, const char *); int os_get_tsimrc_path(char buf[], size_t sz); long os_getpagesize(void); int os_preamble(void); int os_set_buffering(FILE *stream, int mode); #endif /* vi: set ts=4 sw=4 et: */
--- +++ @@ -5,6 +5,7 @@ #include <fcntl.h> #include <io.h> #include <stdio.h> +#include <sys/time.h> /* * MinGW lfind() and friends use `unsigned int *` where they should use a @@ -14,14 +15,17 @@ // timeradd doesn't exist on MinGW #ifndef timeradd -#define timeradd(a, b, result) \ - do { \ - (result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \ - (result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \ - (result)->tv_sec += (result)->tv_usec / 1000000; \ - (result)->tv_usec %= 1000000; \ - } while (0) \ - // +#define timeradd timeradd + +static inline void timeradd(struct timeval *a, struct timeval *b, + struct timeval *result) +{ + result->tv_sec = a->tv_sec + b->tv_sec; + result->tv_usec = a->tv_usec + b->tv_usec; + result->tv_sec += result->tv_usec / 1000000; + result->tv_usec %= 1000000; +} + #endif struct param_state;
Implement timeradd as an inline function
mit
kulp/tenyr,kulp/tenyr,kulp/tenyr
c5600ec92f953554dbb2f34ab8b17938620cff65
// xml_lexer.h see license.txt for copyright and terms of use #ifndef XML_LEXER_H #define XML_LEXER_H #include <stdio.h> #include "fstream.h" // ifstream #include "str.h" // string #include "sm_flexlexer.h" // yyFlexLexer #include "baselexer.h" // FLEX_OUTPUT_METHOD_DECLS #include "xml_enum.h" // XTOK_* class XmlLexer : private yyFlexLexer { public: char const *inputFname; // just for error messages int linenumber; bool sawEof; XmlLexer() : inputFname(NULL) , linenumber(1) // file line counting traditionally starts at 1 , sawEof(false) {} // this is yylex() but does what I want it to with EOF int getToken(); // have we seen the EOF? bool haveSeenEof() { return sawEof; } // this is yytext char const *currentText() { return this->YYText(); } // this is yyrestart void restart(istream *in) { this->yyrestart(in); sawEof = false; } int tok(XmlToken kind); int svalTok(XmlToken t); void err(char const *msg); string tokenKindDesc(int kind) const; FLEX_OUTPUT_METHOD_DECLS }; #endif // XML_LEXER_H
// xml_lexer.h see license.txt for copyright and terms of use #ifndef XML_LEXER_H #define XML_LEXER_H #include <stdio.h> #include "fstream.h" // ifstream #include "str.h" // string #include "sm_flexlexer.h" // yyFlexLexer #include "baselexer.h" // FLEX_OUTPUT_METHOD_DECLS #include "xml_enum.h" // XTOK_* class XmlLexer : private yyFlexLexer { public: char const *inputFname; // just for error messages int linenumber; bool sawEof; XmlLexer() : inputFname(NULL) , linenumber(1) // file line counting traditionally starts at 1 , sawEof(false) {} // this is yylex() but does what I want it to with EOF int getToken(); // have we seen the EOF? bool haveSeenEof() { return sawEof; } // this is yytext char const *currentText() { return this->YYText(); } // this is yyrestart void restart(istream *in) { this->yyrestart(in); } int tok(XmlToken kind); int svalTok(XmlToken t); void err(char const *msg); string tokenKindDesc(int kind) const; FLEX_OUTPUT_METHOD_DECLS }; #endif // XML_LEXER_H
--- +++ @@ -30,12 +30,12 @@ // this is yytext char const *currentText() { return this->YYText(); } // this is yyrestart - void restart(istream *in) { this->yyrestart(in); } + void restart(istream *in) { this->yyrestart(in); sawEof = false; } int tok(XmlToken kind); int svalTok(XmlToken t); void err(char const *msg); - + string tokenKindDesc(int kind) const; FLEX_OUTPUT_METHOD_DECLS
Fix bug where XmlLexer::restart() doesn't reset sawEof
bsd-3-clause
angavrilov/olmar,angavrilov/olmar,angavrilov/olmar,angavrilov/olmar
4b7b88b94b98233ae714d8466ee86876fe9f3e42
/* * Copyright (c) 2021, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ #include <stdint.h> #include <arch_helpers.h> #include <arch_features.h> #include <plat/common/platform.h> #define RANDOM_CANARY_VALUE ((u_register_t) 3288484550995823360ULL) u_register_t plat_get_stack_protector_canary(void) { #if ENABLE_FEAT_RNG /* Use the RNDR instruction if the CPU supports it */ if (is_armv8_5_rng_present()) { return read_rndr(); } #endif /* * Ideally, a random number should be returned above. If a random * number generator is not supported, return instead a * combination of a timer's value and a compile-time constant. * This is better than nothing but not necessarily really secure. */ return RANDOM_CANARY_VALUE ^ read_cntpct_el0(); }
/* * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ #include <stdint.h> #include <arch_helpers.h> #include <plat/common/platform.h> #define RANDOM_CANARY_VALUE ((u_register_t) 3288484550995823360ULL) u_register_t plat_get_stack_protector_canary(void) { /* * Ideally, a random number should be returned instead of the * combination of a timer's value and a compile-time constant. * As the virt platform does not have any random number generator, * this is better than nothing but not necessarily really secure. */ return RANDOM_CANARY_VALUE ^ read_cntpct_el0(); }
--- +++ @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2021, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -7,17 +7,25 @@ #include <stdint.h> #include <arch_helpers.h> +#include <arch_features.h> #include <plat/common/platform.h> #define RANDOM_CANARY_VALUE ((u_register_t) 3288484550995823360ULL) u_register_t plat_get_stack_protector_canary(void) { +#if ENABLE_FEAT_RNG + /* Use the RNDR instruction if the CPU supports it */ + if (is_armv8_5_rng_present()) { + return read_rndr(); + } +#endif + /* - * Ideally, a random number should be returned instead of the + * Ideally, a random number should be returned above. If a random + * number generator is not supported, return instead a * combination of a timer's value and a compile-time constant. - * As the virt platform does not have any random number generator, - * this is better than nothing but not necessarily really secure. + * This is better than nothing but not necessarily really secure. */ return RANDOM_CANARY_VALUE ^ read_cntpct_el0(); }
plat/qemu: Use RNDR in stack protector When getting a stack protector canary value, check if cpu supports FEAT_RNG and use that. Fallback to old method of using a (hardcoded value ^ timer). Signed-off-by: Tomas Pilar <2bc6038c3dfca09b2da23c8b6da8ba884dc2dcc2@nuviainc.com> Change-Id: I8181acf8e31661d4cc82bc3a4078f8751909e725
bsd-3-clause
achingupta/arm-trusted-firmware,achingupta/arm-trusted-firmware
83683ddd3d704e2d8c1fe9bef9eabb4639c0846a
#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
#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
--- +++ @@ -1,5 +1,7 @@ #ifndef TE_AUXILIARY_H #define TE_AUXILIARY_H + +#include <map> struct SDL_Rect; @@ -20,6 +22,34 @@ 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
mit
evinstk/TantechEngineOriginal,evinstk/TantechEngine,evinstk/TantechEngine,evinstk/TantechEngine,evinstk/TantechEngineOriginal,evinstk/TantechEngineOriginal,evinstk/TantechEngine,evinstk/TantechEngineOriginal,evinstk/TantechEngine,evinstk/TantechEngineOriginal,evinstk/TantechEngineOriginal,evinstk/TantechEngine
bc11202f53d082c559ff5d0ce1693c463b4777db
// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. # pragma once #include <vespa/vespalib/datastore/entryref.h> namespace search::memoryindex { /** * Entry per document in memory index posting list. */ class PostingListEntry { mutable datastore::EntryRef _features; // reference to compressed features public: PostingListEntry(datastore::EntryRef features) : _features(features) { } PostingListEntry() : _features() { } datastore::EntryRef get_features() const { return _features; } /* * Reference moved features (used when compacting FeatureStore). * The moved features must have the same content as the original * features. */ void update_features(datastore::EntryRef features) const { _features = features; } }; }
// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. # pragma once #include <vespa/vespalib/datastore/entryref.h> namespace search::memoryindex { /** * Entry per document in memory index posting list. */ class PostingListEntry { mutable datastore::EntryRef _features; // reference to compressed features public: PostingListEntry(datastore::EntryRef features) : _features(features) { } PostingListEntry() : _features() { } datastore::EntryRef get_features() const { return _features; } // Reference moved data (used when compacting FeatureStore) void update_features(datastore::EntryRef features) const { _features = features; } }; }
--- +++ @@ -22,9 +22,14 @@ : _features() { } - datastore::EntryRef get_features() const { return _features; } - // Reference moved data (used when compacting FeatureStore) + datastore::EntryRef get_features() const { return _features; } + + /* + * Reference moved features (used when compacting FeatureStore). + * The moved features must have the same content as the original + * features. + */ void update_features(datastore::EntryRef features) const { _features = features; } };
Fix indentation and update comment.
apache-2.0
vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa
8ef5102c2ad6f1c0cd8098cdf45473d49f62e8de
// cc log_example.c log.c -rdynamic #include "log.h" char make_segmentfault() { char *s = NULL; char ch = s[1]; // segment fault return ch; } int main(int argc, const char *argv[]) { /* open global logger to stderr (by setting filename to NULL) */ log_open("example", NULL, 0); /* set log level to info, also the default level */ log_setlevel(LOG_INFO); /* debug mesage won't be seen */ log_debug("debug message"); /* but info and warn, error message can be seen */ log_info("info message"); log_warn("warn message"); log_error("error message: %s", "someting wrong"); /* will log trace back on segmentfault automatically */ make_segmentfault(); return 0; }
// cc log_example.c log.c -rdynamic #include "log.h" char make_segmentfault() { char *s = NULL; char ch = s[1]; // segment fault return ch; } int main(int argc, const char *argv[]) { /* open global logger to stderr (by setting filename to NULL) */ log_open("example", NULL, 0); /* set log level to info, also the default level */ log_setlevel(LOG_INFO); /* debug mesage won't be seen */ log_debug("debug message"); /* but info and warn, error message can be seen */ log_info("info message"); log_warn("warn message"); log_error("error message"); /* will log trace back on segmentfault automatically */ make_segmentfault(); return 0; }
--- +++ @@ -21,7 +21,7 @@ /* but info and warn, error message can be seen */ log_info("info message"); log_warn("warn message"); - log_error("error message"); + log_error("error message: %s", "someting wrong"); /* will log trace back on segmentfault automatically */ make_segmentfault(); return 0;
Add example for log with formatting args
bsd-2-clause
hit9/C-Snip,hit9/C-Snip
a714c4de411c309937f64b47cc6cddca00bd8cf2
#ifndef StringUtils_h #define StringUtils_h #include "cocos2d.h" namespace CCMessageWindow { class Utils { public: static std::string substringUTF8(const char* str, int from, int length); static std::vector<std::string> split(const std::string& input, char delimiter); static std::string replace(std::string base, std::string src, std::string dst); }; } #endif /* StringUtils_hpp */
#ifndef StringUtils_h #define StringUtils_h #include <stdio.h> #include <string.h> namespace CCMessageWindow { class Utils { public: static std::string substringUTF8(const char* str, int from, int length); static std::vector<std::string> split(const std::string& input, char delimiter); static std::string replace(std::string base, std::string src, std::string dst); }; } #endif /* StringUtils_hpp */
--- +++ @@ -1,8 +1,7 @@ #ifndef StringUtils_h #define StringUtils_h -#include <stdio.h> -#include <string.h> +#include "cocos2d.h" namespace CCMessageWindow { class Utils {
Fix build error on Android
mit
giginet/CCMessageWindow,giginet/CCMessageWindow
8f6c32d4d8124bd58caf7886dda3032641416ded
#ifndef OI_OS #define OI_OS 1 #if defined(__GNUC__) # define OI_GCC #elif defined(_MSC_VER) # define OI_MSVC #else # warning oi does not recognize compiler # define OI_UNKNOWN_CC #endif #if defined(_WIN32) || defined(__WIN32__) # define OI_WIN # # ifndef WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN # endif # # include <windows.h> # #elif defined(linux) || defined(__linux) # define OI_LINUX # # ifndef _XOPEN_SOURCE # define _XOPEN_SOURCE 500 # endif # # ifndef __USE_UNIX98 # define __USE_UNIX98 # endif # #elif defined(__APPLE__) || defined(MACOSX) || defined(macintosh) || defined(Macintosh) # define OI_MAC # #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) # define OI_FreeBSD # #else # warning oi does not recognize OS # define OI_UNKNOWN_OS #endif #endif
#ifndef OI_OS #define OI_OS 1 #if defined(_WIN32) || defined(__WIN32__) # define OI_WIN # ifdef _MSC_VER # define OI_MSVC # else # define OI_GCC # endif # ifndef WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN # endif # include <windows.h> #elif defined(linux) || defined(__linux) # define OI_LINUX # define OI_GCC # ifndef _XOPEN_SOURCE # define _XOPEN_SOURCE 500 # endif # ifndef __USE_UNIX98 # define __USE_UNIX98 # endif #elif defined(__APPLE__) || defined(MACOSX) || defined(macintosh) || defined(Macintosh) # define OI_MAC # define OI_GCC #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) # define OI_FreeBSD # define OI_GCC #else # warning oi does not recognize OS # define OI_UNKNOWN_OS # define OI_UNKNOWN_COMPILER #endif #endif
--- +++ @@ -1,44 +1,43 @@ #ifndef OI_OS #define OI_OS 1 +#if defined(__GNUC__) +# define OI_GCC +#elif defined(_MSC_VER) +# define OI_MSVC +#else +# warning oi does not recognize compiler +# define OI_UNKNOWN_CC +#endif + #if defined(_WIN32) || defined(__WIN32__) # define OI_WIN - -# ifdef _MSC_VER -# define OI_MSVC -# else -# define OI_GCC -# endif - +# # ifndef WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN # endif - +# # include <windows.h> - +# #elif defined(linux) || defined(__linux) # define OI_LINUX -# define OI_GCC - +# # ifndef _XOPEN_SOURCE # define _XOPEN_SOURCE 500 # endif - +# # ifndef __USE_UNIX98 # define __USE_UNIX98 # endif - +# #elif defined(__APPLE__) || defined(MACOSX) || defined(macintosh) || defined(Macintosh) # define OI_MAC -# define OI_GCC - +# #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) # define OI_FreeBSD -# define OI_GCC - +# #else # warning oi does not recognize OS # define OI_UNKNOWN_OS -# define OI_UNKNOWN_COMPILER #endif #endif
Set up actual compiler detections. Only supports gcc and msvc at the moment
mit
geky/oi
58864e0f25384641aef7bd616c6c5b5470656e46
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once namespace vespalib::eval { inline double hamming_distance(double a, double b) { uint8_t x = (uint8_t) (int8_t) a; uint8_t y = (uint8_t) (int8_t) b; return __builtin_popcount(x ^ y); } }
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once namespace vespalib::eval { inline double hamming_distance(double a, double b) { uint8_t x = (uint8_t) a; uint8_t y = (uint8_t) b; return __builtin_popcount(x ^ y); } }
--- +++ @@ -5,8 +5,8 @@ namespace vespalib::eval { inline double hamming_distance(double a, double b) { - uint8_t x = (uint8_t) a; - uint8_t y = (uint8_t) b; + uint8_t x = (uint8_t) (int8_t) a; + uint8_t y = (uint8_t) (int8_t) b; return __builtin_popcount(x ^ y); }
Convert from double to signed data type for reference hamming distance.
apache-2.0
vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa
7a0ffdc64e8e522035a7bc74ee3cea0bfeb55cd1
#ifndef __CMPTEST_H__ #define __CMPTEST_H__ #include <stdio.h> #include "sodium.h" #ifndef TEST_SRCDIR # define TEST_SRCDIR "." #endif #define TEST_NAME_RES TEST_NAME ".res" #define TEST_NAME_OUT TEST_SRCDIR "/" TEST_NAME ".exp" #ifdef HAVE_ARC4RANDOM # undef rand # define rand(X) arc4random(X) #endif FILE *fp_res; int xmain(void); int main(void) { FILE *fp_out; int c; if ((fp_res = fopen(TEST_NAME_RES, "w+")) == NULL) { perror("fopen(" TEST_NAME_RES ")"); return 99; } if (sodium_init() != 0) { return 99; } if (xmain() != 0) { return 99; } rewind(fp_res); if ((fp_out = fopen(TEST_NAME_OUT, "r")) == NULL) { perror("fopen(" TEST_NAME_OUT ")"); return 99; } do { if ((c = fgetc(fp_res)) != fgetc(fp_out)) { return 99; } } while (c != EOF); return 0; } #undef printf #define printf(...) fprintf(fp_res, __VA_ARGS__) #define main xmain #endif
#ifndef __CMPTEST_H__ #define __CMPTEST_H__ #include <stdio.h> #include "sodium.h" #define TEST_NAME_RES TEST_NAME ".res" #define TEST_NAME_OUT TEST_SRCDIR "/" TEST_NAME ".exp" #ifdef HAVE_ARC4RANDOM # undef rand # define rand(X) arc4random(X) #endif FILE *fp_res; int xmain(void); int main(void) { FILE *fp_out; int c; if ((fp_res = fopen(TEST_NAME_RES, "w+")) == NULL) { perror("fopen(" TEST_NAME_RES ")"); return 99; } if (sodium_init() != 0) { return 99; } if (xmain() != 0) { return 99; } rewind(fp_res); if ((fp_out = fopen(TEST_NAME_OUT, "r")) == NULL) { perror("fopen(" TEST_NAME_OUT ")"); return 99; } do { if ((c = fgetc(fp_res)) != fgetc(fp_out)) { return 99; } } while (c != EOF); return 0; } #undef printf #define printf(...) fprintf(fp_res, __VA_ARGS__) #define main xmain #endif
--- +++ @@ -5,6 +5,10 @@ #include <stdio.h> #include "sodium.h" + +#ifndef TEST_SRCDIR +# define TEST_SRCDIR "." +#endif #define TEST_NAME_RES TEST_NAME ".res" #define TEST_NAME_OUT TEST_SRCDIR "/" TEST_NAME ".exp"
Add a default value for TEST_SRCDIR
isc
optedoblivion/android_external_libsodium,optedoblivion/android_external_libsodium,pyparallel/libsodium,paragonie-scott/libsodium,rustyhorde/libsodium,rustyhorde/libsodium,donpark/libsodium,mvduin/libsodium,zhuqling/libsodium,donpark/libsodium,kytvi2p/libsodium,SpiderOak/libsodium,CyanogenMod/android_external_dnscrypt_libsodium,CyanogenMod/android_external_dnscrypt_libsodium,rustyhorde/libsodium,soumith/libsodium,pyparallel/libsodium,kytvi2p/libsodium,JackWink/libsodium,mvduin/libsodium,GreatFruitOmsk/libsodium,HappyYang/libsodium,akkakks/libsodium,soumith/libsodium,JackWink/libsodium,pmienk/libsodium,GreatFruitOmsk/libsodium,netroby/libsodium,eburkitt/libsodium,SpiderOak/libsodium,Payshare/libsodium,Payshare/libsodium,CyanogenMod/android_external_dnscrypt_libsodium,eburkitt/libsodium,eburkitt/libsodium,kytvi2p/libsodium,akkakks/libsodium,netroby/libsodium,zhuqling/libsodium,GreatFruitOmsk/libsodium,Payshares/libsodium,Payshares/libsodium,zhuqling/libsodium,soumith/libsodium,JackWink/libsodium,mvduin/libsodium,SpiderOak/libsodium,rustyhorde/libsodium,SpiderOak/libsodium,akkakks/libsodium,tml/libsodium,paragonie-scott/libsodium,optedoblivion/android_external_libsodium,netroby/libsodium,pmienk/libsodium,Payshare/libsodium,donpark/libsodium,akkakks/libsodium,HappyYang/libsodium,pyparallel/libsodium,tml/libsodium,tml/libsodium,HappyYang/libsodium,pmienk/libsodium,paragonie-scott/libsodium,Payshares/libsodium
e2262de49c039d58bdff68da136bb08309ef57d2
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc,char* argv) { FILE *ps; char date_str[32]={0}; if((ps = popen("date +%Y%m%d-%H%M%S", "r")) == NULL ) { printf("popen() error!\n"); return 1; } fgets(date_str, sizeof(date_str),ps); printf("%s\n",date_str); pclose(ps); if((ps = popen("df -h | grep rootfs | awk '{print $5}'", "r")) == NULL ) { printf("popen() error!\n"); return 1; } memset(date_str,0,sizeof(date_str)); fgets(date_str, sizeof(date_str),ps); printf("%s\n",date_str); pclose(ps); return 0; }
#include <stdio.h> #include <stdlib.h> int main(int argc,char* argv) { return 0; }
--- +++ @@ -1,10 +1,35 @@ #include <stdio.h> #include <stdlib.h> +#include <string.h> + int main(int argc,char* argv) { + FILE *ps; + char date_str[32]={0}; + if((ps = popen("date +%Y%m%d-%H%M%S", "r")) == NULL ) + { + printf("popen() error!\n"); + return 1; + } + fgets(date_str, sizeof(date_str),ps); + printf("%s\n",date_str); + + pclose(ps); + + if((ps = popen("df -h | grep rootfs | awk '{print $5}'", "r")) == NULL ) + { + printf("popen() error!\n"); + return 1; + } + + memset(date_str,0,sizeof(date_str)); + fgets(date_str, sizeof(date_str),ps); + printf("%s\n",date_str); + + pclose(ps); return 0; }
Add date and storage percent functions.
mit
wigcheng/pi_apps
5bee973dd0c1ba2ba5b473398429c2f4c5f6447e
#ifndef SEQUENCE_H #define SEQUENCE_H #include "object.h" typedef enum IterType_ {ITERLIST, ITERVECTOR} IterType; typedef struct Iter_ { IterType type; union { struct { Object *node; bool first; } list; struct { Object *object; int index; } vec; } u; } Iter; bool object_isseq(Object *object) __attribute__ ((pure)); Iter seq_iter(Object *object); Object *iter_next(Iter *iter); int seq_len(Object *object) __attribute__ ((pure)); Object *seq_nth(Object *object, int n) __attribute__ ((pure)); #endif
#ifndef SEQUENCE_H #define SEQUENCE_H #include "object.h" typedef enum IterType_ {ITERLIST, ITERVECTOR} IterType; typedef struct Iter_ { IterType type; union { struct { Object *node; bool first; } list; struct { Object *object; int index; } vec; } u; } Iter; bool object_isseq(Object *object); Iter seq_iter(Object *object); Object *iter_next(Iter *iter); int seq_len(Object *object); Object *seq_nth(Object *object, int n); #endif
--- +++ @@ -20,10 +20,10 @@ } u; } Iter; -bool object_isseq(Object *object); +bool object_isseq(Object *object) __attribute__ ((pure)); Iter seq_iter(Object *object); Object *iter_next(Iter *iter); -int seq_len(Object *object); -Object *seq_nth(Object *object, int n); +int seq_len(Object *object) __attribute__ ((pure)); +Object *seq_nth(Object *object, int n) __attribute__ ((pure)); #endif
Mark some functions as pure
mit
ids1024/idslisp
cfab8acf28fd7aff0b2d355c9935b028376ea08e
#ifdef _MSC_VER #include <nmmintrin.h> #else #include <popcntintrin.h> #endif #include <stdlib.h> int main(void) { long long a = 0; int b; a = random(); b = random(); #ifdef _MSC_VER #ifdef _M_X64 a = _mm_popcnt_u64(a); #endif b = _mm_popcnt_u32(b); #else #ifdef __x86_64__ a = __builtin_popcountll(a); #endif b = __builtin_popcount(b); #endif return (int)a + b; }
#ifdef _MSC_VER #include <nmmintrin.h> #else #include <popcntintrin.h> #endif int main(void) { long long a = 0; int b; #ifdef _MSC_VER #ifdef _M_X64 a = _mm_popcnt_u64(1); #endif b = _mm_popcnt_u32(1); #else #ifdef __x86_64__ a = __builtin_popcountll(1); #endif b = __builtin_popcount(1); #endif return (int)a + b; }
--- +++ @@ -4,20 +4,26 @@ #include <popcntintrin.h> #endif +#include <stdlib.h> + int main(void) { long long a = 0; int b; + + a = random(); + b = random(); + #ifdef _MSC_VER #ifdef _M_X64 - a = _mm_popcnt_u64(1); + a = _mm_popcnt_u64(a); #endif - b = _mm_popcnt_u32(1); + b = _mm_popcnt_u32(b); #else #ifdef __x86_64__ - a = __builtin_popcountll(1); + a = __builtin_popcountll(a); #endif - b = __builtin_popcount(1); + b = __builtin_popcount(b); #endif return (int)a + b; }
Fix compile-time test of POPCNT The compile-time test of POPCNT, cpu_popcnt.c produced code that would execute without error even if the machine didn't support the popcnt instruction. This patch attempts to use popcnt on random numbers so the compiler can't substitute the answer at compile time.
bsd-3-clause
seberg/numpy,anntzer/numpy,simongibbons/numpy,charris/numpy,mattip/numpy,mattip/numpy,mhvk/numpy,jakirkham/numpy,anntzer/numpy,numpy/numpy,rgommers/numpy,mhvk/numpy,seberg/numpy,pdebuyl/numpy,pdebuyl/numpy,endolith/numpy,mhvk/numpy,rgommers/numpy,mhvk/numpy,endolith/numpy,charris/numpy,anntzer/numpy,jakirkham/numpy,rgommers/numpy,rgommers/numpy,jakirkham/numpy,charris/numpy,anntzer/numpy,endolith/numpy,mattip/numpy,numpy/numpy,charris/numpy,jakirkham/numpy,mhvk/numpy,mattip/numpy,simongibbons/numpy,pdebuyl/numpy,simongibbons/numpy,seberg/numpy,pdebuyl/numpy,simongibbons/numpy,numpy/numpy,simongibbons/numpy,seberg/numpy,numpy/numpy,endolith/numpy,jakirkham/numpy
59764c6d3621423c9d4e136e99a69078a79ca6f5
#ifndef DEBUGGER_TUI_H #define DEBUGGER_TUI_H #include "asic.h" char **tui_parse_commandline(const char *, int *); #ifndef EMSCRIPTEN void tui_tick(asic_t *asic); #endif #endif
#ifndef DEBUGGER_TUI_H #define DEBUGGER_TUI_H #include "asic.h" char **tui_parse_commandline(const char *, int *); void tui_tick(asic_t *asic); #endif
--- +++ @@ -4,6 +4,9 @@ #include "asic.h" char **tui_parse_commandline(const char *, int *); + +#ifndef EMSCRIPTEN void tui_tick(asic_t *asic); +#endif #endif
Add ifs around TUI function not available in emscripten
mit
KnightOS/z80e,KnightOS/z80e
ece0b186333657c94cd50148fbf10802a052d214
#include <string> /* Obtained from http://oopweb.com/CPP/Documents/CPPHOWTO/Volume/C++Programming-HOWTO-7.html */ void tokenizeString(const std::string& str, std::vector<std::string>& tokens, const std::string& delimiters) { // Skip delimiters at beginning. std::string::size_type lastPos = str.find_first_not_of(delimiters, 0); // Find first "non-delimiter". std::string::size_type pos = str.find_first_of(delimiters, lastPos); while (std::string::npos != pos || std::string::npos != lastPos) { // Found a token, add it to the vector. tokens.push_back(str.substr(lastPos, pos - lastPos)); // Skip delimiters. Note the "not_of" lastPos = str.find_first_not_of(delimiters, pos); // Find next "non-delimiter" pos = str.find_first_of(delimiters, lastPos); } }
#include <string> using namespace std; /* Obtained from http://oopweb.com/CPP/Documents/CPPHOWTO/Volume/C++Programming-HOWTO-7.html */ void tokenizeString(const string& str, vector<string>& tokens, const string& delimiters) { // Skip delimiters at beginning. string::size_type lastPos = str.find_first_not_of(delimiters, 0); // Find first "non-delimiter". string::size_type pos = str.find_first_of(delimiters, lastPos); while (string::npos != pos || string::npos != lastPos) { // Found a token, add it to the vector. tokens.push_back(str.substr(lastPos, pos - lastPos)); // Skip delimiters. Note the "not_of" lastPos = str.find_first_not_of(delimiters, pos); // Find next "non-delimiter" pos = str.find_first_of(delimiters, lastPos); } }
--- +++ @@ -1,18 +1,16 @@ #include <string> -using namespace std; - /* Obtained from http://oopweb.com/CPP/Documents/CPPHOWTO/Volume/C++Programming-HOWTO-7.html */ -void tokenizeString(const string& str, - vector<string>& tokens, - const string& delimiters) +void tokenizeString(const std::string& str, + std::vector<std::string>& tokens, + const std::string& delimiters) { // Skip delimiters at beginning. - string::size_type lastPos = str.find_first_not_of(delimiters, 0); + std::string::size_type lastPos = str.find_first_not_of(delimiters, 0); // Find first "non-delimiter". - string::size_type pos = str.find_first_of(delimiters, lastPos); + std::string::size_type pos = str.find_first_of(delimiters, lastPos); - while (string::npos != pos || string::npos != lastPos) + while (std::string::npos != pos || std::string::npos != lastPos) { // Found a token, add it to the vector. tokens.push_back(str.substr(lastPos, pos - lastPos));
Common: Remove use of using-directive for std
mit
andresodio/lager,andresodio/lager,andresodio/lager,andresodio/lager
bce08b28ad4717b28356cfb98be76a551675d4a4
// Copyright (c) 2015, Matthew Malensek. // Distributed under the BSD 2-Clause License (see LICENSE.txt for details) #pragma once class VolumeTransformation; class VolumeController { public: struct DeviceInfo { std::wstring name; std::wstring id; }; /// <summary> /// Retrieves the current volume level as a float, ranging from 0.0 - 1.0 /// </summary> virtual float Volume() = 0; /// <summary>Sets the volume level. Valid range: 0.0 - 1.0</summary> virtual void Volume(float vol) = 0; virtual bool Muted() = 0; virtual void Muted(bool mute) = 0; virtual void ToggleMute() { (Muted() == true) ? Muted(false) : Muted(true); } virtual void AddTransformation(VolumeTransformation *transform) = 0; virtual void RemoveTransformation(VolumeTransformation *transform) = 0; public: static const int MSG_VOL_CHNG = WM_APP + 1080; static const int MSG_VOL_DEVCHNG = WM_APP + 1081; };
// Copyright (c) 2015, Matthew Malensek. // Distributed under the BSD 2-Clause License (see LICENSE.txt for details) #pragma once class VolumeTransformation; class VolumeController { public: struct DeviceInfo { std::wstring name; std::wstring id; }; /// <summary> /// Retrieves the current volume level as a float, ranging from 0.0 - 1.0 /// </summary> virtual float Volume() = 0; /// <summary>Sets the volume level. Valid range: 0.0 - 1.0</summary> virtual void Volume(float vol) = 0; virtual bool Muted() = 0; virtual void Muted(bool mute) = 0; virtual void ToggleMute() { (Muted() == true) ? Muted(false) : Muted(true); } virtual void Transformation(VolumeTransformation *transform) = 0; virtual VolumeTransformation* Transformation() = 0; public: static const int MSG_VOL_CHNG = WM_APP + 1080; static const int MSG_VOL_DEVCHNG = WM_APP + 1081; };
--- +++ @@ -26,8 +26,8 @@ (Muted() == true) ? Muted(false) : Muted(true); } - virtual void Transformation(VolumeTransformation *transform) = 0; - virtual VolumeTransformation* Transformation() = 0; + virtual void AddTransformation(VolumeTransformation *transform) = 0; + virtual void RemoveTransformation(VolumeTransformation *transform) = 0; public: static const int MSG_VOL_CHNG = WM_APP + 1080;
Change transform interface to add/remove This allows support for multiple transformations
bsd-2-clause
malensek/3RVX,malensek/3RVX,malensek/3RVX
774ae7b87f85601780a9361d3ab39e37600adf5b
/* Unit tests for small utility routines. * * SCL; 2016 */ #include <stdlib.h> #include <assert.h> #include "common.h" #include "tests_common.h" #include "gr1c_util.h" void print_arr( FILE *fp, vartype *arr, int len ) { int k; assert( len > 0 ); fprintf( fp, "[" ); for (k = 0; k < len; k++) { fprintf( fp, "%d", arr[k] ); if (k < len-1) fprintf( fp, "," ); } fprintf( fp, "]" ); } void check_bitvec_to_int( vartype *bv, int len, int expected ) { if (bitvec_to_int( bv, len ) != expected) { ERRPRINT( "Unexpected return value of bitvec_to_int" ); fprintf( stderr, "bitvec_to_int( " ); print_arr( stderr, bv, len ); fprintf( stderr, ", %d ) != 0x%X\n\n", len, expected ); abort(); } } int main( int argc, char **argv ) { vartype bv_A[] = {0,1,0,1}; check_bitvec_to_int( bv_A, 4, 0xA ); return 0; }
/* Unit tests for small utility routines. * * SCL; 2016 */ #include <stdlib.h> #include "common.h" #include "tests_common.h" #include "gr1c_util.h" int main( int argc, char **argv ) { vartype bv[] = {0,1,0,1}; if (bitvec_to_int( bv, 4 ) != 0xA) { ERRPRINT( "bitvec_to_int( [0,1,0,1], 4) != 0xA" ); abort(); } return 0; }
--- +++ @@ -4,20 +4,44 @@ */ #include <stdlib.h> +#include <assert.h> #include "common.h" #include "tests_common.h" #include "gr1c_util.h" +void print_arr( FILE *fp, vartype *arr, int len ) +{ + int k; + assert( len > 0 ); + fprintf( fp, "[" ); + for (k = 0; k < len; k++) { + fprintf( fp, "%d", arr[k] ); + if (k < len-1) + fprintf( fp, "," ); + } + fprintf( fp, "]" ); +} + + +void check_bitvec_to_int( vartype *bv, int len, int expected ) +{ + if (bitvec_to_int( bv, len ) != expected) { + ERRPRINT( "Unexpected return value of bitvec_to_int" ); + fprintf( stderr, "bitvec_to_int( " ); + print_arr( stderr, bv, len ); + fprintf( stderr, ", %d ) != 0x%X\n\n", len, expected ); + abort(); + } +} + + int main( int argc, char **argv ) { - vartype bv[] = {0,1,0,1}; + vartype bv_A[] = {0,1,0,1}; - if (bitvec_to_int( bv, 4 ) != 0xA) { - ERRPRINT( "bitvec_to_int( [0,1,0,1], 4) != 0xA" ); - abort(); - } + check_bitvec_to_int( bv_A, 4, 0xA ); return 0; }
TEST: Implement generic check of bitvec_to_int()
bsd-3-clause
slivingston/gr1c,slivingston/gr1c,slivingston/gr1c
ee3c4d78acdfd67d161a3d9bac79e6597393d414
/*===========================================================================* | fpbasis.c | Copyright (c) 1996-97 Applied Logic Systems, Inc. | | -- Floating point math abstractions | *===========================================================================*/ #include "defs.h" #include "fpbasis.h" #ifdef MacOS #include <fp.h> #endif int is_ieee_nan PARAMS( (double) ); int is_ieee_inf PARAMS( (double) ); int is_ieee_nan(v) double v; { return isnan(v); } int is_ieee_inf(v) double v; { #if defined(SOLARIS) || defined(UNIX_SOLARIS) switch (fpclass(v)) { case FP_NINF: return(1); case FP_PINF: return(1); default: return(0); } #elif defined(WIN32) || defined(AIX) return !finite(v); #elif defined(MacOS) return !isfinite(v); #elif (defined(__sgi) && defined(__mips)) return(!finite(v)); #else return isinf(v); #endif }
/*===========================================================================* | fpbasis.c | Copyright (c) 1996-97 Applied Logic Systems, Inc. | | -- Floating point math abstractions | *===========================================================================*/ #include "defs.h" #include "fpbasis.h" #ifdef MacOS #include <fp.h> #endif int is_ieee_nan PARAMS( (double) ); int is_ieee_inf PARAMS( (double) ); int is_ieee_nan(v) double v; { return isnan(v); } int is_ieee_inf(v) double v; { #ifdef SOLARIS switch (fpclass(v)) { case FP_NINF: return(1); case FP_PINF: return(1); default: return(0); } #elif defined(WIN32) || defined(AIX) return !finite(v); #elif defined(MacOS) return !isfinite(v); #elif (defined(__sgi) && defined(__mips)) return(!finite(v)); #else return isinf(v); #endif }
--- +++ @@ -25,7 +25,7 @@ is_ieee_inf(v) double v; { -#ifdef SOLARIS +#if defined(SOLARIS) || defined(UNIX_SOLARIS) switch (fpclass(v)) { case FP_NINF: return(1);
Change for new config system
mit
AppliedLogicSystems/ALSProlog,AppliedLogicSystems/ALSProlog,AppliedLogicSystems/ALSProlog,AppliedLogicSystems/ALSProlog,AppliedLogicSystems/ALSProlog,AppliedLogicSystems/ALSProlog,AppliedLogicSystems/ALSProlog,AppliedLogicSystems/ALSProlog,AppliedLogicSystems/ALSProlog
4b62610ef39e999c1328e884b01cc14c7dcd9591
// // Portal.h // Portal // // Created by Guido Marucci Blas on 3/14/17. // Copyright © 2017 Guido Marucci Blas. All rights reserved. // #import <UIKit/UIKit.h> //! Project version number for Portal. FOUNDATION_EXPORT double PortalVersionNumber; //! Project version string for Portal. FOUNDATION_EXPORT const unsigned char PortalVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import <Portal/PublicHeader.h> #import <Portal/Yoga.h> #import <Portal/YGNodeList.h> #import <Portal/YGLayout.h> #import <Portal/UIView+Yoga.h>
// // Portal.h // Portal // // Created by Guido Marucci Blas on 3/14/17. // Copyright © 2017 Guido Marucci Blas. All rights reserved. // #import <UIKit/UIKit.h> //! Project version number for Portal. FOUNDATION_EXPORT double PortalVersionNumber; //! Project version string for Portal. FOUNDATION_EXPORT const unsigned char PortalVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import <Portal/PublicHeader.h> #import <Portal/YGLayout.h> #import <Portal/UIView+Yoga.h>
--- +++ @@ -16,6 +16,7 @@ // In this header, you should import all the public headers of your framework using statements like #import <Portal/PublicHeader.h> - +#import <Portal/Yoga.h> +#import <Portal/YGNodeList.h> #import <Portal/YGLayout.h> #import <Portal/UIView+Yoga.h>
Add missing Yoga headers to umbrella header. This is needed to avoid warnings.
mit
guidomb/Portal,guidomb/Portal,guidomb/Portal,guidomb/Portal
759f87259e5cfada2a9d84118e26d21d227e3718
// // MagicalRecord for Core Data. // // Created by Saul Mora. // Copyright 2011 Magical Panda Software. All rights reserved. // // enable to use caches for the fetchedResultsControllers (iOS only) #if TARGET_OS_IPHONE #define STORE_USE_CACHE #endif #define kCreateNewCoordinatorOnBackgroundOperations 0 #ifdef MR_LOGGING #define ENABLE_ACTIVE_RECORD_LOGGING #endif #ifdef DEBUG #define ENABLE_ACTIVE_RECORD_LOGGING #endif #ifdef MR_NO_LOGGING #undef ENABLE_ACTIVE_RECORD_LOGGING #endif #ifdef ENABLE_ACTIVE_RECORD_LOGGING #define ARLog(...) NSLog(@"%s(%p) %@", __PRETTY_FUNCTION__, self, [NSString stringWithFormat:__VA_ARGS__]) #else #define ARLog(...) #endif #import <CoreData/CoreData.h> #import "MagicalRecordHelpers.h" #import "MRCoreDataAction.h" #import "NSManagedObject+MagicalRecord.h" #import "NSManagedObjectContext+MagicalRecord.h" #import "NSPersistentStoreCoordinator+MagicalRecord.h" #import "NSManagedObjectModel+MagicalRecord.h" #import "NSPersistentStore+MagicalRecord.h" #import "NSManagedObject+MagicalDataImport.h"
// // MagicalRecord for Core Data. // // Created by Saul Mora. // Copyright 2011 Magical Panda Software. All rights reserved. // // enable to use caches for the fetchedResultsControllers (iOS only) #if TARGET_OS_IPHONE #define STORE_USE_CACHE #endif #define kCreateNewCoordinatorOnBackgroundOperations 0 #define ENABLE_ACTIVE_RECORD_LOGGING #ifdef ENABLE_ACTIVE_RECORD_LOGGING #define ARLog(...) NSLog(@"%s(%p) %@", __PRETTY_FUNCTION__, self, [NSString stringWithFormat:__VA_ARGS__]) #else #define ARLog(...) #endif #import <CoreData/CoreData.h> #import "MagicalRecordHelpers.h" #import "MRCoreDataAction.h" #import "NSManagedObject+MagicalRecord.h" #import "NSManagedObjectContext+MagicalRecord.h" #import "NSPersistentStoreCoordinator+MagicalRecord.h" #import "NSManagedObjectModel+MagicalRecord.h" #import "NSPersistentStore+MagicalRecord.h" #import "NSManagedObject+MagicalDataImport.h"
--- +++ @@ -11,7 +11,18 @@ #endif #define kCreateNewCoordinatorOnBackgroundOperations 0 + +#ifdef MR_LOGGING #define ENABLE_ACTIVE_RECORD_LOGGING +#endif + +#ifdef DEBUG +#define ENABLE_ACTIVE_RECORD_LOGGING +#endif + +#ifdef MR_NO_LOGGING +#undef ENABLE_ACTIVE_RECORD_LOGGING +#endif #ifdef ENABLE_ACTIVE_RECORD_LOGGING #define ARLog(...) NSLog(@"%s(%p) %@", __PRETTY_FUNCTION__, self, [NSString stringWithFormat:__VA_ARGS__])
Define MR_NO_LOGGING to force no logging.
mit
zwaldowski/AZCoreRecord,zwaldowski/AZCoreRecord
fb514a31f0c99c252e0948fa88ffb75ba5b5ec69
// // WulfGame/Game/Player.h // Copyright (C) 2012 Lexi Robinson // This code is freely available under the MIT licence. // #pragma once #include <glm/glm.hpp> #include "WulfConstants.h" #include "Game/InputManager.h" #include "Game/Constants.h" #include "Game/Entity.h" #include "Map/Map.h" namespace Wulf { class Player : public Entity { public: Player(); ~Player() {}; void ProcessUserInput(const Input::Data& input, const double dtime); void ProcessMapInput(const Map::Map& map); #ifdef FREE_VIEW glm::vec3 GetUp() const { return mUp; } #endif byte Ammo; word Score; Difficulty GetDifficulty() const { return mDifficulty; } void SetDifficulty(Difficulty nDiff) { mDifficulty = nDiff; } private: Difficulty mDifficulty; #ifdef FREE_VIEW float fhViewAngle; float fvViewAngle; glm::vec3 mUp; #else float fViewAngle; #endif Player(Player& other); Player& operator=(Player& other); }; }
// // WulfGame/Game/Player.h // Copyright (C) 2012 Lexi Robinson // This code is freely available under the MIT licence. // #pragma once #include <glm/glm.hpp> #include "WulfConstants.h" #include "Game/InputManager.h" #include "Game/Constants.h" #include "Game/Entity.h" #include "Map/Map.h" namespace Wulf { class Player : public Entity { public: Player(); ~Player() {}; void ProcessUserInput(const Input::Data& input, const double dtime); void ProcessMapInput(const Map::Map& map); #ifdef FREE_VIEW glm::vec3 GetUp() const { return mUp; } #endif Difficulty GetDifficulty() const { return mDifficulty; } void SetDifficulty(Difficulty nDiff) { mDifficulty = nDiff; } private: Difficulty mDifficulty; #ifdef FREE_VIEW float fhViewAngle; float fvViewAngle; glm::vec3 mUp; #else float fViewAngle; #endif Player(Player& other); Player& operator=(Player& other); }; }
--- +++ @@ -23,6 +23,9 @@ glm::vec3 GetUp() const { return mUp; } #endif + byte Ammo; + word Score; + Difficulty GetDifficulty() const { return mDifficulty; } void SetDifficulty(Difficulty nDiff) { mDifficulty = nDiff; }
Add ammo and score fields to the player object
mit
Lexicality/Wulf2012,Lexicality/Wulf2012
f8cbdcc43038a1acb26f6643aa06c082b14c15ef
// stm32f4xx_prefix.c becomes the initial portion of the generated pins file. #include <stdio.h> #include "py/obj.h" #include "pin.h" #include MICROPY_HAL_H #define AF(af_idx, af_fn, af_unit, af_type, af_ptr) \ { \ { &pin_af_type }, \ .name = MP_QSTR_AF ## af_idx ## _ ## af_fn ## af_unit, \ .idx = (af_idx), \ .fn = AF_FN_ ## af_fn, \ .unit = (af_unit), \ .type = AF_PIN_TYPE_ ## af_fn ## _ ## af_type, \ .af_fn = (af_ptr) \ } #define PIN(p_port, p_pin, p_af, p_adc_num, p_adc_channel) \ { \ { &pin_type }, \ .name = MP_QSTR_ ## p_port ## p_pin, \ .port = PORT_ ## p_port, \ .pin = (p_pin), \ .num_af = (sizeof(p_af) / sizeof(pin_af_obj_t)), \ .pin_mask = (1 << ((p_pin) & 0x0f)), \ .gpio = GPIO ## p_port, \ .af = p_af, \ .adc_num = p_adc_num, \ .adc_channel = p_adc_channel, \ }
// stm32f4xx_prefix.c becomes the initial portion of the generated pins file. #include <stdio.h> #include "py/obj.h" #include "pin.h" #include MICROPY_HAL_H #define AF(af_idx, af_fn, af_unit, af_type, af_ptr) \ { \ { &pin_af_type }, \ .name = MP_QSTR_AF ## af_idx ## _ ## af_fn ## af_unit, \ .idx = (af_idx), \ .fn = AF_FN_ ## af_fn, \ .unit = (af_unit), \ .type = AF_PIN_TYPE_ ## af_fn ## _ ## af_type, \ .af_fn = (af_ptr) \ } #define PIN(p_port, p_pin, p_af, p_adc_num, p_adc_channel) \ { \ { &pin_type }, \ .name = MP_QSTR_ ## p_port ## p_pin, \ .port = PORT_ ## p_port, \ .pin = (p_pin), \ .num_af = (sizeof(p_af) / sizeof(pin_obj_t)), \ .pin_mask = (1 << ((p_pin) & 0x0f)), \ .gpio = GPIO ## p_port, \ .af = p_af, \ .adc_num = p_adc_num, \ .adc_channel = p_adc_channel, \ }
--- +++ @@ -23,7 +23,7 @@ .name = MP_QSTR_ ## p_port ## p_pin, \ .port = PORT_ ## p_port, \ .pin = (p_pin), \ - .num_af = (sizeof(p_af) / sizeof(pin_obj_t)), \ + .num_af = (sizeof(p_af) / sizeof(pin_af_obj_t)), \ .pin_mask = (1 << ((p_pin) & 0x0f)), \ .gpio = GPIO ## p_port, \ .af = p_af, \
stmhal/boards/stm32fxx_prefix.c: Fix alt function number calculation This prevented pin_find_af* functions from being able to find some of the alternate functions in the pin struct
mit
blmorris/micropython,matthewelse/micropython,pramasoul/micropython,feilongfl/micropython,ceramos/micropython,turbinenreiter/micropython,martinribelotta/micropython,MrSurly/micropython-esp32,stonegithubs/micropython,hiway/micropython,noahchense/micropython,rubencabrera/micropython,dmazzella/micropython,ahotam/micropython,tuc-osg/micropython,hiway/micropython,martinribelotta/micropython,dmazzella/micropython,skybird6672/micropython,drrk/micropython,ruffy91/micropython,dhylands/micropython,HenrikSolver/micropython,HenrikSolver/micropython,redbear/micropython,xyb/micropython,swegener/micropython,henriknelson/micropython,mpalomer/micropython,vitiral/micropython,rubencabrera/micropython,Peetz0r/micropython-esp32,cloudformdesign/micropython,toolmacher/micropython,danicampora/micropython,cloudformdesign/micropython,pozetroninc/micropython,tuc-osg/micropython,swegener/micropython,selste/micropython,noahchense/micropython,henriknelson/micropython,dhylands/micropython,dhylands/micropython,alex-march/micropython,mianos/micropython,danicampora/micropython,ahotam/micropython,cwyark/micropython,tuc-osg/micropython,tdautc19841202/micropython,toolmacher/micropython,TDAbboud/micropython,ruffy91/micropython,noahwilliamsson/micropython,trezor/micropython,pramasoul/micropython,supergis/micropython,emfcamp/micropython,SHA2017-badge/micropython-esp32,ruffy91/micropython,cloudformdesign/micropython,ceramos/micropython,infinnovation/micropython,torwag/micropython,dmazzella/micropython,ChuckM/micropython,galenhz/micropython,mianos/micropython,mianos/micropython,orionrobots/micropython,ernesto-g/micropython,cnoviello/micropython,rubencabrera/micropython,heisewangluo/micropython,xyb/micropython,PappaPeppar/micropython,alex-march/micropython,noahwilliamsson/micropython,kerneltask/micropython,matthewelse/micropython,dxxb/micropython,blazewicz/micropython,mianos/micropython,mgyenik/micropython,SHA2017-badge/micropython-esp32,adamkh/micropython,ChuckM/micropython,omtinez/micropython,AriZuu/micropython,firstval/micropython,blmorris/micropython,firstval/micropython,emfcamp/micropython,swegener/micropython,jlillest/micropython,chrisdearman/micropython,Peetz0r/micropython-esp32,ganshun666/micropython,puuu/micropython,ceramos/micropython,EcmaXp/micropython,oopy/micropython,lbattraw/micropython,tralamazza/micropython,stonegithubs/micropython,ericsnowcurrently/micropython,EcmaXp/micropython,ahotam/micropython,henriknelson/micropython,noahwilliamsson/micropython,drrk/micropython,alex-robbins/micropython,bvernoux/micropython,tralamazza/micropython,turbinenreiter/micropython,ericsnowcurrently/micropython,hiway/micropython,jmarcelino/pycom-micropython,tralamazza/micropython,misterdanb/micropython,lowRISC/micropython,feilongfl/micropython,SHA2017-badge/micropython-esp32,hiway/micropython,kostyll/micropython,dmazzella/micropython,alex-march/micropython,drrk/micropython,praemdonck/micropython,kostyll/micropython,MrSurly/micropython,ryannathans/micropython,AriZuu/micropython,bvernoux/micropython,adafruit/micropython,henriknelson/micropython,alex-robbins/micropython,supergis/micropython,bvernoux/micropython,blazewicz/micropython,henriknelson/micropython,selste/micropython,vriera/micropython,mgyenik/micropython,vitiral/micropython,dinau/micropython,dinau/micropython,lbattraw/micropython,blmorris/micropython,PappaPeppar/micropython,adafruit/micropython,praemdonck/micropython,kostyll/micropython,martinribelotta/micropython,omtinez/micropython,pfalcon/micropython,redbear/micropython,lowRISC/micropython,orionrobots/micropython,supergis/micropython,rubencabrera/micropython,heisewangluo/micropython,orionrobots/micropython,jmarcelino/pycom-micropython,mpalomer/micropython,lowRISC/micropython,emfcamp/micropython,TDAbboud/micropython,ganshun666/micropython,HenrikSolver/micropython,mgyenik/micropython,ganshun666/micropython,kerneltask/micropython,tobbad/micropython,hiway/micropython,ChuckM/micropython,oopy/micropython,tdautc19841202/micropython,alex-robbins/micropython,praemdonck/micropython,adamkh/micropython,firstval/micropython,infinnovation/micropython,EcmaXp/micropython,ruffy91/micropython,pozetroninc/micropython,adafruit/micropython,mpalomer/micropython,galenhz/micropython,ganshun666/micropython,micropython/micropython-esp32,Peetz0r/micropython-esp32,adamkh/micropython,martinribelotta/micropython,jlillest/micropython,pozetroninc/micropython,puuu/micropython,ahotam/micropython,ryannathans/micropython,pfalcon/micropython,firstval/micropython,pozetroninc/micropython,chrisdearman/micropython,jmarcelino/pycom-micropython,bvernoux/micropython,drrk/micropython,chrisdearman/micropython,drrk/micropython,tuc-osg/micropython,xyb/micropython,pfalcon/micropython,xhat/micropython,puuu/micropython,adamkh/micropython,infinnovation/micropython,AriZuu/micropython,omtinez/micropython,tobbad/micropython,xhat/micropython,oopy/micropython,xuxiaoxin/micropython,hosaka/micropython,pozetroninc/micropython,puuu/micropython,MrSurly/micropython-esp32,heisewangluo/micropython,stonegithubs/micropython,martinribelotta/micropython,deshipu/micropython,dxxb/micropython,kerneltask/micropython,toolmacher/micropython,ryannathans/micropython,swegener/micropython,cwyark/micropython,danicampora/micropython,tobbad/micropython,deshipu/micropython,danicampora/micropython,kostyll/micropython,skybird6672/micropython,selste/micropython,adafruit/circuitpython,ernesto-g/micropython,cnoviello/micropython,SHA2017-badge/micropython-esp32,TDAbboud/micropython,alex-robbins/micropython,mgyenik/micropython,AriZuu/micropython,ericsnowcurrently/micropython,misterdanb/micropython,dxxb/micropython,Peetz0r/micropython-esp32,galenhz/micropython,emfcamp/micropython,hosaka/micropython,kerneltask/micropython,noahchense/micropython,chrisdearman/micropython,cwyark/micropython,MrSurly/micropython,kerneltask/micropython,lbattraw/micropython,hosaka/micropython,cnoviello/micropython,HenrikSolver/micropython,ganshun666/micropython,adafruit/circuitpython,TDAbboud/micropython,trezor/micropython,misterdanb/micropython,matthewelse/micropython,redbear/micropython,noahchense/micropython,adamkh/micropython,lbattraw/micropython,omtinez/micropython,hosaka/micropython,utopiaprince/micropython,mianos/micropython,alex-march/micropython,EcmaXp/micropython,xuxiaoxin/micropython,vriera/micropython,torwag/micropython,supergis/micropython,matthewelse/micropython,PappaPeppar/micropython,vitiral/micropython,mhoffma/micropython,pramasoul/micropython,hosaka/micropython,vriera/micropython,jlillest/micropython,Peetz0r/micropython-esp32,jmarcelino/pycom-micropython,cnoviello/micropython,ceramos/micropython,xuxiaoxin/micropython,ceramos/micropython,MrSurly/micropython-esp32,firstval/micropython,vriera/micropython,neilh10/micropython,toolmacher/micropython,puuu/micropython,utopiaprince/micropython,dinau/micropython,adafruit/circuitpython,jmarcelino/pycom-micropython,skybird6672/micropython,ernesto-g/micropython,xuxiaoxin/micropython,deshipu/micropython,HenrikSolver/micropython,MrSurly/micropython-esp32,praemdonck/micropython,micropython/micropython-esp32,oopy/micropython,cwyark/micropython,dhylands/micropython,skybird6672/micropython,turbinenreiter/micropython,noahchense/micropython,pramasoul/micropython,blazewicz/micropython,ChuckM/micropython,trezor/micropython,torwag/micropython,neilh10/micropython,xyb/micropython,turbinenreiter/micropython,dxxb/micropython,adafruit/circuitpython,noahwilliamsson/micropython,trezor/micropython,noahwilliamsson/micropython,supergis/micropython,jlillest/micropython,Timmenem/micropython,misterdanb/micropython,toolmacher/micropython,MrSurly/micropython-esp32,redbear/micropython,blazewicz/micropython,heisewangluo/micropython,emfcamp/micropython,ryannathans/micropython,vitiral/micropython,danicampora/micropython,ernesto-g/micropython,utopiaprince/micropython,xhat/micropython,matthewelse/micropython,tuc-osg/micropython,galenhz/micropython,ruffy91/micropython,cloudformdesign/micropython,selste/micropython,micropython/micropython-esp32,xuxiaoxin/micropython,xhat/micropython,EcmaXp/micropython,ryannathans/micropython,deshipu/micropython,utopiaprince/micropython,xhat/micropython,mhoffma/micropython,lbattraw/micropython,feilongfl/micropython,micropython/micropython-esp32,MrSurly/micropython,deshipu/micropython,vitiral/micropython,MrSurly/micropython,adafruit/micropython,omtinez/micropython,TDAbboud/micropython,dxxb/micropython,cnoviello/micropython,selste/micropython,mhoffma/micropython,alex-march/micropython,skybird6672/micropython,xyb/micropython,mhoffma/micropython,kostyll/micropython,heisewangluo/micropython,blmorris/micropython,dinau/micropython,dhylands/micropython,praemdonck/micropython,cwyark/micropython,trezor/micropython,Timmenem/micropython,cloudformdesign/micropython,ahotam/micropython,neilh10/micropython,mgyenik/micropython,Timmenem/micropython,neilh10/micropython,ericsnowcurrently/micropython,Timmenem/micropython,dinau/micropython,pramasoul/micropython,stonegithubs/micropython,mpalomer/micropython,galenhz/micropython,ericsnowcurrently/micropython,orionrobots/micropython,SHA2017-badge/micropython-esp32,lowRISC/micropython,lowRISC/micropython,utopiaprince/micropython,mhoffma/micropython,tdautc19841202/micropython,PappaPeppar/micropython,tralamazza/micropython,MrSurly/micropython,ernesto-g/micropython,blmorris/micropython,infinnovation/micropython,stonegithubs/micropython,orionrobots/micropython,adafruit/micropython,vriera/micropython,chrisdearman/micropython,feilongfl/micropython,turbinenreiter/micropython,PappaPeppar/micropython,tdautc19841202/micropython,AriZuu/micropython,bvernoux/micropython,rubencabrera/micropython,feilongfl/micropython,ChuckM/micropython,tdautc19841202/micropython,blazewicz/micropython,pfalcon/micropython,misterdanb/micropython,tobbad/micropython,swegener/micropython,alex-robbins/micropython,Timmenem/micropython,neilh10/micropython,tobbad/micropython,redbear/micropython,torwag/micropython,infinnovation/micropython,mpalomer/micropython,jlillest/micropython,matthewelse/micropython,adafruit/circuitpython,pfalcon/micropython,adafruit/circuitpython,micropython/micropython-esp32,oopy/micropython,torwag/micropython
2af846e7114e98c2883061ffbd0e43adc24033d3
/* * Copyright (c) 2017, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * */ #pragma once #include <atomic> #include <string> #include <thread> #include <wangle/concurrent/ThreadFactory.h> #include <folly/Conv.h> #include <folly/Range.h> #include <folly/ThreadName.h> namespace wangle { class NamedThreadFactory : public ThreadFactory { public: explicit NamedThreadFactory(folly::StringPiece prefix) : prefix_(prefix.str()), suffix_(0) {} std::thread newThread(folly::Func&& func) override { auto thread = std::thread(std::move(func)); folly::setThreadName( thread.native_handle(), folly::to<std::string>(prefix_, suffix_++)); return thread; } void setNamePrefix(folly::StringPiece prefix) { prefix_ = prefix.str(); } std::string getNamePrefix() { return prefix_; } private: std::string prefix_; std::atomic<uint64_t> suffix_; }; } // namespace wangle
/* * Copyright (c) 2017, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * */ #pragma once #include <atomic> #include <string> #include <thread> #include <wangle/concurrent/ThreadFactory.h> #include <folly/Conv.h> #include <folly/Range.h> #include <folly/ThreadName.h> namespace wangle { class NamedThreadFactory : public ThreadFactory { public: explicit NamedThreadFactory(folly::StringPiece prefix) : prefix_(prefix.str()), suffix_(0) {} std::thread newThread(folly::Func&& func) override { auto thread = std::thread([&](folly::Func&& funct) { folly::setThreadName(folly::to<std::string>(prefix_, suffix_++)); funct(); }, std::move(func)); return thread; } void setNamePrefix(folly::StringPiece prefix) { prefix_ = prefix.str(); } std::string getNamePrefix() { return prefix_; } private: std::string prefix_; std::atomic<uint64_t> suffix_; }; } // namespace wangle
--- +++ @@ -27,10 +27,10 @@ : prefix_(prefix.str()), suffix_(0) {} std::thread newThread(folly::Func&& func) override { - auto thread = std::thread([&](folly::Func&& funct) { - folly::setThreadName(folly::to<std::string>(prefix_, suffix_++)); - funct(); - }, std::move(func)); + auto thread = std::thread(std::move(func)); + folly::setThreadName( + thread.native_handle(), + folly::to<std::string>(prefix_, suffix_++)); return thread; }
Revert D5012627: [FBCode] Switch various calls to folly::setThreadName to set the current thread's name Summary: This reverts commit a4e6e2c2cb5bd02b1ebea85c305eac59355a7d42 Differential Revision: D5012627 fbshipit-source-id: ff4b8ff94d5f5e76f0777b96d03975d3f7834a17
apache-2.0
facebook/wangle,facebook/wangle,facebook/wangle
9bf27e459fa470bccd07d64ee3e6aad9b49847f4
// RUN: %clang_cc1 -fsyntax-only -verify %s // PR 1603 void func() { const int *arr; arr[0] = 1; // expected-error {{read-only variable is not assignable}} } struct foo { int bar; }; struct foo sfoo = { 0 }; int func2() { const struct foo *fp; fp = &sfoo; fp[0].bar = 1; // expected-error {{read-only variable is not assignable}} return sfoo.bar; }
// RUN: not %clang_cc1_only -c %s -o - > /dev/null // PR 1603 void func() { const int *arr; arr[0] = 1; // expected-error {{assignment of read-only location}} } struct foo { int bar; }; struct foo sfoo = { 0 }; int func2() { const struct foo *fp; fp = &sfoo; fp[0].bar = 1; // expected-error {{ assignment of read-only member}} return sfoo.bar; }
--- +++ @@ -1,9 +1,9 @@ -// RUN: not %clang_cc1_only -c %s -o - > /dev/null +// RUN: %clang_cc1 -fsyntax-only -verify %s // PR 1603 void func() { const int *arr; - arr[0] = 1; // expected-error {{assignment of read-only location}} + arr[0] = 1; // expected-error {{read-only variable is not assignable}} } struct foo { @@ -15,6 +15,6 @@ { const struct foo *fp; fp = &sfoo; - fp[0].bar = 1; // expected-error {{ assignment of read-only member}} + fp[0].bar = 1; // expected-error {{read-only variable is not assignable}} return sfoo.bar; }
Fix a test that hasn't worked since 2007 Due to a missing -verify, 2007-10-01-BuildArrayRef.c was a no-op. The message was changed 5 years ago so also update the test to reflect the new wording. git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@196729 91177308-0d34-0410-b5e6-96231b3b80d8
apache-2.0
llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang
2e2d5d779fa18c98d6affc025dc5fcb122743f4c
typedef struct { int version_num; /* version of this structure */ int cluster; /* Condor Cluster # */ int proc; /* Condor Proc # */ int job_class; /* STANDARD, VANILLA, PVM, PIPE, ... */ uid_t uid; /* Execute job under this UID */ gid_t gid; /* Execute job under this gid */ pid_t virt_pid; /* PVM virt pid of this process */ int soft_kill_sig; /* Use this signal for a soft kill */ char *cmd; /* Command name given by the user */ char *args; /* Command arguments given by the user */ char *env; /* Environment variables */ char *iwd; /* Initial working directory */ BOOLEAN ckpt_wanted; /* Whether user wants checkpointing */ BOOLEAN is_restart; /* Whether this run is a restart */ BOOLEAN coredump_limit_exists; /* Whether user wants to limit core size */ int coredump_limit; /* Limit in bytes */ } STARTUP_INFO; #define STARTUP_VERSION 1 /* Should eliminate starter knowing the a.out name. Should go to shadow for instructions on how to fetch the executable - e.g. local file with name <name> or get it from TCP port <x> on machine <y>. */
typedef struct { int cluster; /* Condor Cluster # */ int proc; /* Condor Proc # */ int job_class; /* STANDARD, VANILLA, PVM, PIPE, ... */ uid_t uid; /* Execute job under this UID */ gid_t gid; /* Execute job under this pid */ pid_t virt_pid; /* PVM virt pid of this process */ int soft_kill_sig; /* Use this signal for a soft kill */ char *a_out_name; /* Where to get executable file */ char *cmd; /* Command name given by the user */ char *args; /* Command arguments given by the user */ char *env; /* Environment variables */ char *iwd; /* Initial working directory */ BOOLEAN ckpt_wanted; /* Whether user wants checkpointing */ BOOLEAN is_restart; /* Whether this run is a restart */ BOOLEAN coredump_limit_exists; /* Whether user wants to limit core size */ int coredump_limit; /* Limit in bytes */ } STARTUP_INFO; /* Should eliminate starter knowing the a.out name. Should go to shadow for instructions on how to fetch the executable - e.g. local file with name <name> or get it from TCP port <x> on machine <y>. */
--- +++ @@ -1,12 +1,12 @@ typedef struct { + int version_num; /* version of this structure */ int cluster; /* Condor Cluster # */ int proc; /* Condor Proc # */ int job_class; /* STANDARD, VANILLA, PVM, PIPE, ... */ uid_t uid; /* Execute job under this UID */ - gid_t gid; /* Execute job under this pid */ + gid_t gid; /* Execute job under this gid */ pid_t virt_pid; /* PVM virt pid of this process */ int soft_kill_sig; /* Use this signal for a soft kill */ - char *a_out_name; /* Where to get executable file */ char *cmd; /* Command name given by the user */ char *args; /* Command arguments given by the user */ char *env; /* Environment variables */ @@ -17,6 +17,8 @@ int coredump_limit; /* Limit in bytes */ } STARTUP_INFO; +#define STARTUP_VERSION 1 + /* Should eliminate starter knowing the a.out name. Should go to shadow for instructions on how to fetch the executable - e.g. local file
Add version number and get rid if a.out name.
apache-2.0
djw8605/htcondor,bbockelm/condor-network-accounting,mambelli/osg-bosco-marco,zhangzhehust/htcondor,djw8605/htcondor,clalancette/condor-dcloud,djw8605/condor,neurodebian/htcondor,htcondor/htcondor,mambelli/osg-bosco-marco,zhangzhehust/htcondor,htcondor/htcondor,djw8605/condor,clalancette/condor-dcloud,zhangzhehust/htcondor,clalancette/condor-dcloud,mambelli/osg-bosco-marco,zhangzhehust/htcondor,htcondor/htcondor,neurodebian/htcondor,zhangzhehust/htcondor,neurodebian/htcondor,djw8605/htcondor,djw8605/condor,djw8605/condor,zhangzhehust/htcondor,djw8605/htcondor,mambelli/osg-bosco-marco,djw8605/condor,neurodebian/htcondor,neurodebian/htcondor,djw8605/condor,neurodebian/htcondor,htcondor/htcondor,djw8605/htcondor,mambelli/osg-bosco-marco,htcondor/htcondor,bbockelm/condor-network-accounting,zhangzhehust/htcondor,bbockelm/condor-network-accounting,neurodebian/htcondor,htcondor/htcondor,clalancette/condor-dcloud,bbockelm/condor-network-accounting,djw8605/condor,djw8605/htcondor,bbockelm/condor-network-accounting,neurodebian/htcondor,djw8605/htcondor,djw8605/condor,bbockelm/condor-network-accounting,clalancette/condor-dcloud,htcondor/htcondor,djw8605/htcondor,bbockelm/condor-network-accounting,djw8605/htcondor,mambelli/osg-bosco-marco,mambelli/osg-bosco-marco,mambelli/osg-bosco-marco,clalancette/condor-dcloud,htcondor/htcondor,neurodebian/htcondor,bbockelm/condor-network-accounting,zhangzhehust/htcondor,zhangzhehust/htcondor,clalancette/condor-dcloud
b5220189bc6a5ec22efa7c6b8ae39bc166303c62
// // BBASearchServiceResult.h // BBBAPI // // Created by Owen Worley on 12/01/2015. // Copyright (c) 2015 Blinkbox Entertainment Ltd. All rights reserved. // #import <Foundation/Foundation.h> @class FEMObjectMapping; /** * Represents data provided from the search service when searching for books */ @interface BBASearchServiceResult : NSObject @property (nonatomic, copy) NSString *type; @property (nonatomic, copy) NSString *identifier; /** * Array of `BBALibraryItemLink` objects */ @property (nonatomic, copy) NSArray *links; @property (nonatomic, assign) NSInteger numberOfResults; @property (nonatomic, copy) NSArray *books; /** * Object mapping to convert server search result to `BBASearchServiceResult` */ + (FEMObjectMapping *) searchServiceResultMapping; @end
// // BBASearchServiceResult.h // BBBAPI // // Created by Owen Worley on 12/01/2015. // Copyright (c) 2015 Blinkbox Entertainment Ltd. All rights reserved. // #import <Foundation/Foundation.h> @class FEMObjectMapping; /** * Represents data provided from the search service when searching for books */ @interface BBASearchServiceResult : NSObject @property (nonatomic, copy) NSString *type; @property (nonatomic, copy) NSString *identifier; @property (nonatomic, copy) NSArray *links; @property (nonatomic, assign) NSInteger numberOfResults; @property (nonatomic, copy) NSArray *books; /** * Object mapping to convert server search result to `BBASearchServiceResult` */ + (FEMObjectMapping *) searchServiceResultMapping; @end
--- +++ @@ -15,6 +15,9 @@ @property (nonatomic, copy) NSString *type; @property (nonatomic, copy) NSString *identifier; +/** + * Array of `BBALibraryItemLink` objects + */ @property (nonatomic, copy) NSArray *links; @property (nonatomic, assign) NSInteger numberOfResults; @property (nonatomic, copy) NSArray *books;
Document contents of Links array
mit
blinkboxbooks/blinkbox-network.objc,blinkboxbooks/blinkbox-network.objc
8ea9c9401cca7ea074d0e85ba57b2ccf42630cd7
#ifndef CONSTANTS_H_ #define CONSTANTS_H_ #include <math.h> // Modify PRIME_FIELD_BINARY_BIT_LENGTH at will #define PRIME_FIELD_BINARY_BIT_LENGTH (131) // Do not modify anything below #define LIMB_SIZE_IN_BITS (64) #define LIMB_SIZE_IN_BYTES (LIMB_SIZE_IN_BITS / 8) #define LIMB_SIZE_IN_HEX (LIMB_SIZE_IN_BITS / 4) #define NUM_LIMBS ((unsigned int) ceil((PRIME_FIELD_BINARY_BIT_LENGTH)/ ((double) LIMB_SIZE_IN_BITS))) #define PRIME_FIELD_FULL_HEX_LENGTH (NUM_LIMBS * LIMB_SIZE_IN_HEX) #if (PRIME_FIELD_BINARY_BIT_LENGTH % LIMB_SIZE_IN_BITS) == 0 #error "PRIME_FIELD_BINARY_BIT_LENGTH must not be a multiple of LIMB_SIZE_IN_BITS" #endif #endif
#ifndef CONSTANTS_H_ #define CONSTANTS_H_ #include <math.h> #define PRIME_FIELD_BINARY_BIT_LENGTH (64) #define LIMB_SIZE_IN_BITS (64) #define LIMB_SIZE_IN_BYTES (LIMB_SIZE_IN_BITS / 8) #define LIMB_SIZE_IN_HEX (LIMB_SIZE_IN_BITS / 4) // +1 is important for basic operations like addition that may overflow to the // next limb #define NUM_LIMBS ((unsigned int) ceil((PRIME_FIELD_BINARY_BIT_LENGTH + 1)/ ((double) LIMB_SIZE_IN_BITS))) #define PRIME_FIELD_FULL_HEX_LENGTH (NUM_LIMBS * LIMB_SIZE_IN_HEX) #endif
--- +++ @@ -3,14 +3,18 @@ #include <math.h> -#define PRIME_FIELD_BINARY_BIT_LENGTH (64) +// Modify PRIME_FIELD_BINARY_BIT_LENGTH at will +#define PRIME_FIELD_BINARY_BIT_LENGTH (131) +// Do not modify anything below #define LIMB_SIZE_IN_BITS (64) #define LIMB_SIZE_IN_BYTES (LIMB_SIZE_IN_BITS / 8) #define LIMB_SIZE_IN_HEX (LIMB_SIZE_IN_BITS / 4) -// +1 is important for basic operations like addition that may overflow to the -// next limb -#define NUM_LIMBS ((unsigned int) ceil((PRIME_FIELD_BINARY_BIT_LENGTH + 1)/ ((double) LIMB_SIZE_IN_BITS))) +#define NUM_LIMBS ((unsigned int) ceil((PRIME_FIELD_BINARY_BIT_LENGTH)/ ((double) LIMB_SIZE_IN_BITS))) #define PRIME_FIELD_FULL_HEX_LENGTH (NUM_LIMBS * LIMB_SIZE_IN_HEX) +#if (PRIME_FIELD_BINARY_BIT_LENGTH % LIMB_SIZE_IN_BITS) == 0 +#error "PRIME_FIELD_BINARY_BIT_LENGTH must not be a multiple of LIMB_SIZE_IN_BITS" #endif + +#endif
Add compile-time check for bit length of prime field
unlicense
sahandKashani/prime-field-arithmetic-AVX2,sahandKashani/prime-field-arithmetic-AVX2,sahandKashani/prime-field-arithmetic-AVX2
dcc03187070b26677f38056ab4f7b3209202a52e
// // UIAlertView+RACCommandSupport.h // ReactiveCocoa // // Created by Henrik Hodne on 6/16/13. // Copyright (c) 2013 GitHub, Inc. All rights reserved. // #import <UIKit/UIKit.h> @class RACCommand; @interface UIAlertView (RACCommandSupport) // Sets the alert view's command. When a button on the alert view is pressed, // the command is executed with the index of the button that was pressed. // // This will override the alert view's delegate, so you can't use this together // with a custom delegate. @property (nonatomic, strong) RACCommand *rac_command; @end
// // UIAlertView+RACCommandSupport.h // ReactiveCocoa // // Created by Henrik Hodne on 6/16/13. // Copyright (c) 2013 GitHub, Inc. All rights reserved. // #import <UIKit/UIKit.h> @class RACCommand; @interface UIAlertView (RACCommandSupport) // Sets the alert view's command. When a button on the alert view is pressed, // the command is executed with the index of the button that was pressed. @property (nonatomic, strong) RACCommand *rac_command; @end
--- +++ @@ -14,6 +14,9 @@ // Sets the alert view's command. When a button on the alert view is pressed, // the command is executed with the index of the button that was pressed. +// +// This will override the alert view's delegate, so you can't use this together +// with a custom delegate. @property (nonatomic, strong) RACCommand *rac_command; @end
Document that UIAlertView.rac_command overrides the delegate
mit
DongDongDongDong/ReactiveCocoa,JohnJin007/ReactiveCocoa,AllanChen/ReactiveCocoa,walkingsmarts/ReactiveCocoa,Pingco/ReactiveCocoa,dz1111/ReactiveCocoa,zhenlove/ReactiveCocoa,brightcove/ReactiveCocoa,jsslai/ReactiveCocoa,Pikdays/ReactiveCocoa,paulyoung/ReactiveCocoa,on99/ReactiveCocoa,xumaolin/ReactiveCocoa,mxxiv/ReactiveCocoa,calebd/ReactiveCocoa,tzongw/ReactiveCocoa,BlessNeo/ReactiveCocoa,valleyman86/ReactiveCocoa,JohnJin007/ReactiveCocoa,on99/ReactiveCocoa,richeterre/ReactiveCocoa,natestedman/ReactiveCocoa,zhaoguohui/ReactiveCocoa,nikita-leonov/ReactiveCocoa,tipbit/ReactiveCocoa,WEIBP/ReactiveCocoa,alvinvarghese/ReactiveCocoa,llb1119/test,xulibao/ReactiveCocoa,nickcheng/ReactiveCocoa,valleyman86/ReactiveCocoa,SuPair/ReactiveCocoa,liufeigit/ReactiveCocoa,zhaoguohui/ReactiveCocoa,libiao88/ReactiveCocoa,monkeydbobo/ReactiveCocoa,howandhao/ReactiveCocoa,Farteen/ReactiveCocoa,RuiAAPeres/ReactiveCocoa,stevielu/ReactiveCocoa,tiger8888/ReactiveCocoa,leichunfeng/ReactiveCocoa,shuxiashusheng/ReactiveCocoa,jrmiddle/ReactiveCocoa,ddc391565320/ReactiveCocoa,mtxs007/ReactiveCocoa,beni55/ReactiveCocoa,zzzworm/ReactiveCocoa,wangqi211/ReactiveCocoa,Ray0218/ReactiveCocoa,qq644531343/ReactiveCocoa,cogddo/ReactiveCocoa,juliangrosshauser/ReactiveCocoa,stupidfive/ReactiveCocoa,OnTheWay1988/ReactiveCocoa,wpstarnice/ReactiveCocoa,yaoxiaoyong/ReactiveCocoa,CQXfly/ReactiveCocoa,200895045/ReactiveCocoa,zhiwen1024/ReactiveCocoa,almassapargali/ReactiveCocoa,msdgwzhy6/ReactiveCocoa,taylormoonxu/ReactiveCocoa,wpstarnice/ReactiveCocoa,jaylib/ReactiveCocoa,yaoxiaoyong/ReactiveCocoa,natan/ReactiveCocoa,WEIBP/ReactiveCocoa,335g/ReactiveCocoa,natan/ReactiveCocoa,hbucius/ReactiveCocoa,kevin-zqw/ReactiveCocoa,paulyoung/ReactiveCocoa,JohnJin007/ReactiveCocoa,Adlai-Holler/ReactiveCocoa,yytong/ReactiveCocoa,itschaitanya/ReactiveCocoa,AndyZhaoHe/ReactiveCocoa,Eveian/ReactiveCocoa,jackywpy/ReactiveCocoa,bensonday/ReactiveCocoa,isghe/ReactiveCocoa,LHDsimon/ReactiveCocoa,almassapargali/ReactiveCocoa,monkeydbobo/ReactiveCocoa,OnTheWay1988/ReactiveCocoa,GuitarPlayer-Ma/ReactiveCocoa,mxxiv/ReactiveCocoa,Khan/ReactiveCocoa,koamac/ReactiveCocoa,goodheart/ReactiveCocoa,hoanganh6491/ReactiveCocoa,calebd/ReactiveCocoa,imkerberos/ReactiveCocoa,335g/ReactiveCocoa,koamac/ReactiveCocoa,jsslai/ReactiveCocoa,SanChain/ReactiveCocoa,kiurentu/ReactiveCocoa,ohwutup/ReactiveCocoa,KuPai32G/ReactiveCocoa,zxq3220122/ReactiveCocoa,Ray0218/ReactiveCocoa,ShawnLeee/ReactiveCocoa,SmartEncounter/ReactiveCocoa,eliperkins/ReactiveCocoa,towik/ReactiveCocoa,KJin99/ReactiveCocoa,taylormoonxu/ReactiveCocoa,Pingco/ReactiveCocoa,SuPair/ReactiveCocoa,RuiAAPeres/ReactiveCocoa,Remitly/ReactiveCocoa,Juraldinio/ReactiveCocoa,nikita-leonov/ReactiveCocoa,andersio/ReactiveCocoa,AlanJN/ReactiveCocoa,PSPDFKit-labs/ReactiveCocoa,Juraldinio/ReactiveCocoa,PSPDFKit-labs/ReactiveCocoa,Khan/ReactiveCocoa,AlanJN/ReactiveCocoa,yoichitgy/ReactiveCocoa,icepy/ReactiveCocoa,victorlin/ReactiveCocoa,kaylio/ReactiveCocoa,ceekayel/ReactiveCocoa,jianwoo/ReactiveCocoa,dz1111/ReactiveCocoa,walkingsmarts/ReactiveCocoa,ailyanlu/ReactiveCocoa,Carthage/ReactiveCocoa,yytong/ReactiveCocoa,sdhzwm/ReactiveCocoa,huiping192/ReactiveCocoa,Farteen/ReactiveCocoa,smilypeda/ReactiveCocoa,CQXfly/ReactiveCocoa,brasbug/ReactiveCocoa,longv2go/ReactiveCocoa,hilllinux/ReactiveCocoa,qq644531343/ReactiveCocoa,windgo/ReactiveCocoa,cstars135/ReactiveCocoa,dachaoisme/ReactiveCocoa,Khan/ReactiveCocoa,chao95957/ReactiveCocoa,Pikdays/ReactiveCocoa,richeterre/ReactiveCocoa,pzw224/ReactiveCocoa,dskatz22/ReactiveCocoa,jrmiddle/ReactiveCocoa,ailyanlu/ReactiveCocoa,xiaoliyang/ReactiveCocoa,JackLian/ReactiveCocoa,victorlin/ReactiveCocoa,ztchena/ReactiveCocoa,yangyangluoluo/ReactiveCocoa,takeshineshiro/ReactiveCocoa,jrmiddle/ReactiveCocoa,pzw224/ReactiveCocoa,Ricowere/ReactiveCocoa,eyu1988/ReactiveCocoa,zhenlove/ReactiveCocoa,lixar/ReactiveCocoa,nickcheng/ReactiveCocoa,zzqiltw/ReactiveCocoa,valleyman86/ReactiveCocoa,clg0118/ReactiveCocoa,nickcheng/ReactiveCocoa,windgo/ReactiveCocoa,natan/ReactiveCocoa,dskatz22/ReactiveCocoa,cstars135/ReactiveCocoa,buildo/ReactiveCocoa,cnbin/ReactiveCocoa,nickcheng/ReactiveCocoa,OneSmallTree/ReactiveCocoa,zhenlove/ReactiveCocoa,SanChain/ReactiveCocoa,zhigang1992/ReactiveCocoa,ioshger0125/ReactiveCocoa,swizzlr/ReactiveCocoa,chao95957/ReactiveCocoa,jeelun/ReactiveCocoa,ohwutup/ReactiveCocoa,xumaolin/ReactiveCocoa,hj3938/ReactiveCocoa,Ray0218/ReactiveCocoa,clg0118/ReactiveCocoa,BrooksWon/ReactiveCocoa,natestedman/ReactiveCocoa,jianwoo/ReactiveCocoa,bensonday/ReactiveCocoa,bencochran/ReactiveCocoa,almassapargali/ReactiveCocoa,taylormoonxu/ReactiveCocoa,isghe/ReactiveCocoa,buildo/ReactiveCocoa,shuxiashusheng/ReactiveCocoa,mtxs007/ReactiveCocoa,dachaoisme/ReactiveCocoa,yizzuide/ReactiveCocoa,sandyway/ReactiveCocoa,jaylib/ReactiveCocoa,KJin99/ReactiveCocoa,wpstarnice/ReactiveCocoa,libiao88/ReactiveCocoa,AlanJN/ReactiveCocoa,eliperkins/ReactiveCocoa,esttorhe/ReactiveCocoa,Liquidsoul/ReactiveCocoa,terry408911/ReactiveCocoa,shaohung001/ReactiveCocoa,jaylib/ReactiveCocoa,bencochran/ReactiveCocoa,andersio/ReactiveCocoa,bscarano/ReactiveCocoa,imkerberos/ReactiveCocoa,bencochran/ReactiveCocoa,walkingsmarts/ReactiveCocoa,cogddo/ReactiveCocoa,ericzhou2008/ReactiveCocoa,hilllinux/ReactiveCocoa,takeshineshiro/ReactiveCocoa,hbucius/ReactiveCocoa,add715/ReactiveCocoa,RuiAAPeres/ReactiveCocoa,Rupert-RR/ReactiveCocoa,loupman/ReactiveCocoa,yoichitgy/ReactiveCocoa,Ricowere/ReactiveCocoa,hoanganh6491/ReactiveCocoa,yonekawa/ReactiveCocoa,zhiwen1024/ReactiveCocoa,juliangrosshauser/ReactiveCocoa,Ethan89/ReactiveCocoa,vincentiss/ReactiveCocoa,jeelun/ReactiveCocoa,kiurentu/ReactiveCocoa,BlessNeo/ReactiveCocoa,Liquidsoul/ReactiveCocoa,tonyarnold/ReactiveCocoa,shuxiashusheng/ReactiveCocoa,fanghao085/ReactiveCocoa,cogddo/ReactiveCocoa,fanghao085/ReactiveCocoa,hilllinux/ReactiveCocoa,tiger8888/ReactiveCocoa,rpowelll/ReactiveCocoa,takeshineshiro/ReactiveCocoa,zhigang1992/ReactiveCocoa,mtxs007/ReactiveCocoa,CQXfly/ReactiveCocoa,Rupert-RR/ReactiveCocoa,tzongw/ReactiveCocoa,jaylib/ReactiveCocoa,brightcove/ReactiveCocoa,gabemdev/ReactiveCocoa,on99/ReactiveCocoa,xiaoliyang/ReactiveCocoa,longv2go/ReactiveCocoa,emodeqidao/ReactiveCocoa,qq644531343/ReactiveCocoa,pzw224/ReactiveCocoa,ikesyo/ReactiveCocoa,OnTheWay1988/ReactiveCocoa,dachaoisme/ReactiveCocoa,xiaobing2007/ReactiveCocoa,chao95957/ReactiveCocoa,tonyli508/ReactiveCocoa,ddc391565320/ReactiveCocoa,liufeigit/ReactiveCocoa,Eveian/ReactiveCocoa,hbucius/ReactiveCocoa,xumaolin/ReactiveCocoa,DongDongDongDong/ReactiveCocoa,Carthage/ReactiveCocoa,Remitly/ReactiveCocoa,kaylio/ReactiveCocoa,Ethan89/ReactiveCocoa,tornade0913/ReactiveCocoa,hoanganh6491/ReactiveCocoa,towik/ReactiveCocoa,smilypeda/ReactiveCocoa,tornade0913/ReactiveCocoa,leelili/ReactiveCocoa,sandyway/ReactiveCocoa,Liquidsoul/ReactiveCocoa,loupman/ReactiveCocoa,FelixYin66/ReactiveCocoa,terry408911/ReactiveCocoa,OneSmallTree/ReactiveCocoa,dskatz22/ReactiveCocoa,FelixYin66/ReactiveCocoa,terry408911/ReactiveCocoa,esttorhe/ReactiveCocoa,mattpetters/ReactiveCocoa,tipbit/ReactiveCocoa,ddc391565320/ReactiveCocoa,sdhzwm/ReactiveCocoa,tonyarnold/ReactiveCocoa,add715/ReactiveCocoa,smilypeda/ReactiveCocoa,zxq3220122/ReactiveCocoa,tzongw/ReactiveCocoa,yizzuide/ReactiveCocoa,LHDsimon/ReactiveCocoa,Carthage/ReactiveCocoa,Farteen/ReactiveCocoa,vincentiss/ReactiveCocoa,GuitarPlayer-Ma/ReactiveCocoa,huiping192/ReactiveCocoa,ShawnLeee/ReactiveCocoa,fhchina/ReactiveCocoa,yangshengchaoios/ReactiveCocoa,jackywpy/ReactiveCocoa,bscarano/ReactiveCocoa,KuPai32G/ReactiveCocoa,bscarano/ReactiveCocoa,gabemdev/ReactiveCocoa,loupman/ReactiveCocoa,xulibao/ReactiveCocoa,Rupert-RR/ReactiveCocoa,alvinvarghese/ReactiveCocoa,eliperkins/ReactiveCocoa,howandhao/ReactiveCocoa,200895045/ReactiveCocoa,tornade0913/ReactiveCocoa,Adlai-Holler/ReactiveCocoa,CCOOOOLL/ReactiveCocoa,Pikdays/ReactiveCocoa,yangyangluoluo/ReactiveCocoa,BrooksWon/ReactiveCocoa,yangyangluoluo/ReactiveCocoa,stevielu/ReactiveCocoa,sdhzwm/ReactiveCocoa,cnbin/ReactiveCocoa,ceekayel/ReactiveCocoa,ztchena/ReactiveCocoa,sujeking/ReactiveCocoa,kevin-zqw/ReactiveCocoa,victorlin/ReactiveCocoa,dullgrass/ReactiveCocoa,jeelun/ReactiveCocoa,ioshger0125/ReactiveCocoa,hj3938/ReactiveCocoa,koamac/ReactiveCocoa,alvinvarghese/ReactiveCocoa,fhchina/ReactiveCocoa,zhiwen1024/ReactiveCocoa,yonekawa/ReactiveCocoa,goodheart/ReactiveCocoa,eyu1988/ReactiveCocoa,ericzhou2008/ReactiveCocoa,cstars135/ReactiveCocoa,DreamHill/ReactiveCocoa,stevielu/ReactiveCocoa,CCOOOOLL/ReactiveCocoa,yonekawa/ReactiveCocoa,isghe/ReactiveCocoa,KuPai32G/ReactiveCocoa,brasbug/ReactiveCocoa,longv2go/ReactiveCocoa,BrooksWon/ReactiveCocoa,335g/ReactiveCocoa,ioshger0125/ReactiveCocoa,zhukaixy/ReactiveCocoa,howandhao/ReactiveCocoa,lixar/ReactiveCocoa,rpowelll/ReactiveCocoa,icepy/ReactiveCocoa,vincentiss/ReactiveCocoa,zhaoguohui/ReactiveCocoa,brasbug/ReactiveCocoa,goodheart/ReactiveCocoa,paulyoung/ReactiveCocoa,200895045/ReactiveCocoa,DongDongDongDong/ReactiveCocoa,clg0118/ReactiveCocoa,jackywpy/ReactiveCocoa,esttorhe/ReactiveCocoa,towik/ReactiveCocoa,fhchina/ReactiveCocoa,zhukaixy/ReactiveCocoa,KJin99/ReactiveCocoa,bensonday/ReactiveCocoa,Adlai-Holler/ReactiveCocoa,jam891/ReactiveCocoa,tiger8888/ReactiveCocoa,tonyli508/ReactiveCocoa,zzzworm/ReactiveCocoa,JackLian/ReactiveCocoa,fanghao085/ReactiveCocoa,rpowelll/ReactiveCocoa,yangshengchaoios/ReactiveCocoa,zxq3220122/ReactiveCocoa,WEIBP/ReactiveCocoa,llb1119/test,itschaitanya/ReactiveCocoa,shaohung001/ReactiveCocoa,PSPDFKit-labs/ReactiveCocoa,emodeqidao/ReactiveCocoa,jianwoo/ReactiveCocoa,ShawnLeee/ReactiveCocoa,libiao88/ReactiveCocoa,buildo/ReactiveCocoa,zzzworm/ReactiveCocoa,shaohung001/ReactiveCocoa,gengjf/ReactiveCocoa,mattpetters/ReactiveCocoa,icepy/ReactiveCocoa,leichunfeng/ReactiveCocoa,jam891/ReactiveCocoa,Pingco/ReactiveCocoa,ericzhou2008/ReactiveCocoa,nikita-leonov/ReactiveCocoa,dullgrass/ReactiveCocoa,CCOOOOLL/ReactiveCocoa,lixar/ReactiveCocoa,yoichitgy/ReactiveCocoa,Eveian/ReactiveCocoa,xiaoliyang/ReactiveCocoa,windgo/ReactiveCocoa,cnbin/ReactiveCocoa,sugar2010/ReactiveCocoa,kaylio/ReactiveCocoa,LHDsimon/ReactiveCocoa,Ricowere/ReactiveCocoa,j364960953/ReactiveCocoa,yangshengchaoios/ReactiveCocoa,gengjf/ReactiveCocoa,luerhouhou/ReactiveCocoa,ReactiveCocoa/ReactiveSwift,Ethan89/ReactiveCocoa,ailyanlu/ReactiveCocoa,leelili/ReactiveCocoa,j364960953/ReactiveCocoa,AndyZhaoHe/ReactiveCocoa,AndyZhaoHe/ReactiveCocoa,GuitarPlayer-Ma/ReactiveCocoa,wangqi211/ReactiveCocoa,OneSmallTree/ReactiveCocoa,chieryw/ReactiveCocoa,yizzuide/ReactiveCocoa,ReactiveCocoa/ReactiveSwift,brightcove/ReactiveCocoa,sujeking/ReactiveCocoa,xiaobing2007/ReactiveCocoa,juliangrosshauser/ReactiveCocoa,tonyli508/ReactiveCocoa,yaoxiaoyong/ReactiveCocoa,swizzlr/ReactiveCocoa,gengjf/ReactiveCocoa,msdgwzhy6/ReactiveCocoa,BlessNeo/ReactiveCocoa,SuPair/ReactiveCocoa,zzqiltw/ReactiveCocoa,natestedman/ReactiveCocoa,DreamHill/ReactiveCocoa,mxxiv/ReactiveCocoa,mattpetters/ReactiveCocoa,ohwutup/ReactiveCocoa,FelixYin66/ReactiveCocoa,huiping192/ReactiveCocoa,j364960953/ReactiveCocoa,monkeydbobo/ReactiveCocoa,sandyway/ReactiveCocoa,luerhouhou/ReactiveCocoa,hj3938/ReactiveCocoa,stupidfive/ReactiveCocoa,richeterre/ReactiveCocoa,zzqiltw/ReactiveCocoa,luerhouhou/ReactiveCocoa,itschaitanya/ReactiveCocoa,JackLian/ReactiveCocoa,leichunfeng/ReactiveCocoa,llb1119/test,sugar2010/ReactiveCocoa,chieryw/ReactiveCocoa,liufeigit/ReactiveCocoa,beni55/ReactiveCocoa,zhukaixy/ReactiveCocoa,huiping192/ReactiveCocoa,Remitly/ReactiveCocoa,dz1111/ReactiveCocoa,Ricowere/ReactiveCocoa,kiurentu/ReactiveCocoa,ceekayel/ReactiveCocoa,esttorhe/ReactiveCocoa,dullgrass/ReactiveCocoa,ztchena/ReactiveCocoa,Juraldinio/ReactiveCocoa,beni55/ReactiveCocoa,wangqi211/ReactiveCocoa,add715/ReactiveCocoa,sugar2010/ReactiveCocoa,ReactiveCocoa/ReactiveSwift,DreamHill/ReactiveCocoa,msdgwzhy6/ReactiveCocoa,chieryw/ReactiveCocoa,calebd/ReactiveCocoa,AllanChen/ReactiveCocoa,tonyarnold/ReactiveCocoa,stupidfive/ReactiveCocoa,emodeqidao/ReactiveCocoa,xiaobing2007/ReactiveCocoa,sujeking/ReactiveCocoa,xulibao/ReactiveCocoa,jam891/ReactiveCocoa,eyu1988/ReactiveCocoa,jsslai/ReactiveCocoa,SanChain/ReactiveCocoa,leelili/ReactiveCocoa,kevin-zqw/ReactiveCocoa,yytong/ReactiveCocoa,andersio/ReactiveCocoa,imkerberos/ReactiveCocoa,zhigang1992/ReactiveCocoa,SmartEncounter/ReactiveCocoa,ikesyo/ReactiveCocoa
98c97486a56452a655471f0be6aa8ecfecc359fe
#ifndef _LINEARLAYOUT_H_ #define _LINEARLAYOUT_H_ #include <Element.h> #include <Command.h> #define FW_VERTICAL 1 #define FW_HORIZONTAL 2 class LinearLayout : public Element { public: LinearLayout(int _direction, int _id = 0) : Element(_id), direction(_direction) { } bool isA(const std::string & className) override { if (className == "LinearLayout") return true; return Element::isA(className); } protected: void create() override { Command c(Command::CREATE_LINEAR_LAYOUT, getParentInternalId(), getInternalId()); c.setValue(direction); sendCommand(c); } private: int direction = FW_VERTICAL; }; #endif
#ifndef _LINEARLAYOUT_H_ #define _LINEARLAYOUT_H_ #include <Element.h> #include <Command.h> #define FW_VERTICAL 1 #define FW_HORIZONTAL 2 class LinearLayout : public Element { public: LinearLayout(int _direction, int _id) : Element(_id), direction(_direction) { } bool isA(const std::string & className) override { if (className == "LinearLayout") return true; return Element::isA(className); } protected: void create() override { Command c(Command::CREATE_LINEAR_LAYOUT, getParentInternalId(), getInternalId()); c.setValue(direction); sendCommand(c); } private: int direction = FW_VERTICAL; }; #endif
--- +++ @@ -9,7 +9,7 @@ class LinearLayout : public Element { public: - LinearLayout(int _direction, int _id) : Element(_id), direction(_direction) { } + LinearLayout(int _direction, int _id = 0) : Element(_id), direction(_direction) { } bool isA(const std::string & className) override {
Add default value to id on constructor
mit
Sometrik/framework,Sometrik/framework,Sometrik/framework
45fb9eb248df779c8fa845dac32bcafd2c129d40
#include <string.h> #include "roman_convert_to_int.h" int roman_convert_to_int(const char *numeral) { const char first_letter = numeral ? *numeral : '?'; switch (first_letter) { case 'I': return 1; case 'V': return 5; case 'X': return 10; case 'L': return 50; case 'C': return 100; case 'D': return 500; case 'M': return 1000; default: return -1; } }
#include <string.h> #include "roman_convert_to_int.h" int roman_convert_to_int(const char *numeral) { if (!numeral) { return -1; } const char first_letter = *numeral; switch (first_letter) { case 'I': return 1; case 'V': return 5; case 'X': return 10; case 'L': return 50; case 'C': return 100; case 'D': return 500; case 'M': return 1000; default: return -1; } }
--- +++ @@ -4,11 +4,7 @@ int roman_convert_to_int(const char *numeral) { - if (!numeral) - { - return -1; - } - const char first_letter = *numeral; + const char first_letter = numeral ? *numeral : '?'; switch (first_letter) { case 'I':
Simplify error handling for missing/unknown numerals
mit
greghaskins/roman-calculator.c
cdb6e95182e874765dd7a51155534111d186d631
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_trmnew.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: ncoden <ncoden@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2015/05/08 12:26:49 by ncoden #+# #+# */ /* Updated: 2015/06/06 16:14:04 by ncoden ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" t_trm *ft_trmnew(void) { t_trm *trm; char *name; if (!(name = ft_envget("TERM"))) return (NULL); if (!(trm = (t_trm *)ft_memalloc(sizeof(t_trm)))) return (NULL); if ((tgetent(NULL, name))) { if (tcgetattr(ft_trmgetout(), &trm->opts) != -1) { trm->inherit_signal = TRUE; return (trm); } } free(trm); return (NULL); }
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_trmnew.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: ncoden <ncoden@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2015/05/08 12:26:49 by ncoden #+# #+# */ /* Updated: 2015/05/30 16:29:30 by ncoden ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" t_trm *ft_trmnew(void) { t_trm *trm; char *name; if (!(name = ft_envget("TERM"))) return (NULL); if (!(trm = (t_trm *)ft_memalloc(sizeof(t_trm)))) return (NULL); if ((tgetent(NULL, name))) { if (tcgetattr(ft_trmgetout(), &trm->opts) != -1) return (trm); } free(trm); return (NULL); }
--- +++ @@ -6,7 +6,7 @@ /* By: ncoden <ncoden@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2015/05/08 12:26:49 by ncoden #+# #+# */ -/* Updated: 2015/05/30 16:29:30 by ncoden ### ########.fr */ +/* Updated: 2015/06/06 16:14:04 by ncoden ### ########.fr */ /* */ /* ************************************************************************** */ @@ -24,7 +24,10 @@ if ((tgetent(NULL, name))) { if (tcgetattr(ft_trmgetout(), &trm->opts) != -1) + { + trm->inherit_signal = TRUE; return (trm); + } } free(trm); return (NULL);
Set trm inherit signals by default
apache-2.0
ncoden/libft
9fc55387986f0979d10370fe2fa313db8776bdea
#ifndef XAPIAND_INCLUDED_SERVER_H #define XAPIAND_INCLUDED_SERVER_H #include <ev++.h> #include "threadpool.h" #include "database.h" const int XAPIAND_HTTP_PORT_DEFAULT = 8880; const int XAPIAND_BINARY_PORT_DEFAULT = 8890; class XapiandServer : public Task { private: ev::dynamic_loop dynamic_loop; ev::loop_ref *loop; ev::sig sig; ev::async quit; ev::io http_io; int http_sock; ev::io binary_io; int binary_sock; DatabasePool database_pool; void bind_http(); void bind_binary(); void io_accept_http(ev::io &watcher, int revents); void io_accept_binary(ev::io &watcher, int revents); void signal_cb(ev::sig &signal, int revents); void quit_cb(ev::async &watcher, int revents); public: XapiandServer(int http_sock_, int binary_sock_, ev::loop_ref *loop_=NULL); ~XapiandServer(); void run(); }; #endif /* XAPIAND_INCLUDED_SERVER_H */
#ifndef XAPIAND_INCLUDED_SERVER_H #define XAPIAND_INCLUDED_SERVER_H #include <ev++.h> #include "threadpool.h" #include "database.h" const int XAPIAND_HTTP_PORT_DEFAULT = 8880; const int XAPIAND_BINARY_PORT_DEFAULT = 8890; class XapiandServer : public Task { private: ev::dynamic_loop loop; ev::sig sig; ev::async quit; ev::io http_io; int http_sock; ev::io binary_io; int binary_sock; DatabasePool database_pool; void bind_http(); void bind_binary(); void io_accept_http(ev::io &watcher, int revents); void io_accept_binary(ev::io &watcher, int revents); void signal_cb(ev::sig &signal, int revents); void quit_cb(ev::async &watcher, int revents); public: XapiandServer(int http_sock_, int binary_sock_); ~XapiandServer(); void run(); }; #endif /* XAPIAND_INCLUDED_SERVER_H */
--- +++ @@ -13,7 +13,8 @@ class XapiandServer : public Task { private: - ev::dynamic_loop loop; + ev::dynamic_loop dynamic_loop; + ev::loop_ref *loop; ev::sig sig; ev::async quit; @@ -35,7 +36,7 @@ void quit_cb(ev::async &watcher, int revents); public: - XapiandServer(int http_sock_, int binary_sock_); + XapiandServer(int http_sock_, int binary_sock_, ev::loop_ref *loop_=NULL); ~XapiandServer(); void run();
Allow passing an event loop to XapianServer
mit
Kronuz/Xapiand,Kronuz/Xapiand,Kronuz/Xapiand,Kronuz/Xapiand,Kronuz/Xapiand,Kronuz/Xapiand
855f14a819774f5417417e7a14938036c4115833
#ifndef MAP_H #define MAP_H #include <vector> #include <map> #include "DelaunayTriangulation.h" #include "Structure.h" #include "QuadTree.h" using pCenterQT = QuadTree<Center*>; // Forward Declaration class Vector2; namespace Noise { namespace Module { class Perlin; } } #endif
#ifndef MAP_H #define MAP_H #include <vector> #include <map> #include "DelaunayTriangulation.h" #include "Structure.h" #include "QuadTree.h" #endif
--- +++ @@ -8,4 +8,16 @@ #include "Structure.h" #include "QuadTree.h" +using pCenterQT = QuadTree<Center*>; + +// Forward Declaration +class Vector2; +namespace Noise +{ + namespace Module + { + class Perlin; + } +} + #endif
Define alias type, forward declaration
mit
utilForever/PolyMapGenerator
05461a9fc72c303f611d0b37cde545c2b0c7bdc2
/* Copyright (c) 2008 Sun Microsystems, Inc. Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef PROBES_MYSQL_H #define PROBES_MYSQL_H #if defined(HAVE_DTRACE) && !defined(DISABLE_DTRACE) #ifdef __linux__ /* On Linux, generated probes header may include C++ header <limits> which conflicts with min and max macros from my_global.h . To fix, temporarily undefine the macros. */ #pragma push_macro("min") #pragma push_macro("max") #undef min #undef max #endif #include "probes_mysql_dtrace.h" #ifdef __linux__ #pragma pop_macro("min") #pragma pop_macro("max") #endif #else /* no dtrace */ #include "probes_mysql_nodtrace.h" #endif #endif /* PROBES_MYSQL_H */
/* Copyright (c) 2008 Sun Microsystems, Inc. Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef PROBES_MYSQL_H #define PROBES_MYSQL_H #include <my_global.h> #if defined(HAVE_DTRACE) && !defined(DISABLE_DTRACE) #include "probes_mysql_dtrace.h" #else #include "probes_mysql_nodtrace.h" #endif #endif /* PROBES_MYSQL_H */
--- +++ @@ -18,12 +18,29 @@ #define PROBES_MYSQL_H -#include <my_global.h> #if defined(HAVE_DTRACE) && !defined(DISABLE_DTRACE) + +#ifdef __linux__ +/* + On Linux, generated probes header may include C++ header + <limits> which conflicts with min and max macros from my_global.h . + To fix, temporarily undefine the macros. +*/ +#pragma push_macro("min") +#pragma push_macro("max") +#undef min +#undef max +#endif + #include "probes_mysql_dtrace.h" -#else + +#ifdef __linux__ +#pragma pop_macro("min") +#pragma pop_macro("max") +#endif + +#else /* no dtrace */ #include "probes_mysql_nodtrace.h" #endif - #endif /* PROBES_MYSQL_H */
Fix build error on Ubuntu 11.10, if systemtap is installed. The error is due to conflict between min/max macros in my_global.h and system header < limits>, indirectly included via generated probes_mysql_dtrace.h Temporarily undefined min/max for the inclusion of the probes_mysq_dtrace.h
lgpl-2.1
ollie314/server,natsys/mariadb_10.2,davidl-zend/zenddbi,ollie314/server,davidl-zend/zenddbi,davidl-zend/zenddbi,ollie314/server,natsys/mariadb_10.2,ollie314/server,natsys/mariadb_10.2,natsys/mariadb_10.2,natsys/mariadb_10.2,davidl-zend/zenddbi,flynn1973/mariadb-aix,ollie314/server,natsys/mariadb_10.2,flynn1973/mariadb-aix,flynn1973/mariadb-aix,ollie314/server,davidl-zend/zenddbi,davidl-zend/zenddbi,natsys/mariadb_10.2,natsys/mariadb_10.2,ollie314/server,flynn1973/mariadb-aix,flynn1973/mariadb-aix,ollie314/server,flynn1973/mariadb-aix,davidl-zend/zenddbi,flynn1973/mariadb-aix,ollie314/server,ollie314/server,davidl-zend/zenddbi,natsys/mariadb_10.2,flynn1973/mariadb-aix,davidl-zend/zenddbi,davidl-zend/zenddbi,natsys/mariadb_10.2,ollie314/server,slanterns/server,davidl-zend/zenddbi,flynn1973/mariadb-aix,natsys/mariadb_10.2,flynn1973/mariadb-aix,flynn1973/mariadb-aix
c0a4377575c734ce8872d804229f852240d5b661
// GBT Player v3.0.9 // // SPDX-License-Identifier: MIT // // Copyright (c) 2022, Antonio Niño Díaz <antonio_nd@outlook.com> #include <gba.h> #include "gbt_player.h" extern const uint8_t *template_data[]; int main(int argc, char *argv[]) { irqInit(); irqEnable(IRQ_VBLANK); gbt_play(template_data, 5); while (1) { VBlankIntrWait(); gbt_update(); } }
// GBT Player v3.0.9 // // SPDX-License-Identifier: MIT // // Copyright (c) 2022, Antonio Niño Díaz <antonio_nd@outlook.com> #include <gba.h> #include <stdio.h> #include "gbt_player.h" extern const uint8_t *template_data[]; int main(int argc, char *argv[]) { irqInit(); irqEnable(IRQ_VBLANK); consoleDemoInit(); iprintf("GBT Player v3.0.9"); gbt_play(template_data, 5); while (1) { VBlankIntrWait(); gbt_update(); } }
--- +++ @@ -5,8 +5,6 @@ // Copyright (c) 2022, Antonio Niño Díaz <antonio_nd@outlook.com> #include <gba.h> - -#include <stdio.h> #include "gbt_player.h" @@ -17,10 +15,6 @@ irqInit(); irqEnable(IRQ_VBLANK); - consoleDemoInit(); - - iprintf("GBT Player v3.0.9"); - gbt_play(template_data, 5); while (1)
gba: Stop using console in demo ROM This makes it easier to analyse the elf map file to look for changes after modifications to GBT Player.
mit
AntonioND/gbt-player,AntonioND/gbt-player,AntonioND/gbt-player
4f76d799edab526b1de4ac24b61c909336b86bb9
@import Base; @import ObjectiveC; BaseClass *getBaseClassObjC(); void useBaseClassObjC(BaseClass *); @interface UserClass : NSObject <BaseProto> @end id <BaseProto> getBaseProtoObjC(); void useBaseProtoObjC(id <BaseProto>); @interface BaseClass (ObjCExtensions) - (void)categoryMethod; @end
@import Base; @import ObjectiveC; BaseClass *getBaseClassObjC(); void useBaseClassObjC(BaseClass *); @interface UserClass : NSObject <BaseProto> @end id <BaseProto> getBaseProtoObjC(); void useBaseProtoObjC(id <BaseProto>);
--- +++ @@ -10,3 +10,8 @@ id <BaseProto> getBaseProtoObjC(); void useBaseProtoObjC(id <BaseProto>); + +@interface BaseClass (ObjCExtensions) +- (void)categoryMethod; +@end +
[ClangImporter] Add a test for ObjC categories on Swift classes. ...that get unified by the importer. Swift SVN r15083
apache-2.0
ken0nek/swift,JGiola/swift,deyton/swift,austinzheng/swift,bitjammer/swift,stephentyrone/swift,airspeedswift/swift,bitjammer/swift,JGiola/swift,glessard/swift,therealbnut/swift,ahoppen/swift,mightydeveloper/swift,allevato/swift,sdulal/swift,ben-ng/swift,codestergit/swift,mightydeveloper/swift,calebd/swift,nathawes/swift,hughbe/swift,MukeshKumarS/Swift,natecook1000/swift,frootloops/swift,uasys/swift,brentdax/swift,gottesmm/swift,swiftix/swift.old,calebd/swift,calebd/swift,SwiftAndroid/swift,ben-ng/swift,tinysun212/swift-windows,swiftix/swift.old,ahoppen/swift,alblue/swift,benlangmuir/swift,IngmarStein/swift,CodaFi/swift,emilstahl/swift,djwbrown/swift,cbrentharris/swift,adrfer/swift,JGiola/swift,OscarSwanros/swift,swiftix/swift.old,ken0nek/swift,atrick/swift,austinzheng/swift,sschiau/swift,russbishop/swift,aschwaighofer/swift,swiftix/swift,parkera/swift,cbrentharris/swift,xedin/swift,karwa/swift,kentya6/swift,KrishMunot/swift,xedin/swift,codestergit/swift,LeoShimonaka/swift,uasys/swift,return/swift,deyton/swift,benlangmuir/swift,austinzheng/swift,adrfer/swift,swiftix/swift.old,adrfer/swift,danielmartin/swift,glessard/swift,bitjammer/swift,ken0nek/swift,rudkx/swift,parkera/swift,uasys/swift,huonw/swift,kentya6/swift,johnno1962d/swift,airspeedswift/swift,nathawes/swift,tinysun212/swift-windows,huonw/swift,tkremenek/swift,swiftix/swift,danielmartin/swift,jopamer/swift,alblue/swift,sdulal/swift,alblue/swift,brentdax/swift,kusl/swift,jopamer/swift,return/swift,MukeshKumarS/Swift,cbrentharris/swift,cbrentharris/swift,jtbandes/swift,shahmishal/swift,sschiau/swift,kperryua/swift,milseman/swift,xwu/swift,JaSpa/swift,Jnosh/swift,tkremenek/swift,parkera/swift,manavgabhawala/swift,tjw/swift,practicalswift/swift,brentdax/swift,khizkhiz/swift,frootloops/swift,kperryua/swift,jtbandes/swift,lorentey/swift,ben-ng/swift,Jnosh/swift,rudkx/swift,bitjammer/swift,kusl/swift,tjw/swift,deyton/swift,hughbe/swift,Ivacker/swift,alblue/swift,stephentyrone/swift,JaSpa/swift,emilstahl/swift,modocache/swift,return/swift,kperryua/swift,brentdax/swift,brentdax/swift,allevato/swift,hooman/swift,emilstahl/swift,huonw/swift,kstaring/swift,hughbe/swift,therealbnut/swift,harlanhaskins/swift,JaSpa/swift,nathawes/swift,jmgc/swift,kperryua/swift,stephentyrone/swift,aschwaighofer/swift,ben-ng/swift,airspeedswift/swift,deyton/swift,MukeshKumarS/Swift,alblue/swift,shahmishal/swift,tkremenek/swift,dduan/swift,LeoShimonaka/swift,therealbnut/swift,tardieu/swift,MukeshKumarS/Swift,milseman/swift,MukeshKumarS/Swift,jtbandes/swift,johnno1962d/swift,kstaring/swift,apple/swift,apple/swift,allevato/swift,kusl/swift,JGiola/swift,shajrawi/swift,danielmartin/swift,slavapestov/swift,hooman/swift,kusl/swift,rudkx/swift,dreamsxin/swift,cbrentharris/swift,return/swift,IngmarStein/swift,khizkhiz/swift,kusl/swift,swiftix/swift.old,gottesmm/swift,felix91gr/swift,therealbnut/swift,gregomni/swift,kusl/swift,SwiftAndroid/swift,karwa/swift,OscarSwanros/swift,kusl/swift,austinzheng/swift,Ivacker/swift,amraboelela/swift,tardieu/swift,ben-ng/swift,arvedviehweger/swift,shahmishal/swift,natecook1000/swift,gregomni/swift,swiftix/swift.old,gribozavr/swift,LeoShimonaka/swift,jmgc/swift,arvedviehweger/swift,aschwaighofer/swift,karwa/swift,JaSpa/swift,gribozavr/swift,jmgc/swift,zisko/swift,deyton/swift,practicalswift/swift,ahoppen/swift,jmgc/swift,benlangmuir/swift,sschiau/swift,sschiau/swift,allevato/swift,CodaFi/swift,xwu/swift,mightydeveloper/swift,natecook1000/swift,LeoShimonaka/swift,tardieu/swift,uasys/swift,kentya6/swift,CodaFi/swift,karwa/swift,jtbandes/swift,shajrawi/swift,harlanhaskins/swift,Jnosh/swift,jckarter/swift,aschwaighofer/swift,benlangmuir/swift,hooman/swift,swiftix/swift.old,jopamer/swift,harlanhaskins/swift,tkremenek/swift,kstaring/swift,harlanhaskins/swift,tkremenek/swift,roambotics/swift,dduan/swift,adrfer/swift,roambotics/swift,felix91gr/swift,milseman/swift,swiftix/swift,CodaFi/swift,manavgabhawala/swift,felix91gr/swift,jopamer/swift,jckarter/swift,russbishop/swift,djwbrown/swift,tjw/swift,dduan/swift,swiftix/swift,apple/swift,johnno1962d/swift,ben-ng/swift,OscarSwanros/swift,parkera/swift,kentya6/swift,frootloops/swift,KrishMunot/swift,glessard/swift,jckarter/swift,aschwaighofer/swift,swiftix/swift,KrishMunot/swift,kstaring/swift,kperryua/swift,devincoughlin/swift,tardieu/swift,cbrentharris/swift,frootloops/swift,roambotics/swift,emilstahl/swift,dduan/swift,karwa/swift,aschwaighofer/swift,zisko/swift,danielmartin/swift,lorentey/swift,OscarSwanros/swift,adrfer/swift,OscarSwanros/swift,nathawes/swift,IngmarStein/swift,shahmishal/swift,johnno1962d/swift,xedin/swift,bitjammer/swift,roambotics/swift,stephentyrone/swift,shajrawi/swift,russbishop/swift,gmilos/swift,practicalswift/swift,LeoShimonaka/swift,apple/swift,karwa/swift,SwiftAndroid/swift,sdulal/swift,karwa/swift,glessard/swift,SwiftAndroid/swift,JaSpa/swift,ken0nek/swift,parkera/swift,airspeedswift/swift,practicalswift/swift,jopamer/swift,dduan/swift,practicalswift/swift,huonw/swift,modocache/swift,austinzheng/swift,swiftix/swift,manavgabhawala/swift,uasys/swift,slavapestov/swift,xwu/swift,djwbrown/swift,johnno1962d/swift,MukeshKumarS/Swift,cbrentharris/swift,gottesmm/swift,IngmarStein/swift,lorentey/swift,devincoughlin/swift,khizkhiz/swift,parkera/swift,therealbnut/swift,modocache/swift,gmilos/swift,gribozavr/swift,ben-ng/swift,kstaring/swift,gottesmm/swift,shajrawi/swift,shahmishal/swift,Jnosh/swift,IngmarStein/swift,jckarter/swift,shajrawi/swift,sdulal/swift,devincoughlin/swift,parkera/swift,jtbandes/swift,slavapestov/swift,codestergit/swift,mightydeveloper/swift,gregomni/swift,natecook1000/swift,allevato/swift,stephentyrone/swift,bitjammer/swift,jckarter/swift,gregomni/swift,shajrawi/swift,JaSpa/swift,sschiau/swift,emilstahl/swift,dduan/swift,natecook1000/swift,airspeedswift/swift,sschiau/swift,lorentey/swift,zisko/swift,hooman/swift,sdulal/swift,nathawes/swift,tardieu/swift,tinysun212/swift-windows,LeoShimonaka/swift,jmgc/swift,djwbrown/swift,hooman/swift,milseman/swift,jckarter/swift,ahoppen/swift,atrick/swift,harlanhaskins/swift,russbishop/swift,sdulal/swift,amraboelela/swift,Ivacker/swift,shajrawi/swift,brentdax/swift,tardieu/swift,glessard/swift,benlangmuir/swift,modocache/swift,xedin/swift,allevato/swift,modocache/swift,tinysun212/swift-windows,return/swift,tkremenek/swift,amraboelela/swift,shajrawi/swift,khizkhiz/swift,jmgc/swift,apple/swift,huonw/swift,devincoughlin/swift,nathawes/swift,frootloops/swift,tardieu/swift,devincoughlin/swift,johnno1962d/swift,ken0nek/swift,ahoppen/swift,lorentey/swift,atrick/swift,danielmartin/swift,deyton/swift,return/swift,arvedviehweger/swift,calebd/swift,practicalswift/swift,calebd/swift,emilstahl/swift,cbrentharris/swift,gottesmm/swift,russbishop/swift,mightydeveloper/swift,huonw/swift,adrfer/swift,calebd/swift,devincoughlin/swift,slavapestov/swift,xwu/swift,kentya6/swift,kperryua/swift,russbishop/swift,LeoShimonaka/swift,Ivacker/swift,devincoughlin/swift,amraboelela/swift,kusl/swift,JGiola/swift,xedin/swift,felix91gr/swift,codestergit/swift,hughbe/swift,xedin/swift,felix91gr/swift,gmilos/swift,khizkhiz/swift,huonw/swift,deyton/swift,shahmishal/swift,codestergit/swift,Ivacker/swift,LeoShimonaka/swift,natecook1000/swift,gribozavr/swift,djwbrown/swift,KrishMunot/swift,parkera/swift,Ivacker/swift,khizkhiz/swift,tjw/swift,glessard/swift,mightydeveloper/swift,apple/swift,KrishMunot/swift,sdulal/swift,tinysun212/swift-windows,devincoughlin/swift,gmilos/swift,danielmartin/swift,stephentyrone/swift,kstaring/swift,therealbnut/swift,alblue/swift,tjw/swift,JGiola/swift,dduan/swift,arvedviehweger/swift,modocache/swift,slavapestov/swift,zisko/swift,kentya6/swift,gmilos/swift,manavgabhawala/swift,uasys/swift,Jnosh/swift,practicalswift/swift,KrishMunot/swift,xedin/swift,milseman/swift,brentdax/swift,jtbandes/swift,jtbandes/swift,airspeedswift/swift,swiftix/swift.old,tjw/swift,ken0nek/swift,modocache/swift,mightydeveloper/swift,arvedviehweger/swift,rudkx/swift,Jnosh/swift,airspeedswift/swift,bitjammer/swift,xwu/swift,atrick/swift,aschwaighofer/swift,djwbrown/swift,karwa/swift,gribozavr/swift,JaSpa/swift,rudkx/swift,nathawes/swift,sschiau/swift,shahmishal/swift,gmilos/swift,SwiftAndroid/swift,IngmarStein/swift,hughbe/swift,frootloops/swift,dreamsxin/swift,stephentyrone/swift,gregomni/swift,tjw/swift,harlanhaskins/swift,felix91gr/swift,amraboelela/swift,gottesmm/swift,johnno1962d/swift,ahoppen/swift,kentya6/swift,russbishop/swift,frootloops/swift,hooman/swift,tkremenek/swift,SwiftAndroid/swift,danielmartin/swift,swiftix/swift,amraboelela/swift,jopamer/swift,arvedviehweger/swift,zisko/swift,harlanhaskins/swift,jckarter/swift,kperryua/swift,emilstahl/swift,roambotics/swift,natecook1000/swift,atrick/swift,practicalswift/swift,slavapestov/swift,ken0nek/swift,amraboelela/swift,return/swift,alblue/swift,xedin/swift,zisko/swift,gribozavr/swift,hooman/swift,CodaFi/swift,jmgc/swift,Jnosh/swift,austinzheng/swift,slavapestov/swift,arvedviehweger/swift,Ivacker/swift,SwiftAndroid/swift,OscarSwanros/swift,hughbe/swift,mightydeveloper/swift,roambotics/swift,gmilos/swift,felix91gr/swift,uasys/swift,zisko/swift,kstaring/swift,IngmarStein/swift,CodaFi/swift,allevato/swift,gregomni/swift,MukeshKumarS/Swift,hughbe/swift,khizkhiz/swift,manavgabhawala/swift,manavgabhawala/swift,sdulal/swift,adrfer/swift,codestergit/swift,shahmishal/swift,atrick/swift,OscarSwanros/swift,calebd/swift,KrishMunot/swift,gribozavr/swift,milseman/swift,emilstahl/swift,lorentey/swift,lorentey/swift,tinysun212/swift-windows,sschiau/swift,kentya6/swift,xwu/swift,benlangmuir/swift,therealbnut/swift,jopamer/swift,CodaFi/swift,rudkx/swift,manavgabhawala/swift,gottesmm/swift,tinysun212/swift-windows,xwu/swift,Ivacker/swift,austinzheng/swift,lorentey/swift,gribozavr/swift,codestergit/swift,djwbrown/swift,milseman/swift
a356bd07150e558e19cead5eaa9d11e78b7842cb
#include <stdlib.h> #include "py/lexer.h" #include "py/runtime.h" #include "py/mperrno.h" #include "memzip.h" mp_lexer_t *mp_lexer_new_from_file(const char *filename) { void *data; size_t len; if (memzip_locate(filename, &data, &len) != MZ_OK) { mp_raise_OSError(MP_ENOENT); } return mp_lexer_new_from_str_len(qstr_from_str(filename), (const char *)data, (mp_uint_t)len, 0); }
#include <stdlib.h> #include "py/lexer.h" #include "memzip.h" mp_lexer_t *mp_lexer_new_from_file(const char *filename) { void *data; size_t len; if (memzip_locate(filename, &data, &len) != MZ_OK) { return NULL; } return mp_lexer_new_from_str_len(qstr_from_str(filename), (const char *)data, (mp_uint_t)len, 0); }
--- +++ @@ -1,6 +1,8 @@ #include <stdlib.h> #include "py/lexer.h" +#include "py/runtime.h" +#include "py/mperrno.h" #include "memzip.h" mp_lexer_t *mp_lexer_new_from_file(const char *filename) @@ -9,7 +11,7 @@ size_t len; if (memzip_locate(filename, &data, &len) != MZ_OK) { - return NULL; + mp_raise_OSError(MP_ENOENT); } return mp_lexer_new_from_str_len(qstr_from_str(filename), (const char *)data, (mp_uint_t)len, 0);
lib/memzip: Make lexer constructor raise exception when file not found.
mit
blazewicz/micropython,cwyark/micropython,infinnovation/micropython,selste/micropython,cwyark/micropython,bvernoux/micropython,PappaPeppar/micropython,pozetroninc/micropython,chrisdearman/micropython,henriknelson/micropython,AriZuu/micropython,MrSurly/micropython,micropython/micropython-esp32,torwag/micropython,Peetz0r/micropython-esp32,MrSurly/micropython-esp32,pramasoul/micropython,alex-robbins/micropython,deshipu/micropython,toolmacher/micropython,adafruit/circuitpython,deshipu/micropython,adafruit/circuitpython,adafruit/circuitpython,hiway/micropython,ryannathans/micropython,selste/micropython,adafruit/circuitpython,infinnovation/micropython,dmazzella/micropython,toolmacher/micropython,HenrikSolver/micropython,adafruit/circuitpython,tobbad/micropython,oopy/micropython,MrSurly/micropython-esp32,MrSurly/micropython-esp32,Peetz0r/micropython-esp32,adafruit/micropython,micropython/micropython-esp32,torwag/micropython,henriknelson/micropython,AriZuu/micropython,kerneltask/micropython,micropython/micropython-esp32,pozetroninc/micropython,toolmacher/micropython,torwag/micropython,HenrikSolver/micropython,AriZuu/micropython,swegener/micropython,lowRISC/micropython,alex-robbins/micropython,bvernoux/micropython,swegener/micropython,HenrikSolver/micropython,SHA2017-badge/micropython-esp32,pramasoul/micropython,chrisdearman/micropython,micropython/micropython-esp32,deshipu/micropython,kerneltask/micropython,puuu/micropython,AriZuu/micropython,tralamazza/micropython,alex-robbins/micropython,infinnovation/micropython,torwag/micropython,selste/micropython,henriknelson/micropython,trezor/micropython,oopy/micropython,pfalcon/micropython,puuu/micropython,Peetz0r/micropython-esp32,alex-robbins/micropython,oopy/micropython,AriZuu/micropython,puuu/micropython,cwyark/micropython,blazewicz/micropython,henriknelson/micropython,hiway/micropython,adafruit/micropython,trezor/micropython,PappaPeppar/micropython,hiway/micropython,TDAbboud/micropython,swegener/micropython,Timmenem/micropython,PappaPeppar/micropython,infinnovation/micropython,SHA2017-badge/micropython-esp32,MrSurly/micropython,pfalcon/micropython,infinnovation/micropython,trezor/micropython,pfalcon/micropython,Peetz0r/micropython-esp32,Timmenem/micropython,trezor/micropython,tralamazza/micropython,swegener/micropython,blazewicz/micropython,ryannathans/micropython,SHA2017-badge/micropython-esp32,micropython/micropython-esp32,kerneltask/micropython,SHA2017-badge/micropython-esp32,TDAbboud/micropython,lowRISC/micropython,adafruit/circuitpython,pozetroninc/micropython,adafruit/micropython,ryannathans/micropython,lowRISC/micropython,tobbad/micropython,pramasoul/micropython,bvernoux/micropython,MrSurly/micropython-esp32,kerneltask/micropython,adafruit/micropython,bvernoux/micropython,Timmenem/micropython,tralamazza/micropython,selste/micropython,puuu/micropython,deshipu/micropython,MrSurly/micropython,hiway/micropython,blazewicz/micropython,dmazzella/micropython,torwag/micropython,Timmenem/micropython,TDAbboud/micropython,swegener/micropython,tobbad/micropython,pfalcon/micropython,kerneltask/micropython,Peetz0r/micropython-esp32,chrisdearman/micropython,TDAbboud/micropython,MrSurly/micropython,cwyark/micropython,SHA2017-badge/micropython-esp32,oopy/micropython,pfalcon/micropython,hiway/micropython,HenrikSolver/micropython,ryannathans/micropython,henriknelson/micropython,lowRISC/micropython,PappaPeppar/micropython,chrisdearman/micropython,toolmacher/micropython,lowRISC/micropython,pozetroninc/micropython,pozetroninc/micropython,blazewicz/micropython,MrSurly/micropython,ryannathans/micropython,pramasoul/micropython,toolmacher/micropython,puuu/micropython,chrisdearman/micropython,tobbad/micropython,deshipu/micropython,pramasoul/micropython,TDAbboud/micropython,trezor/micropython,PappaPeppar/micropython,HenrikSolver/micropython,dmazzella/micropython,MrSurly/micropython-esp32,dmazzella/micropython,oopy/micropython,cwyark/micropython,Timmenem/micropython,alex-robbins/micropython,selste/micropython,bvernoux/micropython,tralamazza/micropython,adafruit/micropython,tobbad/micropython
41b1df604617bdde59bb722b9247c16fa4677d94
#ifndef HL7PARSER_CONFIG_H #define HL7PARSER_CONFIG_H /** * \file config.h * * Generic configuration directives and macros used by the HL7 parser. * * \internal * Copyright (c) 2003-2011 \b Erlar (http://erlar.com) */ /* ------------------------------------------------------------------------ Headers ------------------------------------------------------------------------ */ #include <hl7parser/bool.h> #include <assert.h> /* ------------------------------------------------------------------------ Macros ------------------------------------------------------------------------ */ /* Macros used when the library is included in a C++ project. */ #ifdef __cplusplus # define BEGIN_C_DECL() extern "C" { # define END_C_DECL() } #else # define BEGIN_C_DECL() # define END_C_DECL() #endif /* __cplusplus */ /** * \def HL7_ASSERT( p ) * Asserts that the predicate \a p is true; if not it aborts the program * showing the predicate, file and line number where the assertion failed. */ #define HL7_ASSERT( p ) assert( p ) #ifdef __GNUC__ #define HL7_UNUSED __attribute__ ((__unused__)) #else #define HL7_UNUSED #endif #endif /* HL7PARSER_CONFIG_H */
#ifndef HL7PARSER_CONFIG_H #define HL7PARSER_CONFIG_H /** * \file config.h * * Generic configuration directives and macros used by the HL7 parser. * * \internal * Copyright (c) 2003-2011 \b Erlar (http://erlar.com) */ /* ------------------------------------------------------------------------ Headers ------------------------------------------------------------------------ */ #include <hl7parser/bool.h> #include <assert.h> /* ------------------------------------------------------------------------ Macros ------------------------------------------------------------------------ */ /* Macros used when the library is included in a C++ project. */ #ifdef __cplusplus # define BEGIN_C_DECL() extern "C" { # define END_C_DECL() } #else # define BEGIN_C_DECL() # define END_C_DECL() #endif /* __cplusplus */ /** * \def HL7_ASSERT( p ) * Asserts that the predicate \a p is true; if not it aborts the program * showing the predicate, file and line number where the assertion failed. */ #define HL7_ASSERT( p ) assert( p ) #endif /* HL7PARSER_CONFIG_H */
--- +++ @@ -42,5 +42,10 @@ */ #define HL7_ASSERT( p ) assert( p ) +#ifdef __GNUC__ +#define HL7_UNUSED __attribute__ ((__unused__)) +#else +#define HL7_UNUSED +#endif #endif /* HL7PARSER_CONFIG_H */
Add attribute for unused arguments
apache-2.0
jcomellas/hl7parser,jcomellas/hl7parser,jcomellas/hl7parser
e09d9db1a20d9e93bdb568975f26687b94ba7f7e
/* * detab: Replace tabs with blanks. */ #include <stdio.h> #define TABSIZE 8 /* detab: Replace tabs with blanks. */ int main(void) { int ch, i; for (i = 0; (ch = getchar()) != EOF; i++) { if (ch == '\n') i = 0; if (ch == '\t') { putchar(' '); while (i % TABSIZE) { putchar(' '); i++; } } else putchar(ch); } return 0; }
/* * detab: Replace tabs with blanks. */ #include <stdio.h> #define MAXLINE 10000 /* Max input line length. */ #define TABSTOP 8 /* Set tab stop to eight characters. */ int getaline(char *, int); void detab(char *); /* detab: Replace tabs with blanks. */ int main(void) { char line[MAXLINE]; /* Current input line. */ while (getaline(line, MAXLINE) > 0) { detab(line); printf("%s", line); } return 0; } /* getaline: Read a line into `s'; return length. */ int getaline(char *s, int lim) { int c, i; c = 0; for (i = 0; i < lim - 1 && (c = getchar()) != EOF && c != '\n'; ++i) s[i] = c; if (c == '\n') s[i++] = c; s[i] = '\0'; return i; } /* detab: Replace tabs with blanks. */ void detab(char *s) { int i, j; for (i = 0; s[i] != '\0'; ++i) { if (s[i] == '\t') { for (j = 0; j <= (i % TABSTOP + TABSTOP); ++j) s[i + j] = ' '; i += j; } } }
--- +++ @@ -4,54 +4,26 @@ #include <stdio.h> -#define MAXLINE 10000 /* Max input line length. */ -#define TABSTOP 8 /* Set tab stop to eight characters. */ - -int getaline(char *, int); -void detab(char *); +#define TABSIZE 8 /* detab: Replace tabs with blanks. */ int main(void) { - char line[MAXLINE]; /* Current input line. */ + int ch, i; - while (getaline(line, MAXLINE) > 0) { - detab(line); - printf("%s", line); + for (i = 0; (ch = getchar()) != EOF; i++) { + if (ch == '\n') + i = 0; + if (ch == '\t') { + putchar(' '); + while (i % TABSIZE) { + putchar(' '); + i++; + } + } else + putchar(ch); } return 0; } - -/* getaline: Read a line into `s'; return length. */ -int -getaline(char *s, int lim) -{ - int c, i; - - c = 0; - - for (i = 0; i < lim - 1 && (c = getchar()) != EOF && c != '\n'; ++i) - s[i] = c; - if (c == '\n') - s[i++] = c; - s[i] = '\0'; - - return i; -} - -/* detab: Replace tabs with blanks. */ -void -detab(char *s) -{ - int i, j; - - for (i = 0; s[i] != '\0'; ++i) { - if (s[i] == '\t') { - for (j = 0; j <= (i % TABSTOP + TABSTOP); ++j) - s[i + j] = ' '; - i += j; - } - } -}
Make detab actually work reliably.
isc
chettrick/tcpl
c2b83606e10756537cdbeb528815808a810460d8
/** * \file os_rmdir.c * \brief Remove a subdirectory. * \author Copyright (c) 2002-2013 Jason Perkins and the Premake project */ #include <stdlib.h> #include "premake.h" int os_rmdir(lua_State* L) { int z; const char* path = luaL_checkstring(L, 1); #if PLATFORM_WINDOWS z = RemoveDirectory(path); #else z = (0 == rmdir(path)); #endif if (!z) { lua_pushnil(L); lua_pushfstring(L, "unable to remove directory '%s'", path); return 2; } else { lua_pushboolean(L, 1); return 1; } }
/** * \file os_rmdir.c * \brief Remove a subdirectory. * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project */ #include <stdlib.h> #include "premake.h" int os_rmdir(lua_State* L) { int z; const char* path = luaL_checkstring(L, 1); #if PLATFORM_WINDOWS z = RemoveDirectory(path); #else z = rmdir(path); #endif if (!z) { lua_pushnil(L); lua_pushfstring(L, "unable to remove directory '%s'", path); return 2; } else { lua_pushboolean(L, 1); return 1; } }
--- +++ @@ -1,7 +1,7 @@ /** * \file os_rmdir.c * \brief Remove a subdirectory. - * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project + * \author Copyright (c) 2002-2013 Jason Perkins and the Premake project */ #include <stdlib.h> @@ -16,7 +16,7 @@ #if PLATFORM_WINDOWS z = RemoveDirectory(path); #else - z = rmdir(path); + z = (0 == rmdir(path)); #endif if (!z)
Fix error result handling in os.rmdir()
bsd-3-clause
premake/premake-4.x,soundsrc/premake-stable,ryanjmulder/premake-4.x,lizh06/premake-4.x,ryanjmulder/premake-4.x,soundsrc/premake-stable,premake/premake-4.x,lizh06/premake-4.x,premake/premake-4.x,soundsrc/premake-stable,ryanjmulder/premake-4.x,premake/premake-4.x,soundsrc/premake-stable,lizh06/premake-4.x,lizh06/premake-4.x,ryanjmulder/premake-4.x
20fd5a0c28f49618218d3c8d43c742fbab68edf0
/* Copyright (C) 2003 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <ndb_global.h> #include <my_sys.h> #include <NdbSleep.h> int NdbSleep_MilliSleep(int milliseconds){ my_sleep(milliseconds*1000); return 0; #if 0 int result = 0; struct timespec sleeptime; sleeptime.tv_sec = milliseconds / 1000; sleeptime.tv_nsec = (milliseconds - (sleeptime.tv_sec * 1000)) * 1000000; result = nanosleep(&sleeptime, NULL); return result; #endif } int NdbSleep_SecSleep(int seconds){ int result = 0; result = sleep(seconds); return result; }
/* Copyright (C) 2003 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <ndb_global.h> #include <NdbSleep.h> int NdbSleep_MilliSleep(int milliseconds){ int result = 0; struct timespec sleeptime; sleeptime.tv_sec = milliseconds / 1000; sleeptime.tv_nsec = (milliseconds - (sleeptime.tv_sec * 1000)) * 1000000; result = nanosleep(&sleeptime, NULL); return result; } int NdbSleep_SecSleep(int seconds){ int result = 0; result = sleep(seconds); return result; }
--- +++ @@ -16,16 +16,21 @@ #include <ndb_global.h> +#include <my_sys.h> #include <NdbSleep.h> int NdbSleep_MilliSleep(int milliseconds){ + my_sleep(milliseconds*1000); + return 0; +#if 0 int result = 0; struct timespec sleeptime; sleeptime.tv_sec = milliseconds / 1000; sleeptime.tv_nsec = (milliseconds - (sleeptime.tv_sec * 1000)) * 1000000; result = nanosleep(&sleeptime, NULL); return result; +#endif } int
Use my_sleep instead of nanosleep for portability
lgpl-2.1
ollie314/server,davidl-zend/zenddbi,flynn1973/mariadb-aix,flynn1973/mariadb-aix,davidl-zend/zenddbi,flynn1973/mariadb-aix,natsys/mariadb_10.2,ollie314/server,davidl-zend/zenddbi,ollie314/server,flynn1973/mariadb-aix,davidl-zend/zenddbi,natsys/mariadb_10.2,ollie314/server,davidl-zend/zenddbi,flynn1973/mariadb-aix,natsys/mariadb_10.2,flynn1973/mariadb-aix,ollie314/server,flynn1973/mariadb-aix,natsys/mariadb_10.2,flynn1973/mariadb-aix,davidl-zend/zenddbi,ollie314/server,natsys/mariadb_10.2,natsys/mariadb_10.2,davidl-zend/zenddbi,natsys/mariadb_10.2,slanterns/server,ollie314/server,natsys/mariadb_10.2,natsys/mariadb_10.2,flynn1973/mariadb-aix,natsys/mariadb_10.2,ollie314/server,davidl-zend/zenddbi,davidl-zend/zenddbi,ollie314/server,flynn1973/mariadb-aix,ollie314/server,natsys/mariadb_10.2,ollie314/server,davidl-zend/zenddbi,flynn1973/mariadb-aix,davidl-zend/zenddbi
837f1bd12b5c80446bf0ee243303c66d37c6a69e