Skip to content

Commit 01bea4b

Browse files
committed
CDRIVER-5844 fix macOS format specifier (#1819)
* use `PRIu32` to match type of `SecExternalItemType` * include string representation * replace "Please file a JIRA" with "Type is not supported"
1 parent 7f0f3ea commit 01bea4b

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

src/libmongoc/src/mongoc/mongoc-secure-transport.c

+24-1
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,27 @@ _mongoc_secure_transport_extract_subject (const char *filename, const char *pass
309309
return retval;
310310
}
311311

312+
static const char *
313+
SecExternalItemType_to_string (SecExternalItemType value)
314+
{
315+
switch (value) {
316+
case kSecItemTypeUnknown:
317+
return "kSecItemTypeUnknown";
318+
case kSecItemTypePrivateKey:
319+
return "kSecItemTypePrivateKey";
320+
case kSecItemTypePublicKey:
321+
return "kSecItemTypePublicKey";
322+
case kSecItemTypeSessionKey:
323+
return "kSecItemTypeSessionKey";
324+
case kSecItemTypeCertificate:
325+
return "kSecItemTypeCertificate";
326+
case kSecItemTypeAggregate:
327+
return "kSecItemTypeAggregate";
328+
default:
329+
return "Unknown";
330+
}
331+
}
332+
312333
bool
313334
mongoc_secure_transport_setup_certificate (mongoc_stream_tls_secure_transport_t *secure_transport,
314335
mongoc_ssl_opt_t *opt)
@@ -332,7 +353,9 @@ mongoc_secure_transport_setup_certificate (mongoc_stream_tls_secure_transport_t
332353
}
333354

334355
if (type != kSecItemTypeAggregate) {
335-
MONGOC_ERROR ("Cannot work with keys of type \"%d\". Please file a JIRA", type);
356+
MONGOC_ERROR ("Cannot work with keys of type %s (%" PRIu32 "). Type is not supported",
357+
SecExternalItemType_to_string (type),
358+
type);
336359
CFRelease (items);
337360
return false;
338361
}

0 commit comments

Comments
 (0)