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
/** * Win32 EntropySource Header File * (C) 1999-2008 Jack Lloyd */ #ifndef BOTAN_ENTROPY_SRC_WIN32_H__ #define BOTAN_ENTROPY_SRC_WIN32_H__ #include <botan/entropy_src.h> namespace Botan { /** * Win32 Entropy Source */ class BOTAN_DLL Win32_EntropySource : public EntropySource { public: std::string name() const { return "Win32 Statistics"; } u32bit fast_poll(byte buf[], u32bit length); u32bit slow_poll(byte buf[], u32bit length); }; } #endif
/** * Win32 EntropySource Header File * (C) 1999-2008 Jack Lloyd */ #ifndef BOTAN_ENTROPY_SRC_WIN32_H__ #define BOTAN_ENTROPY_SRC_WIN32_H__ #include <botan/entropy_src.h> namespace Botan { /** * Win32 Entropy Source */ class BOTAN_DLL Win32_EntropySource : public EntropySource { public: std::string name() const { return "Win32 Statistics"; } void fast_poll(byte buf[], u32bit length); void slow_poll(byte buf[], u32bit length); }; } #endif
--- +++ @@ -17,8 +17,9 @@ { public: std::string name() const { return "Win32 Statistics"; } - void fast_poll(byte buf[], u32bit length); - void slow_poll(byte buf[], u32bit length); + + u32bit fast_poll(byte buf[], u32bit length); + u32bit slow_poll(byte buf[], u32bit length); }; }
Fix return types in declaration
bsd-2-clause
webmaster128/botan,randombit/botan,randombit/botan,Rohde-Schwarz-Cybersecurity/botan,webmaster128/botan,Rohde-Schwarz-Cybersecurity/botan,randombit/botan,Rohde-Schwarz-Cybersecurity/botan,Rohde-Schwarz-Cybersecurity/botan,randombit/botan,webmaster128/botan,Rohde-Schwarz-Cybersecurity/botan,randombit/botan,Rohde-Schwarz-Cybersecurity/botan,webmaster128/botan,webmaster128/botan
cf1dc543f142263917468c19249d6a3e920b17b2
#include <stdio.h> #include <stdlib.h> #include "../brk.h" #include <unistd.h> #include "clock.h" #define MIN_ALLOC (1024) #define HEADER_SIZE (16) int main(int argc, char *argv[]) { void **ptrs; long num; long i; int small_malloc = HEADER_SIZE; int medium_malloc = (MIN_ALLOC - 3) * HEADER_SIZE; int large_malloc = (MIN_ALLOC - 1) * HEADER_SIZE; num = atol(argv[1]); ptrs = malloc(sizeof(void*) * num); for(i = 0; i < num; i++) { ptrs[i] = malloc(medium_malloc); malloc(small_malloc); } for(i = 0; i < num; i++) { free(ptrs[i]); } _reset_clock(); for(i = 0; i < num; i++) { _resume(); ptrs[i] = malloc(large_malloc); _pause(); } _print_elapsed_time(); return 0; }
#include <stdio.h> #include <stdlib.h> #include "../brk.h" #include <unistd.h> #include "clock.h" int main(int argc, char *argv[]) { int nbytes = 5; void **ptrs; long num; long i; num = atol(argv[1]); ptrs = malloc(sizeof(void*) * num); for(i = 0; i < num; i++) { ptrs[i] = malloc(nbytes); malloc(1); } for(i = 0; i < num; i++) { free(ptrs[i]); } _reset_clock(); for(i = 0; i < num; i++) { _resume(); ptrs[i] = malloc(nbytes + 1); _pause(); } _print_elapsed_time(); return 0; }
--- +++ @@ -4,19 +4,25 @@ #include <unistd.h> #include "clock.h" +#define MIN_ALLOC (1024) +#define HEADER_SIZE (16) + int main(int argc, char *argv[]) { - int nbytes = 5; void **ptrs; long num; long i; + + int small_malloc = HEADER_SIZE; + int medium_malloc = (MIN_ALLOC - 3) * HEADER_SIZE; + int large_malloc = (MIN_ALLOC - 1) * HEADER_SIZE; num = atol(argv[1]); ptrs = malloc(sizeof(void*) * num); for(i = 0; i < num; i++) { - ptrs[i] = malloc(nbytes); - malloc(1); + ptrs[i] = malloc(medium_malloc); + malloc(small_malloc); } for(i = 0; i < num; i++) { @@ -26,7 +32,7 @@ _reset_clock(); for(i = 0; i < num; i++) { _resume(); - ptrs[i] = malloc(nbytes + 1); + ptrs[i] = malloc(large_malloc); _pause(); }
Make worst case actual worst case.
mit
mbark/os14,mbark/os14,mbark/os14
f78169f840c0a551e90df1c45ef17325263ee95c
#include "mruby.h" #include "mruby/value.h" static mrb_value longsize(mrb_state *mrb, mrb_value self) { uint8_t size = (uint8_t)sizeof(long); return mrb_fixnum_value(size); } /* ruby calls this to load the extension */ void mrb_mruby_rubyffi_compat_gem_init(mrb_state *mrb) { struct RClass *mod = mrb_define_module(mrb, "FFI"); mrb_define_class_method(mrb, mod, "longsize", longsize, MRB_ARGS_NONE()); } void mrb_mruby_rubyffi_compat_gem_final(mrb_state *mrb) { }
#include "mruby.h" #include "mruby/value.h" static mrb_value longsize(mrb_state *mrb, mrb_value self) { uint8_t size = (uint8_t)sizeof(long); return mrb_fixnum_value(size); } /* ruby calls this to load the extension */ void mrb_mruby_rubyffi_compat_gem_init(mrb_state *mrb) { struct RClass *mod = mrb_define_module(mrb, "FFI"); mrb_define_class_method(mrb, mod, "longsize", longsize, ARGS_NONE()); } void mrb_mruby_rubyffi_compat_gem_final(mrb_state *mrb) { }
--- +++ @@ -14,7 +14,7 @@ void mrb_mruby_rubyffi_compat_gem_init(mrb_state *mrb) { struct RClass *mod = mrb_define_module(mrb, "FFI"); - mrb_define_class_method(mrb, mod, "longsize", longsize, ARGS_NONE()); + mrb_define_class_method(mrb, mod, "longsize", longsize, MRB_ARGS_NONE()); } void mrb_mruby_rubyffi_compat_gem_final(mrb_state *mrb)
Fix for "implicit declaration of function 'ARGS_NONE' is invalid" error
mit
schmurfy/mruby-rubyffi-compat,schmurfy/mruby-rubyffi-compat,schmurfy/mruby-rubyffi-compat
7cad08e5c045a002e25c710ccb528f22e21ed835
#include <stdio.h> #include <stdlib.h> #ifndef METADATA_H #define METADATA_H typedef struct Metadata { /** * File's name. */ char md_name[255]; /** * File's extension. */ char md_extension[10]; /** * List of keywords to describe the file. */ char md_keywords[255]; /** * Hash of the content. We use SHA-1 which generates a * 160-bit hash value rendered as 40 digits long in * hexadecimal. */ char md_hash[41]; } Metadata; Metadata *new_metadata(char name[], char extension[], char keywords[], char hash[]); void free_metadata(Metadata *md); Metadata *create_metadata_from_path(char pathFile[1000]); #endif /* METADATA_H */
#include <stdio.h> #include <stdlib.h> #ifndef METADATA_H #define METADATA_H typedef struct Metadata { /** * File's name. */ char md_name[255]; /** * File's extension. */ char md_extension[10]; /** * List of keywords to describe the file. */ char md_keywords[255]; /** * Hash of the content. We use SHA-1 which generates a * 160-bit hash value rendered as 40 digits long in * hexadecimal. */ char md_hash[41]; } Metadata; Metadata *new_metadata(char name[], char extension[], char keywords[], char hash[]); void free_metadata(Metadata *md); Metadata *create_metadata_from_path(char pathFile[1000]); #endif /* METADATA_H */
--- +++ @@ -6,27 +6,27 @@ typedef struct Metadata { - /** - * File's name. - */ - char md_name[255]; + /** + * File's name. + */ + char md_name[255]; - /** - * File's extension. - */ - char md_extension[10]; + /** + * File's extension. + */ + char md_extension[10]; - /** - * List of keywords to describe the file. - */ - char md_keywords[255]; + /** + * List of keywords to describe the file. + */ + char md_keywords[255]; - /** - * Hash of the content. We use SHA-1 which generates a - * 160-bit hash value rendered as 40 digits long in - * hexadecimal. - */ - char md_hash[41]; + /** + * Hash of the content. We use SHA-1 which generates a + * 160-bit hash value rendered as 40 digits long in + * hexadecimal. + */ + char md_hash[41]; } Metadata; Metadata *new_metadata(char name[], char extension[], char keywords[], char hash[]);
Indent better than Videl :)
mit
Videl/FrogidelTorrent,Videl/FrogidelTorrent
94212f6fdc2b9f135f69e42392485adce8b04cc7
/* Copyright 2019 The Matrix.org Foundation C.I.C 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. */ #import <Foundation/Foundation.h> #import "MXReplyEventParts.h" #import "MXEvent.h" NS_ASSUME_NONNULL_BEGIN /** Reply event parser. */ @interface MXReplyEventParser : NSObject - (nullable MXReplyEventParts*)parse:(MXEvent*)replyEvent; @end NS_ASSUME_NONNULL_END
/* Copyright 2019 The Matrix.org Foundation C.I.C 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. */ #import <Foundation/Foundation.h> #import "MXReplyEventParts.h" #import "MXEvent.h" NS_ASSUME_NONNULL_BEGIN /** Reply event parser. */ @interface MXReplyEventParser : NSObject - (MXReplyEventParts*)parse:(MXEvent*)replyEvent; @end NS_ASSUME_NONNULL_END
--- +++ @@ -26,7 +26,7 @@ */ @interface MXReplyEventParser : NSObject -- (MXReplyEventParts*)parse:(MXEvent*)replyEvent; +- (nullable MXReplyEventParts*)parse:(MXEvent*)replyEvent; @end
Make reply parser result optional
apache-2.0
matrix-org/matrix-ios-sdk,matrix-org/matrix-ios-sdk,matrix-org/matrix-ios-sdk,matrix-org/matrix-ios-sdk,matrix-org/matrix-ios-sdk
cc884148c3ba9903d9d2355cfd31ddbba3a2b77d
/* Exercise 5-3 */ #include <unistd.h> #include <fcntl.h> #include "tlpi_hdr.h" int main (int argc, char *argv[]) { if (argc < 3 || argc > 4) { usageErr("%s filename num-bytes [x]", argv[0]); } long n = getLong(argv[2], GN_NONNEG | GN_ANY_BASE, "num-bytes"); Boolean x = argc == 4 && strcmp(argv[3], "x") == 0; int flags = O_WRONLY | O_CREAT; if (!x) { flags |= O_APPEND; } int fd = open(argv[1], flags, S_IWUSR | S_IRUSR); if (fd == -1) { errExit("open"); } while (n-- > 0) { if (x) { if (lseek(fd, 0, SEEK_END) == -1) { errExit("seek"); } } if (write(fd, "a", 1) == -1) { errExit("write byte a"); } } if (close(fd) == -1) { errExit("close output"); } exit(EXIT_SUCCESS); }
/* Exercise 5-3 */ #include <unistd.h> #include <fcntl.h> #include "tlpi_hdr.h" int main (int argc, char *argv[]) { if (argc < 3 || argc > 4) { usageErr("%s filename num-bytes [x]", argv[0]); } long n = getLong(argv[2], GN_NONNEG | GN_ANY_BASE, "num-bytes"); Boolean x = argc == 4 && strcmp(argv[3], "x") == 0; int flags = O_WRONLY | O_CREAT; if (!x) { flags |= O_APPEND; } int fd = open(argv[1], flags, S_IWUSR | S_IRUSR); if (fd == -1) { errExit("open"); } while (n-- > 0) { if (x) { if (lseek(fd, 0, SEEK_END) == -1) { errExit("seek"); } } if (write(fd, "a", 1) == -1) { errExit("write byte a"); } } }
--- +++ @@ -24,4 +24,10 @@ errExit("write byte a"); } } + + if (close(fd) == -1) { + errExit("close output"); + } + + exit(EXIT_SUCCESS); }
Add missing close for file descriptor
mit
dalleng/tlpi-exercises,timjb/tlpi-exercises,dalleng/tlpi-exercises,timjb/tlpi-exercises
ecd76f902198765339c7923c2e3f8538a431ac1f
//! \file WalkerException.h #ifndef WALKEREXCEPTION_H #define WALKEREXCEPTION_H #include <stdexcept> #include <string> namespace WikiWalker { //! (base) class for exceptions in WikiWalker class WalkerException : public std::runtime_error { public: /*! Create a Walker exception with a message. * * Message might be shown on exception occurring, depending on * the compiler. * * \param exmessage The exception message. */ explicit WalkerException(const std::string& exmessage) : runtime_error(exmessage) { } }; } // namespace WikiWalker #endif // WALKEREXCEPTION_H
//! \file WalkerException.h #ifndef WALKEREXCEPTION_H #define WALKEREXCEPTION_H #include <stdexcept> #include <string> namespace WikiWalker { //! (base) class for exceptions in WikiWalker class WalkerException : public std::runtime_error { public: /*! Create a Walker exception with a message. * * Message might be shown on exception occurring, depending on * the compiler. * * \param exmessage The exception message. */ explicit WalkerException(std::string exmessage) : runtime_error(exmessage) { } }; } // namespace WikiWalker #endif // WALKEREXCEPTION_H
--- +++ @@ -19,7 +19,7 @@ * * \param exmessage The exception message. */ - explicit WalkerException(std::string exmessage) : runtime_error(exmessage) + explicit WalkerException(const std::string& exmessage) : runtime_error(exmessage) { } };
Use const reference for exception
mit
dueringa/WikiWalker
14ca78ef6e4f09ca085f0d19c9029895d5c57376
/*------------------------------------------------------------------------- * * dynahash-- * POSTGRES dynahash.h file definitions * * * Copyright (c) 1994, Regents of the University of California * * $Id: dynahash.h,v 1.2 1996/11/14 20:06:39 scrappy Exp $ * *------------------------------------------------------------------------- */ #ifndef DYNAHASH_H #define DYNAHASH_H extern int my_log2(long num); #endif /* DYNAHASH_H */
/*------------------------------------------------------------------------- * * dynahash-- * POSTGRES dynahash.h file definitions * * * Copyright (c) 1994, Regents of the University of California * * $Id: dynahash.h,v 1.1 1996/11/09 05:48:28 momjian Exp $ * *------------------------------------------------------------------------- */ #ifndef DYNAHASH_H #define DYNAHASH_H extern int my_log2(long num); #endif DYNAHASH_H /* DYNAHASH_H */
--- +++ @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: dynahash.h,v 1.1 1996/11/09 05:48:28 momjian Exp $ + * $Id: dynahash.h,v 1.2 1996/11/14 20:06:39 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -15,5 +15,5 @@ extern int my_log2(long num); -#endif DYNAHASH_H /* DYNAHASH_H */ +#endif /* DYNAHASH_H */
Fix a comment that wasn't commente'd out Pointed out by: Erik Bertelsen <[email protected]>
apache-2.0
adam8157/gpdb,Chibin/gpdb,adam8157/gpdb,rubikloud/gpdb,kaknikhil/gpdb,kaknikhil/gpdb,tpostgres-projects/tPostgres,yuanzhao/gpdb,zeroae/postgres-xl,adam8157/gpdb,greenplum-db/gpdb,ashwinstar/gpdb,oberstet/postgres-xl,Quikling/gpdb,chrishajas/gpdb,chrishajas/gpdb,zaksoup/gpdb,ashwinstar/gpdb,0x0FFF/gpdb,cjcjameson/gpdb,yuanzhao/gpdb,tangp3/gpdb,arcivanov/postgres-xl,royc1/gpdb,atris/gpdb,rubikloud/gpdb,lisakowen/gpdb,rvs/gpdb,xuegang/gpdb,xinzweb/gpdb,yuanzhao/gpdb,randomtask1155/gpdb,ashwinstar/gpdb,ovr/postgres-xl,50wu/gpdb,ahachete/gpdb,lisakowen/gpdb,rubikloud/gpdb,janebeckman/gpdb,techdragon/Postgres-XL,ahachete/gpdb,royc1/gpdb,foyzur/gpdb,tangp3/gpdb,randomtask1155/gpdb,lisakowen/gpdb,kaknikhil/gpdb,edespino/gpdb,rvs/gpdb,tangp3/gpdb,lintzc/gpdb,Quikling/gpdb,atris/gpdb,randomtask1155/gpdb,yazun/postgres-xl,oberstet/postgres-xl,xinzweb/gpdb,CraigHarris/gpdb,chrishajas/gpdb,tangp3/gpdb,postmind-net/postgres-xl,Postgres-XL/Postgres-XL,xinzweb/gpdb,yazun/postgres-xl,foyzur/gpdb,lintzc/gpdb,lpetrov-pivotal/gpdb,atris/gpdb,Postgres-XL/Postgres-XL,tangp3/gpdb,xuegang/gpdb,ashwinstar/gpdb,zeroae/postgres-xl,randomtask1155/gpdb,edespino/gpdb,zeroae/postgres-xl,ahachete/gpdb,edespino/gpdb,CraigHarris/gpdb,rubikloud/gpdb,lintzc/gpdb,janebeckman/gpdb,randomtask1155/gpdb,50wu/gpdb,jmcatamney/gpdb,greenplum-db/gpdb,Quikling/gpdb,cjcjameson/gpdb,CraigHarris/gpdb,Quikling/gpdb,cjcjameson/gpdb,Postgres-XL/Postgres-XL,lintzc/gpdb,janebeckman/gpdb,rvs/gpdb,cjcjameson/gpdb,edespino/gpdb,xinzweb/gpdb,royc1/gpdb,royc1/gpdb,tpostgres-projects/tPostgres,lisakowen/gpdb,kaknikhil/gpdb,snaga/postgres-xl,kaknikhil/gpdb,chrishajas/gpdb,yuanzhao/gpdb,edespino/gpdb,atris/gpdb,lintzc/gpdb,kmjungersen/PostgresXL,adam8157/gpdb,ovr/postgres-xl,tangp3/gpdb,ashwinstar/gpdb,xinzweb/gpdb,jmcatamney/gpdb,yuanzhao/gpdb,xinzweb/gpdb,zaksoup/gpdb,cjcjameson/gpdb,ovr/postgres-xl,pavanvd/postgres-xl,0x0FFF/gpdb,0x0FFF/gpdb,rvs/gpdb,Quikling/gpdb,rubikloud/gpdb,greenplum-db/gpdb,chrishajas/gpdb,0x0FFF/gpdb,royc1/gpdb,janebeckman/gpdb,0x0FFF/gpdb,rvs/gpdb,zaksoup/gpdb,CraigHarris/gpdb,arcivanov/postgres-xl,xuegang/gpdb,tpostgres-projects/tPostgres,zeroae/postgres-xl,lpetrov-pivotal/gpdb,CraigHarris/gpdb,foyzur/gpdb,rvs/gpdb,edespino/gpdb,Quikling/gpdb,lintzc/gpdb,yazun/postgres-xl,Quikling/gpdb,yuanzhao/gpdb,lisakowen/gpdb,adam8157/gpdb,postmind-net/postgres-xl,royc1/gpdb,xinzweb/gpdb,foyzur/gpdb,kaknikhil/gpdb,oberstet/postgres-xl,jmcatamney/gpdb,greenplum-db/gpdb,cjcjameson/gpdb,Chibin/gpdb,lpetrov-pivotal/gpdb,jmcatamney/gpdb,Chibin/gpdb,kaknikhil/gpdb,techdragon/Postgres-XL,jmcatamney/gpdb,Chibin/gpdb,Chibin/gpdb,Chibin/gpdb,foyzur/gpdb,Chibin/gpdb,greenplum-db/gpdb,jmcatamney/gpdb,lintzc/gpdb,yuanzhao/gpdb,50wu/gpdb,rvs/gpdb,rvs/gpdb,atris/gpdb,pavanvd/postgres-xl,CraigHarris/gpdb,ahachete/gpdb,ahachete/gpdb,xuegang/gpdb,lintzc/gpdb,snaga/postgres-xl,Quikling/gpdb,janebeckman/gpdb,snaga/postgres-xl,postmind-net/postgres-xl,zaksoup/gpdb,CraigHarris/gpdb,janebeckman/gpdb,janebeckman/gpdb,ahachete/gpdb,tangp3/gpdb,greenplum-db/gpdb,yuanzhao/gpdb,randomtask1155/gpdb,yazun/postgres-xl,techdragon/Postgres-XL,Quikling/gpdb,cjcjameson/gpdb,arcivanov/postgres-xl,0x0FFF/gpdb,kaknikhil/gpdb,snaga/postgres-xl,zaksoup/gpdb,postmind-net/postgres-xl,Chibin/gpdb,cjcjameson/gpdb,janebeckman/gpdb,zaksoup/gpdb,ashwinstar/gpdb,arcivanov/postgres-xl,xuegang/gpdb,zaksoup/gpdb,edespino/gpdb,50wu/gpdb,rubikloud/gpdb,tangp3/gpdb,chrishajas/gpdb,lpetrov-pivotal/gpdb,ahachete/gpdb,CraigHarris/gpdb,xuegang/gpdb,atris/gpdb,ahachete/gpdb,xuegang/gpdb,Postgres-XL/Postgres-XL,lisakowen/gpdb,greenplum-db/gpdb,lpetrov-pivotal/gpdb,chrishajas/gpdb,Chibin/gpdb,rubikloud/gpdb,tpostgres-projects/tPostgres,randomtask1155/gpdb,ovr/postgres-xl,jmcatamney/gpdb,rvs/gpdb,kmjungersen/PostgresXL,50wu/gpdb,kaknikhil/gpdb,techdragon/Postgres-XL,ashwinstar/gpdb,Quikling/gpdb,randomtask1155/gpdb,yuanzhao/gpdb,postmind-net/postgres-xl,ovr/postgres-xl,royc1/gpdb,lintzc/gpdb,xuegang/gpdb,lisakowen/gpdb,yazun/postgres-xl,lpetrov-pivotal/gpdb,cjcjameson/gpdb,greenplum-db/gpdb,tpostgres-projects/tPostgres,xuegang/gpdb,adam8157/gpdb,edespino/gpdb,Postgres-XL/Postgres-XL,pavanvd/postgres-xl,zaksoup/gpdb,oberstet/postgres-xl,foyzur/gpdb,0x0FFF/gpdb,kmjungersen/PostgresXL,yuanzhao/gpdb,foyzur/gpdb,janebeckman/gpdb,arcivanov/postgres-xl,snaga/postgres-xl,0x0FFF/gpdb,kmjungersen/PostgresXL,kmjungersen/PostgresXL,50wu/gpdb,zeroae/postgres-xl,CraigHarris/gpdb,50wu/gpdb,cjcjameson/gpdb,lpetrov-pivotal/gpdb,adam8157/gpdb,edespino/gpdb,ashwinstar/gpdb,jmcatamney/gpdb,Chibin/gpdb,chrishajas/gpdb,arcivanov/postgres-xl,kaknikhil/gpdb,rubikloud/gpdb,atris/gpdb,pavanvd/postgres-xl,atris/gpdb,lisakowen/gpdb,foyzur/gpdb,janebeckman/gpdb,xinzweb/gpdb,edespino/gpdb,lpetrov-pivotal/gpdb,techdragon/Postgres-XL,adam8157/gpdb,rvs/gpdb,oberstet/postgres-xl,royc1/gpdb,pavanvd/postgres-xl,50wu/gpdb
fb3b9d76611d1e7ac1d7896aff469a52d36b6078
/* * Copyright (c) 2002-2004, Index Data * See the file LICENSE for details. * * $Id: tstnmem.c,v 1.3 2005-01-05 10:29:42 adam Exp $ */ #if HAVE_CONFIG_H #include <config.h> #endif #include <errno.h> #include <string.h> #include <stdlib.h> #include <ctype.h> #include <yaz/nmem.h> int main (int argc, char **argv) { void *cp; NMEM n; int j; nmem_init(); n = nmem_create(); if (!n) exit (1); for (j = 1; j<500; j++) { cp = nmem_malloc(n, j); if (!cp) exit(2); if (sizeof(long) >= j) *(long*) cp = 123L; #if HAVE_LONG_LONG if (sizeof(long long) >= j) *(long long*) cp = 123L; #endif if (sizeof(double) >= j) *(double*) cp = 12.2; } for (j = 2000; j<20000; j+= 2000) { cp = nmem_malloc(n, j); if (!cp) exit(3); } nmem_destroy(n); nmem_exit(); exit(0); }
/* * Copyright (c) 2002-2004, Index Data * See the file LICENSE for details. * * $Id: tstnmem.c,v 1.2 2004-09-29 20:15:48 adam Exp $ */ #if HAVE_CONFIG_H #include <config.h> #endif #include <errno.h> #include <string.h> #include <stdlib.h> #include <ctype.h> #include <yaz/nmem.h> int main (int argc, char **argv) { void *cp; NMEM n; int j; nmem_init(); n = nmem_create(); if (!n) exit (1); for (j = 1; j<500; j++) { cp = nmem_malloc(n, j); if (!cp) exit(2); } for (j = 2000; j<20000; j+= 2000) { cp = nmem_malloc(n, j); if (!cp) exit(3); } nmem_destroy(n); nmem_exit(); exit(0); }
--- +++ @@ -2,7 +2,7 @@ * Copyright (c) 2002-2004, Index Data * See the file LICENSE for details. * - * $Id: tstnmem.c,v 1.2 2004-09-29 20:15:48 adam Exp $ + * $Id: tstnmem.c,v 1.3 2005-01-05 10:29:42 adam Exp $ */ #if HAVE_CONFIG_H @@ -31,6 +31,14 @@ cp = nmem_malloc(n, j); if (!cp) exit(2); + if (sizeof(long) >= j) + *(long*) cp = 123L; +#if HAVE_LONG_LONG + if (sizeof(long long) >= j) + *(long long*) cp = 123L; +#endif + if (sizeof(double) >= j) + *(double*) cp = 12.2; } for (j = 2000; j<20000; j+= 2000)
Check that assignments to NMEM memory for some basic types
bsd-3-clause
dcrossleyau/yaz,nla/yaz,dcrossleyau/yaz,nla/yaz,nla/yaz,dcrossleyau/yaz,nla/yaz
7788edff9108cafc593759e9e406d6da6509c799
// Test this without pch. // RUN: clang-cc -triple=x86_64-unknown-freebsd7.0 -include %S/va_arg.h %s -emit-llvm -o - && // Test with pch. // RUN: clang-cc -triple=x86_64-unknown-freebsd7.0 -emit-pch -o %t %S/va_arg.h && // RUN: clang-cc -triple=x86_64-unknown-freebsd7.0 -include-pch %t %s -emit-llvm -o - char *g0(char** argv, int argc) { return argv[argc]; } char *g(char **argv) { f(g0, argv, 1, 2, 3); }
// Test this without pch. // RUN: clang-cc -triple=x86_64-unknown-freebsd7.0 -include %S/va_arg.h %s -emit-llvm -o - && // Test with pch. // RUN: clang-cc -triple=x86_64-unknown-freebsd7.0 -o %t %S/va_arg.h && // RUN: clang-cc -triple=x86_64-unknown-freebsd7.0 -include-pch %t %s -emit-llvm -o - char *g0(char** argv, int argc) { return argv[argc]; } char *g(char **argv) { f(g0, argv, 1, 2, 3); }
--- +++ @@ -2,7 +2,7 @@ // RUN: clang-cc -triple=x86_64-unknown-freebsd7.0 -include %S/va_arg.h %s -emit-llvm -o - && // Test with pch. -// RUN: clang-cc -triple=x86_64-unknown-freebsd7.0 -o %t %S/va_arg.h && +// RUN: clang-cc -triple=x86_64-unknown-freebsd7.0 -emit-pch -o %t %S/va_arg.h && // RUN: clang-cc -triple=x86_64-unknown-freebsd7.0 -include-pch %t %s -emit-llvm -o - char *g0(char** argv, int argc) { return argv[argc]; }
Fix a problem with the RUN line of one of the PCH tests git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@70227 91177308-0d34-0410-b5e6-96231b3b80d8
apache-2.0
apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,apple/swift-clang
ce5148894cbf4a465e2bc1158e8a4f8a729f6632
/* Derived from zlib fuzzers at http://github.com/google/oss-fuzz/tree/master/projects/zlib, * see ossfuzz.sh for full license text. */ #include <stddef.h> #include <stdint.h> #include <string.h> #include "miniz.h" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { unsigned long int buffer_length = 1; unsigned char *buffer = NULL; int z_status = 0; if (size > 0) buffer_length *= data[0]; if (size > 1) buffer_length *= data[1]; buffer = (unsigned char *)malloc(buffer_length); z_status = uncompress(buffer, &buffer_length, data, size); free(buffer); if (Z_OK != z_status) return 0; return 0; }
/* Derived from zlib fuzzers at http://github.com/google/oss-fuzz/tree/master/projects/zlib, * see ossfuzz.sh for full license text. */ #include <stddef.h> #include <stdint.h> #include <string.h> #include "miniz.h" static unsigned char buffer[256 * 1024] = { 0 }; int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { unsigned long int buffer_length = sizeof(buffer); if (Z_OK != uncompress(buffer, &buffer_length, data, size)) return 0; return 0; }
--- +++ @@ -8,13 +8,23 @@ #include "miniz.h" -static unsigned char buffer[256 * 1024] = { 0 }; - int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { - unsigned long int buffer_length = sizeof(buffer); + unsigned long int buffer_length = 1; + unsigned char *buffer = NULL; + int z_status = 0; - if (Z_OK != uncompress(buffer, &buffer_length, data, size)) return 0; - + if (size > 0) + buffer_length *= data[0]; + if (size > 1) + buffer_length *= data[1]; + + buffer = (unsigned char *)malloc(buffer_length); + + z_status = uncompress(buffer, &buffer_length, data, size); + free(buffer); + + if (Z_OK != z_status) + return 0; return 0; }
Use variable size input buffer in uncompress fuzzer.
mit
richgel999/miniz,richgel999/miniz,richgel999/miniz
1e7621d96cb9d0821c61db6f4e3ef36ddc19b0cd
#ifndef _DOORS_H_ #define _DOORS_H_ #ifndef NUMBER_OF_DOORS #define NUMBER_OF_DOORS 3 #endif #include <limits.h> #if (NUMBER_OF_DOORS > UINT_MAX) #error (n) doors exceeds storage allocation limit for `unsigned int'. #endif typedef struct { unsigned int has_prize : 1; unsigned int currently_selected: 1; unsigned int revealed : 1; } door; /* * game status updates */ extern void set_doors(void); extern void select_door(unsigned int number); extern void show_doors(void); extern void reveal_all_doors(void); /* * game status queries */ extern unsigned int get_door_number(void); extern unsigned int current_guess(void); extern unsigned int winning_door(void); extern unsigned int hint_door(void); #endif
#ifndef _DOORS_H_ #define _DOORS_H_ #ifndef NUMBER_OF_DOORS #define NUMBER_OF_DOORS 3 #endif typedef struct { unsigned int has_prize : 1; unsigned int currently_selected: 1; unsigned int revealed : 1; } door; /* * game status updates */ extern void set_doors(void); extern void select_door(unsigned int number); extern void show_doors(void); extern void reveal_all_doors(void); /* * game status queries */ extern unsigned int get_door_number(void); extern unsigned int current_guess(void); extern unsigned int winning_door(void); extern unsigned int hint_door(void); #endif
--- +++ @@ -3,6 +3,11 @@ #ifndef NUMBER_OF_DOORS #define NUMBER_OF_DOORS 3 +#endif + +#include <limits.h> +#if (NUMBER_OF_DOORS > UINT_MAX) +#error (n) doors exceeds storage allocation limit for `unsigned int'. #endif typedef struct {
Throw a fatal pre-processor error if (n > UINT_MAX).
cc0-1.0
cxd4/Monty-Hall,cxd4/Monty-Hall
02abf1a1f71cbd7db8b0e0e4d9e94ea1070d7d9a
/** https://www.urionlinejudge.com.br/judge/en/problems/view/1098 */ #include <stdio.h> int main(){ int i, j; float iR, jR; for(i = 0; i <= 20; i += 2){ for (j = 10; j <= 30; j += 10){ iR = (float) i/10; jR = (float) (i+j)/10; if (i % 10) printf("I=%.1f J=%.1f\n", iR, jR); else printf("I=%.0f J=%.0f\n", iR, jR); } } return 0; }
/** https://www.urionlinejudge.com.br/judge/en/problems/view/1098 TODO: Resolver a formatação da última impressão do loop. Está: I=2.0 J=3.0 I=2.0 J=4.0 I=2.0 J=5.0 Mas deveria estar: I=2 J=3 I=2 J=4 I=2 J=5 */ #include <stdio.h> int main(){ double i, j; i = 0; do{ for (j = 1; j <= 3; j++){ if (i == (int) i){ printf("I=%.0lf J=%.0lf\n", i, i+j); } else{ printf("I=%.1lf J=%.1lf\n", i, i+j); } } i += 0.2; //printf("Finalizando loop... Double: %lf e Float: %d\n", (double) i, (int) i); // debug } while(i <= 2.0); return 0; }
--- +++ @@ -1,40 +1,25 @@ /** https://www.urionlinejudge.com.br/judge/en/problems/view/1098 - -TODO: -Resolver a formatação da última impressão do loop. -Está: -I=2.0 J=3.0 -I=2.0 J=4.0 -I=2.0 J=5.0 -Mas deveria estar: -I=2 J=3 -I=2 J=4 -I=2 J=5 - */ #include <stdio.h> int main(){ - double i, j; + int i, j; + float iR, jR; - i = 0; - do{ + for(i = 0; i <= 20; i += 2){ + for (j = 10; j <= 30; j += 10){ - for (j = 1; j <= 3; j++){ - if (i == (int) i){ - printf("I=%.0lf J=%.0lf\n", i, i+j); - } else{ - printf("I=%.1lf J=%.1lf\n", i, i+j); - } + iR = (float) i/10; + jR = (float) (i+j)/10; + + if (i % 10) printf("I=%.1f J=%.1f\n", iR, jR); + else printf("I=%.0f J=%.0f\n", iR, jR); + } - - i += 0.2; - //printf("Finalizando loop... Double: %lf e Float: %d\n", (double) i, (int) i); // debug - } while(i <= 2.0); - + } return 0; }
Fix bug and solves the sequence
unknown
Mazuh/MISC-Algs,Mazuh/Algs,Mazuh/Algs,Mazuh/Algs,Mazuh/Algs,Mazuh/MISC-Algs,Mazuh/MISC-Algs,Mazuh/Algs,Mazuh/MISC-Algs
7bf1f1785e610d9d5148552963edb7b00ff77700
// // SVNetworking.h // SVNetworking // // Created by Nate Stedman on 3/14/14. // Copyright (c) 2014 Svpply. All rights reserved. // #import "NSObject+SVBindings.h" #import "NSObject+SVMultibindings.h" #import "SVDataRequest.h" #import "SVDiskCache.h" #import "SVFunctional.h" #import "SVImageView.h" #import "SVJSONRequest.h" #import "SVRemoteArray.h" #import "SVRemoteImage.h" #import "SVRemoteImageProtocol.h" #import "SVRemoteDataRequestResource.h" #import "SVRemoteDataResource.h" #import "SVRemoteJSONArray.h" #import "SVRemoteJSONRequestResource.h" #import "SVRemoteJSONResource.h" #import "SVRemoteProxyResource.h" #import "SVRemoteResource.h" #import "SVRemoteRetainedScaledImage.h" #import "SVRemoteScaledImage.h" #import "SVRemoteScaledImageProtocol.h" #import "SVRequest.h"
// // SVNetworking.h // SVNetworking // // Created by Nate Stedman on 3/14/14. // Copyright (c) 2014 Svpply. All rights reserved. // #import "NSObject+SVBindings.h" #import "NSObject+SVMultibindings.h" #import "SVDataRequest.h" #import "SVDiskCache.h" #import "SVFunctional.h" #import "SVImageView.h" #import "SVJSONRequest.h" #import "SVRemoteImage.h" #import "SVRemoteImageProtocol.h" #import "SVRemoteDataRequestResource.h" #import "SVRemoteDataResource.h" #import "SVRemoteJSONRequestResource.h" #import "SVRemoteJSONResource.h" #import "SVRemoteProxyResource.h" #import "SVRemoteResource.h" #import "SVRemoteRetainedScaledImage.h" #import "SVRemoteScaledImage.h" #import "SVRemoteScaledImageProtocol.h" #import "SVRequest.h"
--- +++ @@ -13,10 +13,12 @@ #import "SVFunctional.h" #import "SVImageView.h" #import "SVJSONRequest.h" +#import "SVRemoteArray.h" #import "SVRemoteImage.h" #import "SVRemoteImageProtocol.h" #import "SVRemoteDataRequestResource.h" #import "SVRemoteDataResource.h" +#import "SVRemoteJSONArray.h" #import "SVRemoteJSONRequestResource.h" #import "SVRemoteJSONResource.h" #import "SVRemoteProxyResource.h"
Add remote array classes to headers.
bsd-3-clause
eBay/SVNetworking,eBay/SVNetworking
b4bf84df34dd90041f076eb777454d01c41042c0
#ifndef EMBEDDEDHELPERLIBRARY_ISR_WRITTEN_VARIABLE_H #define EMBEDDEDHELPERLIBRARY_ISR_WRITTEN_VARIABLE_H #include "rvalue.h" namespace ehl { template<typename T> class isr_written_variable { private: mutable volatile bool modified; volatile T value; public: isr_written_variable() = default; isr_written_variable(T initial_value) :value{as_rvalue(initial_value)} { } isr_written_variable& operator=(isr_written_variable const& other) { value = other.value; modified = true; return *this; } isr_written_variable<T>& operator=(T new_value) { value = as_rvalue(new_value); modified = true; return *this; } operator T() const { while(true) { modified = false; T v = value; if(!modified) return v; } } }; } #endif //EMBEDDEDHELPERLIBRARY_ISR_WRITTEN_VARIABLE_H
#ifndef EMBEDDEDHELPERLIBRARY_ISR_WRITTEN_VARIABLE_H #define EMBEDDEDHELPERLIBRARY_ISR_WRITTEN_VARIABLE_H #include "rvalue.h" namespace ehl { template<typename T> class isr_written_variable { private: mutable volatile bool modified; volatile T value; public: isr_written_variable() = default; isr_written_variable(T initial_value) :value{as_rvalue(initial_value)} { } isr_written_variable& operator=(isr_written_variable const& other) { value = other.value; modified = true; return *this; } isr_written_variable<T>& operator=(T new_value) { value = as_rvalue(new_value); modified = true; return *this; } operator T() const { modified = false; T v = value; while(modified) { modified = false; v = value; } return v; } }; } #endif //EMBEDDEDHELPERLIBRARY_ISR_WRITTEN_VARIABLE_H
--- +++ @@ -36,14 +36,13 @@ operator T() const { - modified = false; - T v = value; - while(modified) + while(true) { modified = false; - v = value; + T v = value; + if(!modified) + return v; } - return v; } }; }
Refactor to clean up isr written variable
mit
hiddeninplainsight/EmbeddedHelperLibrary,hiddeninplainsight/EmbeddedHelperLibrary,hiddeninplainsight/EmbeddedHelperLibrary,hiddeninplainsight/EmbeddedHelperLibrary
fac8751ad9ac6eab7f5b86fe5fc82d1ca59a7b2a
#if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && (!defined(__IPHONE_6_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_0)) || \ (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && (!defined(__MAC_10_8) || __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_8)) #define PT_DISPATCH_RETAIN_RELEASE 1 #endif #define PT_PRECISE_LIFETIME #define PT_PRECISE_LIFETIME_UNUSED #if defined(PT_DISPATCH_RETAIN_RELEASE) && PT_DISPATCH_RETAIN_RELEASE #define PT_PRECISE_LIFETIME __attribute__((objc_precise_lifetime)) #define PT_PRECISE_LIFETIME_UNUSED __attribute__((objc_precise_lifetime, unused)) #endif
#if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && (!defined(__IPHONE_6_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_0)) || \ (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && (!defined(__MAC_10_8) || __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_8)) #define PT_DISPATCH_RETAIN_RELEASE 1 #endif #if PT_DISPATCH_RETAIN_RELEASE #define PT_PRECISE_LIFETIME #define PT_PRECISE_LIFETIME_UNUSED #else #define PT_PRECISE_LIFETIME __attribute__((objc_precise_lifetime)) #define PT_PRECISE_LIFETIME_UNUSED __attribute__((objc_precise_lifetime, unused)) #endif
--- +++ @@ -3,10 +3,10 @@ #define PT_DISPATCH_RETAIN_RELEASE 1 #endif -#if PT_DISPATCH_RETAIN_RELEASE #define PT_PRECISE_LIFETIME #define PT_PRECISE_LIFETIME_UNUSED -#else + +#if defined(PT_DISPATCH_RETAIN_RELEASE) && PT_DISPATCH_RETAIN_RELEASE #define PT_PRECISE_LIFETIME __attribute__((objc_precise_lifetime)) #define PT_PRECISE_LIFETIME_UNUSED __attribute__((objc_precise_lifetime, unused)) #endif
Fix logic that enables pre-ARC behavior
mit
fly19890211/peertalk,philikon/peertalk,fly19890211/peertalk,yexihu/peertalk,yexihu/peertalk,fly19890211/peertalk,rsms/peertalk,ChetanGandhi/peertalk,philikon/peertalk,ChetanGandhi/peertalk,yexihu/peertalk,rsms/peertalk,msdgwzhy6/peertalk,TaoXueCheng/peertalk,artifacts/peertalk,artifacts/peertalk,dguillamot/PFMacOSClient,ChetanGandhi/peertalk,2bbb/peertalk,msdgwzhy6/peertalk,artifacts/peertalk,2bbb/peertalk,dguillamot/PFMacOSClient,philikon/peertalk,TaoXueCheng/peertalk,TaoXueCheng/peertalk,msdgwzhy6/peertalk,rsms/peertalk,dguillamot/PFMacOSClient,2bbb/peertalk
f0b582a6639ad908211c938287fad26fc99a34dc
#ifndef TGBOT_EXPORT_H #define TGBOT_EXPORT_H #ifndef TGBOT_API #ifdef TGBOT_DLL #if defined _WIN32 || defined __CYGWIN__ #define TGBOT_HELPER_DLL_EXPORT __declspec(dllexport) #define TGBOT_HELPER_DLL_IMPORT __declspec(dllimport) #else #if __GNUC__ >= 4 #define TGBOT_HELPER_DLL_EXPORT __attribute__ ((visibility ("default"))) #define TGBOT_HELPER_DLL_IMPORT __attribute__ ((visibility ("default"))) #else #define TGBOT_HELPER_DLL_EXPORT #define TGBOT_HELPER_DLL_IMPORT #endif #endif #ifdef TgBot_EXPORTS #define TGBOT_API TGBOT_HELPER_DLL_EXPORT #else #define TGBOT_API TGBOT_HELPER_DLL_IMPORT #endif #else #define TGBOT_API #endif #endif #endif //TGBOT_EXPORT_H
#ifndef TGBOT_EXPORT_H #define TGBOT_EXPORT_H #ifndef TGBOT_API #ifdef TGBOT_DLL #if defined _WIN32 || defined __CYGWIN__ #define TGBOT_HELPER_DLL_IMPORT __declspec(dllimport) #define TGBOT_HELPER_DLL_EXPORT __declspec(dllexport) #else #if __GNUC__ >= 4 #define TGBOT_HELPER_DLL_IMPORT __attribute__ ((visibility ("default"))) #define TGBOT_HELPER_DLL_EXPORT __attribute__ ((visibility ("default"))) #else #define TGBOT_HELPER_DLL_IMPORT #define TGBOT_HELPER_DLL_EXPORT #endif #endif #ifdef TgBot_EXPORTS #define TGBOT_API TGBOT_HELPER_DLL_EXPORT #else #define FOX_API TGBOT_HELPER_DLL_IMPORT #endif #else #define TGBOT_API #endif #endif #endif //TGBOT_EXPORT_H
--- +++ @@ -4,21 +4,21 @@ #ifndef TGBOT_API #ifdef TGBOT_DLL #if defined _WIN32 || defined __CYGWIN__ + #define TGBOT_HELPER_DLL_EXPORT __declspec(dllexport) #define TGBOT_HELPER_DLL_IMPORT __declspec(dllimport) - #define TGBOT_HELPER_DLL_EXPORT __declspec(dllexport) #else #if __GNUC__ >= 4 + #define TGBOT_HELPER_DLL_EXPORT __attribute__ ((visibility ("default"))) #define TGBOT_HELPER_DLL_IMPORT __attribute__ ((visibility ("default"))) - #define TGBOT_HELPER_DLL_EXPORT __attribute__ ((visibility ("default"))) #else + #define TGBOT_HELPER_DLL_EXPORT #define TGBOT_HELPER_DLL_IMPORT - #define TGBOT_HELPER_DLL_EXPORT #endif #endif #ifdef TgBot_EXPORTS #define TGBOT_API TGBOT_HELPER_DLL_EXPORT #else - #define FOX_API TGBOT_HELPER_DLL_IMPORT + #define TGBOT_API TGBOT_HELPER_DLL_IMPORT #endif #else #define TGBOT_API
Fix mistake FOX and reorder EXPORT/IMPORT
mit
reo7sp/tgbot-cpp,reo7sp/tgbot-cpp,reo7sp/tgbot-cpp
3b7da8cd1e2f77d73cc19533fc657ba10a80c8cd
#include "openflow_flowtable.h" #include "mut.h" #include <stdint.h> #include "common_def.h" extern void openflow_flowtable_set_defaults(void); extern uint8_t openflow_flowtable_ip_compare(uint32_t ip_1, uint32_t ip_2, uint8_t ip_len); TESTSUITE_BEGIN TEST_BEGIN("Flowtable Modification") openflow_flowtable_init(); ofp_flow_mod mod; uint16_t error_code, error_type; memset(&mod, 0, sizeof(ofp_flow_mod)); mod.flags = htons(OFPFF_SEND_FLOW_REM); mod.command = htons(OFPFC_ADD); mod.match.wildcards = htons(OFPFW_ALL); mod.out_port = htons(OFPP_NONE); mod.header.length = htons(0); mod.priority = htons(19); openflow_flowtable_modify(&mod, &error_type, &error_code); openflow_flowtable_release(); TEST_END TESTSUITE_END
#include "openflow_flowtable.h" #include "mut.h" #include <stdint.h> #include "common_def.h" extern void openflow_flowtable_set_defaults(void); extern uint8_t openflow_flowtable_ip_compare(uint32_t ip_1, uint32_t ip_2, uint8_t ip_len); TESTSUITE_BEGIN TEST_BEGIN("Flowtable Modification") openflow_flowtable_init(); ofp_flow_mod mod; uint16_t error_code, error_type; mod.flags = OFPFF_SEND_FLOW_REM; mod.command = OFPFC_ADD; mod.match.wildcards = OFPFW_ALL; mod.out_port = OFPP_NONE; openflow_flowtable_modify(&mod, &error_type, &error_code); openflow_flowtable_release(); TEST_END TESTSUITE_END
--- +++ @@ -15,10 +15,13 @@ openflow_flowtable_init(); ofp_flow_mod mod; uint16_t error_code, error_type; - mod.flags = OFPFF_SEND_FLOW_REM; - mod.command = OFPFC_ADD; - mod.match.wildcards = OFPFW_ALL; - mod.out_port = OFPP_NONE; + memset(&mod, 0, sizeof(ofp_flow_mod)); + mod.flags = htons(OFPFF_SEND_FLOW_REM); + mod.command = htons(OFPFC_ADD); + mod.match.wildcards = htons(OFPFW_ALL); + mod.out_port = htons(OFPP_NONE); + mod.header.length = htons(0); + mod.priority = htons(19); openflow_flowtable_modify(&mod, &error_type, &error_code); openflow_flowtable_release();
Clean up test, use proper structuring functions
mit
anrl/gini3,anrl/gini3,anrl/gini3,anrl/gini3,michaelkourlas/gini,michaelkourlas/gini,anrl/gini3,michaelkourlas/gini,michaelkourlas/gini,michaelkourlas/gini
2d3728610e716835f1d54606dee0f7c5cb404f66
// // BRScrollerUtilities.h // BRScroller // // Created by Matt on 7/11/13. // Copyright (c) 2013 Blue Rocket. Distributable under the terms of the Apache License, Version 2.0. // #ifndef BRScroller_BRScrollerUtilities_h #define BRScroller_BRScrollerUtilities_h #include <CoreGraphics/CoreGraphics.h> bool BRFloatsAreEqual(CGFloat a, CGFloat b); CGSize BRAspectSizeToFit(CGSize size, CGSize maxSize); #endif
// // BRScrollerUtilities.h // BRScroller // // Created by Matt on 7/11/13. // Copyright (c) 2013 Blue Rocket. Distributable under the terms of the Apache License, Version 2.0. // #ifndef BRScroller_BRScrollerUtilities_h #define BRScroller_BRScrollerUtilities_h #include <CoreFoundation/CoreFoundation.h> #include <QuartzCore/QuartzCore.h> bool BRFloatsAreEqual(CGFloat a, CGFloat b); CGSize BRAspectSizeToFit(CGSize size, CGSize maxSize); #endif
--- +++ @@ -9,8 +9,7 @@ #ifndef BRScroller_BRScrollerUtilities_h #define BRScroller_BRScrollerUtilities_h -#include <CoreFoundation/CoreFoundation.h> -#include <QuartzCore/QuartzCore.h> +#include <CoreGraphics/CoreGraphics.h> bool BRFloatsAreEqual(CGFloat a, CGFloat b);
Fix import to what's actually needed.
apache-2.0
Blue-Rocket/BRScroller,Blue-Rocket/BRScroller
de7f24245a2b51af5ff3489d897ed490d8a0e776
#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 GR_GL_PLATFORM_HEADER <GLES2/gl2.h> #define GR_GL_PLATFORM_HEADER_EXT <GLES2/gl2ext.h> #define GR_GL_FUNCTION_TYPE #define GR_GL_PROC_ADDRESS(X) &X // chrome always assumes BGRA #define GR_GL_32BPP_COLOR_FORMAT GR_GL_BGRA // glGetError() forces a sync with gpu process on chrome #define GR_GL_CHECK_ERROR_START 0 #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 GR_GL_PLATFORM_HEADER <GLES2/gl2.h> #define GR_GL_PLATFORM_HEADER_EXT <GLES2/gl2ext.h> #define GR_GL_FUNCTION_TYPE #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
--- +++ @@ -15,7 +15,7 @@ #define GR_GL_PROC_ADDRESS(X) &X // chrome always assumes BGRA -#define GR_GL_32BPP_COLOR_FORMAT GR_BGRA +#define GR_GL_32BPP_COLOR_FORMAT GR_GL_BGRA // glGetError() forces a sync with gpu process on chrome #define GR_GL_CHECK_ERROR_START 0
Fix macro in Chrome's GL config file Review URL: http://codereview.appspot.com/4308041/ git-svn-id: e8541e15acce502a64c929015570ad1648e548cd@980 2bbb7eff-a529-9590-31e7-b0007b416f81
bsd-3-clause
Cue/skia,Frankie-666/color-emoji.skia,MatChung/color-emoji.skia,Cue/skia,mrobinson/skia,metajack/skia,Frankie-666/color-emoji.skia,MatChung/color-emoji.skia,Frankie-666/color-emoji.skia,metajack/skia,hbwhlklive/color-emoji.skia,hbwhlklive/color-emoji.skia,Hankuo/color-emoji.skia,hbwhlklive/color-emoji.skia,Hankuo/color-emoji.skia,Frankie-666/color-emoji.skia,Hankuo/color-emoji.skia,MatChung/color-emoji.skia,hbwhlklive/color-emoji.skia,MatChung/color-emoji.skia,Hankuo/color-emoji.skia,Cue/skia,Frankie-666/color-emoji.skia,mrobinson/skia,MatChung/color-emoji.skia,metajack/skia,Hankuo/color-emoji.skia,hbwhlklive/color-emoji.skia,MatChung/color-emoji.skia,Hankuo/color-emoji.skia,hbwhlklive/color-emoji.skia,Cue/skia,Frankie-666/color-emoji.skia,metajack/skia,mrobinson/skia,mrobinson/skia,mrobinson/skia
9866c2c2d649fac485bc47aa77cffbc93d1c6c9e
#import "PSControlTableCell.h" @class UIActivityIndicatorView; @interface PSSwitchTableCell : PSControlTableCell { UIActivityIndicatorView *_activityIndicator; } @property (nonatomic) BOOL loading; @end
#import "PSControlTableCell.h" @class UIActivityIndicatorView; @interface PSSwitchTableCell : PSControlTableCell { UIActivityIndicatorView *_activityIndicator; } @property BOOL loading; - (BOOL)loading; - (void)setLoading:(BOOL)loading; - (id)controlValue; - (id)newControl; - (void)setCellEnabled:(BOOL)enabled; - (void)refreshCellContentsWithSpecifier:(id)specifier; - (id)initWithStyle:(int)style reuseIdentifier:(id)identifier specifier:(id)specifier; - (void)reloadWithSpecifier:(id)specifier animated:(BOOL)animated; - (BOOL)canReload; - (void)prepareForReuse; - (void)layoutSubviews; - (void)setValue:(id)value; @end
--- +++ @@ -2,23 +2,10 @@ @class UIActivityIndicatorView; -@interface PSSwitchTableCell : PSControlTableCell { - UIActivityIndicatorView *_activityIndicator; +@interface PSSwitchTableCell : PSControlTableCell { + UIActivityIndicatorView *_activityIndicator; } -@property BOOL loading; - -- (BOOL)loading; -- (void)setLoading:(BOOL)loading; -- (id)controlValue; -- (id)newControl; -- (void)setCellEnabled:(BOOL)enabled; -- (void)refreshCellContentsWithSpecifier:(id)specifier; -- (id)initWithStyle:(int)style reuseIdentifier:(id)identifier specifier:(id)specifier; -- (void)reloadWithSpecifier:(id)specifier animated:(BOOL)animated; -- (BOOL)canReload; -- (void)prepareForReuse; -- (void)layoutSubviews; -- (void)setValue:(id)value; +@property (nonatomic) BOOL loading; @end
[Preferences] Clean up what looks like a direct class-dump header.
unlicense
hbang/headers,hbang/headers
9246d17556bfb4e9e5ba05f90ca3983dd7ad28d3
/* * Written by Scott Bennett. * Public domain. */ #ifndef LOADER_H #define LOADER_H #include "bool.h" bool load(const char * fileName); #endif /* LOADER_H */
/* * Copyright (c) 2014, 2016 Scott Bennett <[email protected]> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef LOADER_H #define LOADER_H #include "bool.h" bool load(const char * fileName); #endif /* LOADER_H */
--- +++ @@ -1,17 +1,6 @@ /* - * Copyright (c) 2014, 2016 Scott Bennett <[email protected]> - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * Written by Scott Bennett. + * Public domain. */ #ifndef LOADER_H
Move this file into public domain; it's too simple to copyright...
isc
sbennett1990/YESS,sbennett1990/YESS,sbennett1990/YESS
490fabb3cf7bd259a4d2a26cfece0c0c70564e37
/* * Copyright (c) 2014-2015 Erik Doernenburg and contributors * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use these files 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. */ #import <Foundation/Foundation.h> @interface OCMLocation : NSObject { id testCase; NSString *file; NSUInteger line; } + (instancetype)locationWithTestCase:(id)aTestCase file:(NSString *)aFile line:(NSUInteger)aLine; - (instancetype)initWithTestCase:(id)aTestCase file:(NSString *)aFile line:(NSUInteger)aLine; - (id)testCase; - (NSString *)file; - (NSUInteger)line; @end #if defined(__cplusplus) extern "C" #else extern #endif OCMLocation *OCMMakeLocation(id testCase, const char *file, int line);
/* * Copyright (c) 2014-2015 Erik Doernenburg and contributors * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use these files 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. */ #import <Foundation/Foundation.h> @interface OCMLocation : NSObject { id testCase; NSString *file; NSUInteger line; } + (instancetype)locationWithTestCase:(id)aTestCase file:(NSString *)aFile line:(NSUInteger)aLine; - (instancetype)initWithTestCase:(id)aTestCase file:(NSString *)aFile line:(NSUInteger)aLine; - (id)testCase; - (NSString *)file; - (NSUInteger)line; @end extern OCMLocation *OCMMakeLocation(id testCase, const char *file, int line);
--- +++ @@ -33,4 +33,9 @@ @end -extern OCMLocation *OCMMakeLocation(id testCase, const char *file, int line); +#if defined(__cplusplus) +extern "C" +#else +extern +#endif +OCMLocation *OCMMakeLocation(id testCase, const char *file, int line);
Fix linking in Objective–C++ tests. As detailed in #238, linking tests sometimes fails when OCMock is being used in Objective-C++ (.mm) test case files. This commit solves that problem by conditionally declaring `OCMMakeLocation` as `extern C` in when included in a C++ compilation unit.
apache-2.0
Lightricks/ocmock,Lightricks/ocmock,Lightricks/ocmock,NextThought/ocmock,erikdoe/ocmock,firebase/ocmock,BohdanOrlov/ocmock,Lightricks/ocmock,erikdoe/ocmock,dhardiman/ocmock,erikdoe/ocmock,imhuntingwabbits/ocmock,erikdoe/ocmock,SteveFortune/ocmock
c21ae1451dd3a20b4ff0566ae45a0e58a35081fe
// // Created by dar on 1/29/16. // #ifndef C003_OS_H #define C003_OS_H enum class OS { WIN32 = 0, UNIX, ANDROID, IOS, MAC }; #ifdef __APPLE__ #include "TargetConditionals.h" #endif constexpr const OS OPERATING_SYTEM = #ifdef _WIN32 OS::WIN32 #elif __APPLE__ #if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE OS::IOS #elif TARGET_OS_MAC OS::MAC #else #error "Unknown Apple platform" #endif #elif __ANDROID__ OS::ANDROID #elif __unix__ OS::UNIX #else #error "Unknown platform" #endif ; constexpr const bool IS_MOBILE = OPERATING_SYTEM == OS::ANDROID || OPERATING_SYTEM == OS::IOS; #endif //C003_OS_H
// // Created by dar on 1/29/16. // #ifndef C003_OS_H #define C003_OS_H enum class OS { WIN32 = 0, UNIX, ANDROID, APPLE }; constexpr const OS OPERATING_SYTEM = #ifdef _WIN32 OS::WIN32 #elif __APPLE__ OS::APPLE #elif __ANDROID__ OS::ANDROID #elif __unix__ OS::UNIX #endif ; constexpr const bool IS_MOBILE = OPERATING_SYTEM == OS::ANDROID || OPERATING_SYTEM == OS::APPLE; #endif //C003_OS_H
--- +++ @@ -9,21 +9,34 @@ WIN32 = 0, UNIX, ANDROID, - APPLE + IOS, + MAC }; + +#ifdef __APPLE__ +#include "TargetConditionals.h" +#endif constexpr const OS OPERATING_SYTEM = #ifdef _WIN32 OS::WIN32 #elif __APPLE__ - OS::APPLE + #if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE + OS::IOS + #elif TARGET_OS_MAC + OS::MAC + #else + #error "Unknown Apple platform" + #endif #elif __ANDROID__ OS::ANDROID #elif __unix__ OS::UNIX +#else + #error "Unknown platform" #endif ; -constexpr const bool IS_MOBILE = OPERATING_SYTEM == OS::ANDROID || OPERATING_SYTEM == OS::APPLE; +constexpr const bool IS_MOBILE = OPERATING_SYTEM == OS::ANDROID || OPERATING_SYTEM == OS::IOS; #endif //C003_OS_H
Split APPLE operating system to IOS and MAC
mit
darsto/spooky,darsto/spooky
8afc766b82b045474873b2c6365bd31b449749ef
#define CAN_RECONNECT #define USE_POSIX #define POSIX_SIGNALS #define USE_UTIME #define USE_WAITPID #define HAVE_GETRUSAGE #define HAVE_FCHMOD #define NEED_PSELECT #define HAVE_SA_LEN #define SETPWENT_VOID #define RLIMIT_TYPE rlim_t #define RLIMIT_LONGLONG #define RLIMIT_FILE_INFINITY #define HAVE_CHROOT #define CAN_CHANGE_ID #define _TIMEZONE timezone #define PORT_NONBLOCK O_NONBLOCK #define PORT_WOULDBLK EWOULDBLOCK #define WAIT_T int #define KSYMS "/kernel" #define KMEM "/dev/kmem" #define UDPSUM "udpcksum" /* * We need to know the IPv6 address family number even on IPv4-only systems. * Note that this is NOT a protocol constant, and that if the system has its * own AF_INET6, different from ours below, all of BIND's libraries and * executables will need to be recompiled after the system <sys/socket.h> * has had this type added. The type number below is correct on most BSD- * derived systems for which AF_INET6 is defined. */ #ifndef AF_INET6 #define AF_INET6 24 #endif
#define CAN_RECONNECT #define USE_POSIX #define POSIX_SIGNALS #define USE_UTIME #define USE_WAITPID #define HAVE_GETRUSAGE #define HAVE_FCHMOD #define NEED_PSELECT #define HAVE_SA_LEN #define USE_LOG_CONS #define HAVE_CHROOT #define CAN_CHANGE_ID #define _TIMEZONE timezone #define PORT_NONBLOCK O_NONBLOCK #define PORT_WOULDBLK EWOULDBLOCK #define WAIT_T int #define KSYMS "/kernel" #define KMEM "/dev/kmem" #define UDPSUM "udpcksum" /* * We need to know the IPv6 address family number even on IPv4-only systems. * Note that this is NOT a protocol constant, and that if the system has its * own AF_INET6, different from ours below, all of BIND's libraries and * executables will need to be recompiled after the system <sys/socket.h> * has had this type added. The type number below is correct on most BSD- * derived systems for which AF_INET6 is defined. */ #ifndef AF_INET6 #define AF_INET6 24 #endif
--- +++ @@ -7,7 +7,10 @@ #define HAVE_FCHMOD #define NEED_PSELECT #define HAVE_SA_LEN -#define USE_LOG_CONS +#define SETPWENT_VOID +#define RLIMIT_TYPE rlim_t +#define RLIMIT_LONGLONG +#define RLIMIT_FILE_INFINITY #define HAVE_CHROOT #define CAN_CHANGE_ID
Update for some -current quirks, and some other things taken from the *bsd bind-8 ports. (our setpwent() was changed to return void, but our setgrent() returns int still!)
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
a82eba7c6c263e67ad58f5211dbc6d32d3963cb3
/* * NovelProcessTool.h * * Created on: 2015年2月19日 * Author: nemo */ #ifndef SRC_NOVELPROCESSTOOL_H_ #define SRC_NOVELPROCESSTOOL_H_ #include <string> #include <fstream> #include <vector> using namespace std; class NovelProcessTool { public: NovelProcessTool(); virtual ~NovelProcessTool(); protected: /// Check the work directory. void checkWorkingDirectory(); /// Open in and out file. int fileOpen(string novelName); /// Close in and out files. void fileClosed(); /// Analysis the temp folder. void analysisFile(); /// Novel tool action, implement in sub class. virtual void parseContents() = 0; fstream _fileInStream; ///< The file input stream. fstream _fileOutStream; ///< The file out stream. string _tempDir; ///< The temp folder directory path. string _resultDir; ///< The result folder directory path. vector<string> _inputNovel; ///< The input file name. }; #endif /* SRC_NOVELPROCESSTOOL_H_ */
/* * NovelProcessTool.h * * Created on: 2015年2月19日 * Author: nemo */ #ifndef SRC_NOVELPROCESSTOOL_H_ #define SRC_NOVELPROCESSTOOL_H_ #include <string> #include <fstream> #include <vector> using namespace std; class NovelProcessTool { public: NovelProcessTool(); virtual ~NovelProcessTool(); protected: /// Check the work directory. void checkWorkingDirectory(); /// Open in and out file. int fileOpen(string novelName); /// Close in and out files. void fileClosed(); /// Analysis the temp folder. void analysisFile(); fstream _fileInStream; ///< The file input stream. fstream _fileOutStream; ///< The file out stream. string _tempDir; ///< The temp folder directory path. string _resultDir; ///< The result folder directory path. vector<string> _inputNovel; ///< The input file name. }; #endif /* SRC_NOVELPROCESSTOOL_H_ */
--- +++ @@ -33,6 +33,9 @@ /// Analysis the temp folder. void analysisFile(); + /// Novel tool action, implement in sub class. + virtual void parseContents() = 0; + fstream _fileInStream; ///< The file input stream. fstream _fileOutStream; ///< The file out stream.
Modify void parseContents(0) as pure virtual function.
apache-2.0
NemoChenTW/NovelProcessTools,NemoChenTW/NovelProcessTools,NemoChenTW/NovelProcessTools
8d942517ca5d635a6510d1ebba97917b03eebb23
/** * Exercise 1-2 * * Experiment to find out what happens when printfs's argument string contains \c, * where c is some character not listed above. * * The C Programming Language - the second edition * by Brian Kernighan and Dennis Ritchie * * Author: Li Zhineng <[email protected]> * URL: https://zhineng.li * File: 1-2-backslash-c.c * Date: 2017-01-01 */ #include <stdio.h> main() { printf("hello, world\n\c"); }
/** * Exercise 1-2 * * Experiment to find out what happens when prints's argument string contains \c, * where c is some character not listed above. * * The C Programming Language - the second edition * by Brian Kernighan and Dennis Ritchie * * Author: Li Zhineng <[email protected]> * URL: https://zhineng.li * File: 1-2-backslash-c.c * Date: 2017-01-01 */ #include <stdio.h> main() { printf("hello, world\n\c"); }
--- +++ @@ -1,7 +1,7 @@ /** * Exercise 1-2 * - * Experiment to find out what happens when prints's argument string contains \c, + * Experiment to find out what happens when printfs's argument string contains \c, * where c is some character not listed above. * * The C Programming Language - the second edition
Fix misspelling in execrise 2 in chapter 1
mit
lizhineng/learning-the-c-programming-language
a9865d3e8694bfe5f94e69fd87d6d90798578936
#include "canard.h" #include "canard_internals.h" CANARD_INTERNAL void canardInitPoolAllocator(CanardPoolAllocator* allocator, CanardPoolAllocatorBlock* buf, unsigned int buf_len) { unsigned int current_index = 0; CanardPoolAllocatorBlock** current_block = &(allocator->free_list); while (current_index < buf_len) { *current_block = &buf[current_index]; current_block = &((*current_block)->next); current_index++; } *current_block = NULL; } CANARD_INTERNAL void* canardAllocateBlock(CanardPoolAllocator* allocator) { /* Check if there are any blocks available in the free list. */ if (allocator->free_list == NULL) { return NULL; } /* Take first available block and prepares next block for use. */ void* result = allocator->free_list; allocator->free_list = allocator->free_list->next; return result; } CANARD_INTERNAL void canardFreeBlock(CanardPoolAllocator* allocator, void* p) { CanardPoolAllocatorBlock* block = (CanardPoolAllocatorBlock*)p; block->next = allocator->free_list; allocator->free_list = block; }
#include "canard.h" #include "canard_internals.h" void canardInitPoolAllocator(CanardPoolAllocator* allocator, CanardPoolAllocatorBlock* buf, unsigned int buf_len) { unsigned int current_index = 0; CanardPoolAllocatorBlock** current_block = &(allocator->free_list); while (current_index < buf_len) { *current_block = &buf[current_index]; current_block = &((*current_block)->next); current_index++; } *current_block = NULL; } void* canardAllocateBlock(CanardPoolAllocator* allocator) { /* Check if there are any blocks available in the free list. */ if (allocator->free_list == NULL) { return NULL; } /* Take first available block and prepares next block for use. */ void* result = allocator->free_list; allocator->free_list = allocator->free_list->next; return result; } void canardFreeBlock(CanardPoolAllocator* allocator, void* p) { CanardPoolAllocatorBlock* block = (CanardPoolAllocatorBlock*)p; block->next = allocator->free_list; allocator->free_list = block; }
--- +++ @@ -1,7 +1,7 @@ #include "canard.h" #include "canard_internals.h" -void canardInitPoolAllocator(CanardPoolAllocator* allocator, CanardPoolAllocatorBlock* buf, unsigned int buf_len) +CANARD_INTERNAL void canardInitPoolAllocator(CanardPoolAllocator* allocator, CanardPoolAllocatorBlock* buf, unsigned int buf_len) { unsigned int current_index = 0; CanardPoolAllocatorBlock** current_block = &(allocator->free_list); @@ -14,7 +14,7 @@ *current_block = NULL; } -void* canardAllocateBlock(CanardPoolAllocator* allocator) +CANARD_INTERNAL void* canardAllocateBlock(CanardPoolAllocator* allocator) { /* Check if there are any blocks available in the free list. */ if (allocator->free_list == NULL) @@ -29,7 +29,7 @@ return result; } -void canardFreeBlock(CanardPoolAllocator* allocator, void* p) +CANARD_INTERNAL void canardFreeBlock(CanardPoolAllocator* allocator, void* p) { CanardPoolAllocatorBlock* block = (CanardPoolAllocatorBlock*)p;
Apply internal API marker to declarations too
mit
UAVCAN/libcanard,UAVCAN/libcanard,antoinealb/libcanard,UAVCAN/libcanard,antoinealb/libcanard
b1d73df29598cb3df43425377a395c1e4cafc1db
// // Copyright 2012 Ludovic Landry - http://about.me/ludoviclandry // // 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. // #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> #import "QRootElement.h" @interface QImageElement : QEntryElement @property (nonatomic, strong) UIImage *imageValue; @property (nonatomic, strong) NSString *imageValueNamed; @property (nonatomic, assign) float imageMaxLength; @property(nonatomic) UIImagePickerControllerSourceType source; - (QImageElement *)initWithTitle:(NSString *)title detailImage:(UIImage *)image; @end
// // Copyright 2012 Ludovic Landry - http://about.me/ludoviclandry // // 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. // #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> #import "QRootElement.h" @interface QImageElement : QEntryElement @property (nonatomic, strong) UIImage *imageValue; @property (nonatomic, strong) NSString *imageValueNamed; @property (nonatomic, assign) float imageMaxLength; @property(nonatomic) enum UIImagePickerControllerSourceType source; - (QImageElement *)initWithTitle:(NSString *)title detailImage:(UIImage *)image; @end
--- +++ @@ -22,7 +22,7 @@ @property (nonatomic, strong) UIImage *imageValue; @property (nonatomic, strong) NSString *imageValueNamed; @property (nonatomic, assign) float imageMaxLength; -@property(nonatomic) enum UIImagePickerControllerSourceType source; +@property(nonatomic) UIImagePickerControllerSourceType source; - (QImageElement *)initWithTitle:(NSString *)title detailImage:(UIImage *)image;
Fix bug that was causing error building pod in RubyMotion project
mit
raiffeisennet/QuickDialog
d352a1145f833ee804dff6576b4c0d5ee04cb099
#pragma once #include "Function.h" #include "FunctionInterface.h" class MMSTestFunc; template <> InputParameters validParams<MMSTestFunc>(); /** * Function of RHS for manufactured solution in spatial_constant_helmholtz test */ class MMSTestFunc : public Function, public FunctionInterface { public: MMSTestFunc(const InputParameters & parameters); virtual Real value(Real t, const Point & p) const override; protected: Real _length; const Function & _a; const Function & _b; Real _d; Real _h; Real _g_0_real; Real _g_0_imag; Real _g_l_real; Real _g_l_imag; MooseEnum _component; };
#ifndef MMSTESTFUNC_H #define MMSTESTFUNC_H #include "Function.h" #include "FunctionInterface.h" class MMSTestFunc; template <> InputParameters validParams<MMSTestFunc>(); /** * Function of RHS for manufactured solution in spatial_constant_helmholtz test */ class MMSTestFunc : public Function, public FunctionInterface { public: MMSTestFunc(const InputParameters & parameters); virtual Real value(Real t, const Point & p) const override; protected: Real _length; const Function & _a; const Function & _b; Real _d; Real _h; Real _g_0_real; Real _g_0_imag; Real _g_l_real; Real _g_l_imag; MooseEnum _component; }; #endif // MMSTESTFUNC_H
--- +++ @@ -1,5 +1,4 @@ -#ifndef MMSTESTFUNC_H -#define MMSTESTFUNC_H +#pragma once #include "Function.h" #include "FunctionInterface.h" @@ -37,5 +36,3 @@ MooseEnum _component; }; - -#endif // MMSTESTFUNC_H
Convert to pragma once in test functions refs #21085
lgpl-2.1
laagesen/moose,harterj/moose,andrsd/moose,sapitts/moose,milljm/moose,milljm/moose,idaholab/moose,lindsayad/moose,harterj/moose,idaholab/moose,andrsd/moose,sapitts/moose,harterj/moose,sapitts/moose,dschwen/moose,andrsd/moose,dschwen/moose,milljm/moose,sapitts/moose,dschwen/moose,laagesen/moose,lindsayad/moose,andrsd/moose,idaholab/moose,idaholab/moose,milljm/moose,harterj/moose,sapitts/moose,laagesen/moose,lindsayad/moose,milljm/moose,laagesen/moose,lindsayad/moose,lindsayad/moose,dschwen/moose,idaholab/moose,andrsd/moose,dschwen/moose,laagesen/moose,harterj/moose
0e8f41582505e156243a37100568f94f158ec978
// // OCTFileContent.h // OctoKit // // Created by Aron Cedercrantz on 14-07-2013. // Copyright (c) 2013 GitHub. All rights reserved. // #import "OCTContent.h" // A file in a git repository. @interface OCTFileContent : OCTContent // The encoding of the file content. @property (nonatomic, copy, readonly) NSString *encoding; // The raw, encoded, content of the file. // // See `encoding` for the encoding used. @property (nonatomic, copy, readonly) NSString *content; @end
// // OCTFileContent.h // OctoKit // // Created by Aron Cedercrantz on 14-07-2013. // Copyright (c) 2013 GitHub. All rights reserved. // #import "OCTContent.h" // A file in a git repository. @interface OCTFileContent : OCTContent // The encoding of the file content. @property (nonatomic, copy, readonly) NSString *encoding; // The raw, encoded, content of the file. // // See encoding for the encoding used. @property (nonatomic, copy, readonly) NSString *content; @end
--- +++ @@ -16,7 +16,7 @@ // The raw, encoded, content of the file. // -// See encoding for the encoding used. +// See `encoding` for the encoding used. @property (nonatomic, copy, readonly) NSString *content; @end
Add backticks around the ref to encoding property. Signed-off-by: Aron Cedercrantz <[email protected]>
mit
daukantas/octokit.objc,cnbin/octokit.objc,CHNLiPeng/octokit.objc,phatblat/octokit.objc,cnbin/octokit.objc,GroundControl-Solutions/octokit.objc,yeahdongcn/octokit.objc,jonesgithub/octokit.objc,GroundControl-Solutions/octokit.objc,daemonchen/octokit.objc,CleanShavenApps/octokit.objc,wrcj12138aaa/octokit.objc,xantage/octokit.objc,CHNLiPeng/octokit.objc,Palleas/octokit.objc,daemonchen/octokit.objc,leichunfeng/octokit.objc,wrcj12138aaa/octokit.objc,leichunfeng/octokit.objc,phatblat/octokit.objc,Acidburn0zzz/octokit.objc,daukantas/octokit.objc,Acidburn0zzz/octokit.objc,xantage/octokit.objc,jonesgithub/octokit.objc,Palleas/octokit.objc
5ad831820bf5c3c557f3b49e70c76c54a92e0085
#include <FreeRTOS.h> #include <semphr.h> #include <csp/arch/csp_semaphore.h> #include <csp/csp_debug.h> #include <csp/csp.h> void csp_bin_sem_init(csp_bin_sem_t * sem) { xSemaphoreCreateBinaryStatic(sem); xSemaphoreGive(sem); } int csp_bin_sem_wait(csp_bin_sem_t * sem, unsigned int timeout) { csp_log_lock("Wait: %p", sem); if (timeout != CSP_MAX_TIMEOUT) { timeout = timeout / portTICK_PERIOD_MS; } if (xSemaphoreTake((QueueHandle_t) sem, timeout) == pdPASS) { return CSP_SEMAPHORE_OK; } return CSP_SEMAPHORE_ERROR; } int csp_bin_sem_post(csp_bin_sem_t * sem) { csp_log_lock("Post: %p", sem); if (xSemaphoreGive((QueueHandle_t)sem) == pdPASS) { return CSP_SEMAPHORE_OK; } return CSP_SEMAPHORE_ERROR; }
#include <FreeRTOS.h> #include <semphr.h> #include <csp/arch/csp_semaphore.h> #include <csp/csp_debug.h> #include <csp/csp.h> void csp_bin_sem_init(csp_bin_sem_t * sem) { xSemaphoreCreateBinaryStatic(sem); xSemaphoreGive(sem); } int csp_bin_sem_wait(csp_bin_sem_t * sem, uint32_t timeout) { csp_log_lock("Wait: %p", sem); if (timeout != CSP_MAX_TIMEOUT) { timeout = timeout / portTICK_PERIOD_MS; } if (xSemaphoreTake((QueueHandle_t) sem, timeout) == pdPASS) { return CSP_SEMAPHORE_OK; } return CSP_SEMAPHORE_ERROR; } int csp_bin_sem_post(csp_bin_sem_t * sem) { csp_log_lock("Post: %p", sem); if (xSemaphoreGive((QueueHandle_t)sem) == pdPASS) { return CSP_SEMAPHORE_OK; } return CSP_SEMAPHORE_ERROR; }
--- +++ @@ -12,7 +12,7 @@ xSemaphoreGive(sem); } -int csp_bin_sem_wait(csp_bin_sem_t * sem, uint32_t timeout) { +int csp_bin_sem_wait(csp_bin_sem_t * sem, unsigned int timeout) { csp_log_lock("Wait: %p", sem); if (timeout != CSP_MAX_TIMEOUT) { timeout = timeout / portTICK_PERIOD_MS;
Fix function prototype for sem_wait on freertos
mit
libcsp/libcsp,libcsp/libcsp
c88a81fc3174e3989a0d75f68f2836ab55f1639e
#ifndef __CONFIG_H #define __CONFIG_H enum { CONFIG_KEY_RESOLUTION = 0, CONFIG_KEY_BLEND_USER1, CONFIG_KEY_BLEND_USER2, CONFIG_KEY_BLEND_USER3, CONFIG_KEY_BLEND_USER4, CONFIG_KEY_COUNT }; #ifdef BOARD_MINISPARTAN6 #define CONFIG_DEFAULTS { 5, 1, 2, 3, 4 } #else #define CONFIG_DEFAULTS { 9, 1, 2, 3, 4 } #endif void config_init(void); void config_write_all(void); unsigned char config_get(unsigned char key); void config_set(unsigned char key, unsigned char value); #endif /* __CONFIG_H */
#ifndef __CONFIG_H #define __CONFIG_H enum { CONFIG_KEY_RESOLUTION = 0, CONFIG_KEY_BLEND_USER1, CONFIG_KEY_BLEND_USER2, CONFIG_KEY_BLEND_USER3, CONFIG_KEY_BLEND_USER4, CONFIG_KEY_COUNT }; #define CONFIG_DEFAULTS { 9, 1, 2, 3, 4 } void config_init(void); void config_write_all(void); unsigned char config_get(unsigned char key); void config_set(unsigned char key, unsigned char value); #endif /* __CONFIG_H */
--- +++ @@ -11,7 +11,11 @@ CONFIG_KEY_COUNT }; +#ifdef BOARD_MINISPARTAN6 +#define CONFIG_DEFAULTS { 5, 1, 2, 3, 4 } +#else #define CONFIG_DEFAULTS { 9, 1, 2, 3, 4 } +#endif void config_init(void); void config_write_all(void);
firmware/lm32: Make 800x600 the default mode for the minispartan6+
bsd-2-clause
mithro/HDMI2USB-litex-firmware,mithro/HDMI2USB-litex-firmware,cr1901/HDMI2USB-litex-firmware,cr1901/HDMI2USB-litex-firmware,mithro/HDMI2USB-litex-firmware,cr1901/HDMI2USB-litex-firmware,cr1901/HDMI2USB-litex-firmware,mithro/HDMI2USB-litex-firmware
526b09b014c8219cfe3747170c6021fe92fb65d5
/* * * Copyright 2018 Asylo authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef ASYLO_TEST_UTIL_TEST_FLAGS_H_ #define ASYLO_TEST_UTIL_TEST_FLAGS_H_ #include <string> #include "absl/flags/declare.h" // Location for all temporary test files. ABSL_DECLARE_FLAG(std::string, test_tmpdir); #endif // ASYLO_TEST_UTIL_TEST_FLAGS_H_
/* * * Copyright 2018 Asylo authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef ASYLO_TEST_UTIL_TEST_FLAGS_H_ #define ASYLO_TEST_UTIL_TEST_FLAGS_H_ #include "absl/flags/declare.h" // Location for all temporary test files. ABSL_DECLARE_FLAG(std::string, test_tmpdir); #endif // ASYLO_TEST_UTIL_TEST_FLAGS_H_
--- +++ @@ -19,6 +19,8 @@ #ifndef ASYLO_TEST_UTIL_TEST_FLAGS_H_ #define ASYLO_TEST_UTIL_TEST_FLAGS_H_ +#include <string> + #include "absl/flags/declare.h" // Location for all temporary test files.
Add missing include of string PiperOrigin-RevId: 317401762 Change-Id: Icbc4d0e2a4e99a9e73a4d8e7ad148e34ee2e9d03
apache-2.0
google/asylo,google/asylo,google/asylo,google/asylo,google/asylo,google/asylo
cd2450371d48da1c548b8894cccc0a67cd8b0e99
/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright 2014 Couchbase, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include <stdarg.h> #include <platform/visibility.h> #ifdef __cplusplus extern "C" { #endif PLATFORM_PUBLIC_API int asprintf(char **ret, const char *format, ...); PLATFORM_PUBLIC_API int vasprintf(char **ret, const char *format, va_list ap); #ifdef __cplusplus } #endif /* * We have a fair amount of use of this file in our code base. * Let's just make a dummy file to aviod a lot of #ifdefs */ #ifndef strcasecmp #define strcasecmp(a, b) _stricmp(a, b) #endif #ifndef snprintf #define snprintf _snprintf #endif
/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright 2014 Couchbase, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include <stdarg.h> #include <platform/visibility.h> PLATFORM_PUBLIC_API int asprintf(char **ret, const char *format, ...); PLATFORM_PUBLIC_API int vasprintf(char **ret, const char *format, va_list ap); /* * We have a fair amount of use of this file in our code base. * Let's just make a dummy file to aviod a lot of #ifdefs */ #ifndef strcasecmp #define strcasecmp(a, b) _stricmp(a, b) #endif #ifndef snprintf #define snprintf _snprintf #endif
--- +++ @@ -20,11 +20,19 @@ #include <platform/visibility.h> +#ifdef __cplusplus +extern "C" { +#endif + PLATFORM_PUBLIC_API int asprintf(char **ret, const char *format, ...); PLATFORM_PUBLIC_API int vasprintf(char **ret, const char *format, va_list ap); + +#ifdef __cplusplus +} +#endif /* * We have a fair amount of use of this file in our code base.
Set C linkage for win32 [v]asprintf Change-Id: I7f82255467c05936baa702fa1d532156b0caba12 Reviewed-on: http://review.couchbase.org/52114 Reviewed-by: Dave Rigby <[email protected]> Tested-by: buildbot <[email protected]>
apache-2.0
vmx/platform,vmx/platform
814fd55d1b26335f1765ed59fda4b6325893a9ad
#ifndef MCLISP_CONS_H_ #define MCLISP_CONS_H_ #include <string> namespace mclisp { struct ConsCell { ConsCell* car; ConsCell* cdr; }; typedef struct ConsCell ConsCell; bool operator==(const ConsCell& lhs, const ConsCell& rhs); bool operator!=(const ConsCell& lhs, const ConsCell& rhs); bool operator< (const ConsCell& lhs, const ConsCell& rhs); bool operator> (const ConsCell& lhs, const ConsCell& rhs); bool operator<=(const ConsCell& lhs, const ConsCell& rhs); bool operator>=(const ConsCell& lhs, const ConsCell& rhs); std::ostream& operator<<(std::ostream& os, const ConsCell& cons); extern const ConsCell* kNil; extern const ConsCell* kT; void HackToFixNil(); const ConsCell* MakeSymbol(const std::string& name); const ConsCell* MakeCons(const ConsCell* car, const ConsCell* cdr); inline bool Symbolp(const ConsCell* c); inline bool Consp(const ConsCell* c); const std::string SymbolName(const ConsCell* symbol); } // namespace mclisp #endif // MCLISP_CONS_H_
#ifndef MCLISP_CONS_H_ #define MCLISP_CONS_H_ #include <string> namespace mclisp { class ConsCell { public: ConsCell(): car(nullptr), cdr(nullptr) {} ConsCell(ConsCell* car, ConsCell* cdr): car(car), cdr(cdr) {} ConsCell* car; ConsCell* cdr; }; bool operator==(const ConsCell& lhs, const ConsCell& rhs); bool operator!=(const ConsCell& lhs, const ConsCell& rhs); bool operator< (const ConsCell& lhs, const ConsCell& rhs); bool operator> (const ConsCell& lhs, const ConsCell& rhs); bool operator<=(const ConsCell& lhs, const ConsCell& rhs); bool operator>=(const ConsCell& lhs, const ConsCell& rhs); std::ostream& operator<<(std::ostream& os, const ConsCell& cons); extern const ConsCell* kNil; extern const ConsCell* kT; void HackToFixNil(); const ConsCell* MakeSymbol(const std::string& name); const ConsCell* MakeCons(const ConsCell* car, const ConsCell* cdr); inline bool Symbolp(const ConsCell* c); inline bool Consp(const ConsCell* c); const std::string SymbolName(const ConsCell* symbol); } // namespace mclisp #endif // MCLISP_CONS_H_
--- +++ @@ -6,15 +6,13 @@ namespace mclisp { -class ConsCell +struct ConsCell { -public: - ConsCell(): car(nullptr), cdr(nullptr) {} - ConsCell(ConsCell* car, ConsCell* cdr): car(car), cdr(cdr) {} + ConsCell* car; + ConsCell* cdr; +}; - ConsCell* car; - ConsCell* cdr; -}; +typedef struct ConsCell ConsCell; bool operator==(const ConsCell& lhs, const ConsCell& rhs); bool operator!=(const ConsCell& lhs, const ConsCell& rhs);
Convert ConsCell from class to POD.
mit
appleby/mccarthy-lisp,appleby/mccarthy-lisp,appleby/mccarthy-lisp,appleby/mccarthy-lisp,appleby/mccarthy-lisp
1aa266b2b3406f046e00b65bb747a19c6d4445d7
// -*- c++ -*- #ifndef LOCKS_H #define LOCKS_H #include <cstdio> #include <pthread.h> namespace locks { template <typename L> void unlocker(void* lock_ptr) { L* lock = (L*) lock_ptr; fprintf(stderr, "Releasing lock (unchecked) during cancellation!\n"); lock->unlock(); } template <typename L> void unlocker_checked(void* lock_ptr) { L& lock = *((L*) lock_ptr); if (lock.owns_lock()) { fprintf(stderr, "Releasing lock (checked) during cancellation!\n"); lock.unlock(); } } } #endif /* LOCKS_H */
// -*- c++ -*- #ifndef LOCKS_H #define LOCKS_H #include <pthread.h> namespace locks { template <typename L> void unlocker(void* lock_ptr) { L* lock = (L*) lock_ptr; lock->unlock(); } template <typename L> void unlocker_checked(void* lock_ptr) { L& lock = *((L*) lock_ptr); if (lock) lock.unlock(); } } #endif /* LOCKS_H */
--- +++ @@ -2,6 +2,7 @@ #ifndef LOCKS_H #define LOCKS_H +#include <cstdio> #include <pthread.h> namespace locks { @@ -10,6 +11,7 @@ void unlocker(void* lock_ptr) { L* lock = (L*) lock_ptr; + fprintf(stderr, "Releasing lock (unchecked) during cancellation!\n"); lock->unlock(); } @@ -17,8 +19,10 @@ void unlocker_checked(void* lock_ptr) { L& lock = *((L*) lock_ptr); - if (lock) + if (lock.owns_lock()) { + fprintf(stderr, "Releasing lock (checked) during cancellation!\n"); lock.unlock(); + } } }
Add logging etc. to lock release code.
lgpl-2.1
csw/libraft,csw/libraft
6ec5fad7e7122413b6e15d07f2ead6a5be8220b9
// Copyright (c) 2021 The Orbit 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 USER_SPACE_INSTRUMENTATION_ATTACH_H_ #define USER_SPACE_INSTRUMENTATION_ATTACH_H_ #include <sys/types.h> #include "OrbitBase/Result.h" namespace orbit_user_space_instrumentation { // Attaches to and stops all threads of the process `pid` using `PTRACE_ATTACH`. Being attached to a // process using this function is a precondition for using any of the tooling provided here. [[nodiscard]] ErrorMessageOr<void> AttachAndStopProcess(pid_t pid); // Detaches from all threads of the process `pid` and continues the execution. [[nodiscard]] ErrorMessageOr<void> DetachAndContinueProcess(pid_t pid); } // namespace orbit_user_space_instrumentation #endif // USER_SPACE_INSTRUMENTATION_ATTACH_H_
// Copyright (c) 2021 The Orbit 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 USER_SPACE_INSTRUMENTATION_ATTACH_H_ #define USER_SPACE_INSTRUMENTATION_ATTACH_H_ #include <sys/types.h> #include "OrbitBase/Result.h" namespace orbit_user_space_instrumentation { [[nodiscard]] ErrorMessageOr<void> AttachAndStopProcess(pid_t pid); [[nodiscard]] ErrorMessageOr<void> DetachAndContinueProcess(pid_t pid); } // namespace orbit_user_space_instrumentation #endif // USER_SPACE_INSTRUMENTATION_ATTACH_H_
--- +++ @@ -11,8 +11,11 @@ namespace orbit_user_space_instrumentation { +// Attaches to and stops all threads of the process `pid` using `PTRACE_ATTACH`. Being attached to a +// process using this function is a precondition for using any of the tooling provided here. [[nodiscard]] ErrorMessageOr<void> AttachAndStopProcess(pid_t pid); +// Detaches from all threads of the process `pid` and continues the execution. [[nodiscard]] ErrorMessageOr<void> DetachAndContinueProcess(pid_t pid); } // namespace orbit_user_space_instrumentation
Fix missing comment in header.
bsd-2-clause
google/orbit,google/orbit,google/orbit,google/orbit
8012d2842d234a838b2ff27c27c5222a665cf7f7
// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm %s -o /dev/null #define _JBLEN ((9 * 2) + 3 + 16) typedef int sigjmp_buf[_JBLEN + 1]; int sigsetjmp(sigjmp_buf env, int savemask); sigjmp_buf B; int foo() { sigsetjmp(B, 1); bar(); }
// RUN: %clang -S -emit-llvm %s -o /dev/null // XFAIL: mingw,win32 #include <setjmp.h> sigjmp_buf B; int foo() { sigsetjmp(B, 1); bar(); }
--- +++ @@ -1,8 +1,8 @@ -// RUN: %clang -S -emit-llvm %s -o /dev/null -// XFAIL: mingw,win32 +// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm %s -o /dev/null -#include <setjmp.h> - +#define _JBLEN ((9 * 2) + 3 + 16) +typedef int sigjmp_buf[_JBLEN + 1]; +int sigsetjmp(sigjmp_buf env, int savemask); sigjmp_buf B; int foo() { sigsetjmp(B, 1);
Remove the need for a header and specify a triple so that the type sizes make sense. git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@136309 91177308-0d34-0410-b5e6-96231b3b80d8
apache-2.0
apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang
95ee667503b8b3123951242e3f7b93598cb9f9b9
// Explorer loader problem list // /problem.h #ifndef PROBLEM_H_ #define PROBLEM_H_ /**错误列表*/ #define ERR_NO_MEM_FOR_ID 1 // 没有可用于中断描述符表的内存 #define ERR_NO_MEM_FOR_SD 2 // 没有可用于储存器描述符表的内存 #define ERR_NO_MEM_FOR_SCTBUF 3 // 没有可用于扇区缓存的内存 #define ERR_NO_MEM_FOR_CONFIG 4 // 没有可以分配给引导配置文件的内存 #define ERR_NO_MEM_FOR_BUFFER 5 // 没有可以分配给缓冲系统的内存 #define ERR_NO_MEM_FOR_FS 6 // 没有可以分配给文件系统的内存 #define ERR_NO_MEM_FOR_MMU 7 // 没有可以分配给MMU的内存 #define ERR_NO_FILE 8 // 没有文件 #define ERR_CONFIG_OVERSIZE 9 // CONFIG.LDR oversized /**警告列表*/ #define WARN_NO_MEM 0x80000001 // 无充足内存 #define WARN_STORAGE_NOT_SUPPORT 0x80000002 // 暂时不支持这个储存器 #define WARN_SCRIPT_SIZE_BAD 0x80000003 // length of cript incorrect #endif
// Explorer loader problem list // /problem.h #ifndef PROBLEM_H_ #define PROBLEM_H_ /**错误列表*/ #define ERR_NO_MEM_FOR_ID 1 // 没有可用于中断描述符表的内存 #define ERR_NO_MEM_FOR_SD 2 // 没有可用于储存器描述符表的内存 #define ERR_NO_MEM_FOR_SCTBUF 3 // 没有可用于扇区缓存的内存 #define ERR_NO_MEM_FOR_CONFIG 4 // 没有可以分配给引导配置文件的内存 #define ERR_NO_MEM_FOR_BUFFER 5 // 没有可以分配给缓冲系统的内存 #define ERR_NO_MEM_FOR_FS 6 // 没有可以分配给文件系统的内存 #define ERR_NO_MEM_FOR_MMU 7 // 没有可以分配给MMU的内存 /**警告列表*/ #define WARN_NO_MEM 0x80000001 // 无充足内存 #define WARN_STORAGE_NOT_SUPPORT 0x80000002 // 暂时不支持这个储存器 #endif
--- +++ @@ -5,18 +5,21 @@ #define PROBLEM_H_ /**错误列表*/ -#define ERR_NO_MEM_FOR_ID 1 // 没有可用于中断描述符表的内存 -#define ERR_NO_MEM_FOR_SD 2 // 没有可用于储存器描述符表的内存 +#define ERR_NO_MEM_FOR_ID 1 // 没有可用于中断描述符表的内存 +#define ERR_NO_MEM_FOR_SD 2 // 没有可用于储存器描述符表的内存 #define ERR_NO_MEM_FOR_SCTBUF 3 // 没有可用于扇区缓存的内存 #define ERR_NO_MEM_FOR_CONFIG 4 // 没有可以分配给引导配置文件的内存 #define ERR_NO_MEM_FOR_BUFFER 5 // 没有可以分配给缓冲系统的内存 -#define ERR_NO_MEM_FOR_FS 6 // 没有可以分配给文件系统的内存 +#define ERR_NO_MEM_FOR_FS 6 // 没有可以分配给文件系统的内存 #define ERR_NO_MEM_FOR_MMU 7 // 没有可以分配给MMU的内存 +#define ERR_NO_FILE 8 // 没有文件 +#define ERR_CONFIG_OVERSIZE 9 // CONFIG.LDR oversized /**警告列表*/ -#define WARN_NO_MEM 0x80000001 // 无充足内存 +#define WARN_NO_MEM 0x80000001 // 无充足内存 #define WARN_STORAGE_NOT_SUPPORT 0x80000002 // 暂时不支持这个储存器 +#define WARN_SCRIPT_SIZE_BAD 0x80000003 // length of cript incorrect #endif
Add new error and warning number
bsd-2-clause
MakeOS/GhostBirdOS,MakeOS/GhostBirdOS
10f5254d144aaa8af56eb6445cea08a491d9fcb8
/* SPDX-License-Identifier: BSD-2-Clause */ #include <tilck/common/basic_defs.h> #include <tilck/common/printk.h> #include <tilck/kernel/sched.h> #include "osl.h" #include <3rd_party/acpi/acpi.h> #include <3rd_party/acpi/acexcep.h> void early_init_acpi_module(void) { ACPI_STATUS rc; rc = AcpiInitializeSubsystem(); if (rc != AE_OK) panic("AcpiInitializeSubsystem() failed with: %d", rc); rc = AcpiInitializeTables(NULL, 0, true); if (rc != AE_OK) panic("AcpiInitializeTables() failed with: %d", rc); }
/* SPDX-License-Identifier: BSD-2-Clause */ #include <tilck/common/basic_defs.h> #include <tilck/common/printk.h> #include <tilck/kernel/sched.h> #include "osl.h" #include <3rd_party/acpi/acpi.h> #include <3rd_party/acpi/acexcep.h> static ACPI_TABLE_DESC acpi_tables[16]; void early_init_acpi_module(void) { ACPI_STATUS rc; rc = AcpiInitializeSubsystem(); if (rc != AE_OK) panic("AcpiInitializeSubsystem() failed with: %d", rc); rc = AcpiInitializeTables(acpi_tables, 16, false); if (rc != AE_OK) panic("AcpiInitializeTables() failed with: %d", rc); }
--- +++ @@ -9,8 +9,6 @@ #include <3rd_party/acpi/acpi.h> #include <3rd_party/acpi/acexcep.h> -static ACPI_TABLE_DESC acpi_tables[16]; - void early_init_acpi_module(void) { @@ -21,7 +19,7 @@ if (rc != AE_OK) panic("AcpiInitializeSubsystem() failed with: %d", rc); - rc = AcpiInitializeTables(acpi_tables, 16, false); + rc = AcpiInitializeTables(NULL, 0, true); if (rc != AE_OK) panic("AcpiInitializeTables() failed with: %d", rc);
[acpi] Make AcpiInitializeTables to dynamically alloc tables
bsd-2-clause
vvaltchev/experimentOs,vvaltchev/experimentOs,vvaltchev/experimentOs,vvaltchev/experimentOs
8fa7230f1fee1f68f7ae6ed03cdc72c63a8c97b2
#include "v3p_f2c.h" #ifdef __cplusplus extern "C" { #endif /* The divide by zero below appears to be perhaps on purpose to create a numerical exception. */ #ifdef _MSC_VER # pragma warning (disable: 4723) /* potential divide by 0 */ #endif #ifdef KR_headers integer pow_ii(ap, bp) integer *ap, *bp; #else integer pow_ii(integer *ap, integer *bp) #endif { integer pow, x, n; unsigned long u; x = *ap; n = *bp; if (n <= 0) { if (n == 0 || x == 1) return 1; if (x != -1) return x == 0 ? 1/x : 0; n = -n; } u = n; for(pow = 1; ; ) { if(u & 01) pow *= x; if(u >>= 1) x *= x; else break; } return(pow); } #ifdef __cplusplus } #endif
#include "v3p_f2c.h" #ifdef __cplusplus extern "C" { #endif #ifdef KR_headers integer pow_ii(ap, bp) integer *ap, *bp; #else integer pow_ii(integer *ap, integer *bp) #endif { integer pow, x, n; unsigned long u; x = *ap; n = *bp; if (n <= 0) { if (n == 0 || x == 1) return 1; if (x != -1) return x == 0 ? 1/x : 0; n = -n; } u = n; for(pow = 1; ; ) { if(u & 01) pow *= x; if(u >>= 1) x *= x; else break; } return(pow); } #ifdef __cplusplus } #endif
--- +++ @@ -1,6 +1,12 @@ #include "v3p_f2c.h" #ifdef __cplusplus extern "C" { +#endif + +/* The divide by zero below appears to be perhaps on purpose to create + a numerical exception. */ +#ifdef _MSC_VER +# pragma warning (disable: 4723) /* potential divide by 0 */ #endif #ifdef KR_headers
COMP: Disable divide by zero warning for VS6 to avoid modifying function implementation.
apache-2.0
InsightSoftwareConsortium/ITK,rhgong/itk-with-dom,LucHermitte/ITK,LucasGandel/ITK,cpatrick/ITK-RemoteIO,jcfr/ITK,paulnovo/ITK,blowekamp/ITK,eile/ITK,GEHC-Surgery/ITK,hjmjohnson/ITK,atsnyder/ITK,biotrump/ITK,richardbeare/ITK,jmerkow/ITK,blowekamp/ITK,vfonov/ITK,jcfr/ITK,malaterre/ITK,jmerkow/ITK,hjmjohnson/ITK,vfonov/ITK,msmolens/ITK,fbudin69500/ITK,fbudin69500/ITK,BlueBrain/ITK,fuentesdt/InsightToolkit-dev,wkjeong/ITK,jcfr/ITK,PlutoniumHeart/ITK,Kitware/ITK,cpatrick/ITK-RemoteIO,PlutoniumHeart/ITK,eile/ITK,daviddoria/itkHoughTransform,daviddoria/itkHoughTransform,GEHC-Surgery/ITK,GEHC-Surgery/ITK,zachary-williamson/ITK,rhgong/itk-with-dom,CapeDrew/DITK,zachary-williamson/ITK,blowekamp/ITK,fedral/ITK,thewtex/ITK,fbudin69500/ITK,paulnovo/ITK,paulnovo/ITK,eile/ITK,ajjl/ITK,blowekamp/ITK,CapeDrew/DITK,daviddoria/itkHoughTransform,hendradarwin/ITK,atsnyder/ITK,hendradarwin/ITK,biotrump/ITK,fedral/ITK,malaterre/ITK,hendradarwin/ITK,stnava/ITK,heimdali/ITK,fedral/ITK,InsightSoftwareConsortium/ITK,cpatrick/ITK-RemoteIO,zachary-williamson/ITK,CapeDrew/DITK,ajjl/ITK,LucHermitte/ITK,malaterre/ITK,ajjl/ITK,thewtex/ITK,InsightSoftwareConsortium/ITK,hendradarwin/ITK,spinicist/ITK,zachary-williamson/ITK,CapeDrew/DCMTK-ITK,atsnyder/ITK,rhgong/itk-with-dom,jmerkow/ITK,PlutoniumHeart/ITK,rhgong/itk-with-dom,LucasGandel/ITK,hinerm/ITK,fedral/ITK,rhgong/itk-with-dom,CapeDrew/DITK,eile/ITK,BlueBrain/ITK,fedral/ITK,wkjeong/ITK,wkjeong/ITK,BRAINSia/ITK,CapeDrew/DITK,wkjeong/ITK,hjmjohnson/ITK,spinicist/ITK,vfonov/ITK,msmolens/ITK,biotrump/ITK,jmerkow/ITK,fedral/ITK,daviddoria/itkHoughTransform,eile/ITK,fuentesdt/InsightToolkit-dev,BlueBrain/ITK,msmolens/ITK,Kitware/ITK,thewtex/ITK,ajjl/ITK,CapeDrew/DCMTK-ITK,paulnovo/ITK,blowekamp/ITK,cpatrick/ITK-RemoteIO,stnava/ITK,biotrump/ITK,itkvideo/ITK,CapeDrew/DCMTK-ITK,jmerkow/ITK,GEHC-Surgery/ITK,hinerm/ITK,cpatrick/ITK-RemoteIO,richardbeare/ITK,heimdali/ITK,jcfr/ITK,msmolens/ITK,biotrump/ITK,hjmjohnson/ITK,LucHermitte/ITK,PlutoniumHeart/ITK,malaterre/ITK,wkjeong/ITK,thewtex/ITK,hinerm/ITK,LucHermitte/ITK,stnava/ITK,jmerkow/ITK,heimdali/ITK,itkvideo/ITK,malaterre/ITK,atsnyder/ITK,CapeDrew/DITK,wkjeong/ITK,stnava/ITK,rhgong/itk-with-dom,LucHermitte/ITK,hjmjohnson/ITK,GEHC-Surgery/ITK,BRAINSia/ITK,fedral/ITK,LucasGandel/ITK,BlueBrain/ITK,BlueBrain/ITK,daviddoria/itkHoughTransform,hendradarwin/ITK,eile/ITK,LucHermitte/ITK,vfonov/ITK,heimdali/ITK,ajjl/ITK,CapeDrew/DITK,itkvideo/ITK,rhgong/itk-with-dom,hendradarwin/ITK,Kitware/ITK,itkvideo/ITK,BRAINSia/ITK,LucasGandel/ITK,CapeDrew/DCMTK-ITK,zachary-williamson/ITK,heimdali/ITK,blowekamp/ITK,CapeDrew/DCMTK-ITK,GEHC-Surgery/ITK,hendradarwin/ITK,fbudin69500/ITK,jcfr/ITK,hjmjohnson/ITK,itkvideo/ITK,thewtex/ITK,fuentesdt/InsightToolkit-dev,itkvideo/ITK,PlutoniumHeart/ITK,CapeDrew/DCMTK-ITK,zachary-williamson/ITK,hinerm/ITK,thewtex/ITK,msmolens/ITK,eile/ITK,eile/ITK,fuentesdt/InsightToolkit-dev,LucasGandel/ITK,stnava/ITK,jmerkow/ITK,hinerm/ITK,LucasGandel/ITK,spinicist/ITK,fuentesdt/InsightToolkit-dev,PlutoniumHeart/ITK,CapeDrew/DITK,itkvideo/ITK,atsnyder/ITK,msmolens/ITK,Kitware/ITK,wkjeong/ITK,stnava/ITK,vfonov/ITK,GEHC-Surgery/ITK,fbudin69500/ITK,BRAINSia/ITK,paulnovo/ITK,jcfr/ITK,vfonov/ITK,heimdali/ITK,zachary-williamson/ITK,jcfr/ITK,heimdali/ITK,biotrump/ITK,richardbeare/ITK,paulnovo/ITK,ajjl/ITK,itkvideo/ITK,InsightSoftwareConsortium/ITK,atsnyder/ITK,PlutoniumHeart/ITK,biotrump/ITK,zachary-williamson/ITK,fuentesdt/InsightToolkit-dev,stnava/ITK,blowekamp/ITK,zachary-williamson/ITK,spinicist/ITK,LucasGandel/ITK,hinerm/ITK,stnava/ITK,GEHC-Surgery/ITK,ajjl/ITK,LucHermitte/ITK,jmerkow/ITK,BlueBrain/ITK,hendradarwin/ITK,daviddoria/itkHoughTransform,InsightSoftwareConsortium/ITK,spinicist/ITK,heimdali/ITK,PlutoniumHeart/ITK,cpatrick/ITK-RemoteIO,fuentesdt/InsightToolkit-dev,thewtex/ITK,fedral/ITK,daviddoria/itkHoughTransform,atsnyder/ITK,spinicist/ITK,fbudin69500/ITK,fuentesdt/InsightToolkit-dev,msmolens/ITK,hinerm/ITK,spinicist/ITK,InsightSoftwareConsortium/ITK,fuentesdt/InsightToolkit-dev,wkjeong/ITK,daviddoria/itkHoughTransform,richardbeare/ITK,atsnyder/ITK,jcfr/ITK,biotrump/ITK,cpatrick/ITK-RemoteIO,richardbeare/ITK,malaterre/ITK,malaterre/ITK,InsightSoftwareConsortium/ITK,fbudin69500/ITK,BRAINSia/ITK,blowekamp/ITK,paulnovo/ITK,BlueBrain/ITK,LucasGandel/ITK,spinicist/ITK,BRAINSia/ITK,vfonov/ITK,richardbeare/ITK,fbudin69500/ITK,Kitware/ITK,Kitware/ITK,cpatrick/ITK-RemoteIO,paulnovo/ITK,msmolens/ITK,BRAINSia/ITK,daviddoria/itkHoughTransform,vfonov/ITK,CapeDrew/DCMTK-ITK,CapeDrew/DITK,spinicist/ITK,vfonov/ITK,Kitware/ITK,atsnyder/ITK,ajjl/ITK,hjmjohnson/ITK,malaterre/ITK,eile/ITK,CapeDrew/DCMTK-ITK,BlueBrain/ITK,LucHermitte/ITK,hinerm/ITK,CapeDrew/DCMTK-ITK,hinerm/ITK,malaterre/ITK,itkvideo/ITK,rhgong/itk-with-dom,richardbeare/ITK,stnava/ITK
01b0b70139f2378c410b089f843c61fb61583031
#include "bmmap.h" #include "vty.h" void bmmap_init() { } void bmmap_print() { vty_puts("BIOS memory map:\n"); vty_printf("%d entries at %p\n", *bios_memmap_entries_ptr, bios_memmap_ptr); vty_printf(" ADDR LEN TYPE RESERVED\n"); for(int i = 0; i < *bios_memmap_entries_ptr; i++) { BmmapEntry * entry = &(*bios_memmap_ptr)[i]; vty_printf("%08x:%08x %08x:%08x %08x %08x\n", entry->base_addr_high, entry->base_addr_low, entry->length_high, entry->length_low, entry->type, entry->reserved); } }
#include "bmmap.h" #include "vty.h" void bmmap_init() { } void bmmap_print() { vty_puts("BIOS memory map:\n"); vty_printf("%d entries at %p\n", *bios_memmap_entries_ptr, bios_memmap_ptr); vty_printf("ADDR LOW ADDR HI LEN LOW LEN HI TYPE RESERVED\n"); for(int i = 0; i < *bios_memmap_entries_ptr; i++) { BmmapEntry * entry = &(*bios_memmap_ptr)[i]; vty_printf("%08x %08x %08x %08x %08x %08x\n", entry->base_addr_low, entry->base_addr_high, entry->length_low, entry->length_high, entry->type, entry->reserved); } }
--- +++ @@ -9,14 +9,14 @@ vty_printf("%d entries at %p\n", *bios_memmap_entries_ptr, bios_memmap_ptr); - vty_printf("ADDR LOW ADDR HI LEN LOW LEN HI TYPE RESERVED\n"); + vty_printf(" ADDR LEN TYPE RESERVED\n"); for(int i = 0; i < *bios_memmap_entries_ptr; i++) { BmmapEntry * entry = &(*bios_memmap_ptr)[i]; - vty_printf("%08x %08x %08x %08x %08x %08x\n", + vty_printf("%08x:%08x %08x:%08x %08x %08x\n", + entry->base_addr_high, entry->base_addr_low, - entry->base_addr_high, + entry->length_high, entry->length_low, - entry->length_high, entry->type, entry->reserved); }
Tweak display of BIOS memory map
mit
wconrad/brazzle,wconrad/brazzle
b4aeaf99c621d17a147acf431d7e131c6860f5ac
#include <stddef.h> #include <stdint.h> #include "cc1.h" Symbol *curfun; extern Node *convert(Node *np, Type *tp1, char iscast); static void Return(void) { Node *np; Type *tp = curfun->type->type; expect(RETURN); np = expr(); if (np->type != tp) { if (tp == voidtype) warn(1, "function returning void returns a value"); else if ((np = convert(np, tp, 0)) == NULL) error("incorrect type in return"); } emitret(tp); emitexp(np); } void compound(void) { expect('{'); while (!accept('}')) { switch (yytoken) { case TYPE: case SCLASS: case TQUALIFIER: decl(); break; case RETURN: Return(); break; default: emitexp(expr()); } expect(';'); } }
#include <stddef.h> #include <stdint.h> #include "cc1.h" Symbol *curfun; extern Node *convert(Node *np, Type *tp1, char iscast); static void Return(void) { Node *np; Type *tp = curfun->type->type; expect(RETURN); np = expr(); if (np->type != tp) { if ((np = convert(np, tp, 0)) == NULL) error("incorrect type in return"); } emitret(tp); emitexp(np); } void compound(void) { expect('{'); while (!accept('}')) { switch (yytoken) { case TYPE: case SCLASS: case TQUALIFIER: decl(); break; case RETURN: Return(); break; default: emitexp(expr()); } expect(';'); } }
--- +++ @@ -17,7 +17,9 @@ expect(RETURN); np = expr(); if (np->type != tp) { - if ((np = convert(np, tp, 0)) == NULL) + if (tp == voidtype) + warn(1, "function returning void returns a value"); + else if ((np = convert(np, tp, 0)) == NULL) error("incorrect type in return"); } emitret(tp);
Check that void function can return a value
isc
k0gaMSX/scc,k0gaMSX/kcc,k0gaMSX/scc,k0gaMSX/scc,k0gaMSX/kcc,8l/scc,8l/scc,8l/scc
ee6d21258db24ac2640a410bc27ea1b552b36ca1
// // main.c // Check if a string has all unique characters by counting how many times each character appears using its ASCII code // // Created by Jack Zuban on 8/20/17. // Copyright © 2017 Jack Zuban. All rights reserved. // #include <stdio.h> _Bool isUniqueChars(char *str) { int frequencyDictionary[127] = {}; while(*str) { frequencyDictionary[(int) *str]++; if (frequencyDictionary[(int) *str] > 1) { return 0; } str++; } return 1; } int main(void) { _Bool isUniqueChars(char *string); char inputString[127] = {}; printf("Please enter your string: "); fgets(inputString, 128, stdin); printf("This string with %s\n", isUniqueChars(inputString) ? "unique characters." : "duplicates."); return 0; }
// // main.c // unique-characters // // Created by Jack Zuban on 8/20/17. // Copyright © 2017 Jack Zuban. All rights reserved. // #include <stdio.h> void printCharacters(char *inputString) { int dictinary[30] = {}; while (*inputString) { dictinary[(int) *inputString]++; printf("Current character is: %c\n", *inputString); inputString++; } } int main(int argc, const char * argv[]) { void printCharacters(char *inputString); char inputString[80] = {}; printf("Please enter your string: "); scanf("%s", inputString); // build a hash table with caracters printCharacters(inputString); printf("Your string is: %s\n", inputString); return 0; }
--- +++ @@ -1,6 +1,6 @@ // // main.c -// unique-characters +// Check if a string has all unique characters by counting how many times each character appears using its ASCII code // // Created by Jack Zuban on 8/20/17. // Copyright © 2017 Jack Zuban. All rights reserved. @@ -8,28 +8,30 @@ #include <stdio.h> -void printCharacters(char *inputString) { - int dictinary[30] = {}; +_Bool isUniqueChars(char *str) { + int frequencyDictionary[127] = {}; - while (*inputString) { - dictinary[(int) *inputString]++; - printf("Current character is: %c\n", *inputString); + while(*str) { + frequencyDictionary[(int) *str]++; - inputString++; + if (frequencyDictionary[(int) *str] > 1) { + return 0; + } + + str++; } + + return 1; } -int main(int argc, const char * argv[]) { - void printCharacters(char *inputString); - char inputString[80] = {}; +int main(void) { + _Bool isUniqueChars(char *string); + char inputString[127] = {}; printf("Please enter your string: "); - scanf("%s", inputString); + fgets(inputString, 128, stdin); - // build a hash table with caracters - printCharacters(inputString); - - printf("Your string is: %s\n", inputString); + printf("This string with %s\n", isUniqueChars(inputString) ? "unique characters." : "duplicates."); return 0; }
Check if a string has all unique characters algorithm
mit
jack-zuban/c-practice
8ae38b029c6566f18bcf7a8781c1235f2d57acbc
#include <gst/gst.h> #include <gst/farsight/fs-codec.h> #include "fs-rtp-discover-codecs.h" int main (int argc, char **argv) { GList *elements = NULL; GError *error = NULL; gst_init (&argc, &argv); g_debug ("AUDIO STARTING!!"); elements = fs_rtp_blueprints_get (FS_MEDIA_TYPE_AUDIO, &error); if (error) g_debug ("Error: %s", error->message); g_clear_error (&error); fs_rtp_blueprints_unref (FS_MEDIA_TYPE_AUDIO); g_debug ("AUDIO FINISHED!!"); g_debug ("VIDEO STARTING!!"); elements = fs_rtp_blueprints_get (FS_MEDIA_TYPE_VIDEO, &error); if (error) g_debug ("Error: %s", error->message); g_clear_error (&error); fs_rtp_blueprints_unref (FS_MEDIA_TYPE_VIDEO); g_debug ("VIDEO FINISHED!!"); return 0; }
#include <gst/gst.h> #include <gst/farsight/fs-codec.h> #include "fs-rtp-discover-codecs.h" int main (int argc, char **argv) { GList *elements = NULL; GError *error = NULL; gst_init (&argc, &argv); g_debug ("AUDIO STARTING!!"); elements = load_codecs (FS_MEDIA_TYPE_AUDIO, &error); if (error) g_debug ("Error: %s", error->message); g_clear_error (&error); unload_codecs (FS_MEDIA_TYPE_AUDIO); g_debug ("AUDIO FINISHED!!"); g_debug ("VIDEO STARTING!!"); elements = load_codecs (FS_MEDIA_TYPE_VIDEO, &error); if (error) g_debug ("Error: %s", error->message); g_clear_error (&error); unload_codecs (FS_MEDIA_TYPE_VIDEO); g_debug ("VIDEO FINISHED!!"); return 0; }
--- +++ @@ -15,27 +15,27 @@ g_debug ("AUDIO STARTING!!"); - elements = load_codecs (FS_MEDIA_TYPE_AUDIO, &error); + elements = fs_rtp_blueprints_get (FS_MEDIA_TYPE_AUDIO, &error); if (error) g_debug ("Error: %s", error->message); g_clear_error (&error); - unload_codecs (FS_MEDIA_TYPE_AUDIO); + fs_rtp_blueprints_unref (FS_MEDIA_TYPE_AUDIO); g_debug ("AUDIO FINISHED!!"); g_debug ("VIDEO STARTING!!"); - elements = load_codecs (FS_MEDIA_TYPE_VIDEO, &error); + elements = fs_rtp_blueprints_get (FS_MEDIA_TYPE_VIDEO, &error); if (error) g_debug ("Error: %s", error->message); g_clear_error (&error); - unload_codecs (FS_MEDIA_TYPE_VIDEO); + fs_rtp_blueprints_unref (FS_MEDIA_TYPE_VIDEO); g_debug ("VIDEO FINISHED!!");
Use the new function names for the codec discovery tests
lgpl-2.1
tieto/farstream,tieto/farstream,pexip/farstream,ahmedammar/skype_farsight2,pexip/farstream,tieto/farstream,shadeslayer/farstream,pexip/farstream,ahmedammar/skype_farsight2,kakaroto/farstream,ahmedammar/skype_farsight2,pexip/farstream,tieto/farstream,kakaroto/farstream,ahmedammar/skype_farsight2,shadeslayer/farstream,kakaroto/farstream,shadeslayer/farstream,kakaroto/farstream,shadeslayer/farstream,tieto/farstream
eed9cdf420ef882a796d9f8e9a233ded25c9becb
#pragma once #include "jwtxx/jwt.h" #include <string> namespace JWTXX { struct Key::Impl { // Need this for polymorphic behavior. virtual ~Impl() = default; // Need this due to the Rule of Five. Impl() = default; Impl(const Impl&) = delete; Impl& operator=(const Impl&) = delete; Impl(Impl&&) = default; Impl& operator=(Impl&&) = default; virtual std::string sign(const void* data, size_t size) const = 0; virtual bool verify(const void* data, size_t size, const std::string& signature) const = 0; }; }
#pragma once #include "jwtxx/jwt.h" #include <string> namespace JWTXX { struct Key::Impl { virtual ~Impl() {} virtual std::string sign(const void* data, size_t size) const = 0; virtual bool verify(const void* data, size_t size, const std::string& signature) const = 0; }; }
--- +++ @@ -9,7 +9,15 @@ struct Key::Impl { - virtual ~Impl() {} + // Need this for polymorphic behavior. + virtual ~Impl() = default; + // Need this due to the Rule of Five. + Impl() = default; + Impl(const Impl&) = delete; + Impl& operator=(const Impl&) = delete; + Impl(Impl&&) = default; + Impl& operator=(Impl&&) = default; + virtual std::string sign(const void* data, size_t size) const = 0; virtual bool verify(const void* data, size_t size, const std::string& signature) const = 0; };
Enable move and disable copy for key implementations.
mit
madf/jwtxx,madf/jwtxx,RealImage/jwtxx,RealImage/jwtxx
0b08a3698e0cc1a26d7a85238c5035ceeb564e3a
// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s extern void abort() __attribute__((noreturn)); void f1() { abort(); } // CHECK-LABEL: define {{.*}}void @f1() // CHECK-NEXT: entry: // CHECK-NEXT: call void @abort() // CHECK-NEXT: unreachable // CHECK-NEXT: } void *f2() { abort(); return 0; } // CHECK-LABEL: define {{.*}}i8* @f2() // CHECK-NEXT: entry: // CHECK-NEXT: call void @abort() // CHECK-NEXT: unreachable // CHECK-NEXT: }
// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s extern void abort() __attribute__((noreturn)); void f1() { abort(); } // CHECK-LABEL: define void @f1() // CHECK-NEXT: entry: // CHECK-NEXT: call void @abort() // CHECK-NEXT: unreachable // CHECK-NEXT: } void *f2() { abort(); return 0; } // CHECK-LABEL: define i8* @f2() // CHECK-NEXT: entry: // CHECK-NEXT: call void @abort() // CHECK-NEXT: unreachable // CHECK-NEXT: }
--- +++ @@ -5,7 +5,7 @@ void f1() { abort(); } -// CHECK-LABEL: define void @f1() +// CHECK-LABEL: define {{.*}}void @f1() // CHECK-NEXT: entry: // CHECK-NEXT: call void @abort() // CHECK-NEXT: unreachable @@ -15,7 +15,7 @@ abort(); return 0; } -// CHECK-LABEL: define i8* @f2() +// CHECK-LABEL: define {{.*}}i8* @f2() // CHECK-NEXT: entry: // CHECK-NEXT: call void @abort() // CHECK-NEXT: unreachable
Fix for different build configurations. git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@358125 91177308-0d34-0410-b5e6-96231b3b80d8
apache-2.0
apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-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,llvm-mirror/clang,llvm-mirror/clang
f5d025e4a30b5f0dc1a4df85135e0ee507847342
#include "../common.c" #include "m-dict.h" static inline bool oor_equal_p(unsigned int k, unsigned char n) { return k == (unsigned int)n; } static inline void oor_set(unsigned int *k, unsigned char n) { *k = (unsigned int)n; } DICT_OA_DEF2(dict_oa_uint, unsigned int, M_OPEXTEND(M_DEFAULT_OPLIST, OOR_EQUAL(oor_equal_p), OOR_SET(oor_set M_IPTR)), unsigned int, M_DEFAULT_OPLIST) void test_int(uint32_t n, uint32_t x0) { uint32_t i, x, z = 0; dict_oa_uint_t h; dict_oa_uint_init(h); for (i = 0, x = x0; i < n; ++i) { x = hash32(x); unsigned int key = get_key(n, x); unsigned int *ptr = dict_oa_uint_get_at(h, key); (*ptr)++; z+= *ptr; } fprintf(stderr, "# unique keys: %d; checksum: %u\n", (int) dict_oa_uint_size(h), z); dict_oa_uint_clear(h); }
#include "../common.c" #include "m-dict.h" static inline bool oor_equal_p(unsigned int k, unsigned char n) { return k == (unsigned int)n; } static inline void oor_set(unsigned int *k, unsigned char n) { *k = (unsigned int)n; } DICT_OA_DEF2(dict_oa_uint, unsigned int, M_OPEXTEND(M_DEFAULT_OPLIST, OOR_EQUAL(oor_equal_p), OOR_SET(oor_set M_IPTR)), unsigned int, M_DEFAULT_OPLIST) void test_int(uint32_t n, uint32_t x0) { uint32_t i, x, z = 0; dict_oa_uint_t h; dict_oa_uint_init(h); for (i = 0, x = x0; i < n; ++i) { x = hash32(x); unsigned int key = get_key(n, x); unsigned int *ptr = dict_oa_uint_get(h, key); if (ptr) { (*ptr)++; z+= *ptr; } else { dict_oa_uint_set_at(h, key, 1); z+=1; } } fprintf(stderr, "# unique keys: %d; checksum: %u\n", (int) dict_oa_uint_size(h), z); dict_oa_uint_clear(h); }
--- +++ @@ -22,9 +22,9 @@ for (i = 0, x = x0; i < n; ++i) { x = hash32(x); unsigned int key = get_key(n, x); - unsigned int *ptr = dict_oa_uint_get(h, key); - if (ptr) { (*ptr)++; z+= *ptr; } - else { dict_oa_uint_set_at(h, key, 1); z+=1; } + unsigned int *ptr = dict_oa_uint_get_at(h, key); + (*ptr)++; + z+= *ptr; } fprintf(stderr, "# unique keys: %d; checksum: %u\n", (int) dict_oa_uint_size(h), z); dict_oa_uint_clear(h);
Simplify code to use get_at method with its get & create semantic
bsd-2-clause
P-p-H-d/mlib,P-p-H-d/mlib
f1e5e9d9db6e8e467d994f6307452147d2becbca
#ifndef CPR_TIMEOUT_H #define CPR_TIMEOUT_H #include <cstdint> #include <chrono> #include <limits> #include <stdexcept> namespace cpr { class Timeout { public: Timeout(const std::chrono::milliseconds& duration) : ms{duration} { if(ms.count() > std::numeric_limits<long>::max()) { throw std::overflow_error("cpr::Timeout: timeout value overflow."); } if(ms.count() < std::numeric_limits<long>::min()) { throw std::underflow_error("cpr::Timeout: timeout value underflow."); } } Timeout(const std::int32_t& milliseconds) : Timeout{std::chrono::milliseconds(milliseconds)} {} std::chrono::milliseconds ms; }; } // namespace cpr #endif
#ifndef CPR_TIMEOUT_H #define CPR_TIMEOUT_H #include <cstdint> #include <chrono> namespace cpr { class Timeout { public: Timeout(const std::chrono::milliseconds& timeout) : ms(timeout) {} Timeout(const std::int32_t& timeout) : ms(timeout) {} std::chrono::milliseconds ms; }; } // namespace cpr #endif
--- +++ @@ -3,13 +3,23 @@ #include <cstdint> #include <chrono> +#include <limits> +#include <stdexcept> namespace cpr { class Timeout { public: - Timeout(const std::chrono::milliseconds& timeout) : ms(timeout) {} - Timeout(const std::int32_t& timeout) : ms(timeout) {} + Timeout(const std::chrono::milliseconds& duration) : ms{duration} { + if(ms.count() > std::numeric_limits<long>::max()) { + throw std::overflow_error("cpr::Timeout: timeout value overflow."); + } + if(ms.count() < std::numeric_limits<long>::min()) { + throw std::underflow_error("cpr::Timeout: timeout value underflow."); + } + } + Timeout(const std::int32_t& milliseconds) + : Timeout{std::chrono::milliseconds(milliseconds)} {} std::chrono::milliseconds ms; };
Check for under/overflow in Timeout constructor. Codestyle fixes.
mit
msuvajac/cpr,msuvajac/cpr,whoshuu/cpr,whoshuu/cpr,msuvajac/cpr,whoshuu/cpr
457459df300b2c65084cac758b8dc28538da8c06
// // YTConnector.h // AKYouTube // // Created by Anton Pomozov on 10.09.13. // Copyright (c) 2013 Akademon Ltd. All rights reserved. // #import <Foundation/Foundation.h> @class YTConnector; @protocol YTLoginViewControllerInterface <NSObject> @property (nonatomic, strong, readonly) UIWebView *webView; @optional @property (nonatomic, assign) BOOL shouldPresentCloseButton; @property (nonatomic, strong) UIImage *closeButtonImageName; @end @protocol YTConnectorDelegate <NSObject> - (void)presentLoginViewControler:(UIViewController<YTLoginViewControllerInterface> *)loginViewController; - (void)connectionEstablished; - (void)connectionDidFailWithError:(NSError *)error; - (void)appDidFailAuthorize; - (void)userRejectedApp; @end @interface YTConnector : NSObject @property (nonatomic, weak) id<YTConnectorDelegate> delegate; + (YTConnector *)sharedInstance; - (void)connectWithClientId:(NSString *)clientId andClientSecret:(NSString *)clientSecret; - (void)authorizeAppWithScopesList:(NSString *)scopesList inLoginViewController:(UIViewController<YTLoginViewControllerInterface> *)loginViewController; @end
// // YTConnector.h // AKYouTube // // Created by Anton Pomozov on 10.09.13. // Copyright (c) 2013 Akademon Ltd. All rights reserved. // #import <Foundation/Foundation.h> @class YTConnector; @protocol YTLoginViewControllerInterface <NSObject> @property (nonatomic, strong, readonly) UIWebView *webView; @property (nonatomic, assign) BOOL shouldPresentCloseButton; @property (nonatomic, strong) UIImage *closeButtonImageName; @end @protocol YTConnectorDelegate <NSObject> - (void)presentLoginViewControler:(UIViewController<YTLoginViewControllerInterface> *)loginViewController; - (void)connectionEstablished; - (void)connectionDidFailWithError:(NSError *)error; - (void)appDidFailAuthorize; - (void)userRejectedApp; @end @interface YTConnector : NSObject @property (nonatomic, weak) id<YTConnectorDelegate> delegate; + (YTConnector *)sharedInstance; - (void)connectWithClientId:(NSString *)clientId andClientSecret:(NSString *)clientSecret; - (void)authorizeAppWithScopesList:(NSString *)scopesList inLoginViewController:(UIViewController<YTLoginViewControllerInterface> *)loginViewController; @end
--- +++ @@ -13,6 +13,9 @@ @protocol YTLoginViewControllerInterface <NSObject> @property (nonatomic, strong, readonly) UIWebView *webView; + +@optional + @property (nonatomic, assign) BOOL shouldPresentCloseButton; @property (nonatomic, strong) UIImage *closeButtonImageName;
[Mod]: Make close button properties optional.
mit
pomozoff/AKYouTube,pomozoff/AKYouTube,pomozoff/AKYouTube
875a794dd1d9c3e183b456b8fe826c04874bbf55
// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef NET_FLIP_FLIP_BITMASKS_H_ #define NET_FLIP_FLIP_BITMASKS_H_ namespace flip { const unsigned int kStreamIdMask = 0x7fffffff; // StreamId mask from the FlipHeader const unsigned int kControlFlagMask = 0x8000; // Control flag mask from the FlipHeader const unsigned int kPriorityMask = 0xc0; // Priority mask from the SYN_FRAME const unsigned int kLengthMask = 0xffffff; // Mask the lower 24 bits. } // flip #endif // NET_FLIP_FLIP_BITMASKS_H_
// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef NET_FLIP_FLIP_BITMASKS_H_ #define NET_FLIP_FLIP_BITMASKS_H_ namespace flip { const int kStreamIdMask = 0x7fffffff; // StreamId mask from the FlipHeader const int kControlFlagMask = 0x8000; // Control flag mask from the FlipHeader const int kPriorityMask = 0xc0; // Priority mask from the SYN_FRAME const int kLengthMask = 0xffffff; // Mask the lower 24 bits. } // flip #endif // NET_FLIP_FLIP_BITMASKS_H_
--- +++ @@ -7,12 +7,11 @@ namespace flip { -const int kStreamIdMask = 0x7fffffff; // StreamId mask from the FlipHeader -const int kControlFlagMask = 0x8000; // Control flag mask from the FlipHeader -const int kPriorityMask = 0xc0; // Priority mask from the SYN_FRAME -const int kLengthMask = 0xffffff; // Mask the lower 24 bits. +const unsigned int kStreamIdMask = 0x7fffffff; // StreamId mask from the FlipHeader +const unsigned int kControlFlagMask = 0x8000; // Control flag mask from the FlipHeader +const unsigned int kPriorityMask = 0xc0; // Priority mask from the SYN_FRAME +const unsigned int kLengthMask = 0xffffff; // Mask the lower 24 bits. } // flip #endif // NET_FLIP_FLIP_BITMASKS_H_ -
linux: Fix signed vs unsigned issue Review URL: http://codereview.chromium.org/297015 git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@30099 0039d316-1c4b-4281-b951-d872f2087c98
bsd-3-clause
krieger-od/nwjs_chromium.src,pozdnyakov/chromium-crosswalk,fujunwei/chromium-crosswalk,M4sse/chromium.src,zcbenz/cefode-chromium,dednal/chromium.src,zcbenz/cefode-chromium,chuan9/chromium-crosswalk,dednal/chromium.src,Just-D/chromium-1,timopulkkinen/BubbleFish,pozdnyakov/chromium-crosswalk,anirudhSK/chromium,fujunwei/chromium-crosswalk,markYoungH/chromium.src,rogerwang/chromium,zcbenz/cefode-chromium,ltilve/chromium,hgl888/chromium-crosswalk,dednal/chromium.src,mogoweb/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,Jonekee/chromium.src,ltilve/chromium,nacl-webkit/chrome_deps,hgl888/chromium-crosswalk,nacl-webkit/chrome_deps,hgl888/chromium-crosswalk,chuan9/chromium-crosswalk,mogoweb/chromium-crosswalk,bright-sparks/chromium-spacewalk,mogoweb/chromium-crosswalk,krieger-od/nwjs_chromium.src,hgl888/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,ltilve/chromium,junmin-zhu/chromium-rivertrail,hujiajie/pa-chromium,rogerwang/chromium,dushu1203/chromium.src,Pluto-tv/chromium-crosswalk,anirudhSK/chromium,keishi/chromium,zcbenz/cefode-chromium,bright-sparks/chromium-spacewalk,hgl888/chromium-crosswalk-efl,fujunwei/chromium-crosswalk,M4sse/chromium.src,hujiajie/pa-chromium,keishi/chromium,hgl888/chromium-crosswalk,patrickm/chromium.src,Fireblend/chromium-crosswalk,axinging/chromium-crosswalk,axinging/chromium-crosswalk,hujiajie/pa-chromium,markYoungH/chromium.src,mogoweb/chromium-crosswalk,rogerwang/chromium,zcbenz/cefode-chromium,crosswalk-project/chromium-crosswalk-efl,Pluto-tv/chromium-crosswalk,ChromiumWebApps/chromium,nacl-webkit/chrome_deps,pozdnyakov/chromium-crosswalk,ChromiumWebApps/chromium,markYoungH/chromium.src,M4sse/chromium.src,krieger-od/nwjs_chromium.src,dushu1203/chromium.src,patrickm/chromium.src,ondra-novak/chromium.src,Pluto-tv/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,chuan9/chromium-crosswalk,Just-D/chromium-1,TheTypoMaster/chromium-crosswalk,nacl-webkit/chrome_deps,Pluto-tv/chromium-crosswalk,anirudhSK/chromium,keishi/chromium,junmin-zhu/chromium-rivertrail,rogerwang/chromium,nacl-webkit/chrome_deps,timopulkkinen/BubbleFish,crosswalk-project/chromium-crosswalk-efl,hujiajie/pa-chromium,chuan9/chromium-crosswalk,junmin-zhu/chromium-rivertrail,Chilledheart/chromium,Just-D/chromium-1,anirudhSK/chromium,robclark/chromium,nacl-webkit/chrome_deps,Jonekee/chromium.src,M4sse/chromium.src,junmin-zhu/chromium-rivertrail,junmin-zhu/chromium-rivertrail,timopulkkinen/BubbleFish,timopulkkinen/BubbleFish,ChromiumWebApps/chromium,markYoungH/chromium.src,krieger-od/nwjs_chromium.src,hgl888/chromium-crosswalk-efl,M4sse/chromium.src,axinging/chromium-crosswalk,littlstar/chromium.src,pozdnyakov/chromium-crosswalk,Jonekee/chromium.src,ltilve/chromium,krieger-od/nwjs_chromium.src,patrickm/chromium.src,robclark/chromium,zcbenz/cefode-chromium,hgl888/chromium-crosswalk-efl,mogoweb/chromium-crosswalk,fujunwei/chromium-crosswalk,axinging/chromium-crosswalk,robclark/chromium,mohamed--abdel-maksoud/chromium.src,hgl888/chromium-crosswalk,ChromiumWebApps/chromium,Pluto-tv/chromium-crosswalk,hujiajie/pa-chromium,rogerwang/chromium,M4sse/chromium.src,markYoungH/chromium.src,hgl888/chromium-crosswalk,M4sse/chromium.src,ltilve/chromium,rogerwang/chromium,robclark/chromium,crosswalk-project/chromium-crosswalk-efl,hgl888/chromium-crosswalk-efl,TheTypoMaster/chromium-crosswalk,Just-D/chromium-1,patrickm/chromium.src,rogerwang/chromium,TheTypoMaster/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,hgl888/chromium-crosswalk-efl,patrickm/chromium.src,Just-D/chromium-1,krieger-od/nwjs_chromium.src,dushu1203/chromium.src,pozdnyakov/chromium-crosswalk,jaruba/chromium.src,PeterWangIntel/chromium-crosswalk,markYoungH/chromium.src,pozdnyakov/chromium-crosswalk,jaruba/chromium.src,Jonekee/chromium.src,nacl-webkit/chrome_deps,crosswalk-project/chromium-crosswalk-efl,dednal/chromium.src,axinging/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,mohamed--abdel-maksoud/chromium.src,markYoungH/chromium.src,jaruba/chromium.src,littlstar/chromium.src,PeterWangIntel/chromium-crosswalk,hgl888/chromium-crosswalk-efl,crosswalk-project/chromium-crosswalk-efl,zcbenz/cefode-chromium,mohamed--abdel-maksoud/chromium.src,robclark/chromium,Fireblend/chromium-crosswalk,Jonekee/chromium.src,keishi/chromium,axinging/chromium-crosswalk,ondra-novak/chromium.src,PeterWangIntel/chromium-crosswalk,jaruba/chromium.src,dednal/chromium.src,krieger-od/nwjs_chromium.src,TheTypoMaster/chromium-crosswalk,Jonekee/chromium.src,dednal/chromium.src,fujunwei/chromium-crosswalk,krieger-od/nwjs_chromium.src,ondra-novak/chromium.src,hgl888/chromium-crosswalk-efl,Just-D/chromium-1,anirudhSK/chromium,krieger-od/nwjs_chromium.src,timopulkkinen/BubbleFish,hujiajie/pa-chromium,keishi/chromium,littlstar/chromium.src,hujiajie/pa-chromium,Chilledheart/chromium,axinging/chromium-crosswalk,anirudhSK/chromium,crosswalk-project/chromium-crosswalk-efl,anirudhSK/chromium,axinging/chromium-crosswalk,hujiajie/pa-chromium,ChromiumWebApps/chromium,bright-sparks/chromium-spacewalk,patrickm/chromium.src,markYoungH/chromium.src,anirudhSK/chromium,markYoungH/chromium.src,hujiajie/pa-chromium,jaruba/chromium.src,dednal/chromium.src,mohamed--abdel-maksoud/chromium.src,mohamed--abdel-maksoud/chromium.src,ChromiumWebApps/chromium,ltilve/chromium,TheTypoMaster/chromium-crosswalk,jaruba/chromium.src,Chilledheart/chromium,patrickm/chromium.src,pozdnyakov/chromium-crosswalk,junmin-zhu/chromium-rivertrail,TheTypoMaster/chromium-crosswalk,ltilve/chromium,junmin-zhu/chromium-rivertrail,timopulkkinen/BubbleFish,ondra-novak/chromium.src,chuan9/chromium-crosswalk,hujiajie/pa-chromium,patrickm/chromium.src,Chilledheart/chromium,zcbenz/cefode-chromium,Jonekee/chromium.src,mogoweb/chromium-crosswalk,fujunwei/chromium-crosswalk,robclark/chromium,TheTypoMaster/chromium-crosswalk,nacl-webkit/chrome_deps,pozdnyakov/chromium-crosswalk,dednal/chromium.src,mogoweb/chromium-crosswalk,zcbenz/cefode-chromium,nacl-webkit/chrome_deps,Fireblend/chromium-crosswalk,Just-D/chromium-1,mohamed--abdel-maksoud/chromium.src,Just-D/chromium-1,Jonekee/chromium.src,junmin-zhu/chromium-rivertrail,Pluto-tv/chromium-crosswalk,Jonekee/chromium.src,Chilledheart/chromium,ChromiumWebApps/chromium,bright-sparks/chromium-spacewalk,axinging/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,ChromiumWebApps/chromium,jaruba/chromium.src,bright-sparks/chromium-spacewalk,Jonekee/chromium.src,littlstar/chromium.src,jaruba/chromium.src,hgl888/chromium-crosswalk-efl,mohamed--abdel-maksoud/chromium.src,hgl888/chromium-crosswalk-efl,mogoweb/chromium-crosswalk,timopulkkinen/BubbleFish,axinging/chromium-crosswalk,fujunwei/chromium-crosswalk,bright-sparks/chromium-spacewalk,ltilve/chromium,krieger-od/nwjs_chromium.src,ChromiumWebApps/chromium,Fireblend/chromium-crosswalk,Chilledheart/chromium,ondra-novak/chromium.src,rogerwang/chromium,bright-sparks/chromium-spacewalk,junmin-zhu/chromium-rivertrail,hgl888/chromium-crosswalk,krieger-od/nwjs_chromium.src,rogerwang/chromium,timopulkkinen/BubbleFish,hujiajie/pa-chromium,Fireblend/chromium-crosswalk,junmin-zhu/chromium-rivertrail,crosswalk-project/chromium-crosswalk-efl,ondra-novak/chromium.src,markYoungH/chromium.src,littlstar/chromium.src,M4sse/chromium.src,dednal/chromium.src,M4sse/chromium.src,Fireblend/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,jaruba/chromium.src,dushu1203/chromium.src,jaruba/chromium.src,Fireblend/chromium-crosswalk,M4sse/chromium.src,anirudhSK/chromium,chuan9/chromium-crosswalk,Pluto-tv/chromium-crosswalk,zcbenz/cefode-chromium,littlstar/chromium.src,ondra-novak/chromium.src,jaruba/chromium.src,PeterWangIntel/chromium-crosswalk,ondra-novak/chromium.src,keishi/chromium,rogerwang/chromium,ChromiumWebApps/chromium,mogoweb/chromium-crosswalk,Just-D/chromium-1,littlstar/chromium.src,anirudhSK/chromium,Pluto-tv/chromium-crosswalk,bright-sparks/chromium-spacewalk,bright-sparks/chromium-spacewalk,ltilve/chromium,dushu1203/chromium.src,dushu1203/chromium.src,dushu1203/chromium.src,dushu1203/chromium.src,keishi/chromium,Fireblend/chromium-crosswalk,fujunwei/chromium-crosswalk,anirudhSK/chromium,Jonekee/chromium.src,nacl-webkit/chrome_deps,axinging/chromium-crosswalk,anirudhSK/chromium,pozdnyakov/chromium-crosswalk,dushu1203/chromium.src,TheTypoMaster/chromium-crosswalk,timopulkkinen/BubbleFish,M4sse/chromium.src,crosswalk-project/chromium-crosswalk-efl,chuan9/chromium-crosswalk,Chilledheart/chromium,dushu1203/chromium.src,junmin-zhu/chromium-rivertrail,PeterWangIntel/chromium-crosswalk,robclark/chromium,fujunwei/chromium-crosswalk,mogoweb/chromium-crosswalk,ChromiumWebApps/chromium,PeterWangIntel/chromium-crosswalk,pozdnyakov/chromium-crosswalk,timopulkkinen/BubbleFish,dednal/chromium.src,robclark/chromium,markYoungH/chromium.src,keishi/chromium,patrickm/chromium.src,keishi/chromium,keishi/chromium,pozdnyakov/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,chuan9/chromium-crosswalk,hgl888/chromium-crosswalk,nacl-webkit/chrome_deps,robclark/chromium,littlstar/chromium.src,robclark/chromium,ChromiumWebApps/chromium,hgl888/chromium-crosswalk-efl,Fireblend/chromium-crosswalk,zcbenz/cefode-chromium,keishi/chromium,dednal/chromium.src,chuan9/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,Chilledheart/chromium,timopulkkinen/BubbleFish,dushu1203/chromium.src,Chilledheart/chromium,Pluto-tv/chromium-crosswalk,ondra-novak/chromium.src
49d8436a2b84d7bd90fc76c17b723ad5c89772a7
#ifndef EMULATOR_REGISTER_H #define EMULATOR_REGISTER_H #include <cstdint> template <typename T> class Register { public: Register() {}; void set(const T new_value) { val = new_value; }; T value() const { return val; }; void increment() { val += 1; }; void decrement() { val -= 1; }; private: T val; }; typedef Register<uint8_t> ByteRegister; typedef Register<uint16_t> WordRegister; class RegisterPair { public: RegisterPair(ByteRegister& low, ByteRegister& high); void set_low(const uint8_t byte); void set_high(const uint8_t byte); void set_low(const ByteRegister& byte); void set_high(const ByteRegister& byte); void set(const uint16_t word); uint8_t low() const; uint8_t high() const; uint16_t value() const; void increment(); void decrement(); private: ByteRegister& low_byte; ByteRegister& high_byte; }; class Offset { public: Offset(uint8_t val) : val(val) {}; Offset(ByteRegister& reg) : val(reg.value()) {}; uint8_t value() { return val; } private: uint8_t val; }; #endif
#ifndef EMULATOR_REGISTER_H #define EMULATOR_REGISTER_H #include <cstdint> template <typename T> class Register { public: Register() {}; void set(const T new_value) { val = new_value; }; T value() const { return val; }; void increment() { val += 1; }; void decrement() { val -= 1; }; private: T val; }; typedef Register<uint8_t> ByteRegister; typedef Register<uint16_t> WordRegister; class RegisterPair { public: RegisterPair(ByteRegister& low, ByteRegister& high); void set_low(const uint8_t byte); void set_high(const uint8_t byte); void set_low(const ByteRegister& byte); void set_high(const ByteRegister& byte); void set(const uint16_t word); uint8_t low() const; uint8_t high() const; uint16_t value() const; void increment(); void decrement(); private: ByteRegister& low_byte; ByteRegister& high_byte; }; #endif
--- +++ @@ -46,4 +46,15 @@ ByteRegister& high_byte; }; +class Offset { +public: + Offset(uint8_t val) : val(val) {}; + Offset(ByteRegister& reg) : val(reg.value()) {}; + + uint8_t value() { return val; } + +private: + uint8_t val; +}; + #endif
Add the mini offset utility class
bsd-3-clause
jgilchrist/emulator,jgilchrist/emulator,jgilchrist/emulator
a394a676b804449c2c939a26ee394a025f7c325c
/*! @file GTMAppAuth.h @brief GTMAppAuth SDK @copyright Copyright 2016 Google Inc. @copydetails 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. */ #import "GTMAppAuthFetcherAuthorization.h" #import "GTMAppAuthFetcherAuthorization+Keychain.h" #if TARGET_OS_TV #elif TARGET_OS_WATCH #elif TARGET_OS_IOS || TARGET_OS_MAC #import "GTMKeychain.h" #import "GTMOAuth2KeychainCompatibility.h" #else #warn "Platform Undefined" #endif
/*! @file GTMAppAuth.h @brief GTMAppAuth SDK @copyright Copyright 2016 Google Inc. @copydetails 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. */ #import "GTMAppAuthFetcherAuthorization.h" #import "GTMAppAuthFetcherAuthorization+Keychain.h" #import "GTMKeychain.h" #if TARGET_OS_TV #elif TARGET_OS_WATCH #elif TARGET_OS_IOS #import "GTMOAuth2KeychainCompatibility.h" #elif TARGET_OS_MAC #import "GTMOAuth2KeychainCompatibility.h" #else #warn "Platform Undefined" #endif
--- +++ @@ -18,13 +18,11 @@ #import "GTMAppAuthFetcherAuthorization.h" #import "GTMAppAuthFetcherAuthorization+Keychain.h" -#import "GTMKeychain.h" #if TARGET_OS_TV #elif TARGET_OS_WATCH -#elif TARGET_OS_IOS -#import "GTMOAuth2KeychainCompatibility.h" -#elif TARGET_OS_MAC +#elif TARGET_OS_IOS || TARGET_OS_MAC +#import "GTMKeychain.h" #import "GTMOAuth2KeychainCompatibility.h" #else #warn "Platform Undefined"
Move to iOS and Mac targets only.
apache-2.0
google/GTMAppAuth,google/GTMAppAuth
2a3b7a9e9928124865cfce561f410a9018aaeb94
#pragma once #include <time.h> #include <sys/time.h> #ifdef __MACH__ #include <mach/clock.h> #include <mach/mach.h> #endif static inline unsigned long long current_time_ns() { #ifdef __MACH__ clock_serv_t cclock; mach_timespec_t mts; host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock); clock_get_time(cclock, &mts); mach_port_deallocate(mach_task_self(), cclock); unsigned long long s = 1000000000ULL * (unsigned long long)mts.tv_sec; return (unsigned long long)mts.tv_nsec + s; #else struct timespec t ={0,0}; clock_gettime(CLOCK_MONOTONIC, &t); unsigned long long s = 1000000000ULL * (unsigned long long)t.tv_sec; return (((unsigned long long)t.tv_nsec)) + s; #endif }
#pragma once #include <time.h> #include <sys/time.h> static inline unsigned long long current_time_ns() { #ifdef __MACH__ clock_serv_t cclock; mach_timespec_t mts; host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock); clock_get_time(cclock, &mts); mach_port_deallocate(mach_task_self(), cclock); unsigned long long s = 1000000000ULL * (unsigned long long)mts.tv_sec; return (unsigned long long)mts.tv_nsec + s; #else struct timespec t ={0,0}; clock_gettime(CLOCK_MONOTONIC, &t); unsigned long long s = 1000000000ULL * (unsigned long long)t.tv_sec; return (((unsigned long long)t.tv_nsec)) + s; #endif }
--- +++ @@ -2,6 +2,11 @@ #include <time.h> #include <sys/time.h> + +#ifdef __MACH__ +#include <mach/clock.h> +#include <mach/mach.h> +#endif static inline unsigned long long current_time_ns() { #ifdef __MACH__
Fix compilation errors on Mac OS
bsd-3-clause
habanero-rice/tasking-micro-benchmark-suite,habanero-rice/tasking-micro-benchmark-suite,habanero-rice/tasking-micro-benchmark-suite
e3a06f573bba62836623a5bc6aab7b6df4c235e5
// // ArticleCellView.h // PXListView // // Adapted from PXListView by Alex Rozanski // Modified by Barijaona Ramaholimihaso // #import <Cocoa/Cocoa.h> #import "PXListViewCell.h" #import "ArticleView.h" @interface ArticleCellView : PXListViewCell { AppController * controller; ArticleView *articleView; NSProgressIndicator * progressIndicator; BOOL inProgress; int folderId; } @property (nonatomic, retain) ArticleView *articleView; @property BOOL inProgress; @property int folderId; // Public functions -(id)initWithReusableIdentifier: (NSString*)identifier inFrame:(NSRect)frameRect; @end
// // ArticleCellView.h // PXListView // // Adapted from PXListView by Alex Rozanski // Modified by Barijaona Ramaholimihaso // #import <Cocoa/Cocoa.h> #import "PXListViewCell.h" #import "ArticleView.h" @interface ArticleCellView : PXListViewCell { AppController * controller; ArticleView *articleView; NSProgressIndicator * progressIndicator; } @property (nonatomic, retain) ArticleView *articleView; @property BOOL inProgress; @property int folderId; // Public functions -(id)initWithReusableIdentifier: (NSString*)identifier inFrame:(NSRect)frameRect; @end
--- +++ @@ -17,6 +17,8 @@ AppController * controller; ArticleView *articleView; NSProgressIndicator * progressIndicator; + BOOL inProgress; + int folderId; } @property (nonatomic, retain) ArticleView *articleView;
Fix a static analyzer error
apache-2.0
Feitianyuan/vienna-rss,josh64x2/vienna-rss,lapcat/vienna-rss,Eitot/vienna-rss,aidanamavi/vienna-rss,iamjasonchoi/vienna-rss,tothgy/vienna-rss,barijaona/vienna-rss,ViennaRSS/vienna-rss,Feitianyuan/vienna-rss,barijaona/vienna-rss,iamjasonchoi/vienna-rss,barijaona/vienna-rss,Eitot/vienna-rss,barijaona/vienna-rss,lapcat/vienna-rss,dak180/vienna,tothgy/vienna-rss,ViennaRSS/vienna-rss,barijaona/vienna-rss,tothgy/vienna-rss,ViennaRSS/vienna-rss,Eitot/vienna-rss,lapcat/vienna-rss,josh64x2/vienna-rss,josh64x2/vienna-rss,lapcat/vienna-rss,tothgy/vienna-rss,iamjasonchoi/vienna-rss,aidanamavi/vienna-rss,aidanamavi/vienna-rss,dak180/vienna,josh64x2/vienna-rss,ViennaRSS/vienna-rss,dak180/vienna,ViennaRSS/vienna-rss,Eitot/vienna-rss,Feitianyuan/vienna-rss,josh64x2/vienna-rss,dak180/vienna
ab7b4a594efab038c9b40f52b0a525c445a25d8d
#pragma once #include "FSMState.h" #define END_STATE_TABLE {nullptr, 0, nullptr} //!< Append this to the end of your state tables; the init function will recognize it and stop searching the table for states. namespace ADBLib { struct FSMTransition { FSMState* currentState; //!< The current state. int input; //!< If this input is received and the FSM state is the currentState, transition. FSMState* nextState; //!< The next state to transition to. }; }
#pragma once #include "FSMState.h" #define END_STATE_TABLE {nullptr, 0, false} //!< Append this to the end of your state tables; the init function will recognize it and stop searching the table for states. namespace ADBLib { class FSMTransition { public: FSMState* currentState; //!< The current state. int input; //!< If this input is recieved and the FSM state is the currentState, transition. FSMState* nextState; //!< The next state to transition to. }; }
--- +++ @@ -2,15 +2,14 @@ #include "FSMState.h" -#define END_STATE_TABLE {nullptr, 0, false} //!< Append this to the end of your state tables; the init function will recognize it and stop searching the table for states. +#define END_STATE_TABLE {nullptr, 0, nullptr} //!< Append this to the end of your state tables; the init function will recognize it and stop searching the table for states. namespace ADBLib { - class FSMTransition + struct FSMTransition { - public: FSMState* currentState; //!< The current state. - int input; //!< If this input is recieved and the FSM state is the currentState, transition. + int input; //!< If this input is received and the FSM state is the currentState, transition. FSMState* nextState; //!< The next state to transition to. }; }
Fix END_STATE_TABLE define causing bool -> ptr conversion error
mit
Dreadbot/ADBLib,Dreadbot/ADBLib,Sourec/ADBLib,Sourec/ADBLib
0efa7eda72c851959fa7da2bd084cc9aec310a77
#include "Allocator.h" #ifndef STACKALLOCATOR_H #define STACKALLOCATOR_H class StackAllocator : public Allocator { protected: /* Offset from the start of the memory block */ std::size_t m_offset; public: /* Allocation of real memory */ StackAllocator(const long totalSize); /* Frees all memory */ virtual ~StackAllocator(); /* Allocate virtual memory */ virtual void* Allocate(const std::size_t size, const std::size_t alignment) override; /* Frees virtual memory */ virtual void Free(void* ptr) override; /* Frees all virtual memory */ virtual void Reset() override; }; #endif /* STACKALLOCATOR_H */
#include "LinearAllocator.h" #ifndef STACKALLOCATOR_H #define STACKALLOCATOR_H class StackAllocator : public LinearAllocator { public: /* Allocation of real memory */ StackAllocator(const long totalSize); /* Frees all memory */ virtual ~StackAllocator(); /* Allocate virtual memory */ virtual void* Allocate(const std::size_t size, const std::size_t alignment) override; /* Frees virtual memory */ virtual void Free(void* ptr) override; }; #endif /* STACKALLOCATOR_H */
--- +++ @@ -1,9 +1,12 @@ -#include "LinearAllocator.h" +#include "Allocator.h" #ifndef STACKALLOCATOR_H #define STACKALLOCATOR_H -class StackAllocator : public LinearAllocator { +class StackAllocator : public Allocator { +protected: + /* Offset from the start of the memory block */ + std::size_t m_offset; public: /* Allocation of real memory */ StackAllocator(const long totalSize); @@ -17,6 +20,8 @@ /* Frees virtual memory */ virtual void Free(void* ptr) override; + /* Frees all virtual memory */ + virtual void Reset() override; }; #endif /* STACKALLOCATOR_H */
Change parent class from LinearAllocator to Allocator.
mit
mtrebi/memory-allocators
66c950522a3563c96cb7d4aca0ba4e940b769462
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix). */ #define HAVE_ALLOCA_H 1 /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ #define HAVE_FSEEKO 1 /* Define to 1 if you have the `pthread' library (-lpthread). */ #define HAVE_LIBPTHREAD 1 /* Define to 1 if you have the `realpath' function. */ #define HAVE_REALPATH 1 #if defined(__MINGW32__) #undef HAVE_ALLOCA_H #undef HAVE_REALPATH #endif #if defined(_MSC_VER) #undef HAVE_ALLOCA_H #undef HAVE_REALPATH #undef HAVE_LIBPTHREAD #undef HAVE_FSEEKO #endif #ifdef __FreeBSD__ #undef HAVE_ALLOCA_H #endif # ifndef __STDC_FORMAT_MACROS # define __STDC_FORMAT_MACROS 1 # endif
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix). */ #define HAVE_ALLOCA_H 1 /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ #define HAVE_FSEEKO 1 /* Define to 1 if you have the `pthread' library (-lpthread). */ #define HAVE_LIBPTHREAD 1 /* Define to 1 if you have the `realpath' function. */ #define HAVE_REALPATH 1 #if defined(__MINGW32__) #undef HAVE_ALLOCA_H #undef HAVE_REALPATH #endif #if defined(_MSC_VER) #undef HAVE_ALLOCA_H #undef HAVE_REALPATH #undef HAVE_LIBPTHREAD #undef HAVE_FSEEKO #endif # ifndef __STDC_FORMAT_MACROS # define __STDC_FORMAT_MACROS 1 # endif
--- +++ @@ -21,6 +21,9 @@ #undef HAVE_LIBPTHREAD #undef HAVE_FSEEKO #endif +#ifdef __FreeBSD__ +#undef HAVE_ALLOCA_H +#endif # ifndef __STDC_FORMAT_MACROS # define __STDC_FORMAT_MACROS 1
Fix build on FreeBSD, which has no alloca.h
isc
YosysHQ/yosys,YosysHQ/yosys,YosysHQ/yosys,YosysHQ/yosys,YosysHQ/yosys,YosysHQ/yosys,YosysHQ/yosys,YosysHQ/yosys
0302e97ebcbb18c9b0bd97ac6641f4b79c401bd0
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #pragma once #include <fizz/protocol/CertificateVerifier.h> namespace quic::test { class TestCertificateVerifier : public fizz::CertificateVerifier { public: ~TestCertificateVerifier() override = default; std::shared_ptr<const folly::AsyncTransportCertificate> verify( const std::vector<std::shared_ptr<const fizz::PeerCert>>& certs) const override { return certs.front(); } [[nodiscard]] std::vector<fizz::Extension> getCertificateRequestExtensions() const override { return std::vector<fizz::Extension>(); } }; inline std::unique_ptr<fizz::CertificateVerifier> createTestCertificateVerifier() { return std::make_unique<TestCertificateVerifier>(); } } // namespace quic::test
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #pragma once #include <fizz/protocol/CertificateVerifier.h> namespace quic::test { class TestCertificateVerifier : public fizz::CertificateVerifier { public: ~TestCertificateVerifier() override = default; void verify(const std::vector<std::shared_ptr<const fizz::PeerCert>>&) const override { return; } [[nodiscard]] std::vector<fizz::Extension> getCertificateRequestExtensions() const override { return std::vector<fizz::Extension>(); } }; inline std::unique_ptr<fizz::CertificateVerifier> createTestCertificateVerifier() { return std::make_unique<TestCertificateVerifier>(); } } // namespace quic::test
--- +++ @@ -15,9 +15,10 @@ public: ~TestCertificateVerifier() override = default; - void verify(const std::vector<std::shared_ptr<const fizz::PeerCert>>&) + std::shared_ptr<const folly::AsyncTransportCertificate> verify( + const std::vector<std::shared_ptr<const fizz::PeerCert>>& certs) const override { - return; + return certs.front(); } [[nodiscard]] std::vector<fizz::Extension> getCertificateRequestExtensions()
Replace fizz server cert with leaf cert returned from verification Summary: Added code to return the leaf cert after successfully verification of the server cert. The returned cert is then used for replacing the server cert. Reviewed By: AjanthanAsogamoorthy Differential Revision: D35898220 fbshipit-source-id: 8f542471a711d5aa62d0aad4c1d12b10c2209744
mit
facebookincubator/mvfst,facebookincubator/mvfst,facebookincubator/mvfst,facebookincubator/mvfst,facebookincubator/mvfst
32df46c68c5f8756b4383b1228d17df6538ae671
#ifndef SCRIPTWINDOW_H #define SCRIPTWINDOW_H #include <QHash> #include <QObject> #include <QScriptValue> class QScriptEngine; class ScriptWindow : public QObject { Q_OBJECT public: explicit ScriptWindow(const QScriptValue &originalWindow, QObject *parent = 0); QScriptValue toScriptValue(); Q_INVOKABLE int randomInt(int min = 0, int max = 2147483647) const; Q_INVOKABLE int setInterval(const QScriptValue &function, int delay); Q_INVOKABLE void clearInterval(int timerId); Q_INVOKABLE int setTimeout(const QScriptValue &function, int delay); Q_INVOKABLE void clearTimeout(int timerId); protected: virtual void timerEvent(QTimerEvent *event); private: QScriptEngine *m_engine; QScriptValue m_originalWindow; QHash<int, QScriptValue> m_intervalHash; QHash<int, QScriptValue> m_timeoutHash; }; #endif // SCRIPTWINDOW_H
#ifndef SCRIPTWINDOW_H #define SCRIPTWINDOW_H #include <stdint.h> #include <QHash> #include <QObject> #include <QScriptValue> class QScriptEngine; class ScriptWindow : public QObject { Q_OBJECT public: explicit ScriptWindow(const QScriptValue &originalWindow, QObject *parent = 0); QScriptValue toScriptValue(); Q_INVOKABLE int randomInt(int min = 0, int max = INT32_MAX) const; Q_INVOKABLE int setInterval(const QScriptValue &function, int delay); Q_INVOKABLE void clearInterval(int timerId); Q_INVOKABLE int setTimeout(const QScriptValue &function, int delay); Q_INVOKABLE void clearTimeout(int timerId); protected: virtual void timerEvent(QTimerEvent *event); private: QScriptEngine *m_engine; QScriptValue m_originalWindow; QHash<int, QScriptValue> m_intervalHash; QHash<int, QScriptValue> m_timeoutHash; }; #endif // SCRIPTWINDOW_H
--- +++ @@ -1,7 +1,5 @@ #ifndef SCRIPTWINDOW_H #define SCRIPTWINDOW_H - -#include <stdint.h> #include <QHash> #include <QObject> @@ -19,7 +17,7 @@ QScriptValue toScriptValue(); - Q_INVOKABLE int randomInt(int min = 0, int max = INT32_MAX) const; + Q_INVOKABLE int randomInt(int min = 0, int max = 2147483647) const; Q_INVOKABLE int setInterval(const QScriptValue &function, int delay); Q_INVOKABLE void clearInterval(int timerId);
Fix compile error on Amazon EC2.
agpl-3.0
arendjr/PlainText,arendjr/PlainText,arendjr/PlainText
f160c0edd74d9f31c936b92c7e7e6b4c9fb6848e
/* * Copyright 2014, NICTA * * This software may be distributed and modified according to the terms of * the BSD 2-Clause license. Note that NO WARRANTY is provided. * See "LICENSE_BSD2.txt" for details. * * @TAG(NICTA_BSD) */ #ifndef _UTILS_ASSUME_H #define _UTILS_ASSUME_H #include <utils/attribute.h> #include <utils/builtin.h> #include <utils/stringify.h> /* This idiom is a way of passing extra information or hints to GCC. It is only * occasionally successful, so don't think of it as a silver optimisation * bullet. */ #define ASSUME(x) \ do { \ if (!(x)) { \ __builtin_unreachable(); \ } \ } while (0) /* Indicate to the compiler that wherever this macro appears is a cold * execution path. That is, it is not performance critical and likely rarely * used. A perfect example is error handling code. This gives the compiler a * light hint to deprioritise optimisation of this path. */ #define COLD_PATH() \ do { \ JOIN(cold_path_, __COUNTER__): COLD UNUSED; \ } while (0) /* The opposite of `COLD_PATH`. That is, aggressively optimise this path, * potentially at the expense of others. */ #define HOT_PATH() \ do { \ JOIN(hot_path_, __COUNTER__): HOT UNUSED; \ } while (0) #endif
/* * Copyright 2014, NICTA * * This software may be distributed and modified according to the terms of * the BSD 2-Clause license. Note that NO WARRANTY is provided. * See "LICENSE_BSD2.txt" for details. * * @TAG(NICTA_BSD) */ #ifndef _UTILS_ASSUME_H #define _UTILS_ASSUME_H #include <utils/builtin.h> /* This idiom is a way of passing extra information or hints to GCC. It is only * occasionally successful, so don't think of it as a silver optimisation * bullet. */ #define ASSUME(x) \ do { \ if (!(x)) { \ __builtin_unreachable(); \ } \ } while (0) #endif
--- +++ @@ -11,7 +11,9 @@ #ifndef _UTILS_ASSUME_H #define _UTILS_ASSUME_H +#include <utils/attribute.h> #include <utils/builtin.h> +#include <utils/stringify.h> /* This idiom is a way of passing extra information or hints to GCC. It is only * occasionally successful, so don't think of it as a silver optimisation @@ -24,4 +26,22 @@ } \ } while (0) +/* Indicate to the compiler that wherever this macro appears is a cold + * execution path. That is, it is not performance critical and likely rarely + * used. A perfect example is error handling code. This gives the compiler a + * light hint to deprioritise optimisation of this path. + */ +#define COLD_PATH() \ + do { \ + JOIN(cold_path_, __COUNTER__): COLD UNUSED; \ + } while (0) + +/* The opposite of `COLD_PATH`. That is, aggressively optimise this path, + * potentially at the expense of others. + */ +#define HOT_PATH() \ + do { \ + JOIN(hot_path_, __COUNTER__): HOT UNUSED; \ + } while (0) + #endif
libutils: Add dedicated macros to indicate hot and cold execution paths.
bsd-2-clause
agacek/util_libs,agacek/util_libs,agacek/util_libs,agacek/util_libs
a3c982089a1443e909ebf8d6cf9be88f23c1f452
#ifndef _EFFECTLESS #define EFFECTLESS /* Macros without multiple execution of side-effects. */ /* Generic min and max without double execution of side-effects: http://stackoverflow.com/questions/3437404/min-and-max-in-c */ #define _CHOOSE(boolop, a, b, uid) \ ({ \ decltype(a) _a_ ## uid = (a); \ decltype(b) _b_ ## uid = (b); \ (_a_ ## uid) boolop (_b_ ## uid) ? (_a_ ## uid) : (_b_ ## uid); \ }) #undef MIN #undef MAX #define MIN(a, b) _CHOOSE(<, a, b, __COUNTER__) #define MAX(a, b) _CHOOSE(>, a, b, __COUNTER__) #endif
#ifndef _EFFECTLESS #define EFFECTLESS /* Macros without multiple execution of side-effects. */ /* Generic min and max without double execution of side-effects: http://stackoverflow.com/questions/3437404/min-and-max-in-c */ #define _CHOOSE(boolop, a, b, uid) \ ({ \ decltype(a) _a_ ## uid = (a); \ decltype(b) _b_ ## uid = (b); \ (a) boolop (b) ? (a) : (b); \ }) #undef MIN #undef MAX #define MIN(a, b) _CHOOSE(<, a, b, __COUNTER__) #define MAX(a, b) _CHOOSE(>, a, b, __COUNTER__) #endif
--- +++ @@ -10,11 +10,11 @@ http://stackoverflow.com/questions/3437404/min-and-max-in-c */ -#define _CHOOSE(boolop, a, b, uid) \ - ({ \ - decltype(a) _a_ ## uid = (a); \ - decltype(b) _b_ ## uid = (b); \ - (a) boolop (b) ? (a) : (b); \ +#define _CHOOSE(boolop, a, b, uid) \ + ({ \ + decltype(a) _a_ ## uid = (a); \ + decltype(b) _b_ ## uid = (b); \ + (_a_ ## uid) boolop (_b_ ## uid) ? (_a_ ## uid) : (_b_ ## uid); \ }) #undef MIN #undef MAX
Fix `_CHOOSE` to use the copies instead of double execution of side-effects (issue reported by tromp at bitcointalk.org)
unlicense
shelby3/cmacros,shelby3/cmacros
b817c6cc5a0231a0ad9bb1e71a69a15df05e4d80
/* Chapter 27, drill 1. Write a Hello World program 2. Define two variables holding "Hello" and "World!", concatenate them with a space in between and output them as "Hello World!" 3. Define a function taking a char* p and an int x, print their values in the format "p is 'foo' and x is 7". Call it with a few argument pairs. */ #include<stdlib.h> #include<string.h> #include<stdio.h> void my_func(char* p, int x) { printf("p is \"%s\" and x is %i\n",p,x); } int main() { printf("Hello World!\n"); { char* hello = "Hello"; char* world = "World!"; char* hello_world = (char*) malloc(strlen(hello)+strlen(world)+2); strcpy(hello_world,hello); hello_world[strlen(hello)] = ' '; strcpy(hello_world+strlen(hello)+1,world); printf("%s\n",hello_world); } my_func("foo",7); my_func("Scott Meyers",42); my_func("Bjarne Stroustrup",99); }
/* Chapter 27, drill 1. Write a Hello World program 2. Define two variables holding "Hello" and "World!", concatenate them with a space in between and output them as "Hello World!" 3. Define a function taking a char* p and an int x, print their values in the format "p is 'foo' and x is 7". Call it with a few argument pairs. */ #include<stdlib.h> #include<string.h> #include<stdio.h> void my_func(char* p, int x) { printf("p is \"%s\" and x is %i\n",p,x); } int main() { printf("Hello World!\n"); char* hello = "Hello"; char* world = "World!"; char* hello_world = (char*) malloc(strlen(hello)+strlen(world)+2); strcpy(hello_world,hello); hello_world[strlen(hello)] = ' '; strcpy(hello_world+strlen(hello)+1,world); printf("%s\n",hello_world); my_func("foo",7); my_func("Scott Meyers",42); my_func("Bjarne Stroustrup",99); }
--- +++ @@ -17,15 +17,15 @@ int main() { printf("Hello World!\n"); - - char* hello = "Hello"; - char* world = "World!"; - char* hello_world = (char*) malloc(strlen(hello)+strlen(world)+2); - strcpy(hello_world,hello); - hello_world[strlen(hello)] = ' '; - strcpy(hello_world+strlen(hello)+1,world); - printf("%s\n",hello_world); - + { + char* hello = "Hello"; + char* world = "World!"; + char* hello_world = (char*) malloc(strlen(hello)+strlen(world)+2); + strcpy(hello_world,hello); + hello_world[strlen(hello)] = ' '; + strcpy(hello_world+strlen(hello)+1,world); + printf("%s\n",hello_world); + } my_func("foo",7); my_func("Scott Meyers",42); my_func("Bjarne Stroustrup",99);
Modify Chapter 27, drill to comply with C89 standard
mit
bewuethr/stroustrup_ppp,bewuethr/stroustrup_ppp
e141aba93148a0e2b5bbcbde36b37d3cf171d1f2
#ifndef LINE_EQUATION_H #define LINE_EQUATION_H #include "Vector2.h" class LineEquation { public: LineEquation(); LineEquation(Vector2 p1, Vector2 p2); LineEquation(Vector2 p, double m); ~LineEquation(); LineEquation(const LineEquation& e); LineEquation(LineEquation&& e); LineEquation& operator=(const LineEquation& e); LineEquation& operator=(LineEquation&& e); double operator()(const double x); void Move(const Vector2 v); Vector2 Intersection(LineEquation& e) const; bool IsHorizontal(); bool IsVertical(); double m; double b; bool vertical; }; #endif
#ifndef LINE_EQUATION_H #define LINE_EQUATION_H #include "Vector2.h" class LineEquation { public: LineEquation(); LineEquation(Vector2 a, Vector2 b); LineEquation(Vector2 p, double m); ~LineEquation(); LineEquation(const LineEquation& e); LineEquation(LineEquation&& e); LineEquation& operator=(const LineEquation& e); LineEquation& operator=(LineEquation&& e); double operator()(const double x); void Move(const Vector2 v); Vector2 Intersection(LineEquation& e) const; bool IsHorizontal(); bool IsVertical(); double m; double b; bool vertical; }; #endif
--- +++ @@ -7,7 +7,7 @@ { public: LineEquation(); - LineEquation(Vector2 a, Vector2 b); + LineEquation(Vector2 p1, Vector2 p2); LineEquation(Vector2 p, double m); ~LineEquation();
Modify parameter's name (name conflict)
mit
utilForever/PolyMapGenerator
9ebd09954a3b53fa5d87e8e3f1b1bb49c15b62e5
// Copyright lowRISC contributors. // Licensed under the Apache License, Version 2.0, see LICENSE for details. // SPDX-License-Identifier: Apache-2.0 #ifndef OPENTITAN_SW_DEVICE_LIB_DIF_DIF_WARN_UNUSED_RESULT_H_ #define OPENTITAN_SW_DEVICE_LIB_DIF_DIF_WARN_UNUSED_RESULT_H_ /** * @file * @brief Unused Result Warning Macro for DIFs. */ // Header Extern Guard (so header can be used from C and C++) #ifdef __cplusplus extern "C" { #endif // __cplusplus /** * Attribute for functions which return errors that must be acknowledged. * * This attribute must be used to mark all DIFs which return an error value of * some kind, to ensure that callers do not accidentally drop the error on the * ground. * * Normally, the standard way to drop such a value on the ground explicitly is * with the syntax `(void)expr;`, in analogy with the behavior of C++'s * `[[nodiscard]]` attribute. * However, GCC does not implement this, so the idiom `if (expr) {}` should be * used instead, for the time being. * See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25509. */ #define DIF_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) #ifdef __cplusplus } // extern "C" #endif // __cplusplus #endif // OPENTITAN_SW_DEVICE_LIB_DIF_DIF_WARN_UNUSED_RESULT_H_
// Copyright lowRISC contributors. // Licensed under the Apache License, Version 2.0, see LICENSE for details. // SPDX-License-Identifier: Apache-2.0 #ifndef OPENTITAN_SW_DEVICE_LIB_DIF_DIF_WARN_UNUSED_RESULT_H_ #define OPENTITAN_SW_DEVICE_LIB_DIF_DIF_WARN_UNUSED_RESULT_H_ /** * @file * @brief Unused Result Warning Macro for DIFs. */ // Header Extern Guard (so header can be used from C and C++) #ifdef __cplusplus extern "C" { #endif // __cplusplus /** * Attribute for functions which return errors that must be acknowledged. * * This attribute must be used to mark all DIFs which return an error value of * some kind, to ensure that callers do not accidentally drop the error on the * ground. */ #define DIF_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) #ifdef __cplusplus } // extern "C" #endif // __cplusplus #endif // OPENTITAN_SW_DEVICE_LIB_DIF_DIF_WARN_UNUSED_RESULT_H_
--- +++ @@ -21,6 +21,13 @@ * This attribute must be used to mark all DIFs which return an error value of * some kind, to ensure that callers do not accidentally drop the error on the * ground. + * + * Normally, the standard way to drop such a value on the ground explicitly is + * with the syntax `(void)expr;`, in analogy with the behavior of C++'s + * `[[nodiscard]]` attribute. + * However, GCC does not implement this, so the idiom `if (expr) {}` should be + * used instead, for the time being. + * See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25509. */ #define DIF_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
[dif] Add a comment explaining how to drop an error on the ground See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25509, which necessitates doing this in a non-standard, but still portable, manner. Signed-off-by: Miguel Young de la Sota <[email protected]>
apache-2.0
lowRISC/opentitan,lowRISC/opentitan,lowRISC/opentitan,lowRISC/opentitan,lowRISC/opentitan,lowRISC/opentitan
642e338cf79c78704ebfa7833fdd148f561921f5
#ifndef ALEXCPT_H #define ALEXCPT_H #include <exception> #include <string> #include "AL/alc.h" #ifdef __GNUC__ #define ALEXCPT_FORMAT(x, y, z) __attribute__((format(x, (y), (z)))) #else #define ALEXCPT_FORMAT(x, y, z) #endif namespace al { class backend_exception final : public std::exception { std::string mMessage; ALCenum mErrorCode; public: backend_exception(ALCenum code, const char *msg, ...) ALEXCPT_FORMAT(printf, 3,4); const char *what() const noexcept override { return mMessage.c_str(); } ALCenum errorCode() const noexcept { return mErrorCode; } }; } // namespace al #define START_API_FUNC try #define END_API_FUNC catch(...) { std::terminate(); } #endif /* ALEXCPT_H */
#ifndef ALEXCPT_H #define ALEXCPT_H #include <exception> #include <string> #include "AL/alc.h" namespace al { class backend_exception final : public std::exception { std::string mMessage; ALCenum mErrorCode; public: backend_exception(ALCenum code, const char *msg, ...); const char *what() const noexcept override { return mMessage.c_str(); } ALCenum errorCode() const noexcept { return mErrorCode; } }; } // namespace al #define START_API_FUNC try #define END_API_FUNC catch(...) { std::terminate(); } #endif /* ALEXCPT_H */
--- +++ @@ -7,6 +7,13 @@ #include "AL/alc.h" +#ifdef __GNUC__ +#define ALEXCPT_FORMAT(x, y, z) __attribute__((format(x, (y), (z)))) +#else +#define ALEXCPT_FORMAT(x, y, z) +#endif + + namespace al { class backend_exception final : public std::exception { @@ -14,7 +21,7 @@ ALCenum mErrorCode; public: - backend_exception(ALCenum code, const char *msg, ...); + backend_exception(ALCenum code, const char *msg, ...) ALEXCPT_FORMAT(printf, 3,4); const char *what() const noexcept override { return mMessage.c_str(); } ALCenum errorCode() const noexcept { return mErrorCode; }
Add the printf format attribute to backend_exception's constructor
lgpl-2.1
aaronmjacobs/openal-soft,aaronmjacobs/openal-soft
b9592bddbc014759941b94b76596c1dbf2245ad3
#include "val_interfaces.h" #include "pal_mbed_os_crypto.h" #include "lifecycle.h" #ifdef ITS_TEST void test_entry_s003(val_api_t *val_api, psa_api_t *psa_api); #elif PS_TEST #ifndef PS_ALLOW_ENTIRE_STORAGE_FILL #error [NOT_SUPPORTED] Test is too long for CI, thus always fails on timeout. #endif void test_entry_p003(val_api_t *val_api, psa_api_t *psa_api); #endif int main(void) { #ifdef ITS_TEST test_start(test_entry_s003); #elif PS_TEST test_start(test_entry_p003); #endif }
#include "val_interfaces.h" #include "pal_mbed_os_crypto.h" #include "lifecycle.h" #ifdef ITS_TEST void test_entry_s003(val_api_t *val_api, psa_api_t *psa_api); #elif PS_TEST #error [NOT_SUPPORTED] Test is too long for CI, thus always fails on timeout. void test_entry_p003(val_api_t *val_api, psa_api_t *psa_api); #endif int main(void) { #ifdef ITS_TEST test_start(test_entry_s003); #elif PS_TEST test_start(test_entry_p003); #endif }
--- +++ @@ -5,7 +5,9 @@ #ifdef ITS_TEST void test_entry_s003(val_api_t *val_api, psa_api_t *psa_api); #elif PS_TEST +#ifndef PS_ALLOW_ENTIRE_STORAGE_FILL #error [NOT_SUPPORTED] Test is too long for CI, thus always fails on timeout. +#endif void test_entry_p003(val_api_t *val_api, psa_api_t *psa_api); #endif
Allow PS test03 with PS_ALLOW_ENTIRE_STORAGE_FILL flag
apache-2.0
andcor02/mbed-os,mbedmicro/mbed,kjbracey-arm/mbed,kjbracey-arm/mbed,andcor02/mbed-os,mbedmicro/mbed,mbedmicro/mbed,mbedmicro/mbed,kjbracey-arm/mbed,mbedmicro/mbed,andcor02/mbed-os,andcor02/mbed-os,andcor02/mbed-os,andcor02/mbed-os,kjbracey-arm/mbed
16a59cb9926bc96792cc9d1b7a996689f7bf1b86
/* * Principal component analysis * Copyright (c) 2004 Michael Niedermayer <[email protected]> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /** * @file pca.h * Principal component analysis */ #ifndef FFMPEG_PCA_H #define FFMPEG_PCA_H struct PCA *ff_pca_init(int n); void ff_pca_free(struct PCA *pca); void ff_pca_add(struct PCA *pca, double *v); int ff_pca(struct PCA *pca, double *eigenvector, double *eigenvalue); #endif /* FFMPEG_PCA_H */
/* * Principal component analysis * Copyright (c) 2004 Michael Niedermayer <[email protected]> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /** * @file pca.h * Principal component analysis */ struct PCA *ff_pca_init(int n); void ff_pca_free(struct PCA *pca); void ff_pca_add(struct PCA *pca, double *v); int ff_pca(struct PCA *pca, double *eigenvector, double *eigenvalue);
--- +++ @@ -23,7 +23,12 @@ * Principal component analysis */ +#ifndef FFMPEG_PCA_H +#define FFMPEG_PCA_H + struct PCA *ff_pca_init(int n); void ff_pca_free(struct PCA *pca); void ff_pca_add(struct PCA *pca, double *v); int ff_pca(struct PCA *pca, double *eigenvector, double *eigenvalue); + +#endif /* FFMPEG_PCA_H */
Make diego happy before he notices. git-svn-id: a4d7c1866f8397a4106e0b57fc4fbf792bbdaaaf@14810 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
lgpl-2.1
prajnashi/ffmpeg,prajnashi/ffmpeg,prajnashi/ffmpeg,prajnashi/ffmpeg
a995514733949a433e39edec0966ba2789b57ada
#ifndef AL_MATH_DEFS_H #define AL_MATH_DEFS_H #ifdef HAVE_FLOAT_H #include <float.h> #endif #define F_PI (3.14159265358979323846f) #define F_PI_2 (1.57079632679489661923f) #define F_TAU (6.28318530717958647692f) #ifndef FLT_EPSILON #define FLT_EPSILON (1.19209290e-07f) #endif #define DEG2RAD(x) ((ALfloat)(x) * (F_PI/180.0f)) #define RAD2DEG(x) ((ALfloat)(x) * (180.0f/F_PI)) #endif /* AL_MATH_DEFS_H */
#ifndef AL_MATH_DEFS_H #define AL_MATH_DEFS_H #define F_PI (3.14159265358979323846f) #define F_PI_2 (1.57079632679489661923f) #define F_TAU (6.28318530717958647692f) #ifndef FLT_EPSILON #define FLT_EPSILON (1.19209290e-07f) #endif #define DEG2RAD(x) ((ALfloat)(x) * (F_PI/180.0f)) #define RAD2DEG(x) ((ALfloat)(x) * (180.0f/F_PI)) #endif /* AL_MATH_DEFS_H */
--- +++ @@ -1,5 +1,9 @@ #ifndef AL_MATH_DEFS_H #define AL_MATH_DEFS_H + +#ifdef HAVE_FLOAT_H +#include <float.h> +#endif #define F_PI (3.14159265358979323846f) #define F_PI_2 (1.57079632679489661923f)
Include float.h if present before defining math stuff
lgpl-2.1
aaronmjacobs/openal-soft,alexxvk/openal-soft,alexxvk/openal-soft,aaronmjacobs/openal-soft
858230f4528ad2f418f97414e3a8be46865c367c
#include <ifdhandler.h> #include <stdio.h> RESPONSECODE IFDHCreateChannelByName(DWORD Lun, LPSTR DeviceName) { return IFD_NO_SUCH_DEVICE; } RESPONSECODE IFDHCreateChannel(DWORD Lun, DWORD Channel) { char buf[40]; snprintf(buf, sizeof(buf), "/dev/o2scr%d", Channel); return IFDHCreateChannelByName(Lun, buf); } RESPONSECODE IFDHCloseChannel(DWORD Lun) { return IFD_SUCCESS; } RESPONSECODE IFDHGetCapabilities (DWORD Lun, DWORD Tag, PDWORD Length, PUCHAR Value) { // FIXME (*Length) = 0; return IFD_ERROR_TAG; } RESPONSECODE IFDHSetCapabilities (DWORD Lun, DWORD Tag, DWORD Length, PUCHAR Value) { return IFD_NOT_SUPPORTED; } RESPONSECODE IFDHPowerICC (DWORD Lun, DWORD Action, PUCHAR Atr, PDWORD AtrLength) { return IFD_NOT_SUPPORTED; } RESPONSECODE IFDHTransmitToICC (DWORD Lun, SCARD_IO_HEADER SendPci, PUCHAR TxBuffer, DWORD TxLength, PUCHAR RxBuffer, PDWORD RxLength, PSCARD_IO_HEADER RecvPci) { return IFD_NOT_SUPPORTED; } RESPONSECODE IFDHICCPresence (DWORD Lun) { return IFD_ICC_NOT_PRESENT; } RESPONSECODE IFDHControl (DWORD Lun, DWORD dwControlCode, PUCHAR TxBuffer, DWORD TxLength, PUCHAR RxBuffer, DWORD RxLength, LPDWORD pdwBytesReturned) { return IFD_NOT_SUPPORTED; } RESPONSECODE IFDHSetProtocolParameters (DWORD Lun, DWORD Protocol, UCHAR Flags, UCHAR PTS1, UCHAR PTS2, UCHAR PTS3) { return IFD_NOT_SUPPORTED; }
#include <ifdhandler.h>
--- +++ @@ -1 +1,57 @@ #include <ifdhandler.h> + +#include <stdio.h> + +RESPONSECODE IFDHCreateChannelByName(DWORD Lun, LPSTR DeviceName) +{ + return IFD_NO_SUCH_DEVICE; +} + +RESPONSECODE IFDHCreateChannel(DWORD Lun, DWORD Channel) +{ + char buf[40]; + snprintf(buf, sizeof(buf), "/dev/o2scr%d", Channel); + return IFDHCreateChannelByName(Lun, buf); +} + +RESPONSECODE IFDHCloseChannel(DWORD Lun) +{ + return IFD_SUCCESS; +} + +RESPONSECODE IFDHGetCapabilities (DWORD Lun, DWORD Tag, PDWORD Length, PUCHAR Value) +{ + // FIXME + (*Length) = 0; + return IFD_ERROR_TAG; +} + +RESPONSECODE IFDHSetCapabilities (DWORD Lun, DWORD Tag, DWORD Length, PUCHAR Value) +{ + return IFD_NOT_SUPPORTED; +} + +RESPONSECODE IFDHPowerICC (DWORD Lun, DWORD Action, PUCHAR Atr, PDWORD AtrLength) +{ + return IFD_NOT_SUPPORTED; +} + +RESPONSECODE IFDHTransmitToICC (DWORD Lun, SCARD_IO_HEADER SendPci, PUCHAR TxBuffer, DWORD TxLength, PUCHAR RxBuffer, PDWORD RxLength, PSCARD_IO_HEADER RecvPci) +{ + return IFD_NOT_SUPPORTED; +} + +RESPONSECODE IFDHICCPresence (DWORD Lun) +{ + return IFD_ICC_NOT_PRESENT; +} + +RESPONSECODE IFDHControl (DWORD Lun, DWORD dwControlCode, PUCHAR TxBuffer, DWORD TxLength, PUCHAR RxBuffer, DWORD RxLength, LPDWORD pdwBytesReturned) +{ + return IFD_NOT_SUPPORTED; +} + +RESPONSECODE IFDHSetProtocolParameters (DWORD Lun, DWORD Protocol, UCHAR Flags, UCHAR PTS1, UCHAR PTS2, UCHAR PTS3) +{ + return IFD_NOT_SUPPORTED; +}
Add empty dummy implementation of ifd handler Signed-off-by: Dmitry Eremin-Solenikov <[email protected]>
lgpl-2.1
lumag/o2scr-ifd
bcdfda8195e5414119afebb64601f89b37cf04fc
#ifndef TYPES_H #define TYPES_H // Explicitly-sized versions of integer types typedef __signed char int8_t; typedef unsigned char uint8_t; typedef short int16_t; typedef unsigned short uint16_t; typedef int int32_t; typedef unsigned int uint32_t; typedef long long int64_t; typedef unsigned long long uint64_t; typedef uint8_t bool; #define true 1; #define false 0; // size_t is used for memory object sizes. typedef uint32_t size_t; #endif /* TYPES_H */
#ifndef TYPES_H #define TYPES_H // Explicitly-sized versions of integer types typedef __signed char int8_t; typedef unsigned char uint8_t; typedef short int16_t; typedef unsigned short uint16_t; typedef int int32_t; typedef unsigned int uint32_t; typedef long long int64_t; typedef unsigned long long uint64_t; // size_t is used for memory object sizes. typedef uint32_t size_t; #endif /* TYPES_H */
--- +++ @@ -11,6 +11,10 @@ typedef long long int64_t; typedef unsigned long long uint64_t; +typedef uint8_t bool; +#define true 1; +#define false 0; + // size_t is used for memory object sizes. typedef uint32_t size_t;
Define bool type together with true/false
mit
dutra/x86_kernel,dutra/x86_kernel
b85b36e461985e3732e346d850e69f9e28135044
#pragma once class UnicodeUtf16StringSearcher { private: const wchar_t* m_Pattern; uint32_t m_PatternLength; public: UnicodeUtf16StringSearcher() : m_Pattern(nullptr) { } void Initialize(const wchar_t* pattern, size_t patternLength) { if (patternLength > std::numeric_limits<uint32_t>::max() / 2) __fastfail(1); m_Pattern = pattern; m_PatternLength = static_cast<uint32_t>(patternLength); } template <typename TextIterator> bool HasSubstring(TextIterator textBegin, TextIterator textEnd) { while (textEnd - textBegin >= m_PatternLength) { auto comparisonResult = CompareStringEx(LOCALE_NAME_SYSTEM_DEFAULT, NORM_IGNORECASE, textBegin, static_cast<int>(m_PatternLength), m_Pattern, static_cast<int>(m_PatternLength), nullptr, nullptr, 0); if (comparisonResult == CSTR_EQUAL) return true; textBegin++; } return false; } };
#pragma once class UnicodeUtf16StringSearcher { private: const wchar_t* m_Pattern; uint32_t m_PatternLength; public: UnicodeUtf16StringSearcher() : m_Pattern(nullptr) { } void Initialize(const wchar_t* pattern, size_t patternLength) { if (patternLength > std::numeric_limits<uint32_t>::max() / 2) __fastfail(1); m_Pattern = pattern; m_PatternLength = static_cast<uint32_t>(patternLength); } template <typename TextIterator> bool HasSubstring(TextIterator textBegin, TextIterator textEnd) { while (textEnd - textBegin >= m_PatternLength) { auto comparisonResult = CompareStringEx(LOCALE_NAME_SYSTEM_DEFAULT, NORM_IGNORECASE, textBegin, static_cast<int>(textEnd - textBegin), m_Pattern, static_cast<int>(m_PatternLength), nullptr, nullptr, 0); if (comparisonResult == CSTR_EQUAL) return true; textBegin++; } return false; } };
--- +++ @@ -26,7 +26,7 @@ { while (textEnd - textBegin >= m_PatternLength) { - auto comparisonResult = CompareStringEx(LOCALE_NAME_SYSTEM_DEFAULT, NORM_IGNORECASE, textBegin, static_cast<int>(textEnd - textBegin), m_Pattern, static_cast<int>(m_PatternLength), nullptr, nullptr, 0); + auto comparisonResult = CompareStringEx(LOCALE_NAME_SYSTEM_DEFAULT, NORM_IGNORECASE, textBegin, static_cast<int>(m_PatternLength), m_Pattern, static_cast<int>(m_PatternLength), nullptr, nullptr, 0); if (comparisonResult == CSTR_EQUAL) return true;
Fix case insensitive UTF16 string search.
mit
TautvydasZilys/FileSystemSearch,TautvydasZilys/FileSystemSearch,TautvydasZilys/FileSystemSearch
8bc349742bc3c97da5bb88d382bc0860f7eb3399
#include "uart.h" void uart_putchar(char c, FILE *stream) { if( c == '\n' ) uart_putchar('\r', stream); loop_until_bit_is_set(UCSR0A, UDRE0); UDR0 = c; } static FILE uart_out = FDEV_SETUP_STREAM(uart_putchar, NULL, _FDEV_SETUP_WRITE); void uart_init(void) { UBRR0L = BAUDRATE&0xFF; UBRR0H = (BAUDRATE>>8); #if USE_2X UCSR0A |= _BV(U2X0); #else UCSR0A &= ~(_BV(U2X0)); #endif UCSR0C = _BV(UCSZ01) | _BV(UCSZ00); /* 8-bit data */ UCSR0B = _BV(RXEN0) | _BV(TXEN0); /* Enable RX and TX */ stdout = &uart_out; }
#include "uart.h" void uart_putchar(char c, FILE *stream) { if( c == '\n' ) uart_putchar( '\r', stream ); UDR0 = c; loop_until_bit_is_set(UCSR0A, TXC0); } static FILE uart_out = FDEV_SETUP_STREAM(uart_putchar, NULL, _FDEV_SETUP_WRITE); void uart_init(void) { UBRR0L = BAUDRATE&0xFF; UBRR0H = (BAUDRATE>>8); #if USE_2X UCSR0A |= _BV(U2X0); #else UCSR0A &= ~(_BV(U2X0)); #endif UCSR0C = _BV(UCSZ01) | _BV(UCSZ00); /* 8-bit data */ UCSR0B = _BV(RXEN0) | _BV(TXEN0); /* Enable RX and TX */ stdout = &uart_out; }
--- +++ @@ -2,9 +2,9 @@ void uart_putchar(char c, FILE *stream) { if( c == '\n' ) - uart_putchar( '\r', stream ); + uart_putchar('\r', stream); + loop_until_bit_is_set(UCSR0A, UDRE0); UDR0 = c; - loop_until_bit_is_set(UCSR0A, TXC0); } static FILE uart_out = FDEV_SETUP_STREAM(uart_putchar, NULL, _FDEV_SETUP_WRITE);
Reorder UART transmission. Instead of waiting for cache to be empty and then sending the value, we first add the value to cache and then wait for transmission. This way no characters are lost during transmission
mit
nathanhi/steep-beta,nathanhi/steep-beta
667e5c1daf0f5e6183361e8c6ff47b34bae3bea3
/* * 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. */ #ifndef _ASM_POWERPC_SWAB_H #define _ASM_POWERPC_SWAB_H #include <uapi/asm/swab.h> #endif /* _ASM_POWERPC_SWAB_H */
/* * 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. */ #ifndef _ASM_POWERPC_SWAB_H #define _ASM_POWERPC_SWAB_H #include <uapi/asm/swab.h> static __inline__ __u16 ld_le16(const volatile __u16 *addr) { __u16 val; __asm__ __volatile__ ("lhbrx %0,0,%1" : "=r" (val) : "r" (addr), "m" (*addr)); return val; } static __inline__ void st_le16(volatile __u16 *addr, const __u16 val) { __asm__ __volatile__ ("sthbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr)); } static __inline__ __u32 ld_le32(const volatile __u32 *addr) { __u32 val; __asm__ __volatile__ ("lwbrx %0,0,%1" : "=r" (val) : "r" (addr), "m" (*addr)); return val; } static __inline__ void st_le32(volatile __u32 *addr, const __u32 val) { __asm__ __volatile__ ("stwbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr)); } #endif /* _ASM_POWERPC_SWAB_H */
--- +++ @@ -9,30 +9,4 @@ #include <uapi/asm/swab.h> -static __inline__ __u16 ld_le16(const volatile __u16 *addr) -{ - __u16 val; - - __asm__ __volatile__ ("lhbrx %0,0,%1" : "=r" (val) : "r" (addr), "m" (*addr)); - return val; -} - -static __inline__ void st_le16(volatile __u16 *addr, const __u16 val) -{ - __asm__ __volatile__ ("sthbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr)); -} - -static __inline__ __u32 ld_le32(const volatile __u32 *addr) -{ - __u32 val; - - __asm__ __volatile__ ("lwbrx %0,0,%1" : "=r" (val) : "r" (addr), "m" (*addr)); - return val; -} - -static __inline__ void st_le32(volatile __u32 *addr, const __u32 val) -{ - __asm__ __volatile__ ("stwbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr)); -} - #endif /* _ASM_POWERPC_SWAB_H */
powerpc: Remove unused st_le*() and ld_le* functions The powerpc specific st_le*() and ld_le*() functions in arch/powerpc/asm/swab.h no longer have any users. They are also misleadingly named, since they always byteswap, even on a little-endian host. This patch removes them. Signed-off-by: David Gibson <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
mit
KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs
0eebf9b5d2da61f84cddd0ec2bb41be93f8fc82b
#include <bert/encoder.h> #include <bert/magic.h> #include <bert/errno.h> #include "test.h" unsigned char output[6]; void test_output() { if (output[0] != BERT_MAGIC) { test_fail("bert_encoder_push did not add the magic byte"); } if (output[1] != BERT_INT) { test_fail("bert_encoder_push did not add the INT magic byte"); } unsigned char bytes[] = {0xff, 0xff, 0xff, 0xff}; test_bytes(output+2,bytes,4); } int main() { bert_encoder_t *encoder = test_encoder(output,6); bert_data_t *data; if (!(data = bert_data_create_int(0xffffffff))) { test_fail("malloc failed"); } test_encoder_push(encoder,data); bert_data_destroy(data); bert_encoder_destroy(encoder); test_output(); return 0; }
#include <bert/encoder.h> #include <bert/magic.h> #include <bert/errno.h> #include "test.h" unsigned char output[6]; void test_output() { if (output[0] != BERT_MAGIC) { test_fail("bert_encoder_push did not add the magic byte"); } if (output[1] != BERT_INT) { test_fail("bert_encoder_push did not add the INT magic byte"); } unsigned int i; for (i=2;i<6;i++) { if (output[i] != 0xff) { test_fail("output[%u] is 0x%x, expected 0x%x",output[i],0xff); } } } int main() { bert_encoder_t *encoder = test_encoder(output,6); bert_data_t *data; if (!(data = bert_data_create_int(0xffffffff))) { test_fail("malloc failed"); } test_encoder_push(encoder,data); bert_data_destroy(data); bert_encoder_destroy(encoder); test_output(); return 0; }
--- +++ @@ -18,15 +18,9 @@ test_fail("bert_encoder_push did not add the INT magic byte"); } - unsigned int i; + unsigned char bytes[] = {0xff, 0xff, 0xff, 0xff}; - for (i=2;i<6;i++) - { - if (output[i] != 0xff) - { - test_fail("output[%u] is 0x%x, expected 0x%x",output[i],0xff); - } - } + test_bytes(output+2,bytes,4); } int main()
Make use of test_bytes in the int encoder test.
mit
postmodern/libBERT
2448675327ceaa844ae2fab4a15c46d0981cad17
// Copyright (c) 2016-2020 The Karbowanec developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef UPDATE_H #define UPDATE_H #include <QObject> #include <QNetworkAccessManager> #include <QNetworkRequest> #include <QNetworkReply> #include <QUrl> const static QString KARBO_UPDATE_URL = "https://api.github.com/repos/seredat/karbowanecwallet/tags"; const static QString KARBO_DOWNLOAD_URL = "https://github.com/seredat/karbowanecwallet/releases/"; class Updater : public QObject { Q_OBJECT public: explicit Updater(QObject *parent = 0); ~Updater() { delete manager; } void checkForUpdate(); signals: public slots: void replyFinished (QNetworkReply *reply); private: QNetworkAccessManager *manager; }; #endif // UPDATE_H
// Copyright (c) 2016-2020 The Karbowanec developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef UPDATE_H #define UPDATE_H #include <QObject> #include <QNetworkAccessManager> #include <QNetworkRequest> #include <QNetworkReply> #include <QUrl> const static QString KARBO_UPDATE_URL = "https://api.github.com/repos/Karbovanets/karbowanecwallet/tags"; const static QString KARBO_DOWNLOAD_URL = "https://github.com/Karbovanets/karbowanecwallet/releases/"; class Updater : public QObject { Q_OBJECT public: explicit Updater(QObject *parent = 0); ~Updater() { delete manager; } void checkForUpdate(); signals: public slots: void replyFinished (QNetworkReply *reply); private: QNetworkAccessManager *manager; }; #endif // UPDATE_H
--- +++ @@ -11,8 +11,8 @@ #include <QNetworkReply> #include <QUrl> -const static QString KARBO_UPDATE_URL = "https://api.github.com/repos/Karbovanets/karbowanecwallet/tags"; -const static QString KARBO_DOWNLOAD_URL = "https://github.com/Karbovanets/karbowanecwallet/releases/"; +const static QString KARBO_UPDATE_URL = "https://api.github.com/repos/seredat/karbowanecwallet/tags"; +const static QString KARBO_DOWNLOAD_URL = "https://github.com/seredat/karbowanecwallet/releases/"; class Updater : public QObject {
Change repository urls to proper for this version
mit
seredat/karbowanecwallet,seredat/karbowanecwallet,seredat/karbowanecwallet
452dbb09e2fd05a8f9fcfa300dd12ceefe9bf8ab
#include "couv-private.h" static int couv_hrtime(lua_State *L) { lua_pushnumber(L, uv_hrtime()); return 1; } static const struct luaL_Reg functions[] = { { "hrtime", couv_hrtime }, { NULL, NULL } }; int luaopen_couv_native(lua_State *L) { lua_createtable(L, 0, ARRAY_SIZE(functions) - 1); couvL_setfuncs(L, functions, 0); luaopen_couv_loop(L); luaopen_couv_buffer(L); luaopen_couv_fs(L); luaopen_couv_ipaddr(L); luaopen_couv_handle(L); luaopen_couv_pipe(L); luaopen_couv_stream(L); luaopen_couv_tcp(L); luaopen_couv_timer(L); luaopen_couv_tty(L); luaopen_couv_udp(L); return 1; }
#include "couv-private.h" static int couv_hrtime(lua_State *L) { lua_pushnumber(L, uv_hrtime() / 1e9); return 1; } static const struct luaL_Reg functions[] = { { "hrtime", couv_hrtime }, { NULL, NULL } }; int luaopen_couv_native(lua_State *L) { lua_createtable(L, 0, ARRAY_SIZE(functions) - 1); couvL_setfuncs(L, functions, 0); luaopen_couv_loop(L); luaopen_couv_buffer(L); luaopen_couv_fs(L); luaopen_couv_ipaddr(L); luaopen_couv_handle(L); luaopen_couv_pipe(L); luaopen_couv_stream(L); luaopen_couv_tcp(L); luaopen_couv_timer(L); luaopen_couv_tty(L); luaopen_couv_udp(L); return 1; }
--- +++ @@ -1,7 +1,7 @@ #include "couv-private.h" static int couv_hrtime(lua_State *L) { - lua_pushnumber(L, uv_hrtime() / 1e9); + lua_pushnumber(L, uv_hrtime()); return 1; }
Change return value of hrtime from seconds to nano seconds.
mit
hnakamur/couv,hnakamur/couv
0d95270ddad8133f04047a15a6b8b2887a5d97a8
// RUN: %clang_cc1 -Wall -Werror -triple thumbv7-eabi -target-cpu cortex-a8 -O3 -emit-llvm -o - %s | FileCheck %s void *f0() { return __builtin_thread_pointer(); } void f1(char *a, char *b) { __clear_cache(a,b); } // CHECK: call void @__clear_cache
// RUN: %clang_cc1 -triple thumbv7-eabi -target-cpu cortex-a8 -O3 -emit-llvm -o %t %s void *f0() { return __builtin_thread_pointer(); }
--- +++ @@ -1,6 +1,12 @@ -// RUN: %clang_cc1 -triple thumbv7-eabi -target-cpu cortex-a8 -O3 -emit-llvm -o %t %s +// RUN: %clang_cc1 -Wall -Werror -triple thumbv7-eabi -target-cpu cortex-a8 -O3 -emit-llvm -o - %s | FileCheck %s void *f0() { return __builtin_thread_pointer(); } + +void f1(char *a, char *b) { + __clear_cache(a,b); +} + +// CHECK: call void @__clear_cache
Add a test to the previous commit. git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@105596 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,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang
a71d3c65375114146bb515b31820c5bf5d670128
#include "ring.h" /* OpenGL 1.1 Extension Copyright (c) 2017 Mahmoud Fayed <[email protected]> */ #include <GL/glew.h> #include <GL/glut.h> RING_FUNC(ring_get_gl_zero) { RING_API_RETNUMBER(GL_ZERO); } RING_FUNC(ring_get_gl_false) { RING_API_RETNUMBER(GL_FALSE); } RING_FUNC(ring_get_gl_logic_op) { RING_API_RETNUMBER(GL_LOGIC_OP); } RING_FUNC(ring_get_gl_none) { RING_API_RETNUMBER(GL_NONE); } RING_API void ringlib_init(RingState *pRingState) { ring_vm_funcregister("get_gl_zero",ring_get_gl_zero); ring_vm_funcregister("get_gl_false",ring_get_gl_false); ring_vm_funcregister("get_gl_logic_op",ring_get_gl_logic_op); ring_vm_funcregister("get_gl_none",ring_get_gl_none); }
#include "ring.h" /* OpenGL 1.1 Extension Copyright (c) 2017 Mahmoud Fayed <[email protected]> */ #include <GL/glew.h> #include <GL/glut.h> RING_FUNC(ring_get_gl_zero) { RING_API_RETNUMBER(GL_ZERO); } RING_FUNC(ring_get_gl_false) { RING_API_RETNUMBER(GL_FALSE); } RING_FUNC(ring_get_gl_logic_op) { RING_API_RETNUMBER(GL_LOGIC_OP); } RING_API void ringlib_init(RingState *pRingState) { ring_vm_funcregister("get_gl_zero",ring_get_gl_zero); ring_vm_funcregister("get_gl_false",ring_get_gl_false); ring_vm_funcregister("get_gl_logic_op",ring_get_gl_logic_op); }
--- +++ @@ -25,9 +25,15 @@ RING_API_RETNUMBER(GL_LOGIC_OP); } +RING_FUNC(ring_get_gl_none) +{ + RING_API_RETNUMBER(GL_NONE); +} + RING_API void ringlib_init(RingState *pRingState) { ring_vm_funcregister("get_gl_zero",ring_get_gl_zero); ring_vm_funcregister("get_gl_false",ring_get_gl_false); ring_vm_funcregister("get_gl_logic_op",ring_get_gl_logic_op); + ring_vm_funcregister("get_gl_none",ring_get_gl_none); }
Update RingOpenGL 1.1 - Add Constant (Source Code) : GL_NONE
mit
ring-lang/ring,ring-lang/ring,ring-lang/ring,ring-lang/ring,ring-lang/ring,ring-lang/ring,ring-lang/ring,ring-lang/ring
e87f79e573ba951dad55b81433b3a1839dd85332
#include "bst.h" static void BST_Transplant(BST* T, BSTNode* u, BSTNode* v); struct BSTNode { BSTNode* left; BSTNode* right; BSTNode* p; void* k; }; struct BST { BSTNode* root; }; BST* BST_Create(void) { BST* T = (BST* )malloc(sizeof(BST)); T->root = NULL; return T; } BSTNode* BSTNode_Create(void* k) { BSTNode* n = (BSTNode* )malloc(sizeof(BSTNode)); n->left = NULL; n->right = NULL; n->p = NULL; n->k = k; }
#include "bst.h" static void BST_Transplant(BST* T, BSTNode* u, BSTNode* v); struct BSTNode { BSTNode* left; BSTNode* right; BSTNode* p; void* k; }; struct BST { BSTNode* root; }; BST* BST_Create(void) { BST* T = (BST* )malloc(sizeof(BST)); T->root = NULL; return T; }
--- +++ @@ -22,3 +22,12 @@ return T; } +BSTNode* BSTNode_Create(void* k) +{ + BSTNode* n = (BSTNode* )malloc(sizeof(BSTNode)); + n->left = NULL; + n->right = NULL; + n->p = NULL; + n->k = k; +} +
Add BSTNode create function implementation
mit
MaxLikelihood/CADT
51f8c2e766d7d7110e073630b6a1885eb7d7cabc
#include <stdio.h> #define CAP 8 const int currency[CAP] = {1, 2, 5, 10, 20, 50, 100, 200}; int total[CAP] = {0, 0, 0, 0, 0, 0, 0, 0}; const int limit = 200; static inline int calculate_total(void) { int sum = 0; for (int i=0; i < CAP; i++) sum += total[i]; return sum; } int main(int argc, char *argv[]) { int ways = 0; int idx = 0; while (total[idx] <= limit && (idx != CAP)) { total[idx] += currency[idx]; int sum = calculate_total(); if (sum < limit) idx = 0; else { if (sum == limit) ways++; total[idx] = 0; idx++; } } printf("Answer: %d\n", ways); return 0; }
#include <stdio.h> #define CAP 8 const int currency[CAP] = {1, 2, 5, 10, 20, 50, 100, 200}; int total[CAP] = {0, 0, 0, 0, 0, 0, 0, 0}; const int limit = 200; static inline int calculate_total(void) { int sum = 0; for (int i=0; i < CAP; i++) sum += total[i]; return sum; } int main(int argc, char *argv[]) { int ways = 0; int idx = 0; while (total[idx] <= limit && (idx != CAP)) { total[idx] += currency[idx]; int sum = calculate_total(); if (sum == limit) ways++; if (total[idx] < limit) idx = 0; else if (total[idx] >= limit) { total[idx] = 0; idx++; } } printf("Answer: %d\n", ways); return 0; }
--- +++ @@ -28,12 +28,11 @@ total[idx] += currency[idx]; int sum = calculate_total(); - if (sum == limit) - ways++; - - if (total[idx] < limit) + if (sum < limit) idx = 0; - else if (total[idx] >= limit) { + else { + if (sum == limit) + ways++; total[idx] = 0; idx++; }
Check against sum, 30 second improvement
mit
tijko/Project-Euler,tijko/Project-Euler,tijko/Project-Euler,tijko/Project-Euler,tijko/Project-Euler,tijko/Project-Euler,tijko/Project-Euler,tijko/Project-Euler
2e8abb7a804ed24013202b53784c31f7e1131429
#define MODULE sample #include <sqmodule.h> #include <stdio.h> DECLARE_SQAPI static SQInteger func(HSQUIRRELVM v) { static char s[] = "Hello, modules!"; SQAPI(pushstring)(v, s, sizeof(s) - 1); return 1; } // Module init function SQRESULT MODULE_INIT(HSQUIRRELVM v, HSQAPI api) { printf("in sqmodule_load\n"); INIT_SQAPI(v, api); SQAPI(pushstring)(v, _SC("func"), -1); SQAPI(newclosure)(v, func, 0); SQAPI(newslot)(v, -3, SQFalse); printf("out sqmodule_load\n"); return SQ_OK; }
#define MODULE sample #include <sqmodule.h> #include <stdio.h> DECLARE_SQAPI static SQInteger func(HSQUIRRELVM v) { static char s[] = "Hello, modules!"; SQAPI(pushstring)(v, s, sizeof(s) - 1); return 1; } // Module init function SQRESULT MODULE_INIT(HSQUIRRELVM v, HSQAPI api) { printf("in sqmodule_load\n"); INIT_SQAPI(api); SQAPI(pushstring)(v, _SC("func"), -1); SQAPI(newclosure)(v, func, 0); SQAPI(newslot)(v, -3, SQFalse); printf("out sqmodule_load\n"); return SQ_OK; }
--- +++ @@ -17,7 +17,7 @@ { printf("in sqmodule_load\n"); - INIT_SQAPI(api); + INIT_SQAPI(v, api); SQAPI(pushstring)(v, _SC("func"), -1); SQAPI(newclosure)(v, func, 0);
Update for sqmodule API change.
mit
pfalcon/squirrel-modules,pfalcon/squirrel-modules,pfalcon/squirrel-modules
807d73e3f1ae1cf89d5c000d8070c9e43d80b453
#ifndef _INC_UTILS_H #define _INC_UTILS_H #include "basetypes.h" inline void *advancePtr(void *vp, SizeType len) { return (void*)((unsigned char *)(vp) + len); } inline const void *advancePtr(const void *vp, SizeType len) { return (void*)((unsigned char *)(vp) + len); } #endif//_INC_UTILS_H
#ifndef _INC_UTILS_H #define _INC_UTILS_H #include "basetypes.h" void *advancePtr(void *vp, SizeType len) { return (void*)((unsigned char *)(vp) + len); } const void *advancePtr(const void *vp, SizeType len) { return (void*)((unsigned char *)(vp) + len); } #endif//_INC_UTILS_H
--- +++ @@ -3,11 +3,11 @@ #include "basetypes.h" -void *advancePtr(void *vp, SizeType len) { +inline void *advancePtr(void *vp, SizeType len) { return (void*)((unsigned char *)(vp) + len); } -const void *advancePtr(const void *vp, SizeType len) { +inline const void *advancePtr(const void *vp, SizeType len) { return (void*)((unsigned char *)(vp) + len); }
Fix header methods to be inline
mit
aroxby/cpu,aroxby/cpu
d4ea2ac1a1bbf61ed190ac9b6e78d6be4ce687f6
#ifndef PHP_SHMT_H #define PHP_SHMT_H #define PHP_SHMT_EXTNAME "SHMT" #define PHP_SHMT_EXTVER "1.0.2dev" #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ extern zend_module_entry shmt_module_entry; #define phpext_shmt_ptr &shmt_module_entry; #endif /* PHP_SHMT_H */
#ifndef PHP_SHMT_H #define PHP_SHMT_H #define PHP_SHMT_EXTNAME "SHMT" #define PHP_SHMT_EXTVER "1.0.1" #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ extern zend_module_entry shmt_module_entry; #define phpext_shmt_ptr &shmt_module_entry; #endif /* PHP_SHMT_H */
--- +++ @@ -2,7 +2,7 @@ #define PHP_SHMT_H #define PHP_SHMT_EXTNAME "SHMT" - #define PHP_SHMT_EXTVER "1.0.1" + #define PHP_SHMT_EXTVER "1.0.2dev" #ifdef HAVE_CONFIG_H #include "config.h"
Update the version after tagging
mit
sevenval/SHMT,sevenval/SHMT
65c761a0d8dd7a84c9fbf9c108dafc1b8b690ac6
// // SFBLELogging.h // SFBluetoothLowEnergyDevice // // Created by Thomas Billicsich on 2014-04-04. // Copyright (c) 2014 Thomas Billicsich. All rights reserved. #import <CocoaLumberjack/CocoaLumberjack.h> // To define a different local (per file) log level // put the following line _before_ the import of SFBLELogging.h // #define LOCAL_LOG_LEVEL LOG_LEVEL_DEBUG #define GLOBAL_LOG_LEVEL DDLogLevelInfo #ifndef LOCAL_LOG_LEVEL #define LOCAL_LOG_LEVEL GLOBAL_LOG_LEVEL #endif static int ddLogLevel = LOCAL_LOG_LEVEL;
// // SFBLELogging.h // SFBluetoothLowEnergyDevice // // Created by Thomas Billicsich on 2014-04-04. // Copyright (c) 2014 Thomas Billicsich. All rights reserved. #import <CocoaLumberjack/CocoaLumberjack.h> // To define a different local (per file) log level // put the following line _before_ the import of SFBLELogging.h // #define LOCAL_LOG_LEVEL LOG_LEVEL_DEBUG #define GLOBAL_LOG_LEVEL DDLogLevelVerbose #ifndef LOCAL_LOG_LEVEL #define LOCAL_LOG_LEVEL GLOBAL_LOG_LEVEL #endif static int ddLogLevel = LOCAL_LOG_LEVEL;
--- +++ @@ -11,7 +11,7 @@ // To define a different local (per file) log level // put the following line _before_ the import of SFBLELogging.h // #define LOCAL_LOG_LEVEL LOG_LEVEL_DEBUG -#define GLOBAL_LOG_LEVEL DDLogLevelVerbose +#define GLOBAL_LOG_LEVEL DDLogLevelInfo #ifndef LOCAL_LOG_LEVEL #define LOCAL_LOG_LEVEL GLOBAL_LOG_LEVEL #endif
Set default log level to info [Delivers #87082830]
mit
martinjacala/SFBluetoothLowEnergyDevice,simpliflow/SFBluetoothLowEnergyDevice
b07d89ca854f79eca700a95f5e1d23d5b5f6f1ba
// // ViewController.h // AAChartKit // // Created by An An on 17/3/13. // Copyright © 2017年 An An. All rights reserved. // source code ----*** https://github.com/AAChartModel/AAChartKit ***--- source code // #import <UIKit/UIKit.h> typedef NS_ENUM(NSInteger,SecondeViewControllerChartType){ SecondeViewControllerChartTypeColumn =0, SecondeViewControllerChartTypeBar, SecondeViewControllerChartTypeArea, SecondeViewControllerChartTypeAreaspline, SecondeViewControllerChartTypeLine, SecondeViewControllerChartTypeSpline, SecondeViewControllerChartTypeScatter, }; @interface SecondViewController : UIViewController @property(nonatomic,assign)NSInteger SecondeViewControllerChartType; @property(nonatomic,copy)NSString *receivedChartType; @end
// // ViewController.h // AAChartKit // // Created by An An on 17/3/13. // Copyright © 2017年 An An. All rights reserved. // source code ----*** https://github.com/AAChartModel/AAChartKit ***--- source code // #import <UIKit/UIKit.h> typedef NS_ENUM(NSInteger,ENUM_secondeViewController_chartType){ ENUM_secondeViewController_chartTypeColumn =0, ENUM_secondeViewController_chartTypeBar, ENUM_secondeViewController_chartTypeArea, ENUM_secondeViewController_chartTypeAreaspline, ENUM_secondeViewController_chartTypeLine, ENUM_secondeViewController_chartTypeSpline, ENUM_secondeViewController_chartTypeScatter, }; @interface SecondViewController : UIViewController @property(nonatomic,assign)NSInteger ENUM_secondeViewController_chartType; @property(nonatomic,copy)NSString *receivedChartType; @end
--- +++ @@ -8,20 +8,20 @@ // #import <UIKit/UIKit.h> -typedef NS_ENUM(NSInteger,ENUM_secondeViewController_chartType){ - ENUM_secondeViewController_chartTypeColumn =0, - ENUM_secondeViewController_chartTypeBar, - ENUM_secondeViewController_chartTypeArea, - ENUM_secondeViewController_chartTypeAreaspline, - ENUM_secondeViewController_chartTypeLine, - ENUM_secondeViewController_chartTypeSpline, - ENUM_secondeViewController_chartTypeScatter, +typedef NS_ENUM(NSInteger,SecondeViewControllerChartType){ + SecondeViewControllerChartTypeColumn =0, + SecondeViewControllerChartTypeBar, + SecondeViewControllerChartTypeArea, + SecondeViewControllerChartTypeAreaspline, + SecondeViewControllerChartTypeLine, + SecondeViewControllerChartTypeSpline, + SecondeViewControllerChartTypeScatter, }; @interface SecondViewController : UIViewController -@property(nonatomic,assign)NSInteger ENUM_secondeViewController_chartType; +@property(nonatomic,assign)NSInteger SecondeViewControllerChartType; @property(nonatomic,copy)NSString *receivedChartType; @end
Correct the naming notations of enumeration
mit
AAChartModel/AAChartKit,AAChartModel/AAChartKit,AAChartModel/AAChartKit
08d8a5ec7d018c771787bd33b429c2b2d096a578
/* dtkComposerSceneNodeLeaf.h --- * * Author: Julien Wintz * Copyright (C) 2008-2011 - Julien Wintz, Inria. * Created: Fri Feb 3 12:34:45 2012 (+0100) * Version: $Id$ * Last-Updated: Thu May 31 09:45:52 2012 (+0200) * By: tkloczko * Update #: 11 */ /* Commentary: * */ /* Change log: * */ #ifndef DTKCOMPOSERSCENENODELEAF_H #define DTKCOMPOSERSCENENODELEAF_H #include "dtkComposerExport.h" #include "dtkComposerSceneNode.h" class dtkComposerNode; class dtkComposerSceneNodeLeafPrivate; class DTKCOMPOSER_EXPORT dtkComposerSceneNodeLeaf : public dtkComposerSceneNode { public: dtkComposerSceneNodeLeaf(void); ~dtkComposerSceneNodeLeaf(void); public: void wrap(dtkComposerNode *node); public: void layout(void); public: void resize(qreal width, qreal height); public: QRectF boundingRect(void) const; public: void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); private: dtkComposerSceneNodeLeafPrivate *d; }; #endif
/* dtkComposerSceneNodeLeaf.h --- * * Author: Julien Wintz * Copyright (C) 2008-2011 - Julien Wintz, Inria. * Created: Fri Feb 3 12:34:45 2012 (+0100) * Version: $Id$ * Last-Updated: Thu Feb 16 14:47:09 2012 (+0100) * By: Julien Wintz * Update #: 10 */ /* Commentary: * */ /* Change log: * */ #ifndef DTKCOMPOSERSCENENODELEAF_H #define DTKCOMPOSERSCENENODELEAF_H #include "dtkComposerSceneNode.h" class dtkComposerNode; class dtkComposerSceneNodeLeafPrivate; class dtkComposerSceneNodeLeaf : public dtkComposerSceneNode { public: dtkComposerSceneNodeLeaf(void); ~dtkComposerSceneNodeLeaf(void); public: void wrap(dtkComposerNode *node); public: void layout(void); public: void resize(qreal width, qreal height); public: QRectF boundingRect(void) const; public: void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); private: dtkComposerSceneNodeLeafPrivate *d; }; #endif
--- +++ @@ -4,9 +4,9 @@ * Copyright (C) 2008-2011 - Julien Wintz, Inria. * Created: Fri Feb 3 12:34:45 2012 (+0100) * Version: $Id$ - * Last-Updated: Thu Feb 16 14:47:09 2012 (+0100) - * By: Julien Wintz - * Update #: 10 + * Last-Updated: Thu May 31 09:45:52 2012 (+0200) + * By: tkloczko + * Update #: 11 */ /* Commentary: @@ -20,12 +20,14 @@ #ifndef DTKCOMPOSERSCENENODELEAF_H #define DTKCOMPOSERSCENENODELEAF_H +#include "dtkComposerExport.h" + #include "dtkComposerSceneNode.h" class dtkComposerNode; class dtkComposerSceneNodeLeafPrivate; -class dtkComposerSceneNodeLeaf : public dtkComposerSceneNode +class DTKCOMPOSER_EXPORT dtkComposerSceneNodeLeaf : public dtkComposerSceneNode { public: dtkComposerSceneNodeLeaf(void);
Add export rules for scene node leaf.
bsd-3-clause
d-tk/dtk,d-tk/dtk,NicolasSchnitzler/dtk,rdebroiz/dtk,d-tk/dtk,rdebroiz/dtk,rdebroiz/dtk,d-tk/dtk,rdebroiz/dtk,d-tk/dtk,NicolasSchnitzler/dtk,NicolasSchnitzler/dtk,NicolasSchnitzler/dtk,d-tk/dtk
08d9391c8f90f0c5c997bd3ab41517774dd582f3
#include <stdio.h> #include <signal.h> #include <unistd.h> #include <assert.h> #include <stdlib.h> #include <setjmp.h> jmp_buf try; void handler(int sig) { static int i = 0; printf("stack overflow %d\n", i); longjmp(try, ++i); assert(0); } unsigned recurse(unsigned x) { return recurse(x)+1; } int main() { char* stack; stack = malloc(sizeof(stack) * SIGSTKSZ); stack_t ss = { .ss_size = SIGSTKSZ, .ss_sp = stack, }; struct sigaction sa = { .sa_handler = handler, .sa_flags = SA_ONSTACK }; sigaltstack(&ss, 0); sigfillset(&sa.sa_mask); sigaction(SIGSEGV, &sa, 0); if (setjmp(try) < 3) { recurse(0); } else { printf("caught exception!\n"); } return 0; }
#include <stdio.h> #include <signal.h> #include <unistd.h> #include <assert.h> #include <stdlib.h> #include <setjmp.h> jmp_buf try; void handler(int sig) { static int i = 0; write(2, "stack overflow\n", 15); longjmp(try, ++i); _exit(1); } unsigned recurse(unsigned x) { return recurse(x)+1; } int main() { char* stack; stack = malloc(sizeof(stack) * SIGSTKSZ); stack_t ss = { .ss_size = SIGSTKSZ, .ss_sp = stack, }; struct sigaction sa = { .sa_handler = handler, .sa_flags = SA_ONSTACK }; sigaltstack(&ss, 0); sigfillset(&sa.sa_mask); sigaction(SIGSEGV, &sa, 0); if (setjmp(try) < 3) { recurse(0); } else { printf("caught exception!\n"); } return 0; }
--- +++ @@ -10,9 +10,9 @@ void handler(int sig) { static int i = 0; - write(2, "stack overflow\n", 15); + printf("stack overflow %d\n", i); longjmp(try, ++i); - _exit(1); + assert(0); } unsigned recurse(unsigned x) { @@ -34,6 +34,7 @@ sigaltstack(&ss, 0); sigfillset(&sa.sa_mask); sigaction(SIGSEGV, &sa, 0); + if (setjmp(try) < 3) { recurse(0); } else {
Add assert, more print info
apache-2.0
danluu/setjmp-longjmp-ucontext-snippets,danluu/setjmp-longjmp-ucontext-snippets
88dd832b22b4927f9d571158c0429df0a50fd6d8
#include <kotaka/paths.h> #include <kotaka/privilege.h> #include <kotaka/bigstruct.h> #include <kotaka/log.h> inherit LIB_INITD; inherit UTILITY_COMPILE; static void create() { load_dir("obj", 1); load_dir("sys", 1); } void full_reset() { object turkeylist; object cursor; object first; object this; ACCESS_CHECK(PRIVILEGED()); turkeylist = new_object(BIGSTRUCT_DEQUE_LWO); this = this_object(); cursor = KERNELD->first_link("Help"); first = cursor; do { LOGD->post_message("help", LOG_DEBUG, "Listing " + object_name(cursor)); turkeylist->push_back(cursor); cursor = KERNELD->next_link(cursor); } while (cursor != first); while (!turkeylist->empty()) { object turkey; turkey = turkeylist->get_front(); turkeylist->pop_front(); if (!turkey || turkey == this) { /* don't self destruct or double destruct */ continue; } destruct_object(turkey); } load_dir("obj", 1); load_dir("sys", 1); }
#include <kotaka/paths.h> inherit LIB_INITD; inherit UTILITY_COMPILE; static void create() { load_dir("obj", 1); load_dir("sys", 1); }
--- +++ @@ -1,4 +1,7 @@ #include <kotaka/paths.h> +#include <kotaka/privilege.h> +#include <kotaka/bigstruct.h> +#include <kotaka/log.h> inherit LIB_INITD; inherit UTILITY_COMPILE; @@ -8,3 +11,42 @@ load_dir("obj", 1); load_dir("sys", 1); } + +void full_reset() +{ + object turkeylist; + object cursor; + object first; + object this; + + ACCESS_CHECK(PRIVILEGED()); + + turkeylist = new_object(BIGSTRUCT_DEQUE_LWO); + + this = this_object(); + cursor = KERNELD->first_link("Help"); + first = cursor; + + do { + LOGD->post_message("help", LOG_DEBUG, "Listing " + object_name(cursor)); + turkeylist->push_back(cursor); + cursor = KERNELD->next_link(cursor); + } while (cursor != first); + + while (!turkeylist->empty()) { + object turkey; + + turkey = turkeylist->get_front(); + turkeylist->pop_front(); + + if (!turkey || turkey == this) { + /* don't self destruct or double destruct */ + continue; + } + + destruct_object(turkey); + } + + load_dir("obj", 1); + load_dir("sys", 1); +}
Allow help module to be rebooted
agpl-3.0
shentino/kotaka,shentino/kotaka,shentino/kotaka
febcd73e5ebc12d91f72bd948d8d8abd2043d84d
#import <Foundation/Foundation.h> @class JSObjectionInjector; @interface JSObjectFactory : NSObject @property (nonatomic, readonly, weak) JSObjectionInjector *injector; - (id)initWithInjector:(JSObjectionInjector *)injector; - (id)getObject:(id)classOrProtocol; - (id)objectForKeyedSubscript: (id)key; - (id)getObjectWithArgs:(id)classOrProtocol, ... NS_REQUIRES_NIL_TERMINATION; @end
#import <Foundation/Foundation.h> @class JSObjectionInjector; @interface JSObjectFactory : NSObject @property (nonatomic, readonly, strong) JSObjectionInjector *injector; - (id)initWithInjector:(JSObjectionInjector *)injector; - (id)getObject:(id)classOrProtocol; - (id)objectForKeyedSubscript: (id)key; - (id)getObjectWithArgs:(id)classOrProtocol, ... NS_REQUIRES_NIL_TERMINATION; @end
--- +++ @@ -3,7 +3,7 @@ @class JSObjectionInjector; @interface JSObjectFactory : NSObject -@property (nonatomic, readonly, strong) JSObjectionInjector *injector; +@property (nonatomic, readonly, weak) JSObjectionInjector *injector; - (id)initWithInjector:(JSObjectionInjector *)injector; - (id)getObject:(id)classOrProtocol;
Use weak reference in object factory to avoid cyclical references
mit
ApplauseAQI/objection,alexfeng/objection,ApplauseAQI/objection,zjh171/objection,atomicobject/objection,technology-ebay-de/objection,paulz/objection,technology-ebay-de/objection,hzm0318hzm/objection,ApplauseAQI/objection,alexfeng/objection,hzm0318hzm/objection,zjh171/objection,paulz/objection,atomicobject/objection,ReutersTV/objection,ApplauseAQI/objection,ReutersTV/objection
052f525884c6664c3047b03b607ca5f7d19e9524
#ifndef _CGMINER_MINER_H #define _CGMINER_MINER_H #include <stdint.h> #include <stdbool.h> struct work { uint8_t *midstate; uint8_t *data; }; #ifndef MAX #define MAX(a,b) ((a) < (b) ? (b) : (a)) #endif #ifndef MIN #define MIN(a,b) ((a) > (b) ? (b) : (a)) #endif #endif
#ifndef _CGMINER_MINER_H #define _CGMINER_MINER_H #include <stdint.h> struct work { uint8_t *midstate; uint8_t *data; }; #ifndef MAX #define MAX(a,b) ((a) < (b) ? (b) : (a)) #endif #ifndef MIN #define MIN(a,b) ((a) > (b) ? (b) : (a)) #endif typedef enum { false = 0, true = 1 } bool; #endif
--- +++ @@ -2,6 +2,7 @@ #define _CGMINER_MINER_H #include <stdint.h> +#include <stdbool.h> struct work { uint8_t *midstate; @@ -15,8 +16,4 @@ #define MIN(a,b) ((a) > (b) ? (b) : (a)) #endif -typedef enum { - false = 0, - true = 1 -} bool; #endif
Use stdbool.h for bool definition. Our own collides with applications using strbool.h
mit
KnCMiner/knc-asic,KnCMiner/knc-asic,KnCMiner/knc-asic
cb39939355915d400a9ea0f0bee5e6fcc5dfeb37
// RUN: %check %s // extern extern inline int f() { static int i; return i++; } // static static inline int h() { static int i; return i++; } // neither inline int g() { static int i; // CHECK: warning: mutable static variable in pure-inline function - may differ per file return i++; } // neither, but const inline int g2() { static const int i = 3; // CHECK: !/warn/ return i; } main() { return f() + g() + h(); }
// RUN: %check %s // extern extern inline int f() { static int i; return i++; } // static static inline int h() { static int i; return i++; } // neither inline int g() { static int i; // CHECK: warning: static variable in pure-inline function - may differ per file return i++; } // neither, but const inline int g2() { static const int i = 3; // CHECK: !/warn/ return i; } main() { return f() + g() + h(); }
--- +++ @@ -17,7 +17,7 @@ // neither inline int g() { - static int i; // CHECK: warning: static variable in pure-inline function - may differ per file + static int i; // CHECK: warning: mutable static variable in pure-inline function - may differ per file return i++; }
Fix inline static local warning
mit
8l/ucc-c-compiler,8l/ucc-c-compiler,8l/ucc-c-compiler,8l/ucc-c-compiler
51f9648c1af205b9822a1dfe220c825eef07a2cc
/* Copyright (c) 2013-2015 Dovecot authors, see the included COPYING file */ #include "lib.h" #include "dict-private.h" static int refcount = 0; void dict_drivers_register_builtin(void) { if (refcount++ > 0) return; dict_driver_register(&dict_driver_client); dict_driver_register(&dict_driver_file); dict_driver_register(&dict_driver_fs); dict_driver_register(&dict_driver_memcached); dict_driver_register(&dict_driver_memcached_ascii); dict_driver_register(&dict_driver_redis); } void dict_drivers_unregister_builtin(void) { if (--refcount > 0) return; dict_driver_unregister(&dict_driver_client); dict_driver_unregister(&dict_driver_file); dict_driver_unregister(&dict_driver_fs); dict_driver_unregister(&dict_driver_memcached); dict_driver_unregister(&dict_driver_memcached_ascii); dict_driver_unregister(&dict_driver_redis); }
/* Copyright (c) 2013-2015 Dovecot authors, see the included COPYING file */ #include "lib.h" #include "dict-private.h" void dict_drivers_register_builtin(void) { dict_driver_register(&dict_driver_client); dict_driver_register(&dict_driver_file); dict_driver_register(&dict_driver_fs); dict_driver_register(&dict_driver_memcached); dict_driver_register(&dict_driver_memcached_ascii); dict_driver_register(&dict_driver_redis); } void dict_drivers_unregister_builtin(void) { dict_driver_unregister(&dict_driver_client); dict_driver_unregister(&dict_driver_file); dict_driver_unregister(&dict_driver_fs); dict_driver_unregister(&dict_driver_memcached); dict_driver_unregister(&dict_driver_memcached_ascii); dict_driver_unregister(&dict_driver_redis); }
--- +++ @@ -3,8 +3,12 @@ #include "lib.h" #include "dict-private.h" +static int refcount = 0; + void dict_drivers_register_builtin(void) { + if (refcount++ > 0) + return; dict_driver_register(&dict_driver_client); dict_driver_register(&dict_driver_file); dict_driver_register(&dict_driver_fs); @@ -15,6 +19,8 @@ void dict_drivers_unregister_builtin(void) { + if (--refcount > 0) + return; dict_driver_unregister(&dict_driver_client); dict_driver_unregister(&dict_driver_file); dict_driver_unregister(&dict_driver_fs);
lib-dict: Allow registering builtin dict drivers multiple times.
mit
dscho/dovecot,dscho/dovecot,dscho/dovecot,dscho/dovecot,dscho/dovecot
9ac14d7ea9468fd480cfd5375242b4101ef37441
// @(#)root/mc:$Name: $:$Id: LinkDef.h,v 1.2 2002/04/26 09:25:02 brun Exp $ #ifdef __CINT__ #pragma link off all globals; #pragma link off all classes; #pragma link off all functions; #pragma link C++ global gMC; #pragma link C++ enum PDG_t; #pragma link C++ enum TMCProcess; #pragma link C++ class TVirtualMC+; #pragma link C++ class TVirtualMCApplication+; #pragma link C++ class TVirtualMCStack+; #pragma link C++ class TVirtualMCDecayer+; #pragma link C++ class TMCVerbose+; #endif
// @(#)root/mc:$Name: $:$Id: LinkDef.h,v 1.2 2002/04/26 08:46:10 brun Exp $ #ifdef __CINT__ #pragma link off all globals; #pragma link off all classes; #pragma link off all functions; #pragma link C++ global gMC; #pragma link C++ enum PDG_t; #pragma link C++ enum TMCProcess; #pragma link C++ class TVirtualMC+; #pragma link C++ class TVirtualMCApplication+; #pragma link C++ class TVirtualMCStack+; #pragma link C++ class TVirtualMCDecayer+; #endif
--- +++ @@ -1,4 +1,4 @@ -// @(#)root/mc:$Name: $:$Id: LinkDef.h,v 1.2 2002/04/26 08:46:10 brun Exp $ +// @(#)root/mc:$Name: $:$Id: LinkDef.h,v 1.2 2002/04/26 09:25:02 brun Exp $ #ifdef __CINT__ #pragma link off all globals; @@ -14,6 +14,7 @@ #pragma link C++ class TVirtualMCApplication+; #pragma link C++ class TVirtualMCStack+; #pragma link C++ class TVirtualMCDecayer+; +#pragma link C++ class TMCVerbose+; #endif
Add TMCVerbose to the list of mc classes git-svn-id: acec3fd5b7ea1eb9e79d6329d318e8118ee2e14f@6190 27541ba8-7e3a-0410-8455-c3a389f83636
lgpl-2.1
satyarth934/root,dfunke/root,tc3t/qoot,georgtroska/root,georgtroska/root,perovic/root,sawenzel/root,alexschlueter/cern-root,kirbyherm/root-r-tools,arch1tect0r/root,abhinavmoudgil95/root,zzxuanyuan/root-compressor-dummy,cxx-hep/root-cern,agarciamontoro/root,nilqed/root,abhinavmoudgil95/root,zzxuanyuan/root-compressor-dummy,olifre/root,root-mirror/root,sirinath/root,smarinac/root,simonpf/root,lgiommi/root,davidlt/root,krafczyk/root,mattkretz/root,sirinath/root,bbockelm/root,karies/root,sawenzel/root,tc3t/qoot,CristinaCristescu/root,omazapa/root,Y--/root,sawenzel/root,gganis/root,vukasinmilosevic/root,esakellari/root,gbitzes/root,beniz/root,nilqed/root,abhinavmoudgil95/root,mattkretz/root,zzxuanyuan/root-compressor-dummy,lgiommi/root,root-mirror/root,Y--/root,sirinath/root,smarinac/root,Y--/root,beniz/root,nilqed/root,CristinaCristescu/root,omazapa/root-old,zzxuanyuan/root,olifre/root,agarciamontoro/root,alexschlueter/cern-root,veprbl/root,mattkretz/root,agarciamontoro/root,zzxuanyuan/root,esakellari/root,0x0all/ROOT,perovic/root,pspe/root,esakellari/root,smarinac/root,esakellari/root,jrtomps/root,karies/root,dfunke/root,pspe/root,sirinath/root,zzxuanyuan/root,CristinaCristescu/root,evgeny-boger/root,gbitzes/root,zzxuanyuan/root-compressor-dummy,arch1tect0r/root,smarinac/root,esakellari/my_root_for_test,kirbyherm/root-r-tools,davidlt/root,sawenzel/root,arch1tect0r/root,karies/root,pspe/root,sbinet/cxx-root,cxx-hep/root-cern,gbitzes/root,mattkretz/root,Duraznos/root,BerserkerTroll/root,olifre/root,omazapa/root-old,jrtomps/root,zzxuanyuan/root-compressor-dummy,veprbl/root,gbitzes/root,0x0all/ROOT,sbinet/cxx-root,sawenzel/root,buuck/root,Dr15Jones/root,BerserkerTroll/root,abhinavmoudgil95/root,buuck/root,abhinavmoudgil95/root,veprbl/root,sirinath/root,vukasinmilosevic/root,gbitzes/root,tc3t/qoot,krafczyk/root,mkret2/root,gbitzes/root,simonpf/root,agarciamontoro/root,cxx-hep/root-cern,smarinac/root,CristinaCristescu/root,esakellari/root,CristinaCristescu/root,root-mirror/root,evgeny-boger/root,omazapa/root-old,mattkretz/root,Y--/root,krafczyk/root,mkret2/root,omazapa/root,satyarth934/root,nilqed/root,Dr15Jones/root,vukasinmilosevic/root,Duraznos/root,georgtroska/root,abhinavmoudgil95/root,krafczyk/root,buuck/root,beniz/root,nilqed/root,thomaskeck/root,esakellari/root,sbinet/cxx-root,perovic/root,gganis/root,georgtroska/root,esakellari/root,gganis/root,olifre/root,mkret2/root,smarinac/root,ffurano/root5,root-mirror/root,omazapa/root,agarciamontoro/root,lgiommi/root,davidlt/root,beniz/root,esakellari/my_root_for_test,zzxuanyuan/root-compressor-dummy,ffurano/root5,dfunke/root,buuck/root,nilqed/root,tc3t/qoot,mhuwiler/rootauto,sirinath/root,Duraznos/root,mkret2/root,olifre/root,BerserkerTroll/root,simonpf/root,buuck/root,sbinet/cxx-root,zzxuanyuan/root-compressor-dummy,omazapa/root-old,root-mirror/root,buuck/root,0x0all/ROOT,georgtroska/root,Y--/root,zzxuanyuan/root,bbockelm/root,gganis/root,tc3t/qoot,evgeny-boger/root,perovic/root,abhinavmoudgil95/root,arch1tect0r/root,vukasinmilosevic/root,sbinet/cxx-root,jrtomps/root,root-mirror/root,arch1tect0r/root,Duraznos/root,karies/root,omazapa/root-old,simonpf/root,beniz/root,thomaskeck/root,buuck/root,krafczyk/root,nilqed/root,omazapa/root,gganis/root,gbitzes/root,vukasinmilosevic/root,cxx-hep/root-cern,davidlt/root,Dr15Jones/root,simonpf/root,vukasinmilosevic/root,satyarth934/root,georgtroska/root,beniz/root,sbinet/cxx-root,BerserkerTroll/root,dfunke/root,sirinath/root,Duraznos/root,esakellari/my_root_for_test,perovic/root,zzxuanyuan/root,zzxuanyuan/root-compressor-dummy,olifre/root,gbitzes/root,tc3t/qoot,sbinet/cxx-root,mhuwiler/rootauto,simonpf/root,sawenzel/root,alexschlueter/cern-root,sbinet/cxx-root,BerserkerTroll/root,bbockelm/root,thomaskeck/root,Duraznos/root,sirinath/root,mkret2/root,buuck/root,karies/root,evgeny-boger/root,agarciamontoro/root,davidlt/root,gbitzes/root,perovic/root,satyarth934/root,veprbl/root,smarinac/root,jrtomps/root,mhuwiler/rootauto,zzxuanyuan/root-compressor-dummy,thomaskeck/root,lgiommi/root,cxx-hep/root-cern,agarciamontoro/root,Dr15Jones/root,arch1tect0r/root,zzxuanyuan/root-compressor-dummy,veprbl/root,0x0all/ROOT,pspe/root,smarinac/root,CristinaCristescu/root,0x0all/ROOT,pspe/root,sbinet/cxx-root,ffurano/root5,arch1tect0r/root,Duraznos/root,strykejern/TTreeReader,krafczyk/root,zzxuanyuan/root,sirinath/root,sawenzel/root,evgeny-boger/root,zzxuanyuan/root,arch1tect0r/root,omazapa/root,esakellari/root,vukasinmilosevic/root,mhuwiler/rootauto,pspe/root,0x0all/ROOT,tc3t/qoot,lgiommi/root,Dr15Jones/root,Duraznos/root,mhuwiler/rootauto,Duraznos/root,mattkretz/root,ffurano/root5,evgeny-boger/root,abhinavmoudgil95/root,olifre/root,gganis/root,pspe/root,esakellari/root,dfunke/root,Y--/root,nilqed/root,smarinac/root,BerserkerTroll/root,omazapa/root-old,veprbl/root,omazapa/root,vukasinmilosevic/root,thomaskeck/root,karies/root,lgiommi/root,buuck/root,BerserkerTroll/root,davidlt/root,agarciamontoro/root,evgeny-boger/root,cxx-hep/root-cern,kirbyherm/root-r-tools,veprbl/root,Duraznos/root,sawenzel/root,esakellari/my_root_for_test,thomaskeck/root,ffurano/root5,dfunke/root,gbitzes/root,perovic/root,esakellari/my_root_for_test,sbinet/cxx-root,agarciamontoro/root,bbockelm/root,satyarth934/root,olifre/root,satyarth934/root,evgeny-boger/root,bbockelm/root,tc3t/qoot,mhuwiler/rootauto,lgiommi/root,gganis/root,sirinath/root,Y--/root,karies/root,CristinaCristescu/root,jrtomps/root,vukasinmilosevic/root,buuck/root,veprbl/root,dfunke/root,sawenzel/root,krafczyk/root,davidlt/root,CristinaCristescu/root,beniz/root,zzxuanyuan/root,sbinet/cxx-root,nilqed/root,esakellari/my_root_for_test,dfunke/root,strykejern/TTreeReader,veprbl/root,kirbyherm/root-r-tools,lgiommi/root,olifre/root,davidlt/root,omazapa/root-old,arch1tect0r/root,omazapa/root,mhuwiler/rootauto,0x0all/ROOT,Y--/root,0x0all/ROOT,mkret2/root,kirbyherm/root-r-tools,Dr15Jones/root,vukasinmilosevic/root,omazapa/root,jrtomps/root,perovic/root,Duraznos/root,agarciamontoro/root,veprbl/root,cxx-hep/root-cern,omazapa/root,Y--/root,Y--/root,mhuwiler/rootauto,buuck/root,strykejern/TTreeReader,pspe/root,veprbl/root,omazapa/root-old,esakellari/root,olifre/root,evgeny-boger/root,gbitzes/root,lgiommi/root,ffurano/root5,tc3t/qoot,CristinaCristescu/root,mhuwiler/rootauto,arch1tect0r/root,krafczyk/root,beniz/root,gganis/root,davidlt/root,alexschlueter/cern-root,jrtomps/root,thomaskeck/root,BerserkerTroll/root,CristinaCristescu/root,sawenzel/root,pspe/root,karies/root,sawenzel/root,alexschlueter/cern-root,omazapa/root-old,strykejern/TTreeReader,perovic/root,olifre/root,esakellari/my_root_for_test,satyarth934/root,krafczyk/root,pspe/root,strykejern/TTreeReader,mattkretz/root,georgtroska/root,dfunke/root,bbockelm/root,karies/root,esakellari/root,lgiommi/root,perovic/root,mkret2/root,zzxuanyuan/root,agarciamontoro/root,mkret2/root,omazapa/root-old,mattkretz/root,omazapa/root-old,0x0all/ROOT,root-mirror/root,omazapa/root,simonpf/root,mattkretz/root,bbockelm/root,zzxuanyuan/root-compressor-dummy,mkret2/root,mkret2/root,jrtomps/root,kirbyherm/root-r-tools,zzxuanyuan/root,ffurano/root5,pspe/root,gganis/root,abhinavmoudgil95/root,davidlt/root,smarinac/root,gganis/root,jrtomps/root,georgtroska/root,strykejern/TTreeReader,BerserkerTroll/root,davidlt/root,nilqed/root,dfunke/root,sirinath/root,gganis/root,root-mirror/root,root-mirror/root,bbockelm/root,satyarth934/root,kirbyherm/root-r-tools,vukasinmilosevic/root,esakellari/my_root_for_test,mkret2/root,thomaskeck/root,simonpf/root,georgtroska/root,thomaskeck/root,mhuwiler/rootauto,esakellari/my_root_for_test,strykejern/TTreeReader,simonpf/root,bbockelm/root,karies/root,Dr15Jones/root,Y--/root,krafczyk/root,krafczyk/root,arch1tect0r/root,jrtomps/root,georgtroska/root,root-mirror/root,cxx-hep/root-cern,karies/root,jrtomps/root,bbockelm/root,omazapa/root,satyarth934/root,thomaskeck/root,tc3t/qoot,evgeny-boger/root,zzxuanyuan/root,simonpf/root,bbockelm/root,dfunke/root,simonpf/root,satyarth934/root,esakellari/my_root_for_test,mattkretz/root,alexschlueter/cern-root,beniz/root,CristinaCristescu/root,zzxuanyuan/root,georgtroska/root,evgeny-boger/root,root-mirror/root,mhuwiler/rootauto,mattkretz/root,beniz/root,abhinavmoudgil95/root,abhinavmoudgil95/root,perovic/root,lgiommi/root,BerserkerTroll/root,satyarth934/root,BerserkerTroll/root,beniz/root,nilqed/root,alexschlueter/cern-root
7210b0870c273abcd45c9d7663623242a846e256
//===--- Dwarf.h - DWARF constants ------------------------------*- C++ -*-===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swift.org/LICENSE.txt for license information // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // //===----------------------------------------------------------------------===// // // This file defines several temporary Swift-specific DWARF constants. // //===----------------------------------------------------------------------===// #ifndef SWIFT_BASIC_DWARF_H #define SWIFT_BASIC_DWARF_H #include "llvm/BinaryFormat/Dwarf.h" namespace swift { /// The DWARF version emitted by the Swift compiler. const unsigned DWARFVersion = 4; static const char MachOASTSegmentName[] = "__SWIFT"; static const char MachOASTSectionName[] = "__ast"; static const char ELFASTSectionName[] = ".swift_ast"; static const char COFFASTSectionName[] = "swiftast"; } // end namespace swift #endif // SWIFT_BASIC_DWARF_H
//===--- Dwarf.h - DWARF constants ------------------------------*- C++ -*-===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swift.org/LICENSE.txt for license information // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // //===----------------------------------------------------------------------===// // // This file defines several temporary Swift-specific DWARF constants. // //===----------------------------------------------------------------------===// #ifndef SWIFT_BASIC_DWARF_H #define SWIFT_BASIC_DWARF_H #include "llvm/Support/Dwarf.h" namespace swift { /// The DWARF version emitted by the Swift compiler. const unsigned DWARFVersion = 4; static const char MachOASTSegmentName[] = "__SWIFT"; static const char MachOASTSectionName[] = "__ast"; static const char ELFASTSectionName[] = ".swift_ast"; static const char COFFASTSectionName[] = "swiftast"; } // end namespace swift #endif // SWIFT_BASIC_DWARF_H
--- +++ @@ -17,7 +17,7 @@ #ifndef SWIFT_BASIC_DWARF_H #define SWIFT_BASIC_DWARF_H -#include "llvm/Support/Dwarf.h" +#include "llvm/BinaryFormat/Dwarf.h" namespace swift { /// The DWARF version emitted by the Swift compiler.
Adjust for new LLVM BinaryFormat library in r304864.
apache-2.0
lorentey/swift,xedin/swift,frootloops/swift,stephentyrone/swift,ahoppen/swift,xedin/swift,stephentyrone/swift,sschiau/swift,huonw/swift,benlangmuir/swift,karwa/swift,alblue/swift,ahoppen/swift,airspeedswift/swift,OscarSwanros/swift,return/swift,practicalswift/swift,jmgc/swift,frootloops/swift,airspeedswift/swift,parkera/swift,uasys/swift,brentdax/swift,gregomni/swift,return/swift,xedin/swift,swiftix/swift,sschiau/swift,huonw/swift,apple/swift,hooman/swift,benlangmuir/swift,devincoughlin/swift,amraboelela/swift,shajrawi/swift,JGiola/swift,danielmartin/swift,return/swift,CodaFi/swift,OscarSwanros/swift,lorentey/swift,sschiau/swift,roambotics/swift,apple/swift,uasys/swift,danielmartin/swift,jckarter/swift,swiftix/swift,milseman/swift,amraboelela/swift,danielmartin/swift,CodaFi/swift,allevato/swift,tjw/swift,shahmishal/swift,karwa/swift,benlangmuir/swift,milseman/swift,deyton/swift,benlangmuir/swift,tkremenek/swift,devincoughlin/swift,xwu/swift,amraboelela/swift,airspeedswift/swift,hooman/swift,austinzheng/swift,practicalswift/swift,gribozavr/swift,benlangmuir/swift,gribozavr/swift,CodaFi/swift,hooman/swift,aschwaighofer/swift,gregomni/swift,frootloops/swift,alblue/swift,shahmishal/swift,aschwaighofer/swift,jopamer/swift,deyton/swift,nathawes/swift,swiftix/swift,JGiola/swift,amraboelela/swift,frootloops/swift,gregomni/swift,harlanhaskins/swift,alblue/swift,shahmishal/swift,JGiola/swift,OscarSwanros/swift,xwu/swift,shajrawi/swift,lorentey/swift,deyton/swift,CodaFi/swift,rudkx/swift,xedin/swift,harlanhaskins/swift,return/swift,natecook1000/swift,devincoughlin/swift,alblue/swift,jopamer/swift,airspeedswift/swift,xwu/swift,brentdax/swift,OscarSwanros/swift,milseman/swift,atrick/swift,ahoppen/swift,parkera/swift,karwa/swift,nathawes/swift,shajrawi/swift,uasys/swift,hooman/swift,zisko/swift,shahmishal/swift,xwu/swift,return/swift,natecook1000/swift,jopamer/swift,tkremenek/swift,austinzheng/swift,danielmartin/swift,zisko/swift,xedin/swift,aschwaighofer/swift,benlangmuir/swift,harlanhaskins/swift,natecook1000/swift,xwu/swift,stephentyrone/swift,gregomni/swift,glessard/swift,rudkx/swift,zisko/swift,JGiola/swift,huonw/swift,lorentey/swift,sschiau/swift,jckarter/swift,uasys/swift,tjw/swift,zisko/swift,tkremenek/swift,jckarter/swift,rudkx/swift,OscarSwanros/swift,ahoppen/swift,devincoughlin/swift,nathawes/swift,zisko/swift,parkera/swift,milseman/swift,austinzheng/swift,gregomni/swift,devincoughlin/swift,alblue/swift,jckarter/swift,jmgc/swift,jmgc/swift,swiftix/swift,nathawes/swift,rudkx/swift,practicalswift/swift,apple/swift,jmgc/swift,brentdax/swift,brentdax/swift,ahoppen/swift,shajrawi/swift,shahmishal/swift,austinzheng/swift,sschiau/swift,roambotics/swift,glessard/swift,sschiau/swift,uasys/swift,roambotics/swift,atrick/swift,amraboelela/swift,uasys/swift,sschiau/swift,alblue/swift,deyton/swift,brentdax/swift,airspeedswift/swift,return/swift,gribozavr/swift,alblue/swift,jmgc/swift,brentdax/swift,jopamer/swift,shajrawi/swift,tjw/swift,jckarter/swift,huonw/swift,parkera/swift,hooman/swift,shajrawi/swift,aschwaighofer/swift,zisko/swift,CodaFi/swift,shahmishal/swift,stephentyrone/swift,tjw/swift,hooman/swift,aschwaighofer/swift,jckarter/swift,tkremenek/swift,natecook1000/swift,danielmartin/swift,jmgc/swift,harlanhaskins/swift,devincoughlin/swift,tjw/swift,glessard/swift,jopamer/swift,atrick/swift,frootloops/swift,nathawes/swift,lorentey/swift,danielmartin/swift,hooman/swift,allevato/swift,xedin/swift,xedin/swift,deyton/swift,atrick/swift,jckarter/swift,jmgc/swift,airspeedswift/swift,allevato/swift,milseman/swift,harlanhaskins/swift,devincoughlin/swift,lorentey/swift,gribozavr/swift,xedin/swift,glessard/swift,roambotics/swift,stephentyrone/swift,allevato/swift,apple/swift,apple/swift,aschwaighofer/swift,lorentey/swift,swiftix/swift,gribozavr/swift,parkera/swift,natecook1000/swift,harlanhaskins/swift,tjw/swift,harlanhaskins/swift,natecook1000/swift,swiftix/swift,roambotics/swift,frootloops/swift,ahoppen/swift,rudkx/swift,glessard/swift,natecook1000/swift,huonw/swift,sschiau/swift,gregomni/swift,austinzheng/swift,apple/swift,OscarSwanros/swift,devincoughlin/swift,amraboelela/swift,airspeedswift/swift,JGiola/swift,amraboelela/swift,allevato/swift,parkera/swift,stephentyrone/swift,stephentyrone/swift,deyton/swift,allevato/swift,xwu/swift,jopamer/swift,atrick/swift,aschwaighofer/swift,karwa/swift,practicalswift/swift,karwa/swift,frootloops/swift,parkera/swift,karwa/swift,glessard/swift,CodaFi/swift,danielmartin/swift,jopamer/swift,xwu/swift,tkremenek/swift,shahmishal/swift,shajrawi/swift,return/swift,milseman/swift,karwa/swift,milseman/swift,lorentey/swift,nathawes/swift,karwa/swift,parkera/swift,shajrawi/swift,zisko/swift,practicalswift/swift,austinzheng/swift,brentdax/swift,tkremenek/swift,atrick/swift,huonw/swift,tkremenek/swift,OscarSwanros/swift,nathawes/swift,roambotics/swift,practicalswift/swift,austinzheng/swift,JGiola/swift,allevato/swift,rudkx/swift,deyton/swift,practicalswift/swift,uasys/swift,huonw/swift,gribozavr/swift,practicalswift/swift,gribozavr/swift,CodaFi/swift,swiftix/swift,shahmishal/swift,tjw/swift,gribozavr/swift
1d40a955d93f517c1468a62896fd2ec24e3660ce
#ifndef STACKALLOCATOR_H #define STACKALLOCATOR_H #include "Allocator.h" class StackAllocator : public Allocator { protected: void* m_start_ptr; std::size_t m_offset; public: StackAllocator(const std::size_t totalSize); virtual ~StackAllocator(); virtual void* Allocate(const std::size_t size, const short alignment = 0); virtual void Free(void* ptr); virtual void Init() override; private: StackAllocator(StackAllocator &stackAllocator); struct AllocationHeader { unsigned short padding; }; }; #endif /* STACKALLOCATOR_H */
#ifndef STACKALLOCATOR_H #define STACKALLOCATOR_H #include "Allocator.h" class StackAllocator : public Allocator { protected: void* m_start_ptr; std::size_t m_offset; public: StackAllocator(const std::size_t totalSize); virtual ~StackAllocator(); virtual void* Allocate(const std::size_t size, const short alignment = 0); virtual void Free(const std::size_t size); virtual void Init() override; private: StackAllocator(StackAllocator &stackAllocator); struct AllocationHeader { char padding; }; }; #endif /* STACKALLOCATOR_H */
--- +++ @@ -14,7 +14,7 @@ virtual void* Allocate(const std::size_t size, const short alignment = 0); - virtual void Free(const std::size_t size); + virtual void Free(void* ptr); virtual void Init() override; @@ -22,7 +22,7 @@ StackAllocator(StackAllocator &stackAllocator); struct AllocationHeader { - char padding; + unsigned short padding; }; };
Change allocation header member padding type from char to unsigned short
mit
mtrebi/memory-allocators
4b516c3c5a41476be8b4ede752eea260879a0602
// RUN: clang-cc %s -x cl -emit-llvm -o - | not grep 'extractelement' && // RUN: clang-cc %s -x cl -emit-llvm -o - | not grep 'insertelement' && // RUN: clang-cc %s -x cl -emit-llvm -o - | grep 'shufflevector' typedef __attribute__(( ext_vector_type(2) )) float float2; typedef __attribute__(( ext_vector_type(4) )) float float4; float2 test1(float4 V) { return V.xy + V.wz; } float4 test2(float4 V) { float2 W = V.ww; return W.xyxy + W.yxyx; } float4 test3(float4 V1, float4 V2) { return (float4)(V1.zw, V2.xy); }
// RUN: clang-cc %s -emit-llvm -o - | not grep 'extractelement' && // RUN: clang-cc %s -emit-llvm -o - | not grep 'insertelement' && // RUN: clang-cc %s -emit-llvm -o - | grep 'shufflevector' typedef __attribute__(( ext_vector_type(2) )) float float2; typedef __attribute__(( ext_vector_type(4) )) float float4; float2 test1(float4 V) { return V.xy + V.wz; } float4 test2(float4 V) { float2 W = V.ww; return W.xyxy + W.yxyx; }
--- +++ @@ -1,6 +1,6 @@ -// RUN: clang-cc %s -emit-llvm -o - | not grep 'extractelement' && -// RUN: clang-cc %s -emit-llvm -o - | not grep 'insertelement' && -// RUN: clang-cc %s -emit-llvm -o - | grep 'shufflevector' +// RUN: clang-cc %s -x cl -emit-llvm -o - | not grep 'extractelement' && +// RUN: clang-cc %s -x cl -emit-llvm -o - | not grep 'insertelement' && +// RUN: clang-cc %s -x cl -emit-llvm -o - | grep 'shufflevector' typedef __attribute__(( ext_vector_type(2) )) float float2; typedef __attribute__(( ext_vector_type(4) )) float float4; @@ -13,3 +13,5 @@ float2 W = V.ww; return W.xyxy + W.yxyx; } + +float4 test3(float4 V1, float4 V2) { return (float4)(V1.zw, V2.xy); }
Add test for OpenCL vector initializer codegen git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@84445 91177308-0d34-0410-b5e6-96231b3b80d8
apache-2.0
llvm-mirror/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,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
bd339f71c7a5a3e2b883f4306689c8bc39077895
//===- lld/ReaderWriter/ELF/AMDGPU/AMDGPURelocationHandler.h --------------===// // // The LLVM Linker // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef LLD_READER_WRITER_ELF_AMDGPU_AMDGPU_RELOCATION_HANDLER_H #define LLD_READER_WRITER_ELF_AMDGPU_AMDGPU_RELOCATION_HANDLER_H #include "lld/ReaderWriter/ELFLinkingContext.h" #include <system_error> namespace lld { namespace elf { class AMDGPUTargetHandler; class AMDGPUTargetLayout; class AMDGPUTargetRelocationHandler final : public TargetRelocationHandler { public: AMDGPUTargetRelocationHandler(AMDGPUTargetLayout &layout) { } std::error_code applyRelocation(ELFWriter &, llvm::FileOutputBuffer &, const AtomLayout &, const Reference &) const override; }; } // elf } // lld #endif
//===- lld/ReaderWriter/ELF/AMDGPU/AMDGPURelocationHandler.h --------------===// // // The LLVM Linker // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef LLD_READER_WRITER_ELF_AMDGPU_AMDGPU_RELOCATION_HANDLER_H #define LLD_READER_WRITER_ELF_AMDGPU_AMDGPU_RELOCATION_HANDLER_H #include "lld/ReaderWriter/ELFLinkingContext.h" #include <system_error> namespace lld { namespace elf { class AMDGPUTargetHandler; class AMDGPUTargetLayout; class AMDGPUTargetRelocationHandler final : public TargetRelocationHandler { public: AMDGPUTargetRelocationHandler(AMDGPUTargetLayout &layout) : _targetLayout(layout) {} std::error_code applyRelocation(ELFWriter &, llvm::FileOutputBuffer &, const AtomLayout &, const Reference &) const override; private: AMDGPUTargetLayout &_targetLayout; }; } // elf } // lld #endif
--- +++ @@ -19,15 +19,12 @@ class AMDGPUTargetRelocationHandler final : public TargetRelocationHandler { public: - AMDGPUTargetRelocationHandler(AMDGPUTargetLayout &layout) - : _targetLayout(layout) {} + AMDGPUTargetRelocationHandler(AMDGPUTargetLayout &layout) { } std::error_code applyRelocation(ELFWriter &, llvm::FileOutputBuffer &, const AtomLayout &, const Reference &) const override; -private: - AMDGPUTargetLayout &_targetLayout; }; } // elf } // lld
ELF/AMDGPU: Remove another unused private member variable git-svn-id: f6089bf0e6284f307027cef4f64114ee9ebb0424@246164 91177308-0d34-0410-b5e6-96231b3b80d8
apache-2.0
llvm-mirror/lld,llvm-mirror/lld
396890929c29d0c7a9b1474f9e0fa6683903ed1a
#ifndef CONTROL_MODE_ENUM_H #define CONTROL_MODE_ENUM_H namespace ControlModes { enum ControlMode { OPEN_LOOP = 0, SIXDOF = 1, RPY_DEPTH = 2, DEPTH_HOLD = 3 }; } typedef ControlModes::ControlMode ControlMode; #endif
#ifndef CONTROL_MODE_ENUM_H #define CONTROL_MODE_ENUM_H namespace ControlModes { enum ControlMode { OPEN_LOOP = 0, SIXDOF = 1, RPY_DEPTH = 2 }; } typedef ControlModes::ControlMode ControlMode; #endif
--- +++ @@ -5,9 +5,10 @@ { enum ControlMode { - OPEN_LOOP = 0, - SIXDOF = 1, - RPY_DEPTH = 2 + OPEN_LOOP = 0, + SIXDOF = 1, + RPY_DEPTH = 2, + DEPTH_HOLD = 3 }; } typedef ControlModes::ControlMode ControlMode;
Add depth hold mode to enum
mit
vortexntnu/rov-control,vortexntnu/rov-control,vortexntnu/rov-control
73d73eeaa0fdd21bfb1592e2f7066590ef7ee920