Skip to content

Commit 646ecb8

Browse files
committed
Change inihandl from c to cpp (to accept bool)
1 parent 3db76c9 commit 646ecb8

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

storage/connect/inihandl.c renamed to storage/connect/inihandl.cpp

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
// The types and variables used locally
3838
//typedef int bool;
3939
typedef unsigned int uint;
40-
#define SVP(S) ((S) ? S : "<null>")
40+
//#define SVP(S) ((S) ? S : "<null>")
4141
#define _strlwr(P) strlwr(P) //OB: changed this line
4242
#define MAX_PATHNAME_LEN 256
4343
#define N_CACHED_PROFILES 10
@@ -61,8 +61,8 @@ void htrc(char const *fmt, ...)
6161
} /* end of htrc */
6262
#else // !TEST_MODULE
6363
// Normal included functions
64-
extern int trace;
65-
void htrc(char const *fmt, ...);
64+
//extern int trace;
65+
//void htrc(char const *fmt, ...);
6666
#endif // !TEST MODULE
6767

6868

@@ -112,10 +112,11 @@ static PROFILE *MRUProfile[N_CACHED_PROFILES] = {NULL};
112112

113113
//static CRITICAL_SECTION PROFILE_CritSect = CRITICAL_SECTION_INIT("PROFILE_CritSect");
114114

115-
static const char hex[16] = "0123456789ABCDEF";
115+
static const char hex[17] = "0123456789ABCDEF";
116116

117117
BOOL WritePrivateProfileString(LPCSTR section, LPCSTR entry,
118-
LPCSTR string, LPCSTR filename );
118+
LPCSTR string, LPCSTR filename);
119+
119120
/***********************************************************************
120121
* PROFILE_CopyEntry
121122
*
@@ -254,7 +255,7 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
254255
PROFILESECTION* *next_section;
255256
PROFILEKEY *key, *prev_key, **next_key;
256257

257-
first_section = malloc(sizeof(*section));
258+
first_section = (PROFILESECTION*)malloc(sizeof(*section));
258259

259260
if (first_section == NULL)
260261
return NULL;
@@ -281,7 +282,7 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
281282
*p2 = '\0';
282283
p++;
283284

284-
if (!(section = malloc(sizeof(*section) + strlen(p))))
285+
if (!(section = (PROFILESECTION*)malloc(sizeof(*section) + strlen(p))))
285286
break;
286287

287288
strcpy(section->name, p);
@@ -319,13 +320,13 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
319320
} // endif p2
320321

321322
if (*p || !prev_key || *prev_key->name) {
322-
if (!(key = malloc(sizeof(*key) + strlen(p))))
323+
if (!(key = (PROFILEKEY*)malloc(sizeof(*key) + strlen(p))))
323324
break;
324325

325326
strcpy(key->name, p);
326327

327328
if (p2) {
328-
key->value = malloc(strlen(p2)+1);
329+
key->value = (char*)malloc(strlen(p2)+1);
329330
strcpy(key->value, p2);
330331
} else
331332
key->value = NULL;
@@ -452,7 +453,7 @@ static BOOL PROFILE_Open(LPCSTR filename)
452453
/* First time around */
453454
if (!CurProfile)
454455
for (i = 0; i < N_CACHED_PROFILES; i++) {
455-
MRUProfile[i] = malloc(sizeof(PROFILE));
456+
MRUProfile[i] = (PROFILE*)malloc(sizeof(PROFILE));
456457

457458
if (MRUProfile[i] == NULL)
458459
break;
@@ -520,7 +521,7 @@ static BOOL PROFILE_Open(LPCSTR filename)
520521
// strcpy(newdos_name, filename);
521522

522523
// CurProfile->dos_name = newdos_name;
523-
CurProfile->filename = malloc(strlen(filename) + 1);
524+
CurProfile->filename = (char*)malloc(strlen(filename) + 1);
524525
strcpy(CurProfile->filename, filename);
525526

526527
/* Try to open the profile file, first in $HOME/.wine */
@@ -783,7 +784,7 @@ static PROFILEKEY *PROFILE_Find(PROFILESECTION* *section,
783784
if (!create)
784785
return NULL;
785786

786-
if (!(*key = malloc(sizeof(PROFILEKEY) + strlen(key_name))))
787+
if (!(*key = (PROFILEKEY*)malloc(sizeof(PROFILEKEY) + strlen(key_name))))
787788
return NULL;
788789

789790
strcpy((*key)->name, key_name);
@@ -798,15 +799,15 @@ static PROFILEKEY *PROFILE_Find(PROFILESECTION* *section,
798799
if (!create)
799800
return NULL;
800801

801-
*section = malloc(sizeof(PROFILESECTION) + strlen(section_name));
802+
*section = (PROFILESECTION*)malloc(sizeof(PROFILESECTION) + strlen(section_name));
802803

803804
if (*section == NULL)
804805
return NULL;
805806

806807
strcpy((*section)->name, section_name);
807808
(*section)->next = NULL;
808809

809-
if (!((*section)->key = malloc(sizeof(PROFILEKEY) + strlen(key_name)))) {
810+
if (!((*section)->key = (tagPROFILEKEY*)malloc(sizeof(PROFILEKEY) + strlen(key_name)))) {
810811
free(*section);
811812
return NULL;
812813
} // endif malloc
@@ -1052,7 +1053,7 @@ static BOOL PROFILE_SetString(LPCSTR section_name, LPCSTR key_name,
10521053
} else if (trace > 1)
10531054
htrc(" creating key\n" );
10541055

1055-
key->value = malloc(strlen(value) + 1);
1056+
key->value = (char*)malloc(strlen(value) + 1);
10561057
strcpy(key->value, value);
10571058
CurProfile->changed = TRUE;
10581059
} // endelse
@@ -1125,7 +1126,7 @@ static int PROFILE_GetPrivateProfileString(LPCSTR section, LPCSTR entry,
11251126
if (*p == ' ') { /* ouch, contained trailing ' ' */
11261127
int len = p - (LPSTR)def_val;
11271128

1128-
pDefVal = malloc(len + 1);
1129+
pDefVal = (LPSTR)malloc(len + 1);
11291130
strncpy(pDefVal, def_val, len);
11301131
pDefVal[len] = '\0';
11311132
} // endif *p
@@ -1277,7 +1278,7 @@ BOOL WritePrivateProfileSection(LPCSTR section,
12771278
ret = TRUE;
12781279

12791280
while (*string) {
1280-
LPSTR buf = malloc(strlen(string) + 1);
1281+
LPSTR buf = (LPSTR)malloc(strlen(string) + 1);
12811282
strcpy(buf, string);
12821283

12831284
if ((p = strchr(buf, '='))) {

0 commit comments

Comments
 (0)