2
0

Small C tweaks and add 2.2 to the site.

[UPDATED]   mpw-cli's usage: line.
[IMPROVED]  Safer code for standardizing of type name.
[FIXED]     Detection of missing Crashlytics API Key wasn't detecting the file being missing.
[ADDED]     2.2 desktop and android to the site.
This commit is contained in:
Maarten Billemont
2015-02-07 09:16:17 -05:00
parent f7d595b0e7
commit f80bbff46e
8 changed files with 15 additions and 12 deletions

View File

@@ -25,7 +25,7 @@
static void usage() {
fprintf( stderr, "Usage: mpw [-u name] [-t type] [-c counter] site\n\n" );
fprintf( stderr, "Usage: mpw [-u name] [-t type] [-c counter] [-V version] [-v variant] [-C context] [-h] site\n\n" );
fprintf( stderr, " -u name Specify the full name of the user.\n"
" Defaults to %s in env.\n\n", MP_env_fullname );
fprintf( stderr, " -t type Specify the password's template.\n"

View File

@@ -21,15 +21,17 @@
const MPSiteType mpw_typeWithName(const char *typeName) {
// Lower-case and trim optionally leading "generated" string from typeName to standardize it.
size_t stdTypeNameOffset = 0;
size_t stdTypeNameSize = strlen( typeName );
char stdTypeName[strlen( typeName )];
if (stdTypeNameSize > strlen( "generated" ))
strcpy( stdTypeName, typeName + strlen( "generated" ) );
else
strcpy( stdTypeName, typeName );
for (char *tN = stdTypeName; *tN; ++tN)
*tN = (char)tolower( *tN );
if (strcasestr(typeName, "generated" ) == typeName)
stdTypeNameSize -= (stdTypeNameOffset = strlen("generated"));
char stdTypeName[stdTypeNameSize + 1];
for (size_t c = 0; c < stdTypeNameSize; ++c)
stdTypeName[c] = (char)tolower( typeName[c + stdTypeNameOffset] );
stdTypeName[stdTypeNameSize] = '\0';
// Find what site type is represented by the type name.
if (0 == strcmp( stdTypeName, "x" ) || 0 == strcmp( stdTypeName, "max" ) || 0 == strcmp( stdTypeName, "maximum" ))
return MPSiteTypeGeneratedMaximum;
if (0 == strcmp( stdTypeName, "l" ) || 0 == strcmp( stdTypeName, "long" ))
@@ -47,8 +49,7 @@ const MPSiteType mpw_typeWithName(const char *typeName) {
if (0 == strcmp( stdTypeName, "p" ) || 0 == strcmp( stdTypeName, "phrase" ))
return MPSiteTypeGeneratedPhrase;
fprintf( stderr, "Not a generated type name: %s", stdTypeName );
abort();
ftl( "Not a generated type name: %s", stdTypeName );
}
inline const char **mpw_templatesForType(MPSiteType type, size_t *count) {

View File

@@ -605,6 +605,7 @@
CGDirectDisplayID displayID = [self.window.screen.deviceDescription[@"NSScreenNumber"] unsignedIntValue];
CGImageRef capturedImage = CGDisplayCreateImage( displayID );
if (!capturedImage || CGImageGetWidth( capturedImage ) <= 1) {
CFRelease( capturedImage );
wrn( @"Failed to capture screen image for display: %d", displayID );
return;
}