Rev 162 | Rev 184 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 162 | Rev 171 | ||
---|---|---|---|
Line 21... | Line 21... | ||
21 | smiley_t *smiley; |
21 | smiley_t *smiley; |
22 | char *file_buffer; |
22 | char *file_buffer; |
23 | wchar_t temp_string[MAX_PATH]; |
23 | wchar_t temp_string[MAX_PATH]; |
24 | // wchar_t smiley_pathname[MAX_PATH]; |
24 | // wchar_t smiley_pathname[MAX_PATH]; |
25 | wchar_t *smiley_name; |
25 | wchar_t *smiley_name; |
- | 26 | int candidate_index; |
|
26 | int language_index; |
27 | int language_index; |
27 | int program_index; |
28 | int program_index; |
28 | int smiley_index; |
29 | int smiley_index; |
29 | int file_length; |
30 | int file_length; |
30 | FILE *fp; |
31 | FILE *fp; |
Line 179... | Line 180... | ||
179 | WRITE_WIDESTRING (L"smilies", L"\";)\"", L"wink.txt"); |
180 | WRITE_WIDESTRING (L"smilies", L"\";)\"", L"wink.txt"); |
180 | WRITE_WIDESTRING (L"smilies", L"\";-)\"", L"wink.txt"); |
181 | WRITE_WIDESTRING (L"smilies", L"\";-)\"", L"wink.txt"); |
181 | } |
182 | } |
182 | smilies = NULL; |
183 | smilies = NULL; |
183 | smiley_count = 0; |
184 | smiley_count = 0; |
- | 185 | candidate_index = 0; |
|
184 | while ((smiley_name = INIFile_GetEntryName (inifile, L"smilies", |
186 | while ((smiley_name = INIFile_GetEntryName (inifile, L"smilies", candidate_index)) != NULL) |
185 | { |
187 | { |
- | 188 | candidate_index++; // advance in the smiley entries list |
|
- | 189 | ||
- | 190 | if ((smiley_name == NULL) || (smiley_name[0] == 0)) |
|
- | 191 | continue; // discard bogus smilies |
|
- | 192 | ||
186 | // for each smiley we can read, reallocate smilies array to hold one smiley more |
193 | // for each smiley we can read, reallocate smilies array to hold one smiley more |
187 | smilies = (smiley_t *) SAFE_realloc (smilies, smiley_count, smiley_count + 1, sizeof (smiley_t), false); |
194 | smilies = (smiley_t *) SAFE_realloc (smilies, smiley_count, smiley_count + 1, sizeof (smiley_t), false); |
188 | 195 | ||
189 | smiley = &smilies[smiley_count]; // quick access to smiley |
196 | smiley = &smilies[smiley_count]; // quick access to smiley |
190 | 197 | ||
191 | // read the smiley name and enclose it between a leading and trailing space |
198 | // read the smiley name and enclose it between a leading and trailing space |
192 |
|
199 | swprintf_s (smiley->name, WCHAR_SIZEOF (smiley->name), L" %s ", smiley_name); |
193 | smiley->name[0] = L' '; // turn the first quote into a space |
- | |
194 | smiley->name[wcslen (smiley->name) - 1] = L' '; // turn the last quote into a space |
- | |
195 | 200 | ||
196 | // now read the smiley's corresponding picture file |
201 | // now read the smiley's corresponding picture file |
197 | READ_WIDESTRING (smiley->filename, inifile, L"smilies", smiley_name, L"smile.txt"); |
202 | READ_WIDESTRING (smiley->filename, inifile, L"smilies", smiley_name, L"smile.txt"); |
198 | 203 | ||
199 | // is this filename the same as another smiley we know already ? |
204 | // is this filename the same as another smiley we know already ? |