diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2004-03-09 11:43:40 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2004-03-09 11:43:40 +0000 |
commit | 052c90ae99fbfd232f34dfa0994500453a963827 (patch) | |
tree | 2e0aac795ce44c2448858ec24fe83201a8f1e3b9 /lingucomponent/source/thesaurus/mythes | |
parent | 3aeab8602932f3750079cd4e866c967041bbc957 (diff) |
INTEGRATION: CWS ooo20040225 (1.2.2); FILE MERGED
2004/02/14 11:15:07 khendricks 1.2.2.1: syncing the 680 tree with my local lingucomponent tree
Diffstat (limited to 'lingucomponent/source/thesaurus/mythes')
-rw-r--r-- | lingucomponent/source/thesaurus/mythes/mythes.cxx | 70 | ||||
-rw-r--r-- | lingucomponent/source/thesaurus/mythes/mythes.hxx | 9 |
2 files changed, 39 insertions, 40 deletions
diff --git a/lingucomponent/source/thesaurus/mythes/mythes.cxx b/lingucomponent/source/thesaurus/mythes/mythes.cxx index 67336f48f60d..e26b6af38b61 100644 --- a/lingucomponent/source/thesaurus/mythes/mythes.cxx +++ b/lingucomponent/source/thesaurus/mythes/mythes.cxx @@ -6,46 +6,6 @@ #include "mythes.hxx" -// some basic utility routines - -#ifdef MYTHES_STANDALONE - -// string duplication routine -char * mystrdup(const char * p) -{ - - int sl = strlen(p) + 1; - char * d = (char *)malloc(sl); - if (d) { - memcpy(d,p,sl); - return d; - } - return NULL; -} - -// remove cross-platform text line end characters -void mychomp(char * s) -{ - int k = strlen(s); - if ((k > 0) && ((*(s+k-1)=='\r') || (*(s+k-1)=='\n'))) *(s+k-1) = '\0'; - if ((k > 1) && (*(s+k-2) == '\r')) *(s+k-2) = '\0'; -} - -#else - -extern char * mystrdup(const char * p); -extern void mychomp(char * s); - -#endif - - -// return index of char in string -int mystr_indexOfChar(const char * d, int c) -{ - char * p = strchr((char *)d,c); - if (p) return (int)(p-d); - return -1; -} MyThes::MyThes(const char* idxpath, const char * datpath) @@ -369,3 +329,33 @@ char * MyThes::get_th_encoding() return NULL; } + +// string duplication routine +char * MyThes::mystrdup(const char * p) +{ + int sl = strlen(p) + 1; + char * d = (char *)malloc(sl); + if (d) { + memcpy(d,p,sl); + return d; + } + return NULL; +} + +// remove cross-platform text line end characters +void MyThes::mychomp(char * s) +{ + int k = strlen(s); + if ((k > 0) && ((*(s+k-1)=='\r') || (*(s+k-1)=='\n'))) *(s+k-1) = '\0'; + if ((k > 1) && (*(s+k-2) == '\r')) *(s+k-2) = '\0'; +} + + +// return index of char in string +int MyThes::mystr_indexOfChar(const char * d, int c) +{ + char * p = strchr((char *)d,c); + if (p) return (int)(p-d); + return -1; +} + diff --git a/lingucomponent/source/thesaurus/mythes/mythes.hxx b/lingucomponent/source/thesaurus/mythes/mythes.hxx index 3eebeda36393..3327708f5c5f 100644 --- a/lingucomponent/source/thesaurus/mythes/mythes.hxx +++ b/lingucomponent/source/thesaurus/mythes/mythes.hxx @@ -57,6 +57,15 @@ private: // binary search on null terminated character strings int binsearch(char * wrd, char* list[], int nlst); + // string duplication routine + char * mystrdup(const char * p); + + // remove cross-platform text line end characters + void mychomp(char * s); + + // return index of char in string + int mystr_indexOfChar(const char * d, int c); + }; #endif |