File tree 1 file changed +13
-2
lines changed
1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -73,19 +73,30 @@ bundled_resources_is_known_assembly_extension (const char *ext)
73
73
#endif
74
74
}
75
75
76
+ // strrchr calls strlen, so we need to do a search with known length instead
77
+ // for some reason memrchr is defined in a header but the build fails when we try to use it
78
+ static const char *
79
+ g_memrchr (const char * s , char c , size_t n )
80
+ {
81
+ while (n -- )
82
+ if (s [n ] == c )
83
+ return (void * )(s + n );
84
+ return NULL ;
85
+ }
86
+
76
87
// If a bundled resource has a known assembly extension, we strip the extension from its name
77
88
// This ensures that lookups for foo.dll will work even if the assembly is in a webcil container
78
89
static char *
79
90
key_from_id (const char * id , char * buffer , guint buffer_len )
80
91
{
81
92
size_t id_length = strlen (id ),
82
93
extension_offset = -1 ;
83
- const char * extension = strrchr (id , '.' );
94
+ const char * extension = g_memrchr (id , '.' , id_length );
84
95
if (extension )
85
96
extension_offset = extension - id ;
86
97
if (!buffer ) {
87
98
buffer_len = (guint )(id_length + 1 );
88
- buffer = g_malloc (buffer_len );
99
+ buffer = g_malloc (buffer_len );
89
100
}
90
101
buffer [0 ] = 0 ;
91
102
You can’t perform that action at this time.
0 commit comments