Skip to content

Commit

Permalink
Updated with changes from OmniGroup svn [291810:292307]
Browse files Browse the repository at this point in the history
General:
- Switch to Xcode 9.0 b3 for macOS and iOS builds
- Enable several warnings suggested by Xcode 9 and fix fallout
- Updated localizations.
- Fix some clang-sa nullability warnings.
- More tweaks for themeing.

OmniUnzip:
- Avoid a undefined behavior noticed by Xcode's UBSan.

OmniUI/iPad:
- Updated OUIKeyCommand to use NSOrderedSet<NSString *> instead of a specially formatted NSString.
  • Loading branch information
tjw committed Jul 15, 2017
1 parent cfadb92 commit 6c69437
Show file tree
Hide file tree
Showing 58 changed files with 441 additions and 95 deletions.
7 changes: 7 additions & 0 deletions Configurations/Omni-Global-Common.xcconfig
Expand Up @@ -72,6 +72,7 @@ ENABLE_STRICT_OBJC_MSGSEND = YES
GCC_TREAT_WARNINGS_AS_ERRORS = YES

// Apple LLVM compiler 4.2 - Warnings - All languages
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES
GCC_WARN_CHECK_SWITCH_STATEMENTS = YES
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES
CLANG_WARN_EMPTY_BODY = YES
Expand All @@ -86,6 +87,7 @@ GCC_WARN_64_TO_32_BIT_CONVERSION = YES
CLANG_WARN_ENUM_CONVERSION = YES
CLANG_WARN_INT_CONVERSION = YES
CLANG_WARN_BOOL_CONVERSION = YES
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
//CLANG_WARN_IMPLICIT_SIGN_CONVERSION
Expand All @@ -100,6 +102,8 @@ GCC_WARN_ABOUT_MISSING_NEWLINE = YES
WARNING_CFLAGS = $(value) -Wall -Wno-#warnings -Wno-trigraphs -Winit-self
//GCC_WARN_ABOUT_POINTER_SIGNEDNESS
GCC_WARN_SIGN_COMPARE = YES
CLANG_WARN_STRICT_PROTOTYPES = YES
CLANG_WARN_COMMA = YES
//CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES
//GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS
//GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS
Expand All @@ -113,16 +117,19 @@ GCC_WARN_UNUSED_LABEL = YES
GCC_WARN_UNUSED_VALUE = YES
GCC_WARN_UNUSED_VARIABLE = YES


// Apple LLVM compiler 4.2 - Warnings - C++
//CLANG_WARN__EXIT_TIME_DESTRUCTORS
//GCC_WARN_NON_VIRTUAL_DESTRUCTOR
//GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES
//GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO
//CLANG_WARN_CXX0X_EXTENSIONS

// Apple LLVM compiler 4.2 - Warnings - Objective-C
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES
//CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES
//CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS
//GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL
//GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES // This is -Wselector, apparently. This has lots of false positives... http://llvm.org/bugs/show_bug.cgi?id=12322 -Wselector incorrectly warns about unimplemented selectors
Expand Down
4 changes: 2 additions & 2 deletions Frameworks/OmniAppKit/OAChangeConfigurationValue.m
@@ -1,4 +1,4 @@
// Copyright 2014-2016 Omni Development, Inc. All rights reserved.
// Copyright 2014-2017 Omni Development, Inc. All rights reserved.
//
// This software may only be used and reproduced according to the
// terms in the file OmniSourceLicense.html, which should be
Expand All @@ -14,7 +14,7 @@

RCS_ID("$Id$");

BOOL OAHandleChangeConfigurationValueURL(NSURL *url, NSError **outError)
BOOL OAHandleChangeConfigurationValueURL(NSURL *url, NSError * __autoreleasing *outError)
{
return OFHandleChangeConfigurationValueURL(url, outError, ^(NSString *title, NSString *message, OFConfigurationValueChangeConfirmationCallback callback){
NSAlert *alert = [[NSAlert alloc] init];
Expand Down
Expand Up @@ -1741,10 +1741,11 @@ static inline void combinePDranges(double *r, double *len, double r1, double r1l
{
double newP, newDL, newDR;

if (r1 <= r2)
newP = r1, newDL = r1len, newDR = r2len + (r2 - newP);
else
newP = r2, newDL = r2len, newDR = r1len + (r1 - newP);
if (r1 <= r2) {
newP = r1; newDL = r1len; newDR = r2len + (r2 - newP);
} else {
newP = r2; newDL = r2len; newDR = r1len + (r1 - newP);
}

*r = newP;
*len = MAX(newDL, newDR);
Expand All @@ -1755,10 +1756,11 @@ static inline void combineNDranges(double *r, double *len, double r1, double r1l
{
double newP, newDL, newDR;

if (r1 >= r2)
newP = r1, newDL = r1len, newDR = r2len + (r2 - newP);
else
newP = r2, newDL = r2len, newDR = r1len + (r1 - newP);
if (r1 >= r2) {
newP = r1; newDL = r1len; newDR = r2len + (r2 - newP);
} else {
newP = r2; newDL = r2len; newDR = r1len + (r1 - newP);
}

*r = newP;
*len = MIN(newDL, newDR);
Expand Down Expand Up @@ -2113,9 +2115,10 @@ unsigned intersectionsBetweenCurveAndLine(const NSPoint *c, const NSPoint *a, st

// Transform the problem so that the line segment goes from (0,0) to (1,0)
// (this simplifies the math, and gets rid of the troublesome horizontal / vertical cases)
xcubic[0] = c[0].x - a[0].x, ycubic[0] = c[0].y - a[0].y;
for(unsigned i = 1; i < 4; i++)
xcubic[i] = c[i].x, ycubic[i] = c[i].y;
xcubic[0] = c[0].x - a[0].x; ycubic[0] = c[0].y - a[0].y;
for(unsigned i = 1; i < 4; i++) {
xcubic[i] = c[i].x; ycubic[i] = c[i].y;
}
double lineLengthSquared = a[1].x*a[1].x + a[1].y*a[1].y;
if (lineLengthSquared < EPSILON*EPSILON) {
return 0;
Expand Down
3 changes: 3 additions & 0 deletions Frameworks/OmniDAV/Localization/iOS/de.lproj/OmniDAV.strings
@@ -1,6 +1,9 @@
/* error description */
"Could not access the WebDAV location <%@>." = "Auf den WebDAV-Speicherort <%@> konnte nicht zugegriffen werden.";

/* parsing a multistatus response, expected a particular XML element but found something else */
"Expected “%@” element missing in multistatus result from %@" = "Erwartetes Element „%1$@“ fehlt in Multistatusergebnis von %2$@";

/* Text for HTTP error code 507 (insufficient storage) */
"insufficient storage" = "unzureichender Speicher";

Expand Down
3 changes: 3 additions & 0 deletions Frameworks/OmniDAV/Localization/iOS/es.lproj/OmniDAV.strings
@@ -1,6 +1,9 @@
/* error description */
"Could not access the WebDAV location <%@>." = "No se ha podido acceder a la ubicación WebDAV <%@>.";

/* parsing a multistatus response, expected a particular XML element but found something else */
"Expected “%@” element missing in multistatus result from %@" = "Falta el elemento esperado “%1$@” en el resultado de estado múltiple de %2$@.";

/* Text for HTTP error code 507 (insufficient storage) */
"insufficient storage" = "almacenamiento insuficiente";

Expand Down
3 changes: 3 additions & 0 deletions Frameworks/OmniDAV/Localization/iOS/fr.lproj/OmniDAV.strings
@@ -1,6 +1,9 @@
/* error description */
"Could not access the WebDAV location <%@>." = "Impossible d’accéder à l’emplacement WebDAV <%@>.";

/* parsing a multistatus response, expected a particular XML element but found something else */
"Expected “%@” element missing in multistatus result from %@" = "L’élément attendu “%1$@” ne figure pas dans le résultat multi-état de %2$@";

/* Text for HTTP error code 507 (insufficient storage) */
"insufficient storage" = "espace de stockage insuffisant";

Expand Down
3 changes: 3 additions & 0 deletions Frameworks/OmniDAV/Localization/iOS/it.lproj/OmniDAV.strings
@@ -1,6 +1,9 @@
/* error description */
"Could not access the WebDAV location <%@>." = "Impossibile accedere alla posizione WebDAV <%@>.";

/* parsing a multistatus response, expected a particular XML element but found something else */
"Expected “%@” element missing in multistatus result from %@" = "Manca l'elemento previsto \"%1$@\" nel risultato multistato di %2$@";

/* Text for HTTP error code 507 (insufficient storage) */
"insufficient storage" = "spazio di archiviazione insufficiente";

Expand Down
3 changes: 3 additions & 0 deletions Frameworks/OmniDAV/Localization/iOS/ja.lproj/OmniDAV.strings
@@ -1,6 +1,9 @@
/* error description */
"Could not access the WebDAV location <%@>." = "WebDAV の場所 <%@> にアクセスできませんでした。";

/* parsing a multistatus response, expected a particular XML element but found something else */
"Expected “%@” element missing in multistatus result from %@" = "%2$@ からのマルチステータス結果に予期されていた “%1$@” 要素がありません";

/* Text for HTTP error code 507 (insufficient storage) */
"insufficient storage" = "空き領域が足りません";

Expand Down
3 changes: 3 additions & 0 deletions Frameworks/OmniDAV/Localization/iOS/ko.lproj/OmniDAV.strings
@@ -1,6 +1,9 @@
/* error description */
"Could not access the WebDAV location <%@>." = "WebDAV 위치 <%@>에 액세스할 수 없습니다.";

/* parsing a multistatus response, expected a particular XML element but found something else */
"Expected “%@” element missing in multistatus result from %@" = "필요한 “%1$@” 요소가 %2$@의 다중 상태 결과에 없습니다.";

/* Text for HTTP error code 507 (insufficient storage) */
"insufficient storage" = "저장소 부족";

Expand Down
3 changes: 3 additions & 0 deletions Frameworks/OmniDAV/Localization/iOS/nl.lproj/OmniDAV.strings
@@ -1,6 +1,9 @@
/* error description */
"Could not access the WebDAV location <%@>." = "Geen toegang mogelijk tot de WebDAV-locatie <%@>.";

/* parsing a multistatus response, expected a particular XML element but found something else */
"Expected “%@” element missing in multistatus result from %@" = "Verwachte element “%1$@” ontbreekt in multistatusresultaat van %2$@";

/* Text for HTTP error code 507 (insufficient storage) */
"insufficient storage" = "Onvoldoende opslagruimte";

Expand Down
@@ -1,6 +1,9 @@
/* error description */
"Could not access the WebDAV location <%@>." = "Não foi possível acessar a localização do WebDAV <%@>.";

/* parsing a multistatus response, expected a particular XML element but found something else */
"Expected “%@” element missing in multistatus result from %@" = "Era esperado o elemento “%1$@” ausente no resultado multiestado de %2$@";

/* Text for HTTP error code 507 (insufficient storage) */
"insufficient storage" = "armazenamento insuficiente";

Expand Down
3 changes: 3 additions & 0 deletions Frameworks/OmniDAV/Localization/iOS/ru.lproj/OmniDAV.strings
@@ -1,6 +1,9 @@
/* error description */
"Could not access the WebDAV location <%@>." = "Не удалось получить доступ к размещению WebDAV <%@>.";

/* parsing a multistatus response, expected a particular XML element but found something else */
"Expected “%@” element missing in multistatus result from %@" = "Ожидаемый элемент «%1$@» отсутствует мультистатусном результате из %2$@";

/* Text for HTTP error code 507 (insufficient storage) */
"insufficient storage" = "недостаточно места";

Expand Down
@@ -1,6 +1,9 @@
/* error description */
"Could not access the WebDAV location <%@>." = "无法访问 WebDAV 位置 <%@>。";

/* parsing a multistatus response, expected a particular XML element but found something else */
"Expected “%@” element missing in multistatus result from %@" = "%2$@ 的多状态结果中缺失应有的“%1$@”";

/* Text for HTTP error code 507 (insufficient storage) */
"insufficient storage" = "存储空间不足";

Expand Down
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0830"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -10,6 +10,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand All @@ -30,6 +31,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0830"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
Expand All @@ -45,6 +46,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
30 changes: 27 additions & 3 deletions Frameworks/OmniDocumentStore/ODSScope.m
Expand Up @@ -1001,12 +1001,22 @@ - (NSURL *)_moveURL:(NSURL *)sourceURL avoidingFileNames:(NSSet *)usedFilenames
__block BOOL success = NO;
if (shouldUseCoordinator) {
NSFileCoordinator *coordinator = [[NSFileCoordinator alloc] initWithFilePresenter:nil];
__block NSError *strongError = nil;
[coordinator coordinateWritingItemAtURL:sourceURL options:NSFileCoordinatorWritingForMoving writingItemAtURL:destinationURL options:NSFileCoordinatorWritingForMerging error:outError byAccessor:^(NSURL *newURL1, NSURL *newURL2) {

DEBUG_STORE(@"Moving document: %@ -> %@ (scope %@)", sourceURL, destinationURL, self);
// The documentation also says that this method does a coordinated move, so we don't need to (and in fact, experimentally, if we try we deadlock).
success = [[NSFileManager defaultManager] moveItemAtURL:sourceURL toURL:destinationURL error:outError];
__autoreleasing NSError *error;
success = [[NSFileManager defaultManager] moveItemAtURL:sourceURL toURL:destinationURL error:&error];
if (!success) {
strongError = error;
}
}];
if (!success) {
if (outError) {
*outError = strongError;
}
}
} else {
DEBUG_STORE(@"Moving document (without extra coordination): %@ -> %@ (scope %@)", sourceURL, destinationURL, self);
success = [[NSFileManager defaultManager] moveItemAtURL:sourceURL toURL:destinationURL error:outError];
Expand Down Expand Up @@ -1040,6 +1050,7 @@ Find an unused folder URL (might be racing with incoming sync'd changes. We don'
destinationFolderURL = [sourceFolderURL URLByAppendingPathComponent:destinationFolderName isDirectory:YES];

destinationRelativePath = OFFileURLRelativePath(self.documentsURL, destinationFolderURL);
OBASSERT_NOTNULL(parentRelativePath);
OBASSERT([destinationRelativePath isEqualToString:[parentRelativePath stringByAppendingPathComponent:destinationFolderName]]);
}

Expand Down Expand Up @@ -1104,13 +1115,24 @@ + (BOOL)trashItemAtURL:(NSURL *)url resultingItemURL:(NSURL **)outResultingURL e
assert(trashScope != nil);

__block BOOL success = NO;
__block NSError *strongError = nil;
__block NSURL *resultingURL = nil;
[trashScope _performSynchronousFileAccessUsingBlock:^{
NSMutableSet *usedFilenames = [trashScope _copyCurrentlyUsedFileNamesInFolderAtURL:nil];
resultingURL = [trashScope _moveURL:url avoidingFileNames:usedFilenames usingCoordinator:NO error:outError];

__autoreleasing NSError *error = nil;
resultingURL = [trashScope _moveURL:url avoidingFileNames:usedFilenames usingCoordinator:NO error:&error];
if (!resultingURL) {
strongError = error;
}

success = (resultingURL != nil);
}];

if (!success && outError) {
*outError = strongError;
}

if (outResultingURL != NULL && resultingURL != nil)
*outResultingURL = resultingURL;

Expand Down Expand Up @@ -1395,8 +1417,10 @@ - (BOOL)isRunningOnActionQueue;
counter++;
}

if (![NSString isEmptyString:extension]) // Is nil when we are creating new folders
if (![NSString isEmptyString:extension]) { // Is nil when we are creating new folders
OBASSERT_NOTNULL(extension);
candidateName = [candidateName stringByAppendingPathExtension:extension];
}

// Not using -memeber: because it uses -isEqual: which was incorrectly returning nil with some Japanese filenames.
NSString *matchedFileName = [usedFileNames any:^BOOL(id object) {
Expand Down
11 changes: 10 additions & 1 deletion Frameworks/OmniFileExchange/OFXFileItem.m
Expand Up @@ -1002,17 +1002,26 @@ - (OFXFileSnapshotTransfer *)prepareDownloadTransferWithConnection:(ODAVConnecti

NSFileCoordinator *coordinator = [[NSFileCoordinator alloc] initWithFilePresenter:filePresenter];
__block BOOL success = NO;
__block NSError *strongError = nil;

[coordinator prepareForReadingItemsAtURLs:@[] options:0 /* provoke save since we are maybe about to write to the file */
writingItemsAtURLs:writingURLs options:NSFileCoordinatorWritingForMerging /* there is no "I might not write option" so other presenters are going to get a relinquish no matter what */
error:outError byAccessor:
^(void (^completionHandler)(void)){
success = [self _performDownloadCommitToURL:updatedLocalDocumentURL localTemporaryDocumentContentsURL:localTemporaryDocumentContentsURL targetLocalSnapshotURL:targetLocalSnapshotURL container:container downloadedSnapshot:downloadedSnapshot coordinator:coordinator downloadContents:downloadContents isMove:moved error:outError];
__autoreleasing NSError *error = nil;
success = [self _performDownloadCommitToURL:updatedLocalDocumentURL localTemporaryDocumentContentsURL:localTemporaryDocumentContentsURL targetLocalSnapshotURL:targetLocalSnapshotURL container:container downloadedSnapshot:downloadedSnapshot coordinator:coordinator downloadContents:downloadContents isMove:moved error:&error];
if (!success) {
strongError = error;
}

if (completionHandler)
completionHandler();
}];

if (!success) {
if (outError) {
*outError = strongError;
}
cleanup();
return NO;
}
Expand Down
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0830"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
Expand All @@ -45,6 +46,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down

0 comments on commit 6c69437

Please sign in to comment.