1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef _VCL_AQUA_COMMON_H
21 #define _VCL_AQUA_COMMON_H
23 #include <sal/types.h>
25 #include <ApplicationServices/ApplicationServices.h>
27 #include <tools/debug.hxx>
29 // CoreFoundation designers, in their wisdom, decided that CFRelease of NULL
30 // cause a Crash, yet few API can return NULL when asking for the creation
31 // of an object, which force us to peper the code with egly if construct everywhere
32 // and open the door to very nasty crash on rare occasion
33 // this macro hide the mess
34 #define SafeCFRelease(a) do { if(a) { CFRelease(a); (a)=NULL; } } while(false)
37 #define round_to_long(a) ((a) >= 0 ? ((long)((a) + 0.5)) : ((long)((a) - 0.5)))
39 #include "vcl/salgtype.hxx"
41 //#define msgs_debug(c,f,...)
42 // fprintf(stderr, "%s::%s(%p:%04.4x)\n", this, #c, __func__, 0, __VA_ARGS__ )
44 #define msgs_debug(c,f,...) \
45 fprintf(stderr, "%s::%s(%p:%4.4u)" f "\n", #c, __func__, this, (unsigned int)((sal_uInt64)pthread_self() & 0x1FFF), ##__VA_ARGS__ );
47 #endif /* _VCL_AQUA_COMMON_H */
49 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */