Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: testing/iossim/iossim.mm

Issue 11471030: Fix bug in iossim's CaseInsensitivePrefixSearch. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import <Foundation/Foundation.h> 5 #import <Foundation/Foundation.h>
6 #include <asl.h> 6 #include <asl.h>
7 #include <libgen.h> 7 #include <libgen.h>
8 #include <stdarg.h> 8 #include <stdarg.h>
9 #include <stdio.h> 9 #include <stdio.h>
10 10
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 return YES; 499 return YES;
500 } 500 }
501 501
502 // Performs a case-insensitive search to see if |stringToSearch| begins with 502 // Performs a case-insensitive search to see if |stringToSearch| begins with
503 // |prefixToFind|. Returns true if a match is found. 503 // |prefixToFind|. Returns true if a match is found.
504 BOOL CaseInsensitivePrefixSearch(NSString* stringToSearch, 504 BOOL CaseInsensitivePrefixSearch(NSString* stringToSearch,
505 NSString* prefixToFind) { 505 NSString* prefixToFind) {
506 NSStringCompareOptions options = (NSAnchoredSearch | NSCaseInsensitiveSearch); 506 NSStringCompareOptions options = (NSAnchoredSearch | NSCaseInsensitiveSearch);
507 NSRange range = [stringToSearch rangeOfString:prefixToFind 507 NSRange range = [stringToSearch rangeOfString:prefixToFind
508 options:options]; 508 options:options];
509 return range.location != 0; 509 return range.location != NSNotFound;
510 } 510 }
511 511
512 // Prints the usage information to stderr. 512 // Prints the usage information to stderr.
513 void PrintUsage() { 513 void PrintUsage() {
514 fprintf(stderr, "Usage: iossim [-d device] [-s sdkVersion] [-u homeDir] " 514 fprintf(stderr, "Usage: iossim [-d device] [-s sdkVersion] [-u homeDir] "
515 "[-e envKey=value]* [-t startupTimeout] <appPath> [<appArgs>]\n" 515 "[-e envKey=value]* [-t startupTimeout] <appPath> [<appArgs>]\n"
516 " where <appPath> is the path to the .app directory and appArgs are any" 516 " where <appPath> is the path to the .app directory and appArgs are any"
517 " arguments to send the simulated app.\n" 517 " arguments to send the simulated app.\n"
518 "\n" 518 "\n"
519 "Options:\n" 519 "Options:\n"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 [error localizedDescription], 707 [error localizedDescription],
708 [error domain], static_cast<long int>([error code])); 708 [error domain], static_cast<long int>([error code]));
709 } 709 }
710 710
711 // Note that this code is only executed if the simulator fails to start 711 // Note that this code is only executed if the simulator fails to start
712 // because once the main run loop is started, only the delegate calling 712 // because once the main run loop is started, only the delegate calling
713 // exit() will end the program. 713 // exit() will end the program.
714 [pool drain]; 714 [pool drain];
715 return EXIT_FAILURE; 715 return EXIT_FAILURE;
716 } 716 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698