[clang-format] Reformat all c/cpp/objc sources with clang-format

Reviewed By: jul

Differential Revision: https://phabricator.fb.com/D2953843
master
Andrzej Kotulski 9 years ago committed by Sam Blackshear
parent c82a4c1cc1
commit 4584f7f6fc

@ -9,13 +9,13 @@
#import <Foundation/Foundation.h>
@interface Hello: NSObject
@interface Hello : NSObject
@property NSString* s;
@end
@implementation Hello
NSString* m() {
Hello* hello = nil;
return hello->_s;
Hello* hello = nil;
return hello->_s;
}
@end

@ -7,17 +7,17 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <sys/select.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/select.h>
#include <unistd.h>
struct Person {
@ -27,26 +27,23 @@ struct Person {
};
int simple_null_pointer() {
struct Person *max = 0;
struct Person* max = 0;
return max->age;
}
struct Person *Person_create(int age, int height, int weight) {
struct Person *who = 0;
struct Person* Person_create(int age, int height, int weight) {
struct Person* who = 0;
return who;
}
int get_age(struct Person *who) {
return who->age;
}
int get_age(struct Person* who) { return who->age; }
int null_pointer_interproc() {
struct Person *joe = Person_create(32, 64, 140);
struct Person* joe = Person_create(32, 64, 140);
return get_age(joe);
}
void fileNotClosed()
{
void fileNotClosed() {
int fd = open("hi.txt", O_WRONLY | O_CREAT | O_TRUNC, 0600);
if (fd != -1) {
char buffer[256];
@ -56,14 +53,15 @@ void fileNotClosed()
}
void simple_leak() {
int *p;
p = (int*) malloc(sizeof(int));
int* p;
p = (int*)malloc(sizeof(int));
}
void common_realloc_leak() {
int *p, *q;
p = (int*) malloc(sizeof(int));
q = (int*) realloc(p, sizeof(int) * 42);
p = (int*)malloc(sizeof(int));
q = (int*)realloc(p, sizeof(int) * 42);
// if realloc fails, then p becomes unreachable
if (q != NULL) free(q);
if (q != NULL)
free(q);
}

@ -10,6 +10,6 @@
#include <stdlib.h>
void test() {
int *s = NULL;
int* s = NULL;
*s = 42;
}

@ -14,10 +14,8 @@
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@interface AppDelegate : UIResponder<UIApplicationDelegate>
@property(strong, nonatomic) UIWindow* window;
@end

@ -22,63 +22,75 @@
@implementation AppDelegate
-(void) memory_leak_bug {
CGPathRef shadowPath = CGPathCreateWithRect(self.inputView.bounds, NULL);
- (void)memory_leak_bug {
CGPathRef shadowPath = CGPathCreateWithRect(self.inputView.bounds, NULL);
}
-(void) resource_leak_bug {
FILE *fp;
fp=fopen("c:\\test.txt", "r");
- (void)resource_leak_bug {
FILE* fp;
fp = fopen("c:\\test.txt", "r");
}
-(void) parameter_not_null_checked_block_bug:(void (^)())callback {
callback();
- (void)parameter_not_null_checked_block_bug:(void (^)())callback {
callback();
}
-(NSArray*) npe_in_array_literal_bug {
NSString *str = nil;
return @[@"horse", str, @"dolphin"];
- (NSArray*)npe_in_array_literal_bug {
NSString* str = nil;
return @[ @"horse", str, @"dolphin" ];
}
-(NSArray*) premature_nil_termination_argument_bug {
NSString *str = nil;
return [NSArray arrayWithObjects: @"horse", str, @"dolphin", nil];
- (NSArray*)premature_nil_termination_argument_bug {
NSString* str = nil;
return [NSArray arrayWithObjects:@"horse", str, @"dolphin", nil];
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
Hello *hello = [Hello new];
[hello null_dereference_bug];
[self memory_leak_bug];
[self resource_leak_bug];
[hello parameter_not_null_checked_bug:nil];
[self parameter_not_null_checked_block_bug:nil];
[hello ivar_not_nullable_bug:nil];
[self npe_in_array_literal_bug];
[self premature_nil_termination_argument_bug];
return YES;
- (BOOL)application:(UIApplication*)application
didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
// Override point for customization after application launch.
Hello* hello = [Hello new];
[hello null_dereference_bug];
[self memory_leak_bug];
[self resource_leak_bug];
[hello parameter_not_null_checked_bug:nil];
[self parameter_not_null_checked_block_bug:nil];
[hello ivar_not_nullable_bug:nil];
[self npe_in_array_literal_bug];
[self premature_nil_termination_argument_bug];
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
- (void)applicationWillResignActive:(UIApplication*)application {
// Sent when the application is about to move from active to inactive state.
// This can occur for certain types of temporary interruptions (such as an
// incoming phone call or SMS message) or when the user quits the application
// and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down
// OpenGL ES frame rates. Games should use this method to pause the game.
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
- (void)applicationDidEnterBackground:(UIApplication*)application {
// Use this method to release shared resources, save user data, invalidate
// timers, and store enough application state information to restore your
// application to its current state in case it is terminated later.
// If your application supports background execution, this method is called
// instead of applicationWillTerminate: when the user quits.
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
- (void)applicationWillEnterForeground:(UIApplication*)application {
// Called as part of the transition from the background to the inactive state;
// here you can undo many of the changes made on entering the background.
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
- (void)applicationDidBecomeActive:(UIApplication*)application {
// Restart any tasks that were paused (or not yet started) while the
// application was inactive. If the application was previously in the
// background, optionally refresh the user interface.
}
- (void)applicationWillTerminate:(UIApplication *)application {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
- (void)applicationWillTerminate:(UIApplication*)application {
// Called when the application is about to terminate. Save data if
// appropriate. See also applicationDidEnterBackground:.
}
@end

@ -16,15 +16,15 @@
@interface Hello : NSObject
@property (strong) NSString* s;
@property (strong) Hello* hello;
@property(strong) NSString* s;
@property(strong) Hello* hello;
-(Hello*) return_hello;
- (Hello*)return_hello;
-(NSString*) null_dereference_bug;
- (NSString*)null_dereference_bug;
-(NSString*) ivar_not_nullable_bug:(Hello*) hello;
- (NSString*)ivar_not_nullable_bug:(Hello*)hello;
-(NSString*) parameter_not_null_checked_bug:(Hello*) hello;
- (NSString*)parameter_not_null_checked_bug:(Hello*)hello;
@end

@ -12,28 +12,28 @@
// HelloWorldApp
//
#import <Foundation/Foundation.h>
#import "Hello.h"
#import <Foundation/Foundation.h>
@implementation Hello
-(Hello*) return_hello {
return [Hello new];
- (Hello*)return_hello {
return [Hello new];
}
-(NSString*) null_dereference_bug {
Hello *hello = nil;
return hello->_s;
- (NSString*)null_dereference_bug {
Hello* hello = nil;
return hello->_s;
}
-(NSString*) ivar_not_nullable_bug:(Hello*) hello {
Hello* ret_hello = [hello->_hello return_hello];
return ret_hello->_s;
- (NSString*)ivar_not_nullable_bug:(Hello*)hello {
Hello* ret_hello = [hello->_hello return_hello];
return ret_hello->_s;
}
-(NSString*) parameter_not_null_checked_bug:(Hello*) hello {
Hello *ret_hello = [hello return_hello];
return ret_hello->_s;
- (NSString*)parameter_not_null_checked_bug:(Hello*)hello {
Hello* ret_hello = [hello return_hello];
return ret_hello->_s;
}
@end

@ -16,6 +16,4 @@
@interface ViewController : UIViewController
@end

@ -21,13 +21,13 @@
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end

@ -12,11 +12,12 @@
// HelloWorldApp
//
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
#import <UIKit/UIKit.h>
int main(int argc, char * argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
int main(int argc, char* argv[]) {
@autoreleasepool {
return UIApplicationMain(
argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}

@ -23,25 +23,27 @@
@implementation HelloWorldAppTests
- (void)setUp {
[super setUp];
// Put setup code here. This method is called before the invocation of each test method in the class.
[super setUp];
// Put setup code here. This method is called before the invocation of each
// test method in the class.
}
- (void)tearDown {
// Put teardown code here. This method is called after the invocation of each test method in the class.
[super tearDown];
// Put teardown code here. This method is called after the invocation of each
// test method in the class.
[super tearDown];
}
- (void)testExample {
// This is an example of a functional test case.
XCTAssert(YES, @"Pass");
// This is an example of a functional test case.
XCTAssert(YES, @"Pass");
}
- (void)testPerformanceExample {
// This is an example of a performance test case.
[self measureBlock:^{
// Put the code you want to measure the time of here.
}];
// This is an example of a performance test case.
[self measureBlock:^{
// Put the code you want to measure the time of here.
}];
}
@end

@ -15,41 +15,42 @@
#include <stdlib.h>
// similar to malloc, but never fails, and returns NULL when size==0
void *g_malloc(size_t size) {
if(size==0) return NULL;
void *res = malloc(size);
void* g_malloc(size_t size) {
if (size == 0)
return NULL;
void* res = malloc(size);
INFER_EXCLUDE_CONDITION(!res);
return res;
}
// modelled as free
void g_free(void *ptr) {
free(ptr);
}
void g_free(void* ptr) { free(ptr); }
void *g_realloc(void *ptr, size_t size) {
if(size==0) { // return NULL and free ptr unless it is NULL
if(ptr) free(ptr);
void* g_realloc(void* ptr, size_t size) {
if (size == 0) { // return NULL and free ptr unless it is NULL
if (ptr)
free(ptr);
return NULL;
}
int old_size;
old_size = __get_array_size(ptr); // force ptr to be an array
int can_enlarge; // nondeterministically choose whether the current block can be enlarged
if(can_enlarge) {
int can_enlarge; // nondeterministically choose whether the current block can
// be enlarged
if (can_enlarge) {
__set_array_size(ptr, size); // enlarge the block
return ptr;
}
int *newblock = (int*)malloc(size);
if(newblock) {
int* newblock = (int*)malloc(size);
if (newblock) {
free(ptr);
return newblock;
}
else exit(0); // assume that new allocation does not fail
} else
exit(0); // assume that new allocation does not fail
}
// simply return object, and assume it is not NULL
void *gtk_type_check_object_cast(void *object, void *cast_type) {
if(!object) exit(0);
void* gtk_type_check_object_cast(void* object, void* cast_type) {
if (!object)
exit(0);
return object;
}

@ -43,8 +43,8 @@ unsigned long int __infer_nondet_unsigned_long_int() {
}
// model returning an arbitrary (nondeterministic) pointer
void *__infer_nondet_ptr() {
void *res;
void* __infer_nondet_ptr() {
void* res;
return res;
}
@ -92,7 +92,10 @@ long infer__builtin_expect(long e, long x) {
}
}
void *infer__builtin___memset_chk(void *dest, int val, unsigned long len, unsigned long dstlen) {
void* infer__builtin___memset_chk(void* dest,
int val,
unsigned long len,
unsigned long dstlen) {
INFER_EXCLUDE_CONDITION(dstlen < len);
return dest;
}

@ -10,8 +10,8 @@
// builtins to be used to model library functions
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
// model returning an arbitrary (nondeterministic) short
@ -30,7 +30,7 @@ long long int __infer_nondet_long_long_int();
unsigned long int __infer_nondet_unsigned_long_int();
// model returning an arbitrary (nondeterministic) pointer
void *__infer_nondet_ptr();
void* __infer_nondet_ptr();
// model returning an arbitrary (nondeterministic) float
float __infer_nondet_float();
@ -51,17 +51,21 @@ time_t __infer_nondet_time_t();
clock_t __infer_nondet_clock_t();
// assume that the cond is false
// and add any constraints to the precondition so that cond is false, if possible
#define INFER_EXCLUDE_CONDITION(cond) if (cond) while(1)
// and add any constraints to the precondition so that cond is false, if
// possible
#define INFER_EXCLUDE_CONDITION(cond) \
if (cond) \
while (1)
// builtin: force arr to be an array and return the size
extern size_t __get_array_size(const void *arr);
extern size_t __get_array_size(const void* arr);
// builtin: change the attribute of ret to a file attribute
extern void __set_file_attribute(void *ret);
extern void __set_file_attribute(void* ret);
// builtin: change the size of the array to size
extern void __set_array_size(void *ptr, size_t size);
extern void __set_array_size(void* ptr, size_t size);
// builtin: set the flag to the given value for the procedure where this call appears
extern void __infer_set_flag(char *flag, char *value);
// builtin: set the flag to the given value for the procedure where this call
// appears
extern void __infer_set_flag(char* flag, char* value);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -19,126 +19,112 @@
#define USE_CPP_OVERLOADS
#endif
#include <stdio.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <wchar.h>
#define restrict
#ifdef _WIN32
#define CLIBCALL __cdecl
#else
#define CLIBCALL
#endif
int CLIBCALL fwscanf(FILE * restrict stream, const wchar_t * restrict format, ...); // builtin: modeled internally
int CLIBCALL swscanf(const wchar_t * restrict s, const wchar_t * restrict format, ...); // builtin: modeled internally
int CLIBCALL vfwscanf(FILE * restrict stream, const wchar_t * restrict format, va_list arg); // builtin: modeled internally
int CLIBCALL vswscanf(const wchar_t * restrict s, const wchar_t * restrict format, va_list arg); // builtin: modeled internally
int CLIBCALL vwscanf(const wchar_t * restrict format, va_list arg); // builtin: modeled internally
int CLIBCALL wscanf(const wchar_t * restrict format, ...); // builtin: modeled internally
wint_t CLIBCALL btowc(int c)
{
return __infer_nondet_int();
}
wint_t CLIBCALL fgetwc(FILE *stream)
{
return __infer_nondet_int();
}
int CLIBCALL fwscanf(FILE* restrict stream,
const wchar_t* restrict format,
...); // builtin: modeled internally
int CLIBCALL swscanf(const wchar_t* restrict s,
const wchar_t* restrict format,
...); // builtin: modeled internally
int CLIBCALL vfwscanf(FILE* restrict stream,
const wchar_t* restrict format,
va_list arg); // builtin: modeled internally
int CLIBCALL vswscanf(const wchar_t* restrict s,
const wchar_t* restrict format,
va_list arg); // builtin: modeled internally
int CLIBCALL vwscanf(const wchar_t* restrict format,
va_list arg); // builtin: modeled internally
int CLIBCALL wscanf(const wchar_t* restrict format,
...); // builtin: modeled internally
wint_t CLIBCALL btowc(int c) { return __infer_nondet_int(); }
wint_t CLIBCALL fgetwc(FILE* stream) { return __infer_nondet_int(); }
// modelled like fgets
wchar_t * CLIBCALL fgetws(wchar_t * restrict s, int n, FILE * restrict stream)
{
return (wchar_t *) fgets((char *)s, n, stream);
wchar_t* CLIBCALL fgetws(wchar_t* restrict s, int n, FILE* restrict stream) {
return (wchar_t*)fgets((char*)s, n, stream);
}
wint_t CLIBCALL fputwc(wchar_t c, FILE *stream)
{
return __infer_nondet_int();
}
wint_t CLIBCALL fputwc(wchar_t c, FILE* stream) { return __infer_nondet_int(); }
// modeled using fputs
int CLIBCALL fputws(const wchar_t * restrict s, FILE * restrict stream)
{
return fputs((char *)s, stream);
int CLIBCALL fputws(const wchar_t* restrict s, FILE* restrict stream) {
return fputs((char*)s, stream);
}
int CLIBCALL fwide(FILE *stream, int mode)
{
return __infer_nondet_int();
}
int CLIBCALL fwide(FILE* stream, int mode) { return __infer_nondet_int(); }
// return a nondeterministic nonnegative integer
int CLIBCALL fwprintf(FILE * restrict stream, const wchar_t * restrict format, ...)
{
int CLIBCALL fwprintf(FILE* restrict stream,
const wchar_t* restrict format,
...) {
int res;
res = __infer_nondet_int();
INFER_EXCLUDE_CONDITION(res < 0);
return res;
}
#ifdef getwc
#undef getwc // disable expansion of getwc
#endif
wint_t CLIBCALL getwc(FILE *stream)
{
return __infer_nondet_int();
}
wint_t CLIBCALL getwc(FILE* stream) { return __infer_nondet_int(); }
#ifdef getwchar
#undef getwchar // disable expansion of getwchar
#endif
wint_t CLIBCALL getwchar()
{
return __infer_nondet_int();
}
wint_t CLIBCALL getwchar() { return __infer_nondet_int(); }
size_t CLIBCALL mbrlen(const char * restrict s, size_t n, mbstate_t * restrict ps)
{
size_t CLIBCALL mbrlen(const char* restrict s,
size_t n,
mbstate_t* restrict ps) {
return __infer_nondet_int();
}
size_t CLIBCALL mbrtowc(wchar_t * restrict pwc, const char * restrict s, size_t n, mbstate_t * restrict ps)
{
size_t CLIBCALL mbrtowc(wchar_t* restrict pwc,
const char* restrict s,
size_t n,
mbstate_t* restrict ps) {
return __infer_nondet_int();
}
int CLIBCALL mbsinit(const mbstate_t *ps)
{
return __infer_nondet_int();
}
int CLIBCALL mbsinit(const mbstate_t* ps) { return __infer_nondet_int(); }
size_t CLIBCALL mbsrtowcs(wchar_t * restrict dst, const char ** restrict src, size_t len, mbstate_t * restrict ps)
{
size_t CLIBCALL mbsrtowcs(wchar_t* restrict dst,
const char** restrict src,
size_t len,
mbstate_t* restrict ps) {
return __infer_nondet_int();
}
#ifdef putwc
#undef putwc // disable expansion of putwc
#endif
wint_t CLIBCALL putwc(wchar_t c, FILE *stream)
{
return __infer_nondet_int();
}
wint_t CLIBCALL putwc(wchar_t c, FILE* stream) { return __infer_nondet_int(); }
#ifdef putwchar
#undef putwchar // disable expansion of putwchar
#endif
wint_t CLIBCALL putwchar(wchar_t c)
{
return __infer_nondet_int();
}
wint_t CLIBCALL putwchar(wchar_t c) { return __infer_nondet_int(); }
// s must be allocated
// return a nondeterministic nonnegative integer
int CLIBCALL swprintf(wchar_t * restrict s, size_t n, const wchar_t * restrict format, ...)
{
int CLIBCALL swprintf(wchar_t* restrict s,
size_t n,
const wchar_t* restrict format,
...) {
int res;
int size1;
size1 = __get_array_size(s);
@ -147,14 +133,12 @@ int CLIBCALL swprintf(wchar_t * restrict s, size_t n, const wchar_t * restrict f
return res;
}
wint_t CLIBCALL ungetwc(wint_t c, FILE *stream)
{
return __infer_nondet_int();
}
wint_t CLIBCALL ungetwc(wint_t c, FILE* stream) { return __infer_nondet_int(); }
// return a nondeterministic nonnegative integer
int CLIBCALL vfwprintf(FILE * restrict stream, const wchar_t * restrict format, va_list arg)
{
int CLIBCALL vfwprintf(FILE* restrict stream,
const wchar_t* restrict format,
va_list arg) {
int res;
res = __infer_nondet_int();
INFER_EXCLUDE_CONDITION(res < 0);
@ -162,8 +146,10 @@ int CLIBCALL vfwprintf(FILE * restrict stream, const wchar_t * restrict format,
}
// return a nondeterministic nonnegative integer
int CLIBCALL vswprintf(wchar_t * restrict s, size_t n, const wchar_t * restrict format, va_list arg)
{
int CLIBCALL vswprintf(wchar_t* restrict s,
size_t n,
const wchar_t* restrict format,
va_list arg) {
int res;
res = __infer_nondet_int();
INFER_EXCLUDE_CONDITION(res < 0);
@ -171,27 +157,26 @@ int CLIBCALL vswprintf(wchar_t * restrict s, size_t n, const wchar_t * restrict
}
// return a nondeterministic nonnegative integer
int CLIBCALL vwprintf(const wchar_t * restrict format, va_list arg)
{
int CLIBCALL vwprintf(const wchar_t* restrict format, va_list arg) {
int res;
res = __infer_nondet_int();
INFER_EXCLUDE_CONDITION(res < 0);
return res;
}
size_t CLIBCALL wcrtomb(char * restrict s, wchar_t wc, mbstate_t * restrict ps)
{
size_t CLIBCALL wcrtomb(char* restrict s, wchar_t wc, mbstate_t* restrict ps) {
return __infer_nondet_int();
}
size_t CLIBCALL wcsrtombs(char * restrict dst, const wchar_t ** restrict src, size_t len, mbstate_t * restrict ps)
{
size_t CLIBCALL wcsrtombs(char* restrict dst,
const wchar_t** restrict src,
size_t len,
mbstate_t* restrict ps) {
return __infer_nondet_int();
}
// return a nondeterministic nonnegative integer
int CLIBCALL wprintf(const wchar_t * restrict format, ...)
{
int CLIBCALL wprintf(const wchar_t* restrict format, ...) {
int res;
res = __infer_nondet_int();
INFER_EXCLUDE_CONDITION(res < 0);
@ -199,41 +184,39 @@ int CLIBCALL wprintf(const wchar_t * restrict format, ...)
}
// modeled using strcat
wchar_t * CLIBCALL wcscat(wchar_t * restrict s1, const wchar_t * restrict s2)
{
return (wchar_t *) strcat((char *) s1, (char *) s2);
wchar_t* CLIBCALL wcscat(wchar_t* restrict s1, const wchar_t* restrict s2) {
return (wchar_t*)strcat((char*)s1, (char*)s2);
}
// modeled using strchr
#ifndef USE_CPP_OVERLOADS
wchar_t * CLIBCALL wcschr(const wchar_t *s, wchar_t c)
# else
const wchar_t * CLIBCALL wcschr(const wchar_t *s, wchar_t c)
{
return wcschr((wchar_t*) s, c);
wchar_t* CLIBCALL wcschr(const wchar_t* s, wchar_t c)
#else
const wchar_t* CLIBCALL wcschr(const wchar_t* s, wchar_t c) {
return wcschr((wchar_t*)s, c);
}
wchar_t * CLIBCALL wcschr(wchar_t *s, wchar_t c)
wchar_t* CLIBCALL wcschr(wchar_t* s, wchar_t c)
#endif
{
return (wchar_t *) strchr((char *) s, c);
return (wchar_t*)strchr((char*)s, c);
}
// modeled using strcmp
int CLIBCALL wcscmp(const wchar_t *s1, const wchar_t *s2)
{
return strcmp((char *) s1, (char *) s2);
int CLIBCALL wcscmp(const wchar_t* s1, const wchar_t* s2) {
return strcmp((char*)s1, (char*)s2);
}
// modeled using strcmp
int CLIBCALL wcscoll(const wchar_t *s1, const wchar_t *s2)
{
return strcmp((char *) s1, (char *) s2);
int CLIBCALL wcscoll(const wchar_t* s1, const wchar_t* s2) {
return strcmp((char*)s1, (char*)s2);
}
// return a nondeterministic nonnegative integer
size_t CLIBCALL wcsftime(wchar_t * restrict s, size_t maxsize,const wchar_t * restrict format, const struct tm * restrict timeptr)
{
size_t CLIBCALL wcsftime(wchar_t* restrict s,
size_t maxsize,
const wchar_t* restrict format,
const struct tm* restrict timeptr) {
int res;
res = __infer_nondet_int();
INFER_EXCLUDE_CONDITION(res < 0);
@ -241,178 +224,169 @@ size_t CLIBCALL wcsftime(wchar_t * restrict s, size_t maxsize,const wchar_t * re
}
// modeled using strcpy
wchar_t * CLIBCALL wcscpy(wchar_t * restrict s1, const wchar_t * restrict s2)
{
return (wchar_t *) strcpy((char *) s1, (char *) s2);
wchar_t* CLIBCALL wcscpy(wchar_t* restrict s1, const wchar_t* restrict s2) {
return (wchar_t*)strcpy((char*)s1, (char*)s2);
}
// modeled using strcmp
size_t CLIBCALL wcscspn(const wchar_t *s1, const wchar_t *s2)
{
return strcmp((char *) s1, (char *) s2);
size_t CLIBCALL wcscspn(const wchar_t* s1, const wchar_t* s2) {
return strcmp((char*)s1, (char*)s2);
}
// modeled using strlen
size_t CLIBCALL wcslen(const wchar_t *s)
{
return strlen((char *) s);
}
size_t CLIBCALL wcslen(const wchar_t* s) { return strlen((char*)s); }
// modeled using strncat
wchar_t * CLIBCALL wcsncat(wchar_t * restrict s1, const wchar_t * restrict s2, size_t n)
{
return (wchar_t *) strncat((char *) s1, (char *) s2, n);
wchar_t* CLIBCALL wcsncat(wchar_t* restrict s1,
const wchar_t* restrict s2,
size_t n) {
return (wchar_t*)strncat((char*)s1, (char*)s2, n);
}
// modeled using strncmp
int CLIBCALL wcsncmp(const wchar_t *s1, const wchar_t *s2, size_t n)
{
return strncmp((char *) s1, (char *) s2, n);
int CLIBCALL wcsncmp(const wchar_t* s1, const wchar_t* s2, size_t n) {
return strncmp((char*)s1, (char*)s2, n);
}
// modeled using strpbrk
#ifndef USE_CPP_OVERLOADS
wchar_t * CLIBCALL wcspbrk(const wchar_t *s1, const wchar_t *s2)
wchar_t* CLIBCALL wcspbrk(const wchar_t* s1, const wchar_t* s2)
#else
const wchar_t * CLIBCALL wcspbrk(const wchar_t *s1, const wchar_t *s2)
{
return wcspbrk((wchar_t*) s1, s2);
const wchar_t* CLIBCALL wcspbrk(const wchar_t* s1, const wchar_t* s2) {
return wcspbrk((wchar_t*)s1, s2);
}
wchar_t * CLIBCALL wcspbrk(wchar_t *s1, const wchar_t *s2)
wchar_t* CLIBCALL wcspbrk(wchar_t* s1, const wchar_t* s2)
#endif
{
return (wchar_t *) strpbrk((char *) s1, (char *) s2);
return (wchar_t*)strpbrk((char*)s1, (char*)s2);
}
// modeled using strchr
#ifndef USE_CPP_OVERLOADS
wchar_t * CLIBCALL wcsrchr(const wchar_t *s, wchar_t c)
wchar_t* CLIBCALL wcsrchr(const wchar_t* s, wchar_t c)
#else
const wchar_t * CLIBCALL wcsrchr(const wchar_t *s, wchar_t c)
{
return wcsrchr((wchar_t*) s, c);
const wchar_t* CLIBCALL wcsrchr(const wchar_t* s, wchar_t c) {
return wcsrchr((wchar_t*)s, c);
}
wchar_t * CLIBCALL wcsrchr(wchar_t *s, wchar_t c)
wchar_t* CLIBCALL wcsrchr(wchar_t* s, wchar_t c)
#endif
{
return (wchar_t *) strchr((char *) s, c);
return (wchar_t*)strchr((char*)s, c);
}
// modeled using strncpy
wchar_t * CLIBCALL wcsncpy(wchar_t * restrict s1, const wchar_t * restrict s2, size_t n)
{
return (wchar_t *) strncpy((char *) s1, (char *) s2, n);
wchar_t* CLIBCALL wcsncpy(wchar_t* restrict s1,
const wchar_t* restrict s2,
size_t n) {
return (wchar_t*)strncpy((char*)s1, (char*)s2, n);
}
// modeled using strspn
size_t CLIBCALL wcsspn(const wchar_t *s1, const wchar_t *s2)
{
return strspn((char *) s1, (char *) s2);
size_t CLIBCALL wcsspn(const wchar_t* s1, const wchar_t* s2) {
return strspn((char*)s1, (char*)s2);
}
// modeled using strstr
#ifndef USE_CPP_OVERLOADS
wchar_t * CLIBCALL wcsstr(const wchar_t *s1, const wchar_t *s2)
wchar_t* CLIBCALL wcsstr(const wchar_t* s1, const wchar_t* s2)
#else
const wchar_t * CLIBCALL wcsstr(const wchar_t *s1, const wchar_t *s2)
{
return wcsstr((wchar_t*) s1, s2);
const wchar_t* CLIBCALL wcsstr(const wchar_t* s1, const wchar_t* s2) {
return wcsstr((wchar_t*)s1, s2);
}
wchar_t * CLIBCALL wcsstr(wchar_t *s1, const wchar_t *s2)
wchar_t* CLIBCALL wcsstr(wchar_t* s1, const wchar_t* s2)
#endif
{
return (wchar_t *) strstr((char *) s1, (char *) s2);
return (wchar_t*)strstr((char*)s1, (char*)s2);
}
int CLIBCALL wctob(wint_t c)
{
return __infer_nondet_int();
}
int CLIBCALL wctob(wint_t c) { return __infer_nondet_int(); }
double CLIBCALL wcstod(const wchar_t * restrict nptr, wchar_t ** restrict endptr)
{
double CLIBCALL wcstod(const wchar_t* restrict nptr,
wchar_t** restrict endptr) {
return __infer_nondet_double();
}
float CLIBCALL wcstof(const wchar_t * restrict nptr, wchar_t ** restrict endptr)
{
float CLIBCALL wcstof(const wchar_t* restrict nptr, wchar_t** restrict endptr) {
return __infer_nondet_float();
}
// simplified modeling which returns s1
wchar_t * CLIBCALL wcstok(wchar_t * restrict s1, const wchar_t * restrict s2, wchar_t ** restrict ptr)
{
wchar_t* CLIBCALL wcstok(wchar_t* restrict s1,
const wchar_t* restrict s2,
wchar_t** restrict ptr) {
return s1;
}
long double CLIBCALL wcstold(const wchar_t * restrict nptr, wchar_t ** restrict endptr)
{
long double CLIBCALL wcstold(const wchar_t* restrict nptr,
wchar_t** restrict endptr) {
return __infer_nondet_long_double();
}
long int CLIBCALL wcstol(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base)
{
long int CLIBCALL wcstol(const wchar_t* restrict nptr,
wchar_t** restrict endptr,
int base) {
return __infer_nondet_long_int();
}
long long int CLIBCALL wcstoll(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base)
{
long long int CLIBCALL wcstoll(const wchar_t* restrict nptr,
wchar_t** restrict endptr,
int base) {
return __infer_nondet_long_long_int();
}
unsigned long int CLIBCALL wcstoul(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base)
{
unsigned long int CLIBCALL wcstoul(const wchar_t* restrict nptr,
wchar_t** restrict endptr,
int base) {
return __infer_nondet_unsigned_long_int();
}
unsigned long long int CLIBCALL wcstoull(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base)
{
unsigned long long int CLIBCALL wcstoull(const wchar_t* restrict nptr,
wchar_t** restrict endptr,
int base) {
return __infer_nondet_long_long_int();
}
// modeled using strncmp
size_t CLIBCALL wcsxfrm(wchar_t * restrict s1, const wchar_t * restrict s2, size_t n)
{
return strncmp((char *) s1, (char *) s2, n);
size_t CLIBCALL wcsxfrm(wchar_t* restrict s1,
const wchar_t* restrict s2,
size_t n) {
return strncmp((char*)s1, (char*)s2, n);
}
// modeled using memchr
#ifndef USE_CPP_OVERLOADS
wchar_t * CLIBCALL wmemchr(const wchar_t *s, wchar_t c, size_t n)
wchar_t* CLIBCALL wmemchr(const wchar_t* s, wchar_t c, size_t n)
#else
const wchar_t * CLIBCALL wmemchr(const wchar_t *s, wchar_t c, size_t n)
{
return wmemchr((wchar_t*) s, c, n);
const wchar_t* CLIBCALL wmemchr(const wchar_t* s, wchar_t c, size_t n) {
return wmemchr((wchar_t*)s, c, n);
}
wchar_t * CLIBCALL wmemchr(wchar_t *s, wchar_t c, size_t n)
wchar_t* CLIBCALL wmemchr(wchar_t* s, wchar_t c, size_t n)
#endif
{
return (wchar_t *) memchr((char *) s, c, n);
return (wchar_t*)memchr((char*)s, c, n);
}
// modeled using memcmp
int CLIBCALL wmemcmp(const wchar_t *s1, const wchar_t *s2, size_t n)
{
return memcmp((char *) s1, (char *) s2, n);
int CLIBCALL wmemcmp(const wchar_t* s1, const wchar_t* s2, size_t n) {
return memcmp((char*)s1, (char*)s2, n);
}
// modeled using memcpy
wchar_t * CLIBCALL wmemcpy(wchar_t * restrict s1, const wchar_t * restrict s2, size_t n)
{
return (wchar_t *) memcpy((char *) s1, (char *) s2, n);
wchar_t* CLIBCALL wmemcpy(wchar_t* restrict s1,
const wchar_t* restrict s2,
size_t n) {
return (wchar_t*)memcpy((char*)s1, (char*)s2, n);
}
// modeled using memmove
wchar_t * CLIBCALL wmemmove(wchar_t *s1, const wchar_t *s2, size_t n)
{
return (wchar_t *) memmove((char *) s1, (char *) s2, n);
wchar_t* CLIBCALL wmemmove(wchar_t* s1, const wchar_t* s2, size_t n) {
return (wchar_t*)memmove((char*)s1, (char*)s2, n);
}
// modeled using memset
wchar_t * CLIBCALL wmemset(wchar_t *s, wchar_t c, size_t n)
{
return (wchar_t *) memset((char *) s, c, n);
wchar_t* CLIBCALL wmemset(wchar_t* s, wchar_t c, size_t n) {
return (wchar_t*)memset((char*)s, c, n);
}

@ -23,105 +23,50 @@
#define CLIBCALL
#endif
// Microsoft-specific
int CLIBCALL __iswcsymf(wint_t wc)
{
return __infer_nondet_int();
}
int CLIBCALL __iswcsymf(wint_t wc) { return __infer_nondet_int(); }
// Microsoft-specific, inline
int CLIBCALL isleadbyte(int wc)
{
return __infer_nondet_int();
}
int CLIBCALL isleadbyte(int wc) { return __infer_nondet_int(); }
int CLIBCALL iswalnum(wint_t wc)
{
return __infer_nondet_int();
}
int CLIBCALL iswalnum(wint_t wc) { return __infer_nondet_int(); }
int CLIBCALL iswalpha(wint_t wc)
{
return __infer_nondet_int();
}
int CLIBCALL iswalpha(wint_t wc) { return __infer_nondet_int(); }
int CLIBCALL iswblank(wint_t wc)
{
return __infer_nondet_int();
}
int CLIBCALL iswblank(wint_t wc) { return __infer_nondet_int(); }
int CLIBCALL iswcntrl(wint_t wc)
{
return __infer_nondet_int();
}
int CLIBCALL iswcntrl(wint_t wc) { return __infer_nondet_int(); }
int CLIBCALL iswctype(wint_t wc, wctype_t desc)
{
return __infer_nondet_int();
}
int CLIBCALL iswctype(wint_t wc, wctype_t desc) { return __infer_nondet_int(); }
int CLIBCALL iswdigit(wint_t wc)
{
return __infer_nondet_int();
}
int CLIBCALL iswdigit(wint_t wc) { return __infer_nondet_int(); }
int CLIBCALL iswgraph(wint_t wc)
{
return __infer_nondet_int();
}
int CLIBCALL iswgraph(wint_t wc) { return __infer_nondet_int(); }
int CLIBCALL iswlower(wint_t wc)
{
return __infer_nondet_int();
}
int CLIBCALL iswlower(wint_t wc) { return __infer_nondet_int(); }
int CLIBCALL iswprint(wint_t wc)
{
return __infer_nondet_int();
}
int CLIBCALL iswprint(wint_t wc) { return __infer_nondet_int(); }
int CLIBCALL iswpunct(wint_t wc)
{
return __infer_nondet_int();
}
int CLIBCALL iswpunct(wint_t wc) { return __infer_nondet_int(); }
int CLIBCALL iswspace(wint_t wc)
{
return __infer_nondet_int();
}
int CLIBCALL iswspace(wint_t wc) { return __infer_nondet_int(); }
int CLIBCALL iswupper(wint_t wc)
{
return __infer_nondet_int();
}
int CLIBCALL iswupper(wint_t wc) { return __infer_nondet_int(); }
int CLIBCALL iswxdigit(wint_t wc)
{
return __infer_nondet_int();
}
int CLIBCALL iswxdigit(wint_t wc) { return __infer_nondet_int(); }
wint_t CLIBCALL towlower(wint_t wc)
{
return __infer_nondet_int();
}
wint_t CLIBCALL towlower(wint_t wc) { return __infer_nondet_int(); }
wint_t CLIBCALL towctrans(wint_t wc, wctrans_t desc)
{
wint_t CLIBCALL towctrans(wint_t wc, wctrans_t desc) {
return __infer_nondet_int();
}
wint_t CLIBCALL towupper(wint_t wc)
{
return __infer_nondet_int();
}
wint_t CLIBCALL towupper(wint_t wc) { return __infer_nondet_int(); }
wctrans_t CLIBCALL wctrans(const char *property)
{
wctrans_t CLIBCALL wctrans(const char* property) {
return (wctrans_t)__infer_nondet_int();
}
wctype_t CLIBCALL wctype(const char *property)
{
wctype_t CLIBCALL wctype(const char* property) {
return (wctype_t)__infer_nondet_int();
}

@ -15,14 +15,14 @@
#include <stdlib.h>
// modelled using malloc
char *XGetAtomName(void *display, void *atom) {
char* XGetAtomName(void* display, void* atom) {
int size;
INFER_EXCLUDE_CONDITION(size <= 0);
return (char*)malloc(size);
}
// modelled as free, requires NONNULL pointer
void XFree(void *ptr) {
void XFree(void* ptr) {
INFER_EXCLUDE_CONDITION(!ptr);
free(ptr);
}

@ -10,35 +10,32 @@
// models for shared_ptr
extern "C" void __method_set_ignore_attribute(void **self, void *arg);
extern "C" void __method_set_ignore_attribute(void** self, void* arg);
// standard constructor
extern "C" void __infer_shared_ptr(void **self, void *arg) {
extern "C" void __infer_shared_ptr(void** self, void* arg) {
__method_set_ignore_attribute(self, arg); // auto memory management
*self = arg;
}
// constructor taking a reference to a shared_ptr
extern "C" void __infer_shared_ptr_ref(void **arg1, void **arg2) {
extern "C" void __infer_shared_ptr_ref(void** arg1, void** arg2) {
*arg1 = *arg2;
}
// operator=
extern "C" void** __infer_shared_ptr_eq(void **arg1, void **arg2) {
extern "C" void** __infer_shared_ptr_eq(void** arg1, void** arg2) {
*arg1 = *arg2;
return arg1;
}
// operator==
extern "C" int __infer_shared_ptr_eqeq(void **arg1, void **arg2) {
extern "C" int __infer_shared_ptr_eqeq(void** arg1, void** arg2) {
return (*arg1 == *arg2);
}
// operator->
extern "C" void* __infer_shared_ptr_arrow(void **arg) {
return *arg;
}
extern "C" void* __infer_shared_ptr_arrow(void** arg) { return *arg; }
// destructor
extern "C" void __infer_shared_ptr_destructor(void **arg) {
}
extern "C" void __infer_shared_ptr_destructor(void** arg) {}

@ -12,7 +12,7 @@
@interface CADisplayLink : NSObject {
id _target;
SEL _selector;
SEL _selector;
}
@property(readonly, nonatomic) CFTimeInterval duration;
@ -24,10 +24,9 @@
@property(readonly, nonatomic) CFTimeInterval timestamp;
// Returns a new display link.
+ (CADisplayLink *)displayLinkWithTarget:(id)target
selector:(SEL)sel;
+ (CADisplayLink*)displayLinkWithTarget:(id)target selector:(SEL)sel;
// Release the target
- (void) invalidate;
- (void)invalidate;
@end

@ -13,19 +13,18 @@
// Returns a new display link.
// The model retains strongly the target object.
+ (CADisplayLink *)displayLinkWithTarget:(id)target
selector:(SEL)sel {
+ (CADisplayLink*)displayLinkWithTarget:(id)target selector:(SEL)sel {
CADisplayLink *c = [CADisplayLink alloc];
c->_target = target;
c->_selector = sel;
CADisplayLink* c = [CADisplayLink alloc];
c->_target = target;
c->_selector = sel;
return c;
return c;
}
// Release the target
- (void) invalidate {
self->_target = nil;
- (void)invalidate {
self->_target = nil;
}
@end

@ -7,47 +7,49 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import <Foundation/Foundation.h>
#import <AddressBook/AddressBook.h>
#import <Foundation/Foundation.h>
CFArrayRef __cf_alloc(CFArrayRef);
CFArrayRef __cf_non_null_alloc(CFArrayRef);
CFArrayRef CFArrayCreate ( CFAllocatorRef allocator,
const void **values,
CFIndex numValues,
const CFArrayCallBacks *callBacks ) {
CFArrayRef CFArrayCreate(CFAllocatorRef allocator,
const void** values,
CFIndex numValues,
const CFArrayCallBacks* callBacks) {
CFArrayRef c;
return __cf_alloc(c);
}
CFArrayRef CFNetworkCopyProxiesForURL ( CFURLRef url, CFDictionaryRef proxySettings ) {
CFArrayRef CFNetworkCopyProxiesForURL(CFURLRef url,
CFDictionaryRef proxySettings) {
CFArrayRef c;
return __cf_alloc(c);
}
CFArrayRef CFStringCreateArrayWithFindResults ( CFAllocatorRef alloc,
CFStringRef theString,
CFStringRef stringToFind,
CFRange rangeToSearch,
CFStringCompareFlags compareOptions ) {
CFArrayRef CFStringCreateArrayWithFindResults(
CFAllocatorRef alloc,
CFStringRef theString,
CFStringRef stringToFind,
CFRange rangeToSearch,
CFStringCompareFlags compareOptions) {
CFArrayRef c;
return __cf_alloc(c);
}
CFArrayRef CFPreferencesCopyKeyList ( CFStringRef applicationID,
CFStringRef userName,
CFStringRef hostName ) {
CFArrayRef CFPreferencesCopyKeyList(CFStringRef applicationID,
CFStringRef userName,
CFStringRef hostName) {
CFArrayRef c;
return __cf_non_null_alloc(c);
}
CFArrayRef CNCopySupportedInterfaces ( void ) {
CFArrayRef CNCopySupportedInterfaces(void) {
CFArrayRef c;
return __cf_non_null_alloc(c);
}
CFArrayRef ABAddressBookCopyArrayOfAllPeople ( ABAddressBookRef addressBook ) {
CFArrayRef ABAddressBookCopyArrayOfAllPeople(ABAddressBookRef addressBook) {
CFArrayRef c;
return __cf_non_null_alloc(c);
}

@ -11,11 +11,11 @@
CFBinaryHeapRef __cf_alloc(CFBinaryHeapRef);
CFBinaryHeapRef CFBinaryHeapCreate ( CFAllocatorRef allocator,
CFIndex capacity,
const CFBinaryHeapCallBacks *callBacks,
const CFBinaryHeapCompareContext *compareContext) {
CFBinaryHeapRef CFBinaryHeapCreate(
CFAllocatorRef allocator,
CFIndex capacity,
const CFBinaryHeapCallBacks* callBacks,
const CFBinaryHeapCompareContext* compareContext) {
CFBinaryHeapRef c;
return __cf_alloc(c);
}

@ -12,9 +12,9 @@
CFBitVectorRef __cf_alloc(CFBitVectorRef);
CFBitVectorRef __cf_non_null_alloc(CFBitVectorRef);
CFBitVectorRef CFBitVectorCreate ( CFAllocatorRef allocator,
const UInt8 *bytes,
CFIndex numBits ) {
CFBitVectorRef CFBitVectorCreate(CFAllocatorRef allocator,
const UInt8* bytes,
CFIndex numBits) {
CFBitVectorRef c;
return __cf_non_null_alloc(c);
}

@ -12,8 +12,7 @@
CFDateRef __cf_alloc(CFDateRef);
CFDateRef __cf_non_null_alloc(CFDateRef);
CFDateRef CFDateCreate ( CFAllocatorRef allocator, CFAbsoluteTime at ) {
CFDateRef CFDateCreate(CFAllocatorRef allocator, CFAbsoluteTime at) {
CFDateRef c;
return __cf_non_null_alloc(c);
}

@ -7,69 +7,67 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import <ImageIO/ImageIO.h>
#import <CoreMedia/CoreMedia.h>
#import <Foundation/Foundation.h>
#import <ImageIO/ImageIO.h>
CFDictionaryRef __cf_non_null_alloc(CFDictionaryRef);
CFDictionaryRef __cf_alloc(CFDictionaryRef);
CFDictionaryRef CGImageSourceCopyPropertiesAtIndex ( CGImageSourceRef isrc,
size_t index,
CFDictionaryRef options )
{
CFDictionaryRef c;
return __cf_non_null_alloc(c);
CFDictionaryRef CGImageSourceCopyPropertiesAtIndex(CGImageSourceRef isrc,
size_t index,
CFDictionaryRef options) {
CFDictionaryRef c;
return __cf_non_null_alloc(c);
}
CFDictionaryRef CFDictionaryCreate ( CFAllocatorRef allocator,
const void **keys,
const void **values,
CFIndex numValues,
const CFDictionaryKeyCallBacks *keyCallBacks,
const CFDictionaryValueCallBacks *valueCallBacks ) {
CFDictionaryRef c;
return __cf_alloc(c);
CFDictionaryRef CFDictionaryCreate(
CFAllocatorRef allocator,
const void** keys,
const void** values,
CFIndex numValues,
const CFDictionaryKeyCallBacks* keyCallBacks,
const CFDictionaryValueCallBacks* valueCallBacks) {
CFDictionaryRef c;
return __cf_alloc(c);
}
CFDictionaryRef CFDictionaryCreateCopy ( CFAllocatorRef allocator,
CFDictionaryRef theDict ) {
CFDictionaryRef c;
return __cf_alloc(c);
CFDictionaryRef CFDictionaryCreateCopy(CFAllocatorRef allocator,
CFDictionaryRef theDict) {
CFDictionaryRef c;
return __cf_alloc(c);
}
CFDictionaryRef CFNetworkCopySystemProxySettings ( void ) {
CFDictionaryRef c;
return __cf_non_null_alloc(c);
CFDictionaryRef CFNetworkCopySystemProxySettings(void) {
CFDictionaryRef c;
return __cf_non_null_alloc(c);
}
CFDictionaryRef CGImageSourceCopyProperties ( CGImageSourceRef isrc, CFDictionaryRef options ) {
CFDictionaryRef c;
return __cf_non_null_alloc(c);
CFDictionaryRef CGImageSourceCopyProperties(CGImageSourceRef isrc,
CFDictionaryRef options) {
CFDictionaryRef c;
return __cf_non_null_alloc(c);
}
CFDictionaryRef CMCopyDictionaryOfAttachments ( CFAllocatorRef allocator,
CMAttachmentBearerRef target,
CMAttachmentMode attachmentMode ) {
CFDictionaryRef c;
return __cf_alloc(c);
CFDictionaryRef CMCopyDictionaryOfAttachments(CFAllocatorRef allocator,
CMAttachmentBearerRef target,
CMAttachmentMode attachmentMode) {
CFDictionaryRef c;
return __cf_alloc(c);
}
CFDictionaryRef CFHTTPMessageCopyAllHeaderFields ( CFHTTPMessageRef message ) {
CFDictionaryRef c;
return __cf_alloc(c);
CFDictionaryRef CFHTTPMessageCopyAllHeaderFields(CFHTTPMessageRef message) {
CFDictionaryRef c;
return __cf_alloc(c);
}
CFDictionaryRef CNCopyCurrentNetworkInfo ( CFStringRef interfaceName ) {
CFDictionaryRef c;
return __cf_non_null_alloc(c);
CFDictionaryRef CNCopyCurrentNetworkInfo(CFStringRef interfaceName) {
CFDictionaryRef c;
return __cf_non_null_alloc(c);
}
CFDictionaryRef CMTimeCopyAsDictionary (CMTime time,
CFAllocatorRef allocator ) {
CFDictionaryRef CMTimeCopyAsDictionary(CMTime time, CFAllocatorRef allocator) {
CFDictionaryRef c;
return __cf_alloc(c);
}

@ -12,13 +12,12 @@
CFErrorRef __cf_alloc(CFErrorRef);
CFErrorRef __cf_non_null_alloc(CFErrorRef);
CFErrorRef CFReadStreamCopyError ( CFReadStreamRef stream ) {
CFErrorRef CFReadStreamCopyError(CFReadStreamRef stream) {
CFErrorRef c;
return __cf_alloc(c);
}
CFErrorRef CFWriteStreamCopyError ( CFWriteStreamRef stream ) {
CFErrorRef CFWriteStreamCopyError(CFWriteStreamRef stream) {
CFErrorRef c;
return __cf_alloc(c);
}

@ -11,31 +11,30 @@
CFHTTPMessageRef __cf_alloc(CFHTTPMessageRef);
CFHTTPMessageRef CFHTTPMessageCreateCopy ( CFAllocatorRef alloc,
CFHTTPMessageRef message ) {
CFHTTPMessageRef c;
return __cf_alloc(c);
CFHTTPMessageRef CFHTTPMessageCreateCopy(CFAllocatorRef alloc,
CFHTTPMessageRef message) {
CFHTTPMessageRef c;
return __cf_alloc(c);
}
CFHTTPMessageRef CFHTTPMessageCreateEmpty ( CFAllocatorRef alloc,
Boolean isRequest ) {
CFHTTPMessageRef c;
return __cf_alloc(c);
CFHTTPMessageRef CFHTTPMessageCreateEmpty(CFAllocatorRef alloc,
Boolean isRequest) {
CFHTTPMessageRef c;
return __cf_alloc(c);
}
CFHTTPMessageRef CFHTTPMessageCreateRequest ( CFAllocatorRef alloc,
CFStringRef requestMethod,
CFURLRef url,
CFStringRef httpVersion ) {
CFHTTPMessageRef c;
return __cf_alloc(c);
CFHTTPMessageRef CFHTTPMessageCreateRequest(CFAllocatorRef alloc,
CFStringRef requestMethod,
CFURLRef url,
CFStringRef httpVersion) {
CFHTTPMessageRef c;
return __cf_alloc(c);
}
CFHTTPMessageRef CFHTTPMessageCreateResponse ( CFAllocatorRef alloc,
CFIndex statusCode,
CFStringRef statusDescription,
CFStringRef httpVersion ) {
CFHTTPMessageRef c;
return __cf_alloc(c);
CFHTTPMessageRef CFHTTPMessageCreateResponse(CFAllocatorRef alloc,
CFIndex statusCode,
CFStringRef statusDescription,
CFStringRef httpVersion) {
CFHTTPMessageRef c;
return __cf_alloc(c);
}

@ -17,8 +17,8 @@ CFLocaleRef CFLocaleCopyCurrent(void) {
return __cf_non_null_alloc(c);
}
CFLocaleRef CFLocaleCreate ( CFAllocatorRef allocator,
CFStringRef localeIdentifier ) {
CFLocaleRef CFLocaleCreate(CFAllocatorRef allocator,
CFStringRef localeIdentifier) {
CFLocaleRef c;
return __cf_alloc(c);
}

@ -12,9 +12,9 @@
CFMutableArrayRef __cf_alloc(CFMutableArrayRef);
CFMutableArrayRef __cf_non_null_alloc(CFMutableArrayRef);
CFMutableArrayRef CFArrayCreateMutable ( CFAllocatorRef allocator,
CFIndex capacity,
const CFArrayCallBacks *callBacks ) {
CFMutableArrayRef CFArrayCreateMutable(CFAllocatorRef allocator,
CFIndex capacity,
const CFArrayCallBacks* callBacks) {
CFMutableArrayRef c;
return __cf_alloc(c);
}

@ -11,8 +11,8 @@
CFMutableAttributedStringRef __cf_non_null_alloc(CFMutableAttributedStringRef);
CFMutableAttributedStringRef CFAttributedStringCreateMutable (CFAllocatorRef alloc,
CFIndex maxLength ) {
CFMutableAttributedStringRef c;
return __cf_non_null_alloc(c);
CFMutableAttributedStringRef CFAttributedStringCreateMutable(
CFAllocatorRef alloc, CFIndex maxLength) {
CFMutableAttributedStringRef c;
return __cf_non_null_alloc(c);
}

@ -7,26 +7,26 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import <ImageIO/ImageIO.h>
#import <CoreMedia/CoreMedia.h>
#import <ImageIO/ImageIO.h>
CFMutableDictionaryRef __cf_non_null_alloc(CFMutableDictionaryRef);
CFMutableDictionaryRef __cf_alloc(CFMutableDictionaryRef);
CFMutableDictionaryRef CFDictionaryCreateMutable ( CFAllocatorRef allocator,
CFIndex capacity,
const CFDictionaryKeyCallBacks *keyCallBacks,
const CFDictionaryValueCallBacks *valueCallBacks ) {
CFMutableDictionaryRef CFDictionaryCreateMutable(
CFAllocatorRef allocator,
CFIndex capacity,
const CFDictionaryKeyCallBacks* keyCallBacks,
const CFDictionaryValueCallBacks* valueCallBacks) {
CFMutableDictionaryRef c;
return __cf_alloc(c);
CFMutableDictionaryRef c;
return __cf_alloc(c);
}
CFMutableDictionaryRef CFDictionaryCreateMutableCopy ( CFAllocatorRef allocator,
CFIndex capacity,
CFDictionaryRef theDict ) {
CFMutableDictionaryRef c;
return __cf_non_null_alloc(c);
CFMutableDictionaryRef CFDictionaryCreateMutableCopy(CFAllocatorRef allocator,
CFIndex capacity,
CFDictionaryRef theDict) {
CFMutableDictionaryRef c;
return __cf_non_null_alloc(c);
}

@ -7,22 +7,21 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import <Foundation/Foundation.h>
CFMutableSetRef __cf_alloc(CFMutableSetRef);
CFMutableSetRef __cf_non_null_alloc(CFMutableSetRef);
CFMutableSetRef CFSetCreateMutable (CFAllocatorRef allocator,
CFIndex capacity,
const CFSetCallBacks *callBacks) {
CFMutableSetRef CFSetCreateMutable(CFAllocatorRef allocator,
CFIndex capacity,
const CFSetCallBacks* callBacks) {
CFMutableSetRef c;
return __cf_alloc(c);
}
CFMutableSetRef CFSetCreateMutableCopy ( CFAllocatorRef allocator,
CFIndex capacity,
CFSetRef theSet ) {
CFMutableSetRef CFSetCreateMutableCopy(CFAllocatorRef allocator,
CFIndex capacity,
CFSetRef theSet) {
CFMutableSetRef c;
return __cf_non_null_alloc(c);
}

@ -11,10 +11,9 @@
CFNumberRef __cf_alloc(CFNumberRef);
CFNumberRef CFNumberCreate ( CFAllocatorRef allocator,
CFNumberType theType,
const void *valuePtr ) {
CFNumberRef c;
return __cf_alloc(c);
CFNumberRef CFNumberCreate(CFAllocatorRef allocator,
CFNumberType theType,
const void* valuePtr) {
CFNumberRef c;
return __cf_alloc(c);
}

@ -12,16 +12,16 @@
CFRunLoopSourceRef __cf_alloc(CFRunLoopSourceRef);
CFRunLoopSourceRef __cf_non_null_alloc(CFRunLoopSourceRef);
CFRunLoopSourceRef CFRunLoopSourceCreate ( CFAllocatorRef allocator,
CFIndex order,
CFRunLoopSourceContext *context ) {
CFRunLoopSourceRef c;
return __cf_non_null_alloc(c);
CFRunLoopSourceRef CFRunLoopSourceCreate(CFAllocatorRef allocator,
CFIndex order,
CFRunLoopSourceContext* context) {
CFRunLoopSourceRef c;
return __cf_non_null_alloc(c);
}
CFRunLoopSourceRef CFSocketCreateRunLoopSource ( CFAllocatorRef allocator,
CFSocketRef s,
CFIndex order ) {
CFRunLoopSourceRef c;
return __cf_non_null_alloc(c);
CFRunLoopSourceRef CFSocketCreateRunLoopSource(CFAllocatorRef allocator,
CFSocketRef s,
CFIndex order) {
CFRunLoopSourceRef c;
return __cf_non_null_alloc(c);
}

@ -12,24 +12,23 @@
CFRunLoopObserverRef __cf_alloc(CFRunLoopObserverRef);
CFRunLoopSourceRef __cf_non_null_alloc(CFRunLoopSourceRef);
CFRunLoopObserverRef CFRunLoopObserverCreate ( CFAllocatorRef allocator,
CFOptionFlags activities,
Boolean repeats,
CFIndex order,
CFRunLoopObserverCallBack callout,
CFRunLoopObserverContext *context) {
CFRunLoopObserverRef c;
return __cf_non_null_alloc(c);
CFRunLoopObserverRef CFRunLoopObserverCreate(
CFAllocatorRef allocator,
CFOptionFlags activities,
Boolean repeats,
CFIndex order,
CFRunLoopObserverCallBack callout,
CFRunLoopObserverContext* context) {
CFRunLoopObserverRef c;
return __cf_non_null_alloc(c);
}
CFRunLoopObserverRef CFRunLoopObserverCreateWithHandler ( CFAllocatorRef allocator,
CFOptionFlags activities,
Boolean repeats,
CFIndex order,
void (^block)(
CFRunLoopObserverRef observer,
CFRunLoopActivity activity) ) {
CFRunLoopObserverRef c;
return __cf_non_null_alloc(c);
CFRunLoopObserverRef CFRunLoopObserverCreateWithHandler(
CFAllocatorRef allocator,
CFOptionFlags activities,
Boolean repeats,
CFIndex order,
void (^block)(CFRunLoopObserverRef observer, CFRunLoopActivity activity)) {
CFRunLoopObserverRef c;
return __cf_non_null_alloc(c);
}

@ -11,13 +11,13 @@
CFSocketRef __cf_alloc(CFSocketRef);
CFSocketRef CFSocketCreate ( CFAllocatorRef allocator,
SInt32 protocolFamily,
SInt32 socketType,
SInt32 protocol,
CFOptionFlags callBackTypes,
CFSocketCallBack callout,
const CFSocketContext *context ) {
CFSocketRef c;
return __cf_alloc(c);
CFSocketRef CFSocketCreate(CFAllocatorRef allocator,
SInt32 protocolFamily,
SInt32 socketType,
SInt32 protocol,
CFOptionFlags callBackTypes,
CFSocketCallBack callout,
const CFSocketContext* context) {
CFSocketRef c;
return __cf_alloc(c);
}

@ -14,20 +14,19 @@ CFStringRef __cf_alloc(CFStringRef);
void __get_array_size(const UInt8);
CFStringRef CFStringCreateWithBytesNoCopy (
CFAllocatorRef alloc,
const UInt8 *bytes,
CFIndex numBytes,
CFStringEncoding encoding,
Boolean isExternalRepresentation,
CFAllocatorRef contentsDeallocator ) {
CFStringRef c;
CFStringRef s = __cf_alloc(c);
if (s) {
if (bytes) {
__get_array_size(bytes);
free(bytes);
}
}
return s;
CFStringRef CFStringCreateWithBytesNoCopy(CFAllocatorRef alloc,
const UInt8* bytes,
CFIndex numBytes,
CFStringEncoding encoding,
Boolean isExternalRepresentation,
CFAllocatorRef contentsDeallocator) {
CFStringRef c;
CFStringRef s = __cf_alloc(c);
if (s) {
if (bytes) {
__get_array_size(bytes);
free(bytes);
}
}
return s;
}

@ -12,11 +12,11 @@
CFStringTokenizerRef __cf_alloc(CFStringTokenizerRef);
CFStringTokenizerRef __cf_non_null_alloc(CFStringTokenizerRef);
CFStringTokenizerRef CFStringTokenizerCreate ( CFAllocatorRef alloc,
CFStringRef string,
CFRange range,
CFOptionFlags options,
CFLocaleRef locale ) {
CFStringTokenizerRef c;
return __cf_non_null_alloc(c);
CFStringTokenizerRef CFStringTokenizerCreate(CFAllocatorRef alloc,
CFStringRef string,
CFRange range,
CFOptionFlags options,
CFLocaleRef locale) {
CFStringTokenizerRef c;
return __cf_non_null_alloc(c);
}

@ -9,6 +9,4 @@
#import <Foundation/Foundation.h>
CFTypeRef CFMakeCollectable ( CFTypeRef cf ) {
return cf;
}
CFTypeRef CFMakeCollectable(CFTypeRef cf) { return cf; }

@ -12,13 +12,13 @@
CFUUIDRef __cf_alloc(CFUUIDRef);
CFUUIDRef __cf_non_null_alloc(CFUUIDRef);
CFUUIDRef CFUUIDCreate ( CFAllocatorRef alloc ){
CFUUIDRef c;
return __cf_non_null_alloc(c);
CFUUIDRef CFUUIDCreate(CFAllocatorRef alloc) {
CFUUIDRef c;
return __cf_non_null_alloc(c);
}
CFUUIDRef CFUUIDCreateFromUUIDBytes ( CFAllocatorRef alloc, CFUUIDBytes bytes ) {
CFUUIDRef CFUUIDCreateFromUUIDBytes(CFAllocatorRef alloc, CFUUIDBytes bytes) {
CFUUIDRef c;
return __cf_non_null_alloc(c);
CFUUIDRef c;
return __cf_non_null_alloc(c);
}

@ -11,9 +11,9 @@
CTFontRef __cf_alloc(CTFontRef);
CTFontRef CTFontCreateWithName ( CFStringRef name,
CGFloat size,
const CGAffineTransform *matrix ) {
CTFontRef CTFontCreateWithName(CFStringRef name,
CGFloat size,
const CGAffineTransform* matrix) {
CTFontRef c;
return __cf_alloc(c);
}

@ -11,7 +11,8 @@
CTFramesetterRef __cf_alloc(CTFramesetterRef);
CTFramesetterRef CTFramesetterCreateWithAttributedString ( CFAttributedStringRef string ) {
CTFramesetterRef c;
return __cf_alloc(c);
CTFramesetterRef CTFramesetterCreateWithAttributedString(
CFAttributedStringRef string) {
CTFramesetterRef c;
return __cf_alloc(c);
}

@ -7,15 +7,14 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import <Foundation/Foundation.h>
#import <CoreText/CoreText.h>
#import <Foundation/Foundation.h>
CTParagraphStyleRef __cf_alloc(CTParagraphStyleRef);
CTParagraphStyleRef __cf_non_null_alloc(CTParagraphStyleRef);
CTParagraphStyleRef CTParagraphStyleCreate ( const CTParagraphStyleSetting *settings,
size_t settingCount ) {
CTParagraphStyleRef c;
return __cf_alloc(c);
CTParagraphStyleRef CTParagraphStyleCreate(
const CTParagraphStyleSetting* settings, size_t settingCount) {
CTParagraphStyleRef c;
return __cf_alloc(c);
}

@ -7,20 +7,19 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import <Foundation/Foundation.h>
#import "SystemConfiguration/SCNetworkReachability.h"
#import <Foundation/Foundation.h>
SCNetworkReachabilityRef __cf_non_null_alloc(SCNetworkReachabilityRef);
SCNetworkReachabilityRef SCNetworkReachabilityCreateWithName (
CFAllocatorRef allocator,
const char *nodename ) {
SCNetworkReachabilityRef c;
return __cf_non_null_alloc(c);
SCNetworkReachabilityRef SCNetworkReachabilityCreateWithName(
CFAllocatorRef allocator, const char* nodename) {
SCNetworkReachabilityRef c;
return __cf_non_null_alloc(c);
}
SCNetworkReachabilityRef SCNetworkReachabilityCreateWithAddress ( CFAllocatorRef allocator,
const struct sockaddr *address ) {
SCNetworkReachabilityRef c;
return __cf_non_null_alloc(c);
SCNetworkReachabilityRef SCNetworkReachabilityCreateWithAddress(
CFAllocatorRef allocator, const struct sockaddr* address) {
SCNetworkReachabilityRef c;
return __cf_non_null_alloc(c);
}

@ -13,9 +13,8 @@ SecCertificateRef __cf_alloc(SecCertificateRef);
SecCertificateRef __cf_non_null_alloc(SecCertificateRef);
SecCertificateRef SecCertificateCreateWithData ( CFAllocatorRef allocator,
CFDataRef data ) {
SecCertificateRef c;
return __cf_alloc(c);
SecCertificateRef SecCertificateCreateWithData(CFAllocatorRef allocator,
CFDataRef data) {
SecCertificateRef c;
return __cf_alloc(c);
}

@ -14,18 +14,17 @@ SecKeyRef __cf_alloc(SecKeyRef);
SecPolicyRef __cf_non_null_alloc(SecPolicyRef);
SecKeyRef SecTrustCopyPublicKey ( SecTrustRef trust ){
SecKeyRef c;
return __cf_alloc(c);
SecKeyRef SecTrustCopyPublicKey(SecTrustRef trust) {
SecKeyRef c;
return __cf_alloc(c);
}
SecPolicyRef SecPolicyCreateSSL ( Boolean server, CFStringRef hostname ) {
SecPolicyRef c;
return __cf_non_null_alloc(c);
SecPolicyRef SecPolicyCreateSSL(Boolean server, CFStringRef hostname) {
SecPolicyRef c;
return __cf_non_null_alloc(c);
}
SecPolicyRef SecPolicyCreateBasicX509 ( void ) {
SecPolicyRef c;
return __cf_non_null_alloc(c);
SecPolicyRef SecPolicyCreateBasicX509(void) {
SecPolicyRef c;
return __cf_non_null_alloc(c);
}

@ -13,33 +13,34 @@ CGColorRef __cf_non_null_alloc(CGColorRef);
void __objc_release_cf(CGColorRef);
void CGColorRelease (CGColorRef color) {
if (color) __objc_release_cf(color);
void CGColorRelease(CGColorRef color) {
if (color)
__objc_release_cf(color);
}
CGColorRef CGColorCreate(CGColorSpaceRef space, const CGFloat components[]) {
CGColorRef c;
return __cf_non_null_alloc(c);
CGColorRef c;
return __cf_non_null_alloc(c);
}
CGColorRef CGColorCreateCopyWithAlpha ( CGColorRef color, CGFloat alpha ) {
CGColorRef c;
return __cf_non_null_alloc(c);
CGColorRef CGColorCreateCopyWithAlpha(CGColorRef color, CGFloat alpha) {
CGColorRef c;
return __cf_non_null_alloc(c);
}
//FB own code
// FB own code
CGColorRef FBColorCreateWithGray(CGFloat gray, CGFloat a) {
CGColorRef c;
return __cf_non_null_alloc(c);
CGColorRef c;
return __cf_non_null_alloc(c);
}
CGColorRef FBColorCreateWithRGBA(uint8_t r, uint8_t g, uint8_t b, CGFloat a) {
CGColorRef c;
return __cf_non_null_alloc(c);
CGColorRef c;
return __cf_non_null_alloc(c);
}
CGColorRef FBColorCreateWithRGB(uint8_t r, uint8_t g, uint8_t b) {
CGColorRef c;
return __cf_non_null_alloc(c);
CGColorRef c;
return __cf_non_null_alloc(c);
}

@ -11,18 +11,19 @@
void __objc_release_cf(CGColorSpaceRef);
void CGColorSpaceRelease ( CGColorSpaceRef space ) {
if (space) __objc_release_cf(space);
void CGColorSpaceRelease(CGColorSpaceRef space) {
if (space)
__objc_release_cf(space);
}
CGColorSpaceRef __cf_alloc(CGColorSpaceRef);
CGColorSpaceRef CGColorSpaceCreateDeviceRGB ( void ) {
CGColorSpaceRef c;
return __cf_alloc(c);
CGColorSpaceRef CGColorSpaceCreateDeviceRGB(void) {
CGColorSpaceRef c;
return __cf_alloc(c);
}
CGColorSpaceRef CGColorSpaceCreateDeviceGray ( void ) {
CGColorSpaceRef c;
return __cf_alloc(c);
CGColorSpaceRef CGColorSpaceCreateDeviceGray(void) {
CGColorSpaceRef c;
return __cf_alloc(c);
}

@ -13,19 +13,20 @@
void __objc_release_cf(CGContextRef);
void CGContextRelease ( CGContextRef c ){
if (c) __objc_release_cf(c);
void CGContextRelease(CGContextRef c) {
if (c)
__objc_release_cf(c);
}
CGContextRef __cf_alloc(CGContextRef);
CGContextRef CGBitmapContextCreate ( void *data,
size_t width,
size_t height,
size_t bitsPerComponent,
size_t bytesPerRow,
CGColorSpaceRef space,
CGBitmapInfo bitmapInfo ) {
CGContextRef c;
return __cf_alloc(c);
CGContextRef CGBitmapContextCreate(void* data,
size_t width,
size_t height,
size_t bitsPerComponent,
size_t bytesPerRow,
CGColorSpaceRef space,
CGBitmapInfo bitmapInfo) {
CGContextRef c;
return __cf_alloc(c);
}

@ -11,6 +11,7 @@
void __objc_release_cf(CGDataConsumerRef);
void CGDataConsumerRelease ( CGDataConsumerRef consumer ) {
if (consumer) __objc_release_cf(consumer);
void CGDataConsumerRelease(CGDataConsumerRef consumer) {
if (consumer)
__objc_release_cf(consumer);
}

@ -11,41 +11,42 @@
void __objc_release_cf(CGDataProviderRef);
void CGDataProviderRelease ( CGDataProviderRef provider ){
if (provider) __objc_release_cf(provider);
void CGDataProviderRelease(CGDataProviderRef provider) {
if (provider)
__objc_release_cf(provider);
}
CGDataProviderRef __cf_alloc(CGDataProviderRef);
CGDataProviderRef __cf_non_null_alloc(CGDataProviderRef);
CGDataProviderRef CGDataProviderCreateWithCFData ( CFDataRef data ) {
CGDataProviderRef c;
return __cf_non_null_alloc(c);
CGDataProviderRef CGDataProviderCreateWithCFData(CFDataRef data) {
CGDataProviderRef c;
return __cf_non_null_alloc(c);
}
CGDataProviderRef CGDataProviderCreateWithData ( void *info,
const void *data, size_t size,
CGDataProviderReleaseDataCallback releaseData ) {
CGDataProviderRef c;
return __cf_non_null_alloc(c);
CGDataProviderRef CGDataProviderCreateWithData(
void* info,
const void* data,
size_t size,
CGDataProviderReleaseDataCallback releaseData) {
CGDataProviderRef c;
return __cf_non_null_alloc(c);
}
CGDataProviderRef CGDataProviderCreateWithURL ( CFURLRef url ) {
CGDataProviderRef c;
return __cf_alloc(c);
CGDataProviderRef CGDataProviderCreateWithURL(CFURLRef url) {
CGDataProviderRef c;
return __cf_alloc(c);
}
CGDataProviderRef CGDataProviderCreateDirect ( void *info,
off_t size,
const CGDataProviderDirectCallbacks *callbacks) {
CGDataProviderRef c;
return __cf_non_null_alloc(c);
CGDataProviderRef CGDataProviderCreateDirect(
void* info, off_t size, const CGDataProviderDirectCallbacks* callbacks) {
CGDataProviderRef c;
return __cf_non_null_alloc(c);
}
CGDataProviderRef CGDataProviderCreateSequential ( void *info,
const CGDataProviderSequentialCallbacks *callbacks ) {
CGDataProviderRef c;
return __cf_non_null_alloc(c);
CGDataProviderRef CGDataProviderCreateSequential(
void* info, const CGDataProviderSequentialCallbacks* callbacks) {
CGDataProviderRef c;
return __cf_non_null_alloc(c);
}

@ -13,11 +13,12 @@ void __objc_release_cf(CGFontRef);
CGFontRef __cf_alloc(CGFontRef);
void CGFontRelease ( CGFontRef font ) {
if (font) __objc_release_cf(font);
void CGFontRelease(CGFontRef font) {
if (font)
__objc_release_cf(font);
}
CGFontRef CGFontCreateWithDataProvider ( CGDataProviderRef provider ) {
CGFontRef c;
return __cf_alloc(c);
CGFontRef CGFontCreateWithDataProvider(CGDataProviderRef provider) {
CGFontRef c;
return __cf_alloc(c);
}

@ -11,6 +11,7 @@
void __objc_release_cf(CGFunctionRef);
void CGFunctionRelease ( CGFunctionRef function ) {
if (function) __objc_release_cf(function);
void CGFunctionRelease(CGFunctionRef function) {
if (function)
__objc_release_cf(function);
}

@ -11,23 +11,24 @@
void __objc_release_cf(CGGradientRef);
void CGGradientRelease ( CGGradientRef gradient ) {
if (gradient) __objc_release_cf(gradient);
void CGGradientRelease(CGGradientRef gradient) {
if (gradient)
__objc_release_cf(gradient);
}
CGGradientRef __cf_non_null_alloc(CGGradientRef);
CGGradientRef CGGradientCreateWithColors ( CGColorSpaceRef space,
CFArrayRef colors,
const CGFloat locations[]) {
CGGradientRef c;
return __cf_non_null_alloc(c);
CGGradientRef CGGradientCreateWithColors(CGColorSpaceRef space,
CFArrayRef colors,
const CGFloat locations[]) {
CGGradientRef c;
return __cf_non_null_alloc(c);
}
CGGradientRef CGGradientCreateWithColorComponents ( CGColorSpaceRef space,
const CGFloat components[],
const CGFloat locations[],
size_t count ) {
CGGradientRef c;
return __cf_non_null_alloc(c);
CGGradientRef CGGradientCreateWithColorComponents(CGColorSpaceRef space,
const CGFloat components[],
const CGFloat locations[],
size_t count) {
CGGradientRef c;
return __cf_non_null_alloc(c);
}

@ -14,72 +14,72 @@ CGImageRef __cf_non_null_alloc(CGImageRef);
CGImageRef __cf_alloc(CGImageRef);
void __objc_release_cf(CGImageRef);
CGImageRef CGImageSourceCreateImageAtIndex ( CGImageSourceRef isrc, size_t index, CFDictionaryRef options )
{
CGImageRef c;
return __cf_non_null_alloc(c);
CGImageRef CGImageSourceCreateImageAtIndex(CGImageSourceRef isrc,
size_t index,
CFDictionaryRef options) {
CGImageRef c;
return __cf_non_null_alloc(c);
}
CGImageRef CGImageSourceCreateThumbnailAtIndex ( CGImageSourceRef isrc, size_t index, CFDictionaryRef options )
{
CGImageRef c;
return __cf_non_null_alloc(c);
CGImageRef CGImageSourceCreateThumbnailAtIndex(CGImageSourceRef isrc,
size_t index,
CFDictionaryRef options) {
CGImageRef c;
return __cf_non_null_alloc(c);
}
void CGImageRelease ( CGImageRef image )
{
if (image) __objc_release_cf(image);
void CGImageRelease(CGImageRef image) {
if (image)
__objc_release_cf(image);
}
CGImageRef CGBitmapContextCreateImage ( CGContextRef context )
{
CGImageRef c;
return __cf_alloc(c);
CGImageRef CGBitmapContextCreateImage(CGContextRef context) {
CGImageRef c;
return __cf_alloc(c);
}
CGImageRef CGImageCreateCopy ( CGImageRef image ) {
CGImageRef c;
return __cf_non_null_alloc(c);
CGImageRef CGImageCreateCopy(CGImageRef image) {
CGImageRef c;
return __cf_non_null_alloc(c);
}
CGImageRef CGImageCreateWithImageInRect ( CGImageRef image, CGRect rect ) {
CGImageRef c;
return __cf_alloc(c);
CGImageRef CGImageCreateWithImageInRect(CGImageRef image, CGRect rect) {
CGImageRef c;
return __cf_alloc(c);
}
CGImageRef CGImageCreateWithJPEGDataProvider ( CGDataProviderRef source,
const CGFloat decode[],
bool shouldInterpolate,
CGColorRenderingIntent intent) {
CGImageRef c;
return __cf_non_null_alloc(c);
CGImageRef CGImageCreateWithJPEGDataProvider(CGDataProviderRef source,
const CGFloat decode[],
bool shouldInterpolate,
CGColorRenderingIntent intent) {
CGImageRef c;
return __cf_non_null_alloc(c);
}
CGImageRef CGImageCreateWithPNGDataProvider ( CGDataProviderRef source,
const CGFloat decode[],
bool shouldInterpolate,
CGColorRenderingIntent intent ) {
CGImageRef c;
return __cf_non_null_alloc(c);
CGImageRef CGImageCreateWithPNGDataProvider(CGDataProviderRef source,
const CGFloat decode[],
bool shouldInterpolate,
CGColorRenderingIntent intent) {
CGImageRef c;
return __cf_non_null_alloc(c);
}
CGImageRef CGImageCreate ( size_t width,
size_t height,
size_t bitsPerComponent,
size_t bitsPerPixel,
size_t bytesPerRow,
CGColorSpaceRef space,
CGBitmapInfo bitmapInfo,
CGDataProviderRef provider,
const CGFloat decode[],
bool shouldInterpolate,
CGColorRenderingIntent intent) {
CGImageRef c;
return __cf_non_null_alloc(c);
CGImageRef CGImageCreate(size_t width,
size_t height,
size_t bitsPerComponent,
size_t bitsPerPixel,
size_t bytesPerRow,
CGColorSpaceRef space,
CGBitmapInfo bitmapInfo,
CGDataProviderRef provider,
const CGFloat decode[],
bool shouldInterpolate,
CGColorRenderingIntent intent) {
CGImageRef c;
return __cf_non_null_alloc(c);
}
CGImageRef CGImageCreateWithMask ( CGImageRef image, CGImageRef mask ) {
CGImageRef c;
return __cf_non_null_alloc(c);
CGImageRef CGImageCreateWithMask(CGImageRef image, CGImageRef mask) {
CGImageRef c;
return __cf_non_null_alloc(c);
}

@ -13,18 +13,19 @@
CGImageDestinationRef __cf_non_null_alloc(CGImageDestinationRef);
CGImageDestinationRef __cf_alloc(CGImageDestinationRef);
CGImageDestinationRef CGImageDestinationCreateWithURL (CFURLRef url,
CFStringRef type,
size_t count,
CFDictionaryRef options) {
CGImageDestinationRef c;
return __cf_non_null_alloc(c);
CGImageDestinationRef CGImageDestinationCreateWithURL(CFURLRef url,
CFStringRef type,
size_t count,
CFDictionaryRef options) {
CGImageDestinationRef c;
return __cf_non_null_alloc(c);
}
CGImageDestinationRef CGImageDestinationCreateWithData ( CFMutableDataRef data,
CFStringRef type,
size_t count,
CFDictionaryRef options) {
CGImageDestinationRef c;
return __cf_non_null_alloc(c);
CGImageDestinationRef CGImageDestinationCreateWithData(
CFMutableDataRef data,
CFStringRef type,
size_t count,
CFDictionaryRef options) {
CGImageDestinationRef c;
return __cf_non_null_alloc(c);
}

@ -14,31 +14,30 @@ CGImageSourceRef __cf_non_null_alloc(CGImageSourceRef);
CGImageSourceRef __cf_alloc(CGImageSourceRef);
void __objc_release_cf(CGImageSourceRef);
CGImageSourceRef CGImageSourceCreateWithData ( CFDataRef data, CFDictionaryRef options )
{
CGImageSourceRef c;
return __cf_non_null_alloc(c);
CGImageSourceRef CGImageSourceCreateWithData(CFDataRef data,
CFDictionaryRef options) {
CGImageSourceRef c;
return __cf_non_null_alloc(c);
}
CGImageSourceRef CGImageSourceCreateWithDataProvider ( CGDataProviderRef provider, CFDictionaryRef options )
{
CGImageSourceRef c;
return __cf_non_null_alloc(c);
CGImageSourceRef CGImageSourceCreateWithDataProvider(CGDataProviderRef provider,
CFDictionaryRef options) {
CGImageSourceRef c;
return __cf_non_null_alloc(c);
}
CGImageSourceRef CGImageSourceCreateWithURL ( CFURLRef url, CFDictionaryRef options )
{
CGImageSourceRef c;
return __cf_alloc(c);
CGImageSourceRef CGImageSourceCreateWithURL(CFURLRef url,
CFDictionaryRef options) {
CGImageSourceRef c;
return __cf_alloc(c);
}
CGImageSourceRef CGImageSourceCreateIncremental ( CFDictionaryRef options )
{
CGImageSourceRef c;
return __cf_non_null_alloc(c);
CGImageSourceRef CGImageSourceCreateIncremental(CFDictionaryRef options) {
CGImageSourceRef c;
return __cf_non_null_alloc(c);
}
void CGImageSourceRelease ( CGImageSourceRef image )
{
if (image) __objc_release_cf(image);
void CGImageSourceRelease(CGImageSourceRef image) {
if (image)
__objc_release_cf(image);
}

@ -11,6 +11,7 @@
void __objc_release_cf(CGLayerRef);
void CGLayerRelease ( CGLayerRef layer ){
if (layer) __objc_release_cf(layer);
void CGLayerRelease(CGLayerRef layer) {
if (layer)
__objc_release_cf(layer);
}

@ -11,6 +11,7 @@
void __objc_release_cf(CGPDFContentStreamRef);
void CGPDFContentStreamRelease ( CGPDFContentStreamRef cs ) {
if (cs) __objc_release_cf(cs);
void CGPDFContentStreamRelease(CGPDFContentStreamRef cs) {
if (cs)
__objc_release_cf(cs);
}

@ -11,6 +11,7 @@
void __objc_release_cf(CGPDFDocumentRef);
void CGPDFDocumentRelease ( CGPDFDocumentRef document ) {
if (document) __objc_release_cf(document);
void CGPDFDocumentRelease(CGPDFDocumentRef document) {
if (document)
__objc_release_cf(document);
}

@ -11,6 +11,7 @@
void __objc_release_cf(CGPDFOperatorTableRef);
void CGPDFOperatorTableRelease ( CGPDFOperatorTableRef table ) {
if (table) __objc_release_cf(table);
void CGPDFOperatorTableRelease(CGPDFOperatorTableRef table) {
if (table)
__objc_release_cf(table);
}

@ -11,6 +11,7 @@
void __objc_release_cf(CGPDFPageRef);
void CGPDFPageRelease ( CGPDFPageRef page ) {
if (page) __objc_release_cf(page);
void CGPDFPageRelease(CGPDFPageRef page) {
if (page)
__objc_release_cf(page);
}

@ -11,6 +11,7 @@
void __objc_release_cf(CGPDFScannerRef);
void CGPDFScannerRelease ( CGPDFScannerRef scanner ) {
if (scanner) __objc_release_cf(scanner);
void CGPDFScannerRelease(CGPDFScannerRef scanner) {
if (scanner)
__objc_release_cf(scanner);
}

@ -13,42 +13,43 @@
CGPathRef __cf_non_null_alloc(CGPathRef);
void __objc_release_cf(CGPathRef);
CGMutablePathRef CGPathCreateMutable () {
CGMutablePathRef c;
return (CGMutablePathRef) __cf_non_null_alloc(c);
CGMutablePathRef CGPathCreateMutable() {
CGMutablePathRef c;
return (CGMutablePathRef)__cf_non_null_alloc(c);
}
CGPathRef CGPathCreateWithRect ( CGRect rect, const CGAffineTransform *transform ) {
CGPathRef c;
return __cf_non_null_alloc(c);
CGPathRef CGPathCreateWithRect(CGRect rect,
const CGAffineTransform* transform) {
CGPathRef c;
return __cf_non_null_alloc(c);
}
void CGPathRelease ( CGPathRef path ) {
if (path) __objc_release_cf(path);
void CGPathRelease(CGPathRef path) {
if (path)
__objc_release_cf(path);
}
CGPathRef CGPathCreateWithEllipseInRect ( CGRect rect,
const CGAffineTransform *transform ){
CGPathRef c;
return __cf_non_null_alloc(c);
CGPathRef CGPathCreateWithEllipseInRect(CGRect rect,
const CGAffineTransform* transform) {
CGPathRef c;
return __cf_non_null_alloc(c);
}
CGPathRef CGPathCreateCopy ( CGPathRef path ) {
CGPathRef c;
return __cf_non_null_alloc(c);
CGPathRef CGPathCreateCopy(CGPathRef path) {
CGPathRef c;
return __cf_non_null_alloc(c);
}
CGPathRef CGPathCreateCopyByTransformingPath ( CGPathRef path,
const CGAffineTransform *transform ) {
CGPathRef c;
return __cf_non_null_alloc(c);
CGPathRef CGPathCreateCopyByTransformingPath(
CGPathRef path, const CGAffineTransform* transform) {
CGPathRef c;
return __cf_non_null_alloc(c);
}
CGPathRef CGPathCreateWithRoundedRect ( CGRect rect,
CGFloat cornerWidth,
CGFloat cornerHeight,
const CGAffineTransform *transform) {
CGPathRef c;
return __cf_non_null_alloc(c);
CGPathRef CGPathCreateWithRoundedRect(CGRect rect,
CGFloat cornerWidth,
CGFloat cornerHeight,
const CGAffineTransform* transform) {
CGPathRef c;
return __cf_non_null_alloc(c);
}

@ -11,6 +11,7 @@
void __objc_release_cf(CGPatternRef);
void CGPatternRelease ( CGPatternRef pattern ) {
if (pattern) __objc_release_cf(pattern);
void CGPatternRelease(CGPatternRef pattern) {
if (pattern)
__objc_release_cf(pattern);
}

@ -11,6 +11,7 @@
void __objc_release_cf(CGShadingRef);
void CGShadingRelease ( CGShadingRef shading ) {
if (shading) __objc_release_cf(shading);
void CGShadingRelease(CGShadingRef shading) {
if (shading)
__objc_release_cf(shading);
}

@ -12,7 +12,7 @@
@implementation NSArray
+ (instancetype)array {
return [NSArray alloc];
return [NSArray alloc];
}
@end

@ -7,18 +7,18 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
#pragma clang diagnostic ignored "-Wprotocol"
#pragma clang diagnostic ignored "-Wprotocol"
#pragma clang diagnostic ignored "-Wincomplete-implementation"
#pragma clang diagnostic ignored "-Wincomplete-implementation"
#pragma clang diagnostic ignored "-Wimplicit-function-declaration"
#pragma clang diagnostic ignored "-Wimplicit-function-declaration"
#import <Foundation/NSObject.h>
#import <Foundation/NSObject.h>
@implementation NSAutoreleasePool
@implementation NSAutoreleasePool
- (id)init {
return (id)[self autorelease];
}
- (id)init {
return (id)[self autorelease];
}
@end
@end

@ -14,30 +14,34 @@ NSData* __objc_alloc(NSData*);
@interface NSData : NSObject
@property (nonatomic, readonly) const void *bytes;
@property(nonatomic, readonly) const void* bytes;
+ (instancetype)dataWithBytesNoCopy:(void *)bytes length:(NSUInteger)length;
+ (instancetype)dataWithBytesNoCopy:(void *)bytes length:(NSUInteger)length freeWhenDone:(BOOL)b;
+ (instancetype)dataWithBytesNoCopy:(void*)bytes length:(NSUInteger)length;
+ (instancetype)dataWithBytesNoCopy:(void*)bytes
length:(NSUInteger)length
freeWhenDone:(BOOL)b;
@end
@implementation NSData
+ (instancetype)dataWithBytesNoCopy:(void *)bytes length:(NSUInteger)length {
return [NSData dataWithBytesNoCopy:bytes length:length freeWhenDone:YES];
+ (instancetype)dataWithBytesNoCopy:(void*)bytes length:(NSUInteger)length {
return [NSData dataWithBytesNoCopy:bytes length:length freeWhenDone:YES];
}
+ (instancetype)dataWithBytesNoCopy:(void *)bytes length:(NSUInteger)length freeWhenDone:(BOOL)b {
NSData* data = __objc_alloc(self);
if (data) {
data->_bytes = bytes;
return data;
}
else return nil;
+ (instancetype)dataWithBytesNoCopy:(void*)bytes
length:(NSUInteger)length
freeWhenDone:(BOOL)b {
NSData* data = __objc_alloc(self);
if (data) {
data->_bytes = bytes;
return data;
} else
return nil;
}
- (void) dealloc {
if (self)
free(self->_bytes);
- (void)dealloc {
if (self)
free(self->_bytes);
}
@end

@ -16,7 +16,7 @@
@implementation NSDictionary
+ (instancetype)dictionary {
return [NSDictionary alloc];
return [NSDictionary alloc];
}
@end

@ -20,29 +20,29 @@
- (instancetype)initWithFileDescriptor:(int)fd;
@property (nonatomic, readonly) int fileDescriptor;
@property(nonatomic, readonly) int fileDescriptor;
@end
@implementation NSFileHandle
- (instancetype)initWithFileDescriptor:(int)fd closeOnDealloc:(BOOL)closeopt {
if (self) {
self->_fileDescriptor = fd;
return self;
}
if (self) {
self->_fileDescriptor = fd;
return self;
}
}
- (instancetype)initWithFileDescriptor:(int)fd {
[self initWithFileDescriptor:fd closeOnDealloc:NO];
[self initWithFileDescriptor:fd closeOnDealloc:NO];
}
- (void)closeFile {
close(self->_fileDescriptor);
close(self->_fileDescriptor);
}
- (void)dealloc {
[self closeFile];
[self closeFile];
}
@end

@ -16,23 +16,22 @@
@implementation NSMutableArray
- (void)setObject:(id)anObject atIndexedSubscript:(NSUInteger)index {
NSObject *obj = (NSObject*)anObject;
id isa = obj->isa;
NSObject* obj = (NSObject*)anObject;
id isa = obj->isa;
}
- (void)addObject:(id)anObject {
NSObject *obj = (NSObject*)anObject;
id isa = obj->isa;
NSObject* obj = (NSObject*)anObject;
id isa = obj->isa;
}
- (void)insertObject:(id)anObject atIndex:(NSUInteger)index {
NSObject *obj = (NSObject*)anObject;
id isa = obj->isa;
NSObject* obj = (NSObject*)anObject;
id isa = obj->isa;
}
+ (instancetype)array {
return [NSMutableArray alloc];
return [NSMutableArray alloc];
}
@end

@ -16,21 +16,21 @@
@implementation NSMutableDictionary
- (void)setObject:(id)object forKeyedSubscript:(id)aKey {
NSObject *obj = (NSObject*)object;
id isa = obj->isa;
NSObject *key = (NSObject*)aKey;
id isa2 = key->isa;
NSObject* obj = (NSObject*)object;
id isa = obj->isa;
NSObject* key = (NSObject*)aKey;
id isa2 = key->isa;
}
- (void)setObject:(id)anObject forKey:(id)aKey {
NSObject *obj = (NSObject*)anObject;
id isa = obj->isa;
NSObject *key = (NSObject*)aKey;
id isa2 = key->isa;
NSObject* obj = (NSObject*)anObject;
id isa = obj->isa;
NSObject* key = (NSObject*)aKey;
id isa2 = key->isa;
}
+ (instancetype)dictionary {
return [NSMutableDictionary alloc];
return [NSMutableDictionary alloc];
}
@end

@ -14,39 +14,35 @@ void __set_unsubscribed_observer_attribute(id);
@interface NSNotificationCenter : NSObject
- (void) addObserver:(id)notificationObserver
selector:(SEL)notificationSelector
name:(NSString *)notificationName
object:(id)notificationSender;
- (void)addObserver:(id)notificationObserver
selector:(SEL)notificationSelector
name:(NSString*)notificationName
object:(id)notificationSender;
- (void) removeObserver:(id)notificationObserver;
- (void)removeObserver:(id)notificationObserver;
- (void) removeObserver:(id)notificationObserver
name:(NSString *)notificationName
object:(id)notificationSender;
- (void)removeObserver:(id)notificationObserver
name:(NSString*)notificationName
object:(id)notificationSender;
@end
@implementation NSNotificationCenter
- (void) addObserver:(id)notificationObserver
selector:(SEL)notificationSelector
name:(NSString *)notificationName
object:(id)notificationSender
{
__set_observer_attribute(notificationObserver);
- (void)addObserver:(id)notificationObserver
selector:(SEL)notificationSelector
name:(NSString*)notificationName
object:(id)notificationSender {
__set_observer_attribute(notificationObserver);
}
- (void) removeObserver:(id)notificationObserver
{
__set_unsubscribed_observer_attribute(notificationObserver);
- (void)removeObserver:(id)notificationObserver {
__set_unsubscribed_observer_attribute(notificationObserver);
}
- (void) removeObserver:(id)notificationObserver
name:(NSString *)notificationName
object:(id)notificationSender
{
__set_unsubscribed_observer_attribute(notificationObserver);
- (void)removeObserver:(id)notificationObserver
name:(NSString*)notificationName
object:(id)notificationSender {
__set_unsubscribed_observer_attribute(notificationObserver);
}
@end

@ -10,7 +10,7 @@
#import <Foundation/NSObject.h>
@interface NSNumber : NSObject {
double value;
double value;
}
@end

@ -9,51 +9,50 @@
#import "NSNumber.h"
@implementation NSNumber
+(NSNumber *)numberWithInt:(int)value {
// using alloc as the documentation doesn't say it may return nil
NSNumber *number = [self alloc];
return [number initWithInt:value];
+ (NSNumber*)numberWithInt:(int)value {
// using alloc as the documentation doesn't say it may return nil
NSNumber* number = [self alloc];
return [number initWithInt:value];
}
- (id)initWithInt:(int)v {
self->value = (double)v;
return self;
self->value = (double)v;
return self;
}
+(NSNumber *)numberWithFloat:(float)value {
// using alloc as the documentation doesn't say it may return nil
NSNumber *number = [NSNumber alloc];
return [number initWithInt:value];
+ (NSNumber*)numberWithFloat:(float)value {
// using alloc as the documentation doesn't say it may return nil
NSNumber* number = [NSNumber alloc];
return [number initWithInt:value];
}
- (id)initWithFloat:(float)v {
self->value = (double)v;
return self;
self->value = (double)v;
return self;
}
+(NSNumber *)numberWithDouble:(double)value {
// using alloc as the documentation doesn't say it may return nil
NSNumber *number = [self alloc];
return [number initWithInt:value];
+ (NSNumber*)numberWithDouble:(double)value {
// using alloc as the documentation doesn't say it may return nil
NSNumber* number = [self alloc];
return [number initWithInt:value];
}
- (id)initWithDouble:(double)v {
self->value = v;
return self;
self->value = v;
return self;
}
+(NSNumber *)numberWithBool:(BOOL)value {
// using alloc as the documentation doesn't say it may return nil
NSNumber *number = [self alloc];
return [number initWithBool:value];
+ (NSNumber*)numberWithBool:(BOOL)value {
// using alloc as the documentation doesn't say it may return nil
NSNumber* number = [self alloc];
return [number initWithBool:value];
}
- (id)initWithBool:(BOOL)v {
self->value = (double)v;
return self;
self->value = (double)v;
return self;
}
@end

@ -18,6 +18,6 @@
@implementation NSObject
- (id)init {
return (id)self;
return (id)self;
}
@end

@ -7,39 +7,28 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import <Foundation/NSObject.h>
#import <Foundation/NSDate.h>
#import <Foundation/NSObject.h>
@class NSTimer;
@interface NSRunLoop : NSObject
+ (NSRunLoop*) currentRunLoop;
+ (NSRunLoop*) mainRunLoop;
+ (NSRunLoop*)currentRunLoop;
+ (NSRunLoop*)mainRunLoop;
- (void)acceptInputForMode:(NSString*)mode beforeDate:(NSDate*)limit_date;
- (void) acceptInputForMode: (NSString*)mode
beforeDate: (NSDate*)limit_date;
- (void)addTimer:(NSTimer*)timer forMode:(NSString*)mode;
- (void) addTimer: (NSTimer*)timer
forMode: (NSString*)mode;
- (NSString*)currentMode;
- (NSString*) currentMode;
- (NSDate*)limitDateForMode:(NSString*)mode;
- (NSDate*) limitDateForMode: (NSString*)mode;
- (void)run;
- (void) run;
- (BOOL)runMode:(NSString*)mode beforeDate:(NSDate*)date;
- (BOOL) runMode: (NSString*)mode
beforeDate: (NSDate*)date;
- (void) runUntilDate: (NSDate*)date;
- (void)runUntilDate:(NSDate*)date;
@end

@ -7,50 +7,44 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import "NSRunLoop.h"
@implementation NSRunLoop
@implementation NSRunLoop
+ (NSRunLoop*) currentRunLoop {
+ (NSRunLoop*)currentRunLoop {
return [NSRunLoop alloc];
return [NSRunLoop alloc];
};
+ (NSRunLoop*) mainRunLoop {
+ (NSRunLoop*)mainRunLoop {
return [NSRunLoop alloc];
return [NSRunLoop alloc];
};
- (void)acceptInputForMode:(NSString*)mode beforeDate:(NSDate*)limit_date{};
- (void) acceptInputForMode: (NSString*)mode
beforeDate: (NSDate*)limit_date {
};
- (void)addTimer:(NSTimer*)timer
forMode:(NSString*)mode{
- (void) addTimer: (NSTimer*)timer
forMode: (NSString*)mode {
};
- (NSString*)currentMode {
return @"";
};
- (NSString*) currentMode {
return @"";
};
- (NSDate*)limitDateForMode:(NSString*)mode {
- (NSDate*) limitDateForMode: (NSString*)mode {
return [NSDate alloc];
return [NSDate alloc];
};
- (void) run {};
- (void)run{};
- (BOOL) runMode: (NSString*)mode
beforeDate: (NSDate*)date {
- (BOOL)runMode:(NSString*)mode beforeDate:(NSDate*)date {
int res;
return res;
int res;
return res;
};
- (void) runUntilDate: (NSDate*)date {};
- (void)runUntilDate:(NSDate*)date{};
@end

@ -10,9 +10,9 @@
#import <Foundation/NSObject.h>
@interface NSString : NSObject {
const char * value;
const char* value;
}
+ (instancetype)stringWithUTF8String:(const char *)bytes;
+ (instancetype)stringWithUTF8String:(const char*)bytes;
@end

@ -14,24 +14,23 @@ void __get_array_size(const UInt8);
@implementation NSString
+ (instancetype)stringWithUTF8String:(const char *)bytes {
// using alloc as the documentation doesn't say it may return nil
NSString *s = [NSString alloc];
s->value = bytes;
return s;
+ (instancetype)stringWithUTF8String:(const char*)bytes {
// using alloc as the documentation doesn't say it may return nil
NSString* s = [NSString alloc];
s->value = bytes;
return s;
}
- (instancetype)initWithBytesNoCopy:(char*)bytes
length:(NSUInteger)length
encoding:(id)encoding
freeWhenDone:(BOOL)flag {
if (flag == YES) {
if (bytes) {
__get_array_size(bytes);
free(bytes);
}
}
return self;
if (flag == YES) {
if (bytes) {
__get_array_size(bytes);
free(bytes);
}
}
return self;
}
@end

@ -11,49 +11,47 @@
@class NSInvocation;
@interface NSTimer : NSObject
{
NSTimeInterval _interval;
id _info;
id _target;
SEL _selector;
unsigned _repeats:2;
unsigned _timer_filler:6;
@public
NSDate *_fireDate;
BOOL _is_valid;
@interface NSTimer : NSObject {
NSTimeInterval _interval;
id _info;
id _target;
SEL _selector;
unsigned _repeats : 2;
unsigned _timer_filler : 6;
@public
NSDate* _fireDate;
BOOL _is_valid;
}
+ (NSTimer *) scheduledTimerWithTimeInterval:(NSTimeInterval) ti
invocation:(NSInvocation *) invocation
repeats:(BOOL) f;
+ (NSTimer *) scheduledTimerWithTimeInterval:(NSTimeInterval) ti
target:(id) object
selector:(SEL) selector
userInfo:(id) info
repeats:(BOOL) f;
+ (NSTimer *) timerWithTimeInterval:(NSTimeInterval) ti
invocation:(NSInvocation *) invocation
repeats:(BOOL) f;
+ (NSTimer *) timerWithTimeInterval:(NSTimeInterval) ti
target:(id) object
selector:(SEL) selector
userInfo:(id) info
repeats:(BOOL) f;
+ (NSTimer*)scheduledTimerWithTimeInterval:(NSTimeInterval)ti
invocation:(NSInvocation*)invocation
repeats:(BOOL)f;
+ (NSTimer*)scheduledTimerWithTimeInterval:(NSTimeInterval)ti
target:(id)object
selector:(SEL)selector
userInfo:(id)info
repeats:(BOOL)f;
+ (NSTimer*)timerWithTimeInterval:(NSTimeInterval)ti
invocation:(NSInvocation*)invocation
repeats:(BOOL)f;
+ (NSTimer*)timerWithTimeInterval:(NSTimeInterval)ti
target:(id)object
selector:(SEL)selector
userInfo:(id)info
repeats:(BOOL)f;
- (void) fire;
- (NSDate *) fireDate;
- (id) initWithFireDate:(NSDate *) date
interval:(NSTimeInterval) seconds
target:(id) target
selector:(SEL) aSelector
userInfo:(id) userInfo
repeats:(BOOL) repeats;
- (void) invalidate;
- (BOOL) isValid;
- (void) setFireDate:(NSDate *) date;
- (NSTimeInterval) timeInterval;
- (id) userInfo;
- (void)fire;
- (NSDate*)fireDate;
- (id)initWithFireDate:(NSDate*)date
interval:(NSTimeInterval)seconds
target:(id)target
selector:(SEL)aSelector
userInfo:(id)userInfo
repeats:(BOOL)repeats;
- (void)invalidate;
- (BOOL)isValid;
- (void)setFireDate:(NSDate*)date;
- (NSTimeInterval)timeInterval;
- (id)userInfo;
@end

@ -13,132 +13,117 @@
// Note: we do not link timers to NSRunLoop as this is irrelevant for
// our models. If at some point becomes important it needs to be changed.
void free(void *ptr);
void free(void* ptr);
@implementation NSTimer
+ (NSTimer*) timerWithTimeInterval:(NSTimeInterval)seconds
invocation:(NSInvocation *)invocation
repeats:(BOOL)f
{
NSTimer *t = [self alloc];
if(t)
{
t->_interval = seconds;
t->_fireDate = [NSDate alloc];
t->_is_valid = YES;
t->_target = invocation;
t->_repeats = f;
}
return t;
+ (NSTimer*)timerWithTimeInterval:(NSTimeInterval)seconds
invocation:(NSInvocation*)invocation
repeats:(BOOL)f {
NSTimer* t = [self alloc];
if (t) {
t->_interval = seconds;
t->_fireDate = [NSDate alloc];
t->_is_valid = YES;
t->_target = invocation;
t->_repeats = f;
}
return t;
}
+ (NSTimer*) timerWithTimeInterval:(NSTimeInterval)seconds
target:(id)object
selector:(SEL)selector
userInfo:(id)info
repeats:(BOOL)f
{
NSDate *d = [NSDate alloc];
return [[self alloc] initWithFireDate:d
interval:seconds
target:object
selector:selector
userInfo:info
repeats:f];
+ (NSTimer*)timerWithTimeInterval:(NSTimeInterval)seconds
target:(id)object
selector:(SEL)selector
userInfo:(id)info
repeats:(BOOL)f {
NSDate* d = [NSDate alloc];
return [[self alloc] initWithFireDate:d
interval:seconds
target:object
selector:selector
userInfo:info
repeats:f];
}
+ (NSTimer*) scheduledTimerWithTimeInterval:(NSTimeInterval)ti
invocation:(NSInvocation *)invocation
repeats:(BOOL)f
{
NSTimer *t = [self timerWithTimeInterval:ti invocation:invocation repeats:f];
return t;
+ (NSTimer*)scheduledTimerWithTimeInterval:(NSTimeInterval)ti
invocation:(NSInvocation*)invocation
repeats:(BOOL)f {
NSTimer* t = [self timerWithTimeInterval:ti invocation:invocation repeats:f];
return t;
}
+ (NSTimer*) scheduledTimerWithTimeInterval:(NSTimeInterval)ti
target:(id)object
selector:(SEL)selector
userInfo:(id)info
repeats:(BOOL)f
{
NSTimer *t = [self timerWithTimeInterval: ti
target: object
selector: selector
userInfo: info
repeats: f];
return t;
+ (NSTimer*)scheduledTimerWithTimeInterval:(NSTimeInterval)ti
target:(id)object
selector:(SEL)selector
userInfo:(id)info
repeats:(BOOL)f {
NSTimer* t = [self timerWithTimeInterval:ti
target:object
selector:selector
userInfo:info
repeats:f];
return t;
}
- (id) initWithFireDate:(NSDate *) date
interval:(NSTimeInterval)seconds
target:(id)object
selector:(SEL)selector
userInfo:(id)info
repeats:(BOOL)f
{
_interval = seconds;
_fireDate = date;
_is_valid = YES;
_selector = selector;
_target = object;
_info = info;
_repeats = f;
return self;
- (id)initWithFireDate:(NSDate*)date
interval:(NSTimeInterval)seconds
target:(id)object
selector:(SEL)selector
userInfo:(id)info
repeats:(BOOL)f {
_interval = seconds;
_fireDate = date;
_is_valid = YES;
_selector = selector;
_target = object;
_info = info;
_repeats = f;
return self;
}
- (void) dealloc
{
_fireDate=nil;
free(self);
- (void)dealloc {
_fireDate = nil;
free(self);
}
- (NSString *) description;
{
return [NSString alloc];
}
- (NSString*)description;
{ return [NSString alloc]; }
// Abstract everything except making the timer invalid if
// cannot repeat
- (void) fire
{
if(!_repeats)
_is_valid = NO;
}
- (void) invalidate
{
- (void)fire {
if (!_repeats)
_is_valid = NO;
}
- (BOOL) isValid {
return _is_valid;
- (void)invalidate {
_is_valid = NO;
}
- (NSDate *) fireDate {
return _fireDate;
- (BOOL)isValid {
return _is_valid;
}
- (NSTimeInterval) timeInterval {
return _interval;
- (NSDate*)fireDate {
return _fireDate;
}
- (id) userInfo {
return _info;
- (NSTimeInterval)timeInterval {
return _interval;
}
- (void) setFireDate:(NSDate *)date;
{
_fireDate =date;
- (id)userInfo {
return _info;
}
- (int) compare:(NSTimer*)anotherTimer
{
int res;
return res;
- (void)setFireDate:(NSDate*)date;
{ _fireDate = date; }
- (int)compare:(NSTimer*)anotherTimer {
int res;
return res;
}
@end

@ -8,58 +8,57 @@
*/
#include "clang/Frontend/FrontendPluginRegistry.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/AST.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/Frontend/CompilerInstance.h"
#include "llvm/Support/raw_ostream.h"
using namespace clang;
namespace {
class PrintFunctionsConsumer : public ASTConsumer {
public:
virtual bool HandleTopLevelDecl(DeclGroupRef DG) {
for (DeclGroupRef::iterator i = DG.begin(), e = DG.end(); i != e; ++i) {
const Decl *D = *i;
if (const NamedDecl *ND = dyn_cast<NamedDecl>(D))
llvm::errs() << "top-level-decl: \"" << ND->getNameAsString() << "\"\n";
}
return true;
class PrintFunctionsConsumer : public ASTConsumer {
public:
virtual bool HandleTopLevelDecl(DeclGroupRef DG) {
for (DeclGroupRef::iterator i = DG.begin(), e = DG.end(); i != e; ++i) {
const Decl* D = *i;
if (const NamedDecl* ND = dyn_cast<NamedDecl>(D))
llvm::errs() << "top-level-decl: \"" << ND->getNameAsString() << "\"\n";
}
};
class PrintFunctionNamesAction : public PluginASTAction {
protected:
ASTConsumer *CreateASTConsumer(CompilerInstance &CI, llvm::StringRef) {
return new PrintFunctionsConsumer();
}
return true;
}
};
bool ParseArgs(const CompilerInstance &CI,
const std::vector<std::string>& args) {
for (unsigned i = 0, e = args.size(); i != e; ++i) {
llvm::errs() << "toplevel-plugin arg = " << args[i] << "\n";
class PrintFunctionNamesAction : public PluginASTAction {
protected:
ASTConsumer* CreateASTConsumer(CompilerInstance& CI, llvm::StringRef) {
return new PrintFunctionsConsumer();
}
// Example error handling.
if (args[i] == "-an-error") {
DiagnosticsEngine &D = CI.getDiagnostics();
unsigned DiagID = D.getCustomDiagID(
DiagnosticsEngine::Error, "invalid argument '" + args[i] + "'");
D.Report(DiagID);
return false;
}
}
if (args.size() && args[0] == "help")
PrintHelp(llvm::errs());
bool ParseArgs(const CompilerInstance& CI,
const std::vector<std::string>& args) {
for (unsigned i = 0, e = args.size(); i != e; ++i) {
llvm::errs() << "toplevel-plugin arg = " << args[i] << "\n";
return true;
}
void PrintHelp(llvm::raw_ostream& ros) {
ros << "Help for toplevel-plugin plugin goes here\n";
// Example error handling.
if (args[i] == "-an-error") {
DiagnosticsEngine& D = CI.getDiagnostics();
unsigned DiagID = D.getCustomDiagID(
DiagnosticsEngine::Error, "invalid argument '" + args[i] + "'");
D.Report(DiagID);
return false;
}
}
if (args.size() && args[0] == "help")
PrintHelp(llvm::errs());
};
return true;
}
void PrintHelp(llvm::raw_ostream& ros) {
ros << "Help for toplevel-plugin plugin goes here\n";
}
};
}
static FrontendPluginRegistry::Add<PrintFunctionNamesAction> X("infer-plugin", "print function names");
static FrontendPluginRegistry::Add<PrintFunctionNamesAction> X(
"infer-plugin", "print function names");

@ -7,12 +7,10 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
#include <stdlib.h>
#include <assert.h>
#include <stdlib.h>
void simple_check(int x) {
assert(x < 3);
}
void simple_check(int x) { assert(x < 3); }
void simple_assertion_failure() {
int x = 4;
@ -24,16 +22,12 @@ void no_assertion_failure() {
simple_check(x);
}
typedef struct {
int value;
} node;
typedef struct { int value; } node;
void check_node(node *n) {
assert(n->value < 3);
}
void check_node(node* n) { assert(n->value < 3); }
node* assertion_failure_with_heap() {
node *n = malloc(sizeof(node));
node* n = malloc(sizeof(node));
if (n != NULL) {
n->value = 4;
check_node(n);
@ -42,7 +36,7 @@ node* assertion_failure_with_heap() {
}
node* no_assertion_failure_with_heap() {
node *n = malloc(sizeof(node));
node* n = malloc(sizeof(node));
if (n != NULL) {
n->value = 2;
check_node(n);
@ -58,9 +52,7 @@ void my_assert(int x) {
}
}
void should_not_report_assertion_failure(int x) {
my_assert(x);
}
void should_not_report_assertion_failure(int x) { my_assert(x); }
void should_report_assertion_failure(int x) {
x = 0;
@ -69,9 +61,7 @@ void should_report_assertion_failure(int x) {
int global;
void check_global() {
assert(global != 0);
}
void check_global() { assert(global != 0); }
void skip() {}

@ -11,14 +11,14 @@
extern int add_all_ints(int x, int y, int z, ...) __attribute__((sentinel));
void valid_call(int *a, int *b, int *c) {
void valid_call(int* a, int* b, int* c) {
// fine
int x = add_all_ints(0, 0, 0, a, b, c, NULL);
}
void truncated_call(void) {
int a = 0, b = 1, c = 2, d = 3;
int *p = NULL;
int* p = NULL;
// warning: p is NULL so only first argument sent to add_all_ints
int x = add_all_ints(0, 0, 0, &a, p, &b, &c, &d, NULL);

@ -12,7 +12,8 @@
void __infer_fail(char*);
void check_exponent(int x) {
if (x < 0) __infer_fail("UNEXPECTED_NEGATIVE_EXPONENT");
if (x < 0)
__infer_fail("UNEXPECTED_NEGATIVE_EXPONENT");
}
int power(int x) {
@ -32,9 +33,7 @@ int paf() {
int global;
void set_global() {
global = -2;
}
void set_global() { global = -2; }
int pouf() {
set_global();

@ -10,32 +10,32 @@
#include <stdio.h>
#include <stdlib.h>
int *set42(int* x) {
*x = 42;
return x;
int* set42(int* x) {
*x = 42;
return x;
}
void nodpd () {
int w,*z;
z = set42(&w);
void nodpd() {
int w, *z;
z = set42(&w);
}
void nodpd1 () {
int *y = malloc(sizeof(int));
int *z;
z = set42(y);
free(y);
void nodpd1() {
int* y = malloc(sizeof(int));
int* z;
z = set42(y);
free(y);
}
void dpd () {
int *y;
int *z;
z = set42(y);
void dpd() {
int* y;
int* z;
z = set42(y);
}
void intraprocdpd () {
int *y;
int *z;
*y = 42;
z = y;
void intraprocdpd() {
int* y;
int* z;
*y = 42;
z = y;
}

@ -12,10 +12,6 @@ struct point {
int y;
};
int return_zero() {
return ((struct point) { .y = 32, .x = 0 }).x;
}
int return_zero() { return ((struct point){.y = 32, .x = 0}).x; }
int divide_by_zero() {
return 1/return_zero();
}
int divide_by_zero() { return 1 / return_zero(); }

@ -8,6 +8,6 @@
*/
int init_divide_by_zero() {
int t[2][3][2] = {{{1,1},{2,2},{3,3}},{{4,4},{5,5},{1,0}}};
return t[0][1][0]/t[1][2][1];
int t[2][3][2] = {{{1, 1}, {2, 2}, {3, 3}}, {{4, 4}, {5, 5}, {1, 0}}};
return t[0][1][0] / t[1][2][1];
}

@ -8,20 +8,20 @@
*/
struct l2 {
int b;
struct l2 *a;
int b;
struct l2* a;
};
int add2(struct l2 *l) {
int r = 0;
for (; l; l = l->a) {
r += l->b;
}
return r;
int add2(struct l2* l) {
int r = 0;
for (; l; l = l->a) {
r += l->b;
}
return r;
}
/* Divide by zero error shows that we get a spec for add2 */
int main() {
int res = add2(0);
return 5/res;
int res = add2(0);
return 5 / res;
}

@ -7,40 +7,45 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
int m(int z) {
int y = 0;
int x = 5;
if (z < 10) {
int x = 7;
if (x == 7) return x/y;
}
if (x == 5)
return x/y;
else return 0;
int y = 0;
int x = 5;
if (z < 10) {
int x = 7;
if (x == 7)
return x / y;
}
if (x == 5)
return x / y;
else
return 0;
}
int mm() {
int y = 0;
int x = 0;
{
int x = 5;
if (x == 5) return x/y;
}
if (x == 0)
return x/y;
else return 0;
int y = 0;
int x = 0;
{
int x = 5;
if (x == 5)
return x / y;
}
if (x == 0)
return x / y;
else
return 0;
}
int t() {
int y = 0;
int x = 1;
int z = 0;
int y = 0;
int x = 1;
int z = 0;
for (int x = 0; x < 10; x++) {
int x = 9;
if (x == 9) return x/y;
else return 0;
}
return 0;
for (int x = 0; x < 10; x++) {
int x = 9;
if (x == 9)
return x / y;
else
return 0;
}
return 0;
}

@ -11,32 +11,31 @@
#include <string.h>
void simple_leak() {
int *p;
p = (int*) malloc(sizeof(int));
int* p;
p = (int*)malloc(sizeof(int));
}
void common_realloc_leak() {
int *p, *q;
p = (int*) malloc(sizeof(int));
q = (int*) realloc(p, sizeof(int) * 42);
p = (int*)malloc(sizeof(int));
q = (int*)realloc(p, sizeof(int) * 42);
// if realloc fails, then p becomes unreachable
if (q != NULL) free(q);
if (q != NULL)
free(q);
}
int* allocate() {
int *p = NULL;
int* p = NULL;
do {
p = (int*) malloc(sizeof(int));
p = (int*)malloc(sizeof(int));
} while (p == NULL);
return p;
}
void uses_allocator() {
int *p;
int* p;
p = allocate();
*p = 42;
}
void * builtin_no_leak(size_t s) {
return memset(malloc(s), 0, s);
}
void* builtin_no_leak(size_t s) { return memset(malloc(s), 0, s); }

@ -13,17 +13,17 @@ struct delicious {
int yum;
};
struct delicious *bake(struct delicious **cake) {
int *zero = NULL;
struct delicious* bake(struct delicious** cake) {
int* zero = NULL;
*zero = 3;
return NULL;
}
struct delicious *skip_function_with_no_spec(void) {
struct delicious *cake = NULL;
struct delicious* skip_function_with_no_spec(void) {
struct delicious* cake = NULL;
int i;
if(bake(&cake) == NULL) {
if (bake(&cake) == NULL) {
return 0;
}
@ -31,17 +31,17 @@ struct delicious *skip_function_with_no_spec(void) {
return cake;
}
extern struct delicious *bakery(struct delicious **cake);
extern struct delicious *bakery2(struct delicious **cake,
struct delicious **pie);
extern struct delicious *returnPassByRef();
extern void skip(struct delicious * s);
extern struct delicious* bakery(struct delicious** cake);
extern struct delicious* bakery2(struct delicious** cake,
struct delicious** pie);
extern struct delicious* returnPassByRef();
extern void skip(struct delicious* s);
struct delicious *skip_external_function(void) {
struct delicious *cake = NULL;
struct delicious* skip_external_function(void) {
struct delicious* cake = NULL;
int i;
if(bakery(&cake) == NULL) {
if (bakery(&cake) == NULL) {
return 0;
}
@ -49,9 +49,9 @@ struct delicious *skip_external_function(void) {
return cake;
}
void by_ref_actual_already_in_footprint(struct delicious *param) {
void by_ref_actual_already_in_footprint(struct delicious* param) {
int i;
struct delicious * ret = bakery(&param);
struct delicious* ret = bakery(&param);
i = param->yum;
}
@ -59,11 +59,11 @@ void call_by_ref_actual_already_in_footprint_ok() {
by_ref_actual_already_in_footprint(NULL); // should not report a warning
}
void by_ref_actual_already_in_footprint2(struct delicious *param) {
void by_ref_actual_already_in_footprint2(struct delicious* param) {
int i;
i = param->yum; // should not report a warning
struct delicious * ret = bakery(&param);
i = param->yum; // should not report a warning
i = param->yum; // should not report a warning
struct delicious* ret = bakery(&param);
i = param->yum; // should not report a warning
}
void call_by_ref_actual_already_in_footprint_bad() {
@ -71,20 +71,20 @@ void call_by_ref_actual_already_in_footprint_bad() {
}
void passByRefTwice() {
struct delicious *param;
struct delicious* param;
bakery2(&param, &param); // should not report a warning
int i = param->yum;
}
struct delicious * returnPassByRef2() {
struct delicious *param = NULL;
struct delicious* returnPassByRef2() {
struct delicious* param = NULL;
bakery(&param);
int i = param->yum; // should not report a warning
return param;
}
void returnPassByRefDeref() {
struct delicious *ret = returnPassByRef();
struct delicious* ret = returnPassByRef();
ret->yum = 2; // should not report a warning
free(ret);
}

@ -11,392 +11,338 @@
#include <stdlib.h>
void crash_getc() {
FILE *f;
int i;
f = fopen("this_file_doesnt_exist", "r");
FILE* f;
int i;
f = fopen("this_file_doesnt_exist", "r");
i = getc(f);
printf("i =%i\n", i);
fclose(f);
}
void nocrash_getc() {
FILE* f;
int i;
f = fopen("this_file_doesnt_exist", "r");
if (f) {
i = getc(f);
printf("i =%i\n", i);
fclose(f);
}
}
void nocrash_getc() {
FILE *f;
int i;
f = fopen("this_file_doesnt_exist", "r");
if (f) {
i = getc(f);
printf("i =%i\n", i);
fclose(f);
}
void crash_fgetc() {
FILE* f;
int i;
f = fopen("this_file_doesnt_exist", "r");
i = fgetc(f);
printf("i =%i\n", i);
fclose(f);
}
void crash_fgetc() {
FILE *f;
int i;
f = fopen("this_file_doesnt_exist", "r");
void nocrash_fgetc() {
FILE* f;
int i;
f = fopen("this_file_doesnt_exist", "r");
if (f) {
i = fgetc(f);
printf("i =%i\n", i);
fclose(f);
}
}
void nocrash_fgetc() {
FILE *f;
int i;
f = fopen("this_file_doesnt_exist", "r");
if (f) {
i = fgetc(f);
printf("i =%i\n", i);
fclose(f);
}
}
void crash_ungetc() {
FILE* f;
f = fopen("this_file_doesnt_exist", "r");
void crash_ungetc()
{
FILE *f;
int i = ungetc(10, f);
fclose(f);
}
f = fopen("this_file_doesnt_exist", "r");
void nocrash_ungetc() {
FILE* f;
int i =ungetc(10,f);
f = fopen("this_file_doesnt_exist", "r");
if (f) {
int i = ungetc(10, f);
fclose(f);
}
}
void nocrash_ungetc()
{
FILE *f;
void crash_fputs() {
FILE* f;
f = fopen("this_file_doesnt_exist", "r");
if (f) {
int i =ungetc(10,f);
fclose(f);
}
f = fopen("this_file_doesnt_exist", "r");
fputs("blablabla", f);
fclose(f);
}
void crash_fputs()
{
FILE *f;
void nocrash_fputs() {
FILE* f;
f = fopen("this_file_doesnt_exist", "r");
f = fopen("this_file_doesnt_exist", "r");
if (f) {
fputs("blablabla", f);
fclose(f);
}
}
void nocrash_fputs()
{
FILE *f;
void crash_fputc() {
FILE* f;
f = fopen("this_file_doesnt_exist", "r");
if (f) {
fputs("blablabla", f);
fclose(f);
}
f = fopen("this_file_doesnt_exist", "r");
fputc(42, f);
fclose(f);
}
void crash_fputc()
{
FILE *f;
void nocrash_fputc() {
FILE* f;
f = fopen("this_file_doesnt_exist", "r");
f = fopen("this_file_doesnt_exist", "r");
if (f) {
fputc(42, f);
fclose(f);
}
}
void nocrash_fputc()
{
FILE *f;
void crash_putc() {
FILE* f;
f = fopen("this_file_doesnt_exist", "r");
if (f) {
fputc(42, f);
fclose(f);
}
f = fopen("this_file_doesnt_exist", "r");
putc(42, f);
fclose(f);
}
void crash_putc()
{
FILE *f;
void nocrash_putc() {
FILE* f;
f = fopen("this_file_doesnt_exist", "r");
f = fopen("this_file_doesnt_exist", "r");
if (f) {
putc(42, f);
fclose(f);
}
}
void nocrash_putc()
{
FILE *f;
void crash_fseeks() {
FILE* f;
f = fopen("this_file_doesnt_exist", "r");
if (f) {
putc(42, f);
fclose(f);
}
f = fopen("this_file_doesnt_exist", "r");
fseek(f, 7, SEEK_SET);
fclose(f);
}
void crash_fseeks()
{
FILE *f;
void nocrash_fseek() {
FILE* f;
f = fopen("this_file_doesnt_exist", "r");
fseek( f, 7, SEEK_SET );
f = fopen("this_file_doesnt_exist", "r");
if (f) {
fseek(f, 7, SEEK_SET);
fclose(f);
}
}
void nocrash_fseek()
{
FILE *f;
void crash_ftell() {
FILE* f;
f = fopen("this_file_doesnt_exist", "r");
if (f) {
fseek( f, 7, SEEK_SET );
fclose(f);
}
f = fopen("this_file_doesnt_exist", "r");
ftell(f);
fclose(f);
}
void crash_ftell()
{
FILE *f;
void nocrash_ftell() {
FILE* f;
f = fopen("this_file_doesnt_exist", "r");
f = fopen("this_file_doesnt_exist", "r");
if (f) {
ftell(f);
fclose(f);
}
}
void nocrash_ftell()
{
FILE *f;
void crash_fgets() {
FILE* f;
char str[60];
f = fopen("this_file_doesnt_exist", "r");
if (f) {
ftell( f);
fclose(f);
}
f = fopen("this_file_doesnt_exist", "r");
fgets(str, 60, f);
fclose(f);
}
void crash_fgets()
{
FILE *f;
char str[60];
void nocrash_fgets() {
FILE* f;
char str[60];
f = fopen("this_file_doesnt_exist", "r");
fgets(str,60, f);
f = fopen("this_file_doesnt_exist", "r");
if (f) {
fgets(str, 60, f);
fclose(f);
}
}
void nocrash_fgets()
{
FILE *f;
char str[60];
void crash_rewind() {
FILE* f;
f = fopen("this_file_doesnt_exist", "r");
if (f) {
fgets(str,60, f);
fclose(f);
}
f = fopen("this_file_doesnt_exist", "r");
rewind(f);
fclose(f);
}
void nocrash_rewind() {
FILE* f;
void crash_rewind()
{
FILE *f;
f = fopen("this_file_doesnt_exist", "r");
f = fopen("this_file_doesnt_exist", "r");
if (f) {
rewind(f);
fclose(f);
}
}
void nocrash_rewind()
{
FILE *f;
void crash_fileno() {
FILE* f;
f = fopen("this_file_doesnt_exist", "r");
if (f) {
rewind( f);
fclose(f);
}
f = fopen("this_file_doesnt_exist", "r");
fileno(f);
fclose(f);
}
void crash_fileno()
{
FILE *f;
void nocrash_fileno() {
FILE* f;
f = fopen("this_file_doesnt_exist", "r");
f = fopen("this_file_doesnt_exist", "r");
if (f) {
fileno(f);
fclose(f);
}
}
void nocrash_fileno()
{
FILE *f;
void crash_clearerr() {
FILE* f;
f = fopen("this_file_doesnt_exist", "r");
if (f) {
fileno( f);
fclose(f);
}
f = fopen("this_file_doesnt_exist", "r");
clearerr(f);
fclose(f);
}
void nocrash_clearerr() {
FILE* f;
void crash_clearerr()
{
FILE *f;
f = fopen("this_file_doesnt_exist", "r");
f = fopen("this_file_doesnt_exist", "r");
if (f) {
clearerr(f);
fclose(f);
}
}
void nocrash_clearerr()
{
FILE *f;
void crash_ferror() {
FILE* f;
f = fopen("this_file_doesnt_exist", "r");
if (f) {
clearerr( f);
fclose(f);
}
f = fopen("this_file_doesnt_exist", "r");
ferror(f);
fclose(f);
}
void crash_ferror()
{
FILE *f;
void nocrash_ferror() {
FILE* f;
f = fopen("this_file_doesnt_exist", "r");
f = fopen("this_file_doesnt_exist", "r");
if (f) {
ferror(f);
fclose(f);
}
}
void nocrash_ferror()
{
FILE *f;
void crash_feof() {
FILE* f;
f = fopen("this_file_doesnt_exist", "r");
if (f) {
ferror( f);
fclose(f);
}
f = fopen("this_file_doesnt_exist", "r");
feof(f);
fclose(f);
}
void crash_feof()
{
FILE *f;
void nocrash_feof() {
FILE* f;
f = fopen("this_file_doesnt_exist", "r");
f = fopen("this_file_doesnt_exist", "r");
if (f) {
feof(f);
fclose(f);
}
}
void nocrash_feof()
{
FILE *f;
void crash_fprintf() {
FILE* f;
f = fopen("this_file_doesnt_exist", "r");
if (f) {
feof(f);
fclose(f);
}
f = fopen("this_file_doesnt_exist", "r");
fprintf(f, "blablabla\n");
fclose(f);
}
void nocrash_fprintf() {
FILE* f;
void crash_fprintf()
{
FILE *f;
f = fopen("this_file_doesnt_exist", "r");
fprintf(f,"blablabla\n");
f = fopen("this_file_doesnt_exist", "r");
if (f) {
fprintf(f, "blablabla\n");
fclose(f);
}
}
void nocrash_fprintf()
{
FILE *f;
void crash_vfprintf() {
FILE* f;
va_list arg;
f = fopen("this_file_doesnt_exist", "r");
if (f) {
fprintf(f,"blablabla\n");
fclose(f);
}
f = fopen("this_file_doesnt_exist", "r");
vfprintf(f, "blablabla\n", arg);
fclose(f);
}
void crash_vfprintf()
{
FILE *f;
va_list arg;
void nocrash_vfprintf() {
FILE* f;
va_list arg;
f = fopen("this_file_doesnt_exist", "r");
vfprintf(f,"blablabla\n",arg);
f = fopen("this_file_doesnt_exist", "r");
if (f) {
vfprintf(f, "blablabla\n", arg);
fclose(f);
}
}
void nocrash_vfprintf()
{
FILE *f;
va_list arg;
void crash_fgetpos() {
FILE* f;
fpos_t position;
f = fopen("this_file_doesnt_exist", "r");
if (f) {
vfprintf(f,"blablabla\n",arg);
fclose(f);
}
f = fopen("this_file_doesnt_exist", "r");
fgetpos(f, &position);
fclose(f);
}
void nocrash_fgetpos() {
FILE* f;
fpos_t position;
void crash_fgetpos()
{
FILE *f;
fpos_t position;
f = fopen("this_file_doesnt_exist", "r");
fgetpos(f,&position);
f = fopen("this_file_doesnt_exist", "r");
if (f) {
fgetpos(f, &position);
fclose(f);
}
}
void nocrash_fgetpos()
{
FILE *f;
fpos_t position;
void crash_fsetpos() {
FILE* f;
fpos_t position;
f = fopen("this_file_doesnt_exist", "r");
if (f) {
fgetpos(f,&position);
fclose(f);
}
f = fopen("this_file_doesnt_exist", "r");
fsetpos(f, &position);
fclose(f);
}
void crash_fsetpos()
{
FILE *f;
fpos_t position;
void nocrash_fsetpos() {
FILE* f;
fpos_t position;
f = fopen("this_file_doesnt_exist", "r");
fsetpos(f,&position);
f = fopen("this_file_doesnt_exist", "r");
if (f) {
fsetpos(f, &position);
fclose(f);
}
void nocrash_fsetpos()
{
FILE *f;
fpos_t position;
f = fopen("this_file_doesnt_exist", "r");
if (f) {
fsetpos(f,&position);
fclose(f);
}
}
}

@ -16,90 +16,86 @@ struct Person {
};
int simple_null_pointer() {
struct Person *max = 0;
struct Person* max = 0;
return max->age;
}
struct Person *Person_create(int age, int height, int weight) {
struct Person *who = 0;
struct Person* Person_create(int age, int height, int weight) {
struct Person* who = 0;
return who;
}
int get_age(struct Person *who) {
return who->age;
}
int get_age(struct Person* who) { return who->age; }
int null_pointer_interproc() {
struct Person *joe = Person_create(32, 64, 140);
struct Person* joe = Person_create(32, 64, 140);
return get_age(joe);
}
int negation_in_conditional() {
int *x = 0;
if (!x) return 0;
else return *x; // this never happens
int* x = 0;
if (!x)
return 0;
else
return *x; // this never happens
}
int * foo() {
return 0;
}
int* foo() { return 0; }
void null_pointer_with_function_pointer() {
int * (*fp)();
int* (*fp)();
fp = foo;
int *x = fp();
int* x = fp();
*x = 3;
}
void use_exit (struct Person *htbl) {
if (!htbl)
exit(0);
int x = htbl->age;
void use_exit(struct Person* htbl) {
if (!htbl)
exit(0);
int x = htbl->age;
}
void basic_null_dereference() {
int *p = NULL;
int* p = NULL;
*p = 42; // NULL dereference
}
void no_check_for_null_after_malloc() {
int *p;
p = (int*) malloc(sizeof(int));
int* p;
p = (int*)malloc(sizeof(int));
*p = 42; // NULL dereference
free(p);
}
void no_check_for_null_after_realloc() {
int *p;
p = (int*) malloc(sizeof(int) * 5);
int* p;
p = (int*)malloc(sizeof(int) * 5);
if (p) {
p[3] = 42;
}
int *q = (int*) realloc(p, sizeof(int) * 10);
int* q = (int*)realloc(p, sizeof(int) * 10);
if (!q)
free(p);
q[7] = 0; // NULL dereference
q[7] = 0; // NULL dereference
free(q);
}
void assign(int *p, int n) {
*p = n;
}
void assign(int* p, int n) { *p = n; }
void potentially_null_pointer_passed_as_argument() {
int *p = NULL;
p = (int*) malloc(sizeof(int));
assign(p, 42); // NULL dereference
int* p = NULL;
p = (int*)malloc(sizeof(int));
assign(p, 42); // NULL dereference
free(p);
}
void null_passed_as_argument() {
assign(NULL, 42); // NULL dereference
assign(NULL, 42); // NULL dereference
}
void allocated_pointer_passed_as_argument() {
int *p = NULL;
p = (int*) malloc(sizeof(int));
int* p = NULL;
p = (int*)malloc(sizeof(int));
if (p) {
assign(p, 42);
free(p);
@ -107,28 +103,28 @@ void allocated_pointer_passed_as_argument() {
}
int* unsafe_allocate() {
int *p = NULL;
p = (int*) malloc(sizeof(int));
int* p = NULL;
p = (int*)malloc(sizeof(int));
return p;
}
int* safe_allocate() {
int *p = NULL;
int* p = NULL;
while (!p) {
p = (int*) malloc(sizeof(int));
p = (int*)malloc(sizeof(int));
}
return p;
}
void function_call_can_return_null_pointer() {
int *p = NULL;
int* p = NULL;
p = unsafe_allocate();
assign(p, 42); // NULL dereference
assign(p, 42); // NULL dereference
free(p);
}
void function_call_returns_allocated_pointer() {
int *p = NULL;
int* p = NULL;
p = safe_allocate();
assign(p, 42);
free(p);

@ -14,72 +14,69 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/select.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
void fileNotClosed()
{
int fd = open("hi.txt", O_WRONLY | O_CREAT | O_TRUNC, 0600);
if (fd != -1) {
char buffer[256];
// We can easily batch that by separating with space
write(fd, buffer, strlen(buffer));
}
void fileNotClosed() {
int fd = open("hi.txt", O_WRONLY | O_CREAT | O_TRUNC, 0600);
if (fd != -1) {
char buffer[256];
// We can easily batch that by separating with space
write(fd, buffer, strlen(buffer));
}
}
void fileClosed()
{
int fd = open("hi.txt", O_WRONLY | O_CREAT | O_TRUNC, 0600);
if (fd != -1) {
char buffer[256];
// We can easily batch that by separating with space
write(fd, buffer, strlen(buffer));
close(fd);
}
void fileClosed() {
int fd = open("hi.txt", O_WRONLY | O_CREAT | O_TRUNC, 0600);
if (fd != -1) {
char buffer[256];
// We can easily batch that by separating with space
write(fd, buffer, strlen(buffer));
close(fd);
}
}
void socketNotClosed()
{
int fd = socket(AF_LOCAL, SOCK_RAW, 0);
if (fd != -1) {
char buffer[256];
// We can easily batch that by separating with space
write(fd, buffer, strlen(buffer));
}
void socketNotClosed() {
int fd = socket(AF_LOCAL, SOCK_RAW, 0);
if (fd != -1) {
char buffer[256];
// We can easily batch that by separating with space
write(fd, buffer, strlen(buffer));
}
}
int socketClosed()
{
int socketFD = socket(AF_LOCAL, SOCK_RAW, 0);
if (socketFD == -1) {
return -1;
}
int socketClosed() {
int socketFD = socket(AF_LOCAL, SOCK_RAW, 0);
if (socketFD == -1) {
return -1;
}
int status;
int status;
status = fcntl(socketFD, F_SETFL, O_NONBLOCK);
if (status == -1) {
close(socketFD);
return -1;
}
status = fcntl(socketFD, F_SETFL, O_NONBLOCK);
if (status == -1) {
close(socketFD);
return -1;
}
int reuseaddr = 1;
status = setsockopt(socketFD, SOL_SOCKET, SO_REUSEADDR, &reuseaddr, sizeof(reuseaddr));
if (status == -1) {
close(socketFD);
return -1;
}
int reuseaddr = 1;
status = setsockopt(
socketFD, SOL_SOCKET, SO_REUSEADDR, &reuseaddr, sizeof(reuseaddr));
if (status == -1) {
close(socketFD);
return -1;
}
int nosigpipe = 1;
status = setsockopt(socketFD, SOL_SOCKET, SO_REUSEADDR, &nosigpipe, sizeof(nosigpipe));
if (status == -1) {
close(socketFD);
return -1;
}
int nosigpipe = 1;
status = setsockopt(
socketFD, SOL_SOCKET, SO_REUSEADDR, &nosigpipe, sizeof(nosigpipe));
if (status == -1) {
close(socketFD);
return -1;
}
return socketFD;
return socketFD;
}

@ -9,15 +9,15 @@
int main() {
int volatile a;
int *volatile b;
float *const c;
long double d;
int volatile a;
int* volatile b;
float* const c;
long double d;
static const int kDuration = 3;
static const int kDuration = 3;
int large_int = 9223372036854775807;
int overflow_int = 9223372036854775808;
int large_int = 9223372036854775807;
int overflow_int = 9223372036854775808;
return 0;
return 0;
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save