1
10
13
14
20
21
22
23
24
25
26
27
28
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
94
95
96
97
98
99
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
123
124
125
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
193
194
195
196
197
198
199
200
201
202
203
204
205
206
217
218
219
220
221
222
223
224
225
226
228
229
230
231
232
233
234
235
236
237
248
249
250
251
252
253
254
255
256
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
275
276
277
278
279
280
281
282
283
284
285
291
292
293
294
295
296
297
298
299
300
301
302
304
309
310
311
318
319
320
321
322
323
324
325
326
327
329
333
334
335
336
337
338
339
341
342
343
344
346
347
348
349
350
351
352
353
354
356
357
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
391
392
393
394
395
402
417
418
419
425
426
427
428
429
430
431
432
433
439
440
441
442
443
444
445
446
447
448
449
450
451
...
...
...
#define FX_SOURCE_CODE
#include "fx_api.h"
#include "fx_system.h"
#include "fx_file.h"
#include "fx_utility.h"
#include "fx_directory.h"
5 includes
#ifndef FX_NO_LOCAL_PATH
FX_LOCAL_PATH_SETUP
#endif
...
...
UINT _fx_directory_local_path_set(FX_MEDIA *media_ptr, FX_LOCAL_PATH *local_path_ptr, CHAR *new_path_name)
{
#ifndef FX_NO_LOCAL_PATH
UINT status;
CHAR *path_string_ptr;
UINT path_string_capacity;
FX_PATH *path_ptr;
UINT i, j;/* ... */
#endif
FX_DIR_ENTRY dir_entry;
#ifndef FX_MEDIA_STATISTICS_DISABLE
media_ptr -> fx_media_directory_local_path_sets++;/* ... */
#endif
dir_entry.fx_dir_entry_name = media_ptr -> fx_media_name_buffer + FX_MAX_LONG_NAME_LEN;
local_path_ptr -> fx_path_directory.fx_dir_entry_name = local_path_ptr -> fx_path_name_buffer;
dir_entry.fx_dir_entry_short_name[0] = (CHAR)0;
dir_entry.fx_dir_entry_name[0] = (CHAR)0;
if (media_ptr -> fx_media_id != FX_MEDIA_ID)
{
return(FX_MEDIA_NOT_OPEN);
}if (media_ptr -> fx_media_id != FX_MEDIA_ID) { ... }
#ifdef FX_NO_LOCAL_PATH
FX_PARAMETER_NOT_USED(new_path_name);
return(FX_NOT_IMPLEMENTED);/* ... */
#else
FX_TRACE_IN_LINE_INSERT(FX_TRACE_DIRECTORY_LOCAL_PATH_SET, media_ptr, local_path_ptr, new_path_name, 0, FX_TRACE_DIRECTORY_EVENTS, 0, 0)
FX_PROTECT
if ((!new_path_name) || (((new_path_name[0] == '\\') || (new_path_name[0] == '/')) && (new_path_name[1] == (CHAR)0)))
{
local_path_ptr -> fx_path_directory.fx_dir_entry_name[0] = (CHAR)0;
local_path_ptr -> fx_path_string[0] = (CHAR)0;
local_path_ptr -> fx_path_string[FX_MAXIMUM_PATH - 2] = (CHAR)0;
_tx_thread_current_ptr -> tx_thread_filex_ptr = (VOID *)local_path_ptr;
}if ((!new_path_name) || (((new_path_name[0] == '\\') || (new_path_name[0] == '/')) && (new_path_name[1] == (CHAR)0))) { ... }
else
{
status = _fx_directory_search(media_ptr, new_path_name, &dir_entry, FX_NULL, FX_NULL);
/* ... */
if ((status != FX_SUCCESS) || (!(dir_entry.fx_dir_entry_attributes & FX_DIRECTORY)))
{
FX_UNPROTECT
return(FX_INVALID_PATH);
}if ((status != FX_SUCCESS) || (!(dir_entry.fx_dir_entry_attributes & FX_DIRECTORY))) { ... }
path_string_ptr = &(local_path_ptr -> fx_path_string[0]);
path_string_capacity = FX_MAXIMUM_PATH - 1;
if ((new_path_name[0] != '\\') && (new_path_name[0] != '/'))
{
path_ptr = local_path_ptr;
if (local_path_ptr != (FX_LOCAL_PATH *)_tx_thread_current_ptr -> tx_thread_filex_ptr)
{
/* ... */
if (_tx_thread_current_ptr -> tx_thread_filex_ptr)
{
i = 0;
do
{
local_path_ptr -> fx_path_string[i] =
((FX_LOCAL_PATH *)_tx_thread_current_ptr -> tx_thread_filex_ptr) -> fx_path_string[i];
if (local_path_ptr -> fx_path_string[i] == 0)
{
if (i < (FX_MAXIMUM_PATH - 1))
{
break;
}if (i < (FX_MAXIMUM_PATH - 1)) { ... }
}if (local_path_ptr -> fx_path_string[i] == 0) { ... }
i++;
...} while (i < FX_MAXIMUM_PATH);
}if (_tx_thread_current_ptr -> tx_thread_filex_ptr) { ... }
else
{
/* ... */
i = 0;
do
{
local_path_ptr -> fx_path_string[i] =
media_ptr -> fx_media_default_path.fx_path_string[i];
if (local_path_ptr -> fx_path_string[i] == 0)
{
if (i < (FX_MAXIMUM_PATH - 1))
{
break;
}if (i < (FX_MAXIMUM_PATH - 1)) { ... }
}if (local_path_ptr -> fx_path_string[i] == 0) { ... }
i++;
...} while (i < FX_MAXIMUM_PATH);
}else { ... }
}if (local_path_ptr != (FX_LOCAL_PATH *)_tx_thread_current_ptr -> tx_thread_filex_ptr) { ... }
/* ... */
if (path_ptr -> fx_path_string[FX_MAXIMUM_PATH - 2] == '*')
{
if (!dir_entry.fx_dir_entry_cluster)
{
dir_entry.fx_dir_entry_name[0] = (CHAR)0;
path_ptr -> fx_path_string[0] = (CHAR)0;
/* ... */
path_ptr -> fx_path_string[FX_MAXIMUM_PATH - 2] = (CHAR)0;
}if (!dir_entry.fx_dir_entry_cluster) { ... }
path_ptr -> fx_path_directory = dir_entry;
local_path_ptr -> fx_path_directory.fx_dir_entry_name = local_path_ptr -> fx_path_name_buffer;
for (j = 0; j < FX_MAX_LONG_NAME_LEN; j++)
{
local_path_ptr -> fx_path_directory.fx_dir_entry_name[j] = dir_entry.fx_dir_entry_name[j];
}for (j = 0; j < FX_MAX_LONG_NAME_LEN; j++) { ... }
_tx_thread_current_ptr -> tx_thread_filex_ptr = (VOID *)local_path_ptr;
FX_UNPROTECT
return(FX_SUCCESS);
}if (path_ptr -> fx_path_string[FX_MAXIMUM_PATH - 2] == '*') { ... }
/* ... */
while ((path_string_capacity) && (*path_string_ptr != FX_NULL))
{
path_string_ptr++;
path_string_capacity--;
}while ((path_string_capacity) && (*path_string_ptr != FX_NULL)) { ... }
if (path_string_capacity)
{
*path_string_ptr++ = '\\';
path_string_capacity--;
}if (path_string_capacity) { ... }
}if ((new_path_name[0] != '\\') && (new_path_name[0] != '/')) { ... }
else
{
path_ptr = local_path_ptr;
/* ... */
if (path_ptr -> fx_path_string[FX_MAXIMUM_PATH - 2] == '*')
{
path_ptr -> fx_path_string[FX_MAXIMUM_PATH - 2] = (CHAR)0;
}if (path_ptr -> fx_path_string[FX_MAXIMUM_PATH - 2] == '*') { ... }
}else { ... }
while (*new_path_name)
{
/* ... */
if ((*new_path_name == '.') && (*(new_path_name + 1) == '.'))
{
/* ... */
path_string_capacity = path_string_capacity + 2;
path_string_ptr = path_string_ptr - 2;
while (path_string_capacity <= (FX_MAXIMUM_PATH - 1))
{
/* ... */
if ((*path_string_ptr == '\\') || (*path_string_ptr == '/'))
{
break;
}if ((*path_string_ptr == '\\') || (*path_string_ptr == '/')) { ... }
path_string_capacity++;
path_string_ptr--;
}while (path_string_capacity <= (FX_MAXIMUM_PATH - 1)) { ... }
new_path_name = new_path_name + 2;
}if ((*new_path_name == '.') && (*(new_path_name + 1) == '.')) { ... }
else
{
if (path_string_capacity)
{
*path_string_ptr++ = *new_path_name++;
path_string_capacity--;
}if (path_string_capacity) { ... }
else
{
break;
}else { ... }
}else { ... }
}while (*new_path_name) { ... }
if (path_string_capacity)
{
/* ... */
*path_string_ptr = (CHAR)FX_NULL;
}if (path_string_capacity) { ... }
else
{
/* ... */
if (*new_path_name)
{
/* ... */
path_ptr -> fx_path_string[FX_MAXIMUM_PATH - 2] = '*';
}if (*new_path_name) { ... }
}else { ... }
if (!dir_entry.fx_dir_entry_cluster)
{
dir_entry.fx_dir_entry_name[0] = (CHAR)0;
local_path_ptr -> fx_path_name_buffer[0] = (CHAR)0;
}if (!dir_entry.fx_dir_entry_cluster) { ... }
path_ptr -> fx_path_directory = dir_entry;
local_path_ptr -> fx_path_directory.fx_dir_entry_name = local_path_ptr -> fx_path_name_buffer;
for (j = 0; j < FX_MAX_LONG_NAME_LEN; j++)
{
local_path_ptr -> fx_path_directory.fx_dir_entry_name[j] = dir_entry.fx_dir_entry_name[j];
}for (j = 0; j < FX_MAX_LONG_NAME_LEN; j++) { ... }
_tx_thread_current_ptr -> tx_thread_filex_ptr = (VOID *)local_path_ptr;
}else { ... }
FX_UNPROTECT
return(FX_SUCCESS);/* ... */
#endif
}{ ... }