| 115 char *bytes = Tcl_GetStringFromObj(obj, NULL); |
115 char *bytes = Tcl_GetStringFromObj(obj, NULL); |
| 116 char *ptr; |
116 char *ptr; |
| 117 PurpleStringref *type; |
117 PurpleStringref *type; |
| 118 void *value; |
118 void *value; |
| 119 static const char prefix[] = "purple-"; |
119 static const char prefix[] = "purple-"; |
| 120 static const int prefixlen = sizeof(prefix) - 1; |
120 static const gsize prefixlen = sizeof(prefix) - 1; |
| 121 |
121 |
| 122 if (strlen(bytes) < prefixlen |
122 if (strlen(bytes) < prefixlen |
| 123 || strncmp(bytes, prefix, prefixlen) |
123 || strncmp(bytes, prefix, prefixlen) |
| 124 || (ptr = strchr(bytes, ':')) == NULL |
124 || (ptr = strchr(bytes, ':')) == NULL |
| 125 || (ptr - bytes) == prefixlen) |
125 || (gsize)(ptr - bytes) == prefixlen) |
| 126 goto badobject; |
126 goto badobject; |
| 127 |
127 |
| 128 /* Bad Ethan */ |
128 /* Bad Ethan */ |
| 129 *ptr = '\0'; |
129 *ptr = '\0'; |
| 130 type = purple_stringref_new(bytes + prefixlen); |
130 type = purple_stringref_new(bytes + prefixlen); |