37
37
// The types and variables used locally
38
38
// typedef int bool;
39
39
typedef unsigned int uint;
40
- #define SVP (S ) ((S) ? S : "<null>")
40
+ // #define SVP(S) ((S) ? S : "<null>")
41
41
#define _strlwr (P ) strlwr(P) // OB: changed this line
42
42
#define MAX_PATHNAME_LEN 256
43
43
#define N_CACHED_PROFILES 10
@@ -61,8 +61,8 @@ void htrc(char const *fmt, ...)
61
61
} /* end of htrc */
62
62
#else // !TEST_MODULE
63
63
// Normal included functions
64
- extern int trace ;
65
- void htrc (char const * fmt , ...);
64
+ // extern int trace;
65
+ // void htrc(char const *fmt, ...);
66
66
#endif // !TEST MODULE
67
67
68
68
@@ -112,10 +112,11 @@ static PROFILE *MRUProfile[N_CACHED_PROFILES] = {NULL};
112
112
113
113
// static CRITICAL_SECTION PROFILE_CritSect = CRITICAL_SECTION_INIT("PROFILE_CritSect");
114
114
115
- static const char hex [16 ] = "0123456789ABCDEF" ;
115
+ static const char hex[17 ] = " 0123456789ABCDEF" ;
116
116
117
117
BOOL WritePrivateProfileString (LPCSTR section, LPCSTR entry,
118
- LPCSTR string , LPCSTR filename );
118
+ LPCSTR string, LPCSTR filename);
119
+
119
120
/* **********************************************************************
120
121
* PROFILE_CopyEntry
121
122
*
@@ -254,7 +255,7 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
254
255
PROFILESECTION* *next_section;
255
256
PROFILEKEY *key, *prev_key, **next_key;
256
257
257
- first_section = malloc (sizeof (* section ));
258
+ first_section = (PROFILESECTION*) malloc (sizeof (*section));
258
259
259
260
if (first_section == NULL )
260
261
return NULL ;
@@ -281,7 +282,7 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
281
282
*p2 = ' \0 ' ;
282
283
p++;
283
284
284
- if (!(section = malloc (sizeof (* section ) + strlen (p ))))
285
+ if (!(section = (PROFILESECTION*) malloc (sizeof (*section) + strlen (p))))
285
286
break ;
286
287
287
288
strcpy (section->name , p);
@@ -319,13 +320,13 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
319
320
} // endif p2
320
321
321
322
if (*p || !prev_key || *prev_key->name ) {
322
- if (!(key = malloc (sizeof (* key ) + strlen (p ))))
323
+ if (!(key = (PROFILEKEY*) malloc (sizeof (*key) + strlen (p))))
323
324
break ;
324
325
325
326
strcpy (key->name , p);
326
327
327
328
if (p2) {
328
- key -> value = malloc (strlen (p2 )+ 1 );
329
+ key->value = ( char *) malloc (strlen (p2)+1 );
329
330
strcpy (key->value , p2);
330
331
} else
331
332
key->value = NULL ;
@@ -452,7 +453,7 @@ static BOOL PROFILE_Open(LPCSTR filename)
452
453
/* First time around */
453
454
if (!CurProfile)
454
455
for (i = 0 ; i < N_CACHED_PROFILES; i++) {
455
- MRUProfile [i ] = malloc (sizeof (PROFILE ));
456
+ MRUProfile[i] = (PROFILE*) malloc (sizeof (PROFILE));
456
457
457
458
if (MRUProfile[i] == NULL )
458
459
break ;
@@ -520,7 +521,7 @@ static BOOL PROFILE_Open(LPCSTR filename)
520
521
// strcpy(newdos_name, filename);
521
522
522
523
// CurProfile->dos_name = newdos_name;
523
- CurProfile -> filename = malloc (strlen (filename ) + 1 );
524
+ CurProfile->filename = ( char *) malloc (strlen (filename) + 1 );
524
525
strcpy (CurProfile->filename , filename);
525
526
526
527
/* Try to open the profile file, first in $HOME/.wine */
@@ -783,7 +784,7 @@ static PROFILEKEY *PROFILE_Find(PROFILESECTION* *section,
783
784
if (!create)
784
785
return NULL ;
785
786
786
- if (!(* key = malloc (sizeof (PROFILEKEY ) + strlen (key_name ))))
787
+ if (!(*key = (PROFILEKEY*) malloc (sizeof (PROFILEKEY) + strlen (key_name))))
787
788
return NULL ;
788
789
789
790
strcpy ((*key)->name , key_name);
@@ -798,15 +799,15 @@ static PROFILEKEY *PROFILE_Find(PROFILESECTION* *section,
798
799
if (!create)
799
800
return NULL ;
800
801
801
- * section = malloc (sizeof (PROFILESECTION ) + strlen (section_name ));
802
+ *section = (PROFILESECTION*) malloc (sizeof (PROFILESECTION) + strlen (section_name));
802
803
803
804
if (*section == NULL )
804
805
return NULL ;
805
806
806
807
strcpy ((*section)->name , section_name);
807
808
(*section)->next = NULL ;
808
809
809
- if (!((* section )-> key = malloc (sizeof (PROFILEKEY ) + strlen (key_name )))) {
810
+ if (!((*section)->key = (tagPROFILEKEY*) malloc (sizeof (PROFILEKEY) + strlen (key_name)))) {
810
811
free (*section);
811
812
return NULL ;
812
813
} // endif malloc
@@ -1052,7 +1053,7 @@ static BOOL PROFILE_SetString(LPCSTR section_name, LPCSTR key_name,
1052
1053
} else if (trace > 1 )
1053
1054
htrc (" creating key\n " );
1054
1055
1055
- key -> value = malloc (strlen (value ) + 1 );
1056
+ key->value = ( char *) malloc (strlen (value) + 1 );
1056
1057
strcpy (key->value , value);
1057
1058
CurProfile->changed = TRUE ;
1058
1059
} // endelse
@@ -1125,7 +1126,7 @@ static int PROFILE_GetPrivateProfileString(LPCSTR section, LPCSTR entry,
1125
1126
if (*p == ' ' ) { /* ouch, contained trailing ' ' */
1126
1127
int len = p - (LPSTR)def_val;
1127
1128
1128
- pDefVal = malloc (len + 1 );
1129
+ pDefVal = (LPSTR) malloc (len + 1 );
1129
1130
strncpy (pDefVal, def_val, len);
1130
1131
pDefVal[len] = ' \0 ' ;
1131
1132
} // endif *p
@@ -1277,7 +1278,7 @@ BOOL WritePrivateProfileSection(LPCSTR section,
1277
1278
ret = TRUE ;
1278
1279
1279
1280
while (*string) {
1280
- LPSTR buf = malloc (strlen (string ) + 1 );
1281
+ LPSTR buf = (LPSTR) malloc (strlen (string) + 1 );
1281
1282
strcpy (buf, string);
1282
1283
1283
1284
if ((p = strchr (buf, ' =' ))) {
0 commit comments