gboolean CertUtil_FindCert(const gchar *certFile, // IN const gchar *certDir, // IN const gchar *hash, // IN int *num, // OUT int *last) // OUT { gboolean ret = FALSE; const GList *node; GList *list = NULL; gchar *path = NULL; *last = *num = -1; if (!SearchFile(certDir, hash, &list)) { goto exit; } ret = TRUE; if (!list) { goto exit; } /* *last = the highest file version */ node = g_list_last(list); *last = GPOINTER_TO_INT(node->data); for (node = g_list_first(list); node; node = g_list_next(node)) { gboolean same = FALSE; int ext = GPOINTER_TO_INT(node->data); g_free(path); path = CertUtil_CreateCertFileName(certDir, hash, ext); if (!CompareFile(certFile, path, &same)) { ret = FALSE; goto exit; } if (same) { *num = ext; break; } } exit: g_free(path); if (list) { g_list_free(list); } return ret; }
TEST( StringTests, AsciiStringTest ) { ASSERT_TRUE( CompareFile( "./build/testdata/string1.enc", "./build/testdata/string1.raw" ) ); }
TEST( StringTests, EscapedCtrlCharTest ) { ASSERT_TRUE( CompareFile( "./build/testdata/string2.enc", "./build/testdata/string2.raw" ) ); }
TEST( StringTests, FourHexDigitsTest ) { ASSERT_TRUE( CompareFile( "./build/testdata/string3.enc", "./build/testdata/string3.raw" ) ); }