Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/include/mdict_extern.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ void mdict_stem(void *dict, char *word, char **suggested_words, int length);
*/
int mdict_destory(void *dict);

// C wrapper for mime_detect
const char* c_mime_detect(const char* filename);

//-------------------------

#ifdef __cplusplus
Expand Down
10 changes: 10 additions & 0 deletions src/mdict_extern.cc
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,16 @@ int mdict_destory(void *dict) {
return 0;
}


const char* c_mime_detect(const char* filename) {
static std::string result; // keep it alive after return
result = mime_detect(filename);
return result.c_str();
}




#ifdef __cplusplus
}
#endif
Loading