Rename the |dont_return_name| flag of |OBJ_obj2txt| to |always_return_oid|.
The name of this has been annoying me every time I've seen it over the
past couple of days. Having a flag with a negation in the name isn't
always bad, but I think this case was.
Change-Id: I5922bf4cc94eab8c59256042a9d9acb575bd40aa
Reviewed-on: https://boringssl-review.googlesource.com/10242
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: Adam Langley <agl@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
diff --git a/crypto/obj/obj.c b/crypto/obj/obj.c
index bcc5478..c44ffc8 100644
--- a/crypto/obj/obj.c
+++ b/crypto/obj/obj.c
@@ -454,14 +454,14 @@
}
int OBJ_obj2txt(char *out, int out_len, const ASN1_OBJECT *obj,
- int dont_return_name) {
+ int always_return_oid) {
/* Python depends on the empty OID successfully encoding as the empty
* string. */
if (obj == NULL || obj->length == 0) {
return strlcpy_int(out, "", out_len);
}
- if (!dont_return_name) {
+ if (!always_return_oid) {
int nid = OBJ_obj2nid(obj);
if (nid != NID_undef) {
const char *name = OBJ_nid2ln(nid);
diff --git a/crypto/obj/obj_test.cc b/crypto/obj/obj_test.cc
index 31d02b9..4813b05 100644
--- a/crypto/obj/obj_test.cc
+++ b/crypto/obj/obj_test.cc
@@ -95,7 +95,7 @@
}
static bool ExpectObj2Txt(const uint8_t *der, size_t der_len,
- bool dont_return_name, const char *expected) {
+ bool always_return_oid, const char *expected) {
ASN1_OBJECT obj;
memset(&obj, 0, sizeof(obj));
obj.data = der;
@@ -103,7 +103,7 @@
int expected_len = static_cast<int>(strlen(expected));
- int len = OBJ_obj2txt(nullptr, 0, &obj, dont_return_name);
+ int len = OBJ_obj2txt(nullptr, 0, &obj, always_return_oid);
if (len != expected_len) {
fprintf(stderr,
"OBJ_obj2txt of %s with out_len = 0 returned %d, wanted %d.\n",
@@ -113,7 +113,7 @@
char short_buf[1];
memset(short_buf, 0xff, sizeof(short_buf));
- len = OBJ_obj2txt(short_buf, sizeof(short_buf), &obj, dont_return_name);
+ len = OBJ_obj2txt(short_buf, sizeof(short_buf), &obj, always_return_oid);
if (len != expected_len) {
fprintf(stderr,
"OBJ_obj2txt of %s with out_len = 1 returned %d, wanted %d.\n",
@@ -130,7 +130,7 @@
}
char buf[256];
- len = OBJ_obj2txt(buf, sizeof(buf), &obj, dont_return_name);
+ len = OBJ_obj2txt(buf, sizeof(buf), &obj, always_return_oid);
if (len != expected_len) {
fprintf(stderr,
"OBJ_obj2txt of %s with out_len = 256 returned %d, wanted %d.\n",
diff --git a/include/openssl/obj.h b/include/openssl/obj.h
index 367cfdc..8819593 100644
--- a/include/openssl/obj.h
+++ b/include/openssl/obj.h
@@ -144,7 +144,7 @@
OPENSSL_EXPORT ASN1_OBJECT *OBJ_txt2obj(const char *s, int dont_search_names);
/* OBJ_obj2txt converts |obj| to a textual representation. If
- * |dont_return_name| is zero then |obj| will be matched against known objects
+ * |always_return_oid| is zero then |obj| will be matched against known objects
* and the long (preferably) or short name will be used if found. Otherwise
* |obj| will be converted into a dotted sequence of integers. If |out| is not
* NULL, then at most |out_len| bytes of the textual form will be written
@@ -152,7 +152,7 @@
* always be NUL terminated. It returns the number of characters that could
* have been written, not including the final NUL, or -1 on error. */
OPENSSL_EXPORT int OBJ_obj2txt(char *out, int out_len, const ASN1_OBJECT *obj,
- int dont_return_name);
+ int always_return_oid);
/* Adding objects at runtime. */