Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -33,10 +33,12 @@ AX_CHECK_COMPILER_FLAGS(-pipe, [OBJCXXFLAGS="$OBJCXXFLAGS -pipe"]) AX_CHECK_COMPILER_FLAGS(-fno-common, [OBJCXXFLAGS="$OBJCXXFLAGS -fno-common"]) AX_CHECK_COMPILER_FLAGS(-Wobjc-missing-property-synthesis -Werror, [OBJCXXFLAGS="$OBJCXXFLAGS -Wobjc-missing-property-synthesis"]) +AX_CHECK_COMPILER_FLAGS(-Watomic-properties, + [OBJCXXFLAGS="$OBJCXXFLAGS -Watomic-properties"]) AX_CHECK_COMPILER_FLAGS(-Wno-ignored-attributes -Werror, [OBJCXXFLAGS="$OBJCXXFLAGS -Wno-ignored-attributes"]) AC_CHECK_TOOL(AR, ar) AC_PROG_RANLIB Index: src/QtCore/QtObject.h ================================================================== --- src/QtCore/QtObject.h +++ src/QtCore/QtObject.h @@ -53,11 +53,11 @@ method: (OFString *)method; - (bool)disconnectAllSignalsForReceiver: (QtObject *)receiver method: (OFString *)method; - (void)dumpObjectInfo; - (void)dumpObjectTree; -- (OFArray OF_GENERIC(OFDataArray *) *)dynamicPropertyNames; +- (OFArray OF_GENERIC(OFData *) *)dynamicPropertyNames; - (bool)handleEvent: (QtEvent *)event; - (bool)filterEvent: (QtEvent *)event forObject: (QtObject *)watched; // MISSING: T findChild(const QString &name = QString(), // Qt::FindChildOptions options = Qt::FindChildrenRecursively) const; Index: src/QtCore/QtObject.mm ================================================================== --- src/QtCore/QtObject.mm +++ src/QtCore/QtObject.mm @@ -22,11 +22,11 @@ #import "QtObject.h" #import "QtEvent.h" #import "QtThread.h" #import "OFString+QString.h" -#import "OFDataArray+QByteArray.h" +#import "OFData+QByteArray.h" #include using ObjQt::toOF; using ObjQt::toQt; @@ -131,11 +131,11 @@ - (void)dumpObjectTree { _qObject->dumpObjectTree(); } -- (OFArray OF_GENERIC(OFDataArray *) *)dynamicPropertyNames +- (OFArray OF_GENERIC(OFData *) *)dynamicPropertyNames { const QList &dynamicPropertyNames = _qObject->dynamicPropertyNames(); OFMutableArray *ret = [OFMutableArray arrayWithCapacity: dynamicPropertyNames.count()]; Index: src/QtWidgets/QtWidget.h ================================================================== --- src/QtWidgets/QtWidget.h +++ src/QtWidgets/QtWidget.h @@ -167,12 +167,12 @@ targetOffset: (of_point_t)targetOffset sourceRegion: (QRegion)sourceRegion flags: (QWidget::RenderFlags)renderFlags; - (void)repaintInRectangle: (of_rectangle_t)rect; - (void)repaintInRegion: (const QRegion &)region; -- (bool)restoreGeometry: (OFDataArray *)geometry; -- (OFDataArray *)saveGeometry; +- (bool)restoreGeometry: (OFData *)geometry; +- (OFData *)saveGeometry; - (void)scrollRight: (int)dx down: (int)dy; - (void)scrollRight: (int)dx down: (int)dy inRectangle: (of_rectangle_t)rect; Index: src/QtWidgets/QtWidget.mm ================================================================== --- src/QtWidgets/QtWidget.mm +++ src/QtWidgets/QtWidget.mm @@ -21,11 +21,11 @@ */ #import "QtWidget.h" #import "QtAction.h" #import "OFString+QString.h" -#import "OFDataArray+QByteArray.h" +#import "OFData+QByteArray.h" #import "helpers.h" #include #include @@ -911,16 +911,16 @@ - (void)repaintInRegion: (const QRegion &)region { toQt(self)->repaint(region); } -- (bool)restoreGeometry: (OFDataArray *)geometry +- (bool)restoreGeometry: (OFData *)geometry { return toQt(self)->restoreGeometry(toQt(geometry)); } -- (OFDataArray *)saveGeometry +- (OFData *)saveGeometry { return toOF(toQt(self)->saveGeometry()); } - (void)scrollRight: (int)dx Index: src/common/Makefile ================================================================== --- src/common/Makefile +++ src/common/Makefile @@ -1,11 +1,11 @@ include ../../extra.mk STATIC_PIC_LIB_NOINST = ${COMMON_LIB_A} STATIC_LIB_NOINST = ${COMMON_A} -SRCS = OFDataArray+QByteArray.mm \ +SRCS = OFData+QByteArray.mm \ OFString+QString.mm include ../../buildsys.mk CPPFLAGS += -I. -I../QtCore ADDED src/common/OFData+QByteArray.h Index: src/common/OFData+QByteArray.h ================================================================== --- /dev/null +++ src/common/OFData+QByteArray.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2017, Jonathan Schleifer + * + * https://heap.zone/git/objqt.git + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice is present in all copies. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#import + +#include + +@interface OFData (QByteArray) ++ (instancetype)dataWithQByteArray: (const QByteArray &)qByteArray; +- (QByteArray)qByteArray; +@end + +namespace ObjQt { + +static OF_INLINE OFData * +toOF(const QByteArray &qByteArray) +{ + if (qByteArray.isNull()) + return nil; + + return [OFData dataWithQByteArray: qByteArray]; +} + +static OF_INLINE QByteArray +toQt(OFData *data) +{ + if (data == nil) + return QByteArray(); + + return [data qByteArray]; +} + +} ADDED src/common/OFData+QByteArray.mm Index: src/common/OFData+QByteArray.mm ================================================================== --- /dev/null +++ src/common/OFData+QByteArray.mm @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2017, Jonathan Schleifer + * + * https://heap.zone/git/objqt.git + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice is present in all copies. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#import "OFData+QByteArray.h" + +@implementation OFData (QByteArray) ++ (instancetype)dataWithQByteArray: (const QByteArray &)qByteArray +{ + return [OFData dataWithItems: qByteArray.data() + count: qByteArray.count()]; +} + +- (QByteArray)qByteArray +{ + return QByteArray((const char *)[self items], + [self count] * [self itemSize]); +} +@end DELETED src/common/OFDataArray+QByteArray.h Index: src/common/OFDataArray+QByteArray.h ================================================================== --- src/common/OFDataArray+QByteArray.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2017, Jonathan Schleifer - * - * https://heap.zone/git/objqt.git - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice is present in all copies. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#import - -#include - -@interface OFDataArray (QByteArray) -+ (instancetype)dataArrayWithQByteArray: (const QByteArray &)qByteArray; -- (QByteArray)qByteArray; -@end - -namespace ObjQt { - -static OF_INLINE OFDataArray * -toOF(const QByteArray &qByteArray) -{ - if (qByteArray.isNull()) - return nil; - - return [OFDataArray dataArrayWithQByteArray: qByteArray]; -} - -static OF_INLINE QByteArray -toQt(OFDataArray *dataArray) -{ - if (dataArray == nil) - return QByteArray(); - - return [dataArray qByteArray]; -} - -} DELETED src/common/OFDataArray+QByteArray.mm Index: src/common/OFDataArray+QByteArray.mm ================================================================== --- src/common/OFDataArray+QByteArray.mm +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2017, Jonathan Schleifer - * - * https://heap.zone/git/objqt.git - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice is present in all copies. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#import "OFDataArray+QByteArray.h" - -@implementation OFDataArray (QByteArray) -+ (instancetype)dataArrayWithQByteArray: (const QByteArray &)qByteArray -{ - OFDataArray *ret = [OFDataArray dataArray]; - [ret addItems: qByteArray.data() - count: qByteArray.count()]; - - return ret; -} - -- (QByteArray)qByteArray -{ - return QByteArray((char *)[self items], [self count] * [self itemSize]); -} -@end