// Epoch
+ gboolean bad_epoch = FALSE;
ptr = strstr(string, ":");
if (ptr) {
evr->epoch = g_strndup(string, len);
}
}
+ } else { // Bad (non-numerical) epoch
+ bad_epoch = TRUE;
}
} else { // There is no epoch
ptr = (char*) string-1;
}
- if (!evr->epoch) {
+ if (!evr->epoch && !bad_epoch) {
if (chunk) {
evr->epoch = g_string_chunk_insert_const(chunk, "0");
} else {
cr_evr_free(evr);
evr = cr_str_to_evr("-:", NULL);
- g_assert_cmpstr(evr->epoch, ==, "0");
+ g_assert_cmpstr(evr->epoch, ==, NULL);
g_assert_cmpstr(evr->version, ==, "");
g_assert_cmpstr(evr->release, ==, NULL);
cr_evr_free(evr);
evr = cr_str_to_evr("foo:bar", NULL);
- g_assert_cmpstr(evr->epoch, ==, "0");
+ g_assert_cmpstr(evr->epoch, ==, NULL);
g_assert_cmpstr(evr->version, ==, "bar");
g_assert_cmpstr(evr->release, ==, NULL);
cr_evr_free(evr);
g_free(evr);
evr = cr_str_to_evr("-:", chunk);
- g_assert_cmpstr(evr->epoch, ==, "0");
+ g_assert_cmpstr(evr->epoch, ==, NULL);
g_assert_cmpstr(evr->version, ==, "");
g_assert_cmpstr(evr->release, ==, NULL);
g_free(evr);
evr = cr_str_to_evr("foo:bar", chunk);
- g_assert_cmpstr(evr->epoch, ==, "0");
+ g_assert_cmpstr(evr->epoch, ==, NULL);
g_assert_cmpstr(evr->version, ==, "bar");
g_assert_cmpstr(evr->release, ==, NULL);
g_free(evr);