#include <sys/stat.h>
#endif
-#ifdef PLATFORM_MACOSX
+#ifdef HOST_DARWIN
#include <mach-o/dyld.h>
#endif
void
mono_set_rootdir (void)
{
-#if defined(HOST_WIN32) || (defined(PLATFORM_MACOSX) && !defined(TARGET_ARM))
+#if defined(HOST_WIN32) || (defined(HOST_DARWIN) && !defined(TARGET_ARM))
gchar *bindir, *installdir, *root, *name, *resolvedname, *config;
#ifdef HOST_WIN32
const gchar *pkey;
gchar header [16], val, *arr, *endp;
gint i, j, offset, bitlen, keylen, pkeylen;
-
+
+ //both pubkey and is_ecma are required arguments
+ g_assert (pubkey && is_ecma);
+
keylen = strlen (key) >> 1;
if (keylen < 1)
return FALSE;
/* allow the ECMA standard key */
if (strcmp (key, "00000000000000000400000000000000") == 0) {
- if (pubkey) {
- *pubkey = g_strdup (key);
- *is_ecma = TRUE;
- }
+ *pubkey = NULL;
+ *is_ecma = TRUE;
return TRUE;
}
*is_ecma = FALSE;
bitlen = read32 (header + 12) >> 3;
if ((bitlen + 16 + 4) != pkeylen)
return FALSE;
-
- /* parsing is OK and the public key itself is not requested back */
- if (!pubkey)
- return TRUE;
arr = (gchar *)g_malloc (keylen + 4);
/* Encode the size of the blob */
gint major, minor, build, revision;
gint len;
gint version_parts;
- gchar *pkey, *pkeyptr, *encoded, tok [8];
+ gchar *pkeyptr, *encoded, tok [8];
memset (aname, 0, sizeof (MonoAssemblyName));
}
if (key) {
- gboolean is_ecma;
+ gboolean is_ecma = FALSE;
+ gchar *pkey = NULL;
if (strcmp (key, "null") == 0 || !parse_public_key (key, &pkey, &is_ecma)) {
mono_assembly_name_free (aname);
return FALSE;
}
if (is_ecma) {
- if (save_public_key)
- aname->public_key = (guint8*)pkey;
- else
- g_free (pkey);
+ g_assert (pkey == NULL);
+ aname->public_key = NULL;
g_strlcpy ((gchar*)aname->public_key_token, "b77a5c561934e089", MONO_PUBLIC_KEY_TOKEN_LENGTH);
return TRUE;
}