~bialix/fte-mirror/fte-utf8

« back to all changes in this revision

Viewing changes to src/c_config.cpp

  • Committer: chaac
  • Date: 2004-03-10 19:34:50 UTC
  • Revision ID: chaac_chaac-20040310193450-f3a8g4g71s60xu0w
Some blind fixing for OS/2. Converted GUICharacters stuff to TChar a bit.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
typedef struct _GUICharactersEntry {
15
15
    struct _GUICharactersEntry *next;
16
16
    char *name;
17
 
    char *chars;
 
17
    TChar *chars;
18
18
} GUICharactersEntry;
19
19
 
20
20
typedef struct _CurPos {
94
94
// Which characters to get. defaultCharacters if not set, rest filled
95
95
// with defaultCharacters if too short
96
96
// List of GUICharacters is freed, only one item remains
97
 
const char *GetGUICharacters(const char *which, const char *defChars) {
 
97
const TChar *GetGUICharacters(const char *which, const TChar *defChars) {
98
98
    GUICharactersEntry *g, *gg, *found = NULL;
99
 
    char *s;
 
99
    TChar *s;
100
100
    unsigned int i;
101
101
 
102
102
    for (g = GUICharacters; g; g=gg) {
103
103
        gg = g->next;
104
104
        if (strcmp(g->name, which) == 0) {
105
 
            if ((i = strlen(g->chars)) < strlen(defChars)) {
106
 
                s = new char [strlen(defChars) + 1];
 
105
            if ((i = tstrlen(g->chars)) < tstrlen(defChars)) {
 
106
                s = new TChar [tstrlen(defChars) + 1];
107
107
                assert(s != NULL);
108
 
                strcpy(s, g->chars);
109
 
                strcpy(s + i, defChars + i);
 
108
                tstrlcpy(s, g->chars, tstrlen(defChars) + 1);
 
109
                tstrlcpy(s + i, defChars + i, tstrlen(defChars) + 1);
110
110
                delete g->chars;
111
111
                g->chars = s;
112
112
            }
142
142
        strncat(g->name, string, (s-string));
143
143
 
144
144
        // copy text after ':' to chars...
145
 
        g->chars = strdup(s+1);
 
145
        g->chars = tstrdup(s+1);
146
146
        assert(g->chars != NULL);
147
147
 
148
148
        g->next = GUICharacters;