memset(&ndef, 0, sizeof(YKNDEF));
char uri[] = "https://example.com/foo";
int rc = ykp_construct_ndef_uri(&ndef, uri);
- assert(rc == 0);
+ assert(rc == 1);
assert(ndef.type == 'U');
assert(ndef.data[0] == 0x04);
assert(strncmp(ndef.data + 1, "example.com/foo", 15) == 0);
memset(&ndef, 0, sizeof(YKNDEF));
char uri[] = "https://example.example.example.example.com/foo/kaka/bar/blahonga";
int rc = ykp_construct_ndef_uri(&ndef, uri);
- assert(rc == 1);
+ assert(rc == 0);
assert(ndef.type == 0);
assert(ndef.len == 0);
}
memset(&ndef, 0, sizeof(YKNDEF));
char uri[] = "https://www.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
int rc = ykp_construct_ndef_uri(&ndef, uri);
- assert(rc == 0);
+ assert(rc == 1);
assert(ndef.type == 'U');
assert(ndef.data[0] == 0x02);
assert(strncmp(ndef.data + 1, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", NDEF_DATA_SIZE -1) == 0);
memset(&ndef, 0, sizeof(YKNDEF));
char text[] = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
int rc = ykp_construct_ndef_text(&ndef, text, "en", false);
- assert(rc == 0);
+ assert(rc == 1);
assert(ndef.type == 'T');
assert(ndef.data[0] == 2);
assert(strncmp(ndef.data + 1, "en", 2) == 0);
char text[] = "aaaaaaaaaaaaaaa";
size_t text_len = strlen(text);
int rc = ykp_construct_ndef_text(&ndef, text, "sv-SE", true);
- assert(rc == 0);
+ assert(rc == 1);
assert(ndef.type == 'T');
assert(ndef.data[0] == (0x80 & 5));
assert(strncmp(ndef.data + 1, "sv-SE", 5) == 0);
data_length = strlen(uri);
if(data_length + 1 > NDEF_DATA_SIZE) {
ykp_errno = YKP_EINVAL;
- return 1;
+ return 0;
}
if(indx > num_identifiers) {
ndef->data[0] = 0;
memcpy(ndef->data + 1, uri, data_length);
ndef->len = data_length + 1;
ndef->type = 'U';
- return 0;
+ return 1;
}
/* Fill in the data and len parts of the YKNDEF struct based on supplied text. */
}
if((data_length + lang_length + 1) > NDEF_DATA_SIZE) {
ykp_errno = YKP_EINVAL;
- return 1;
+ return 0;
}
ndef->data[0] = status;
memcpy(ndef->data + 1, lang, lang_length);
memcpy(ndef->data + lang_length + 1, text, data_length);
ndef->len = data_length + lang_length + 1;
ndef->type = 'T';
- return 0;
+ return 1;
}
static bool vcheck_all(const YKP_CONFIG *cfg)