Commit 8cfa84ca authored by Alexander Barkov's avatar Alexander Barkov

Fixing compilation warnings:

Using "bool" in pure C code is not a good idea.
- Defining BOOL as "long" on Unix (this is how MS defines it)
- Replacing bool to BOOL in pure C code.

modified:
  storage/connect/global.h
  storage/connect/inihandl.c
  storage/connect/os.h
  storage/connect/osutil.c
  storage/connect/osutil.h
parent 48ca5c6b
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
#define CRLF 2 #define CRLF 2
#else // !WIN32 #else // !WIN32
#define CRLF 1 #define CRLF 1
#define BOOL my_bool
#endif // !WIN32 #endif // !WIN32
/***********************************************************************/ /***********************************************************************/
......
...@@ -36,9 +36,6 @@ ...@@ -36,9 +36,6 @@
// The types and variables used locally // The types and variables used locally
//typedef int bool; //typedef int bool;
typedef unsigned int uint; typedef unsigned int uint;
#define DWORD int
#define TRUE 1
#define FALSE 0
#define SVP(S) ((S) ? S : "<null>") #define SVP(S) ((S) ? S : "<null>")
#define _strlwr(P) strlwr(P) //OB: changed this line #define _strlwr(P) strlwr(P) //OB: changed this line
#define MAX_PATHNAME_LEN 256 #define MAX_PATHNAME_LEN 256
...@@ -81,7 +78,7 @@ typedef struct tagPROFILESECTION { ...@@ -81,7 +78,7 @@ typedef struct tagPROFILESECTION {
} PROFILESECTION; } PROFILESECTION;
typedef struct { typedef struct {
bool changed; BOOL changed;
PROFILESECTION *section; PROFILESECTION *section;
//char *dos_name; //char *dos_name;
//char *unix_name; //char *unix_name;
...@@ -116,7 +113,7 @@ static char PROFILE_WineIniUsed[MAX_PATHNAME_LEN] = ""; ...@@ -116,7 +113,7 @@ static char PROFILE_WineIniUsed[MAX_PATHNAME_LEN] = "";
static const char hex[16] = "0123456789ABCDEF"; static const char hex[16] = "0123456789ABCDEF";
bool WritePrivateProfileString(LPCSTR section, LPCSTR entry, BOOL WritePrivateProfileString(LPCSTR section, LPCSTR entry,
LPCSTR string, LPCSTR filename ); LPCSTR string, LPCSTR filename );
/*********************************************************************** /***********************************************************************
* PROFILE_CopyEntry * PROFILE_CopyEntry
...@@ -350,7 +347,7 @@ static PROFILESECTION *PROFILE_Load( FILE *file ) ...@@ -350,7 +347,7 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
* *
* Flush the current profile to disk if changed. * Flush the current profile to disk if changed.
***********************************************************************/ ***********************************************************************/
static bool PROFILE_FlushFile(void) static BOOL PROFILE_FlushFile(void)
{ {
//char *p, buffer[MAX_PATHNAME_LEN]; //char *p, buffer[MAX_PATHNAME_LEN];
//const char *unix_name; //const char *unix_name;
...@@ -436,7 +433,7 @@ static void PROFILE_ReleaseFile(void) ...@@ -436,7 +433,7 @@ static void PROFILE_ReleaseFile(void)
* *
* Open a profile file, checking the cached file first. * Open a profile file, checking the cached file first.
***********************************************************************/ ***********************************************************************/
static bool PROFILE_Open(LPCSTR filename) static BOOL PROFILE_Open(LPCSTR filename)
{ {
//char buffer[MAX_PATHNAME_LEN]; //char buffer[MAX_PATHNAME_LEN];
//char *p; //char *p;
...@@ -565,7 +562,7 @@ static bool PROFILE_Open(LPCSTR filename) ...@@ -565,7 +562,7 @@ static bool PROFILE_Open(LPCSTR filename)
* *
* Delete a section from a profile tree. * Delete a section from a profile tree.
***********************************************************************/ ***********************************************************************/
static bool PROFILE_DeleteSection(PROFILESECTION* *section, LPCSTR name) static BOOL PROFILE_DeleteSection(PROFILESECTION* *section, LPCSTR name)
{ {
while (*section) { while (*section) {
if ((*section)->name[0] && !stricmp((*section)->name, name)) { if ((*section)->name[0] && !stricmp((*section)->name, name)) {
...@@ -589,7 +586,7 @@ static bool PROFILE_DeleteSection(PROFILESECTION* *section, LPCSTR name) ...@@ -589,7 +586,7 @@ static bool PROFILE_DeleteSection(PROFILESECTION* *section, LPCSTR name)
* *
* Delete a key from a profile tree. * Delete a key from a profile tree.
***********************************************************************/ ***********************************************************************/
static bool PROFILE_DeleteKey(PROFILESECTION* *section, static BOOL PROFILE_DeleteKey(PROFILESECTION* *section,
LPCSTR section_name, LPCSTR key_name) LPCSTR section_name, LPCSTR key_name)
{ {
while (*section) { while (*section) {
...@@ -656,7 +653,7 @@ void PROFILE_DeleteAllKeys(LPCSTR section_name) ...@@ -656,7 +653,7 @@ void PROFILE_DeleteAllKeys(LPCSTR section_name)
static PROFILEKEY *PROFILE_Find(PROFILESECTION* *section, static PROFILEKEY *PROFILE_Find(PROFILESECTION* *section,
const char *section_name, const char *section_name,
const char *key_name, const char *key_name,
bool create, bool create_always) BOOL create, BOOL create_always)
{ {
const char *p; const char *p;
int seclen, keylen; int seclen, keylen;
...@@ -747,8 +744,8 @@ static PROFILEKEY *PROFILE_Find(PROFILESECTION* *section, ...@@ -747,8 +744,8 @@ static PROFILEKEY *PROFILE_Find(PROFILESECTION* *section,
* If return_values is TRUE, also include the corresponding values. * If return_values is TRUE, also include the corresponding values.
***********************************************************************/ ***********************************************************************/
static int PROFILE_GetSection(PROFILESECTION *section, LPCSTR section_name, static int PROFILE_GetSection(PROFILESECTION *section, LPCSTR section_name,
LPSTR buffer, uint len, bool handle_env, LPSTR buffer, uint len,
bool return_values) BOOL handle_env, BOOL return_values)
{ {
PROFILEKEY *key; PROFILEKEY *key;
...@@ -927,8 +924,8 @@ static int PROFILE_GetString(LPCSTR section, LPCSTR key_name, ...@@ -927,8 +924,8 @@ static int PROFILE_GetString(LPCSTR section, LPCSTR key_name,
* *
* Set a profile string. * Set a profile string.
***********************************************************************/ ***********************************************************************/
static bool PROFILE_SetString(LPCSTR section_name, LPCSTR key_name, static BOOL PROFILE_SetString(LPCSTR section_name, LPCSTR key_name,
LPCSTR value, bool create_always) LPCSTR value, BOOL create_always)
{ {
if (!key_name) { /* Delete a whole section */ if (!key_name) { /* Delete a whole section */
if (trace > 1) if (trace > 1)
...@@ -1026,7 +1023,7 @@ char *PROFILE_GetStringItem(char* start) ...@@ -1026,7 +1023,7 @@ char *PROFILE_GetStringItem(char* start)
static int PROFILE_GetPrivateProfileString(LPCSTR section, LPCSTR entry, static int PROFILE_GetPrivateProfileString(LPCSTR section, LPCSTR entry,
LPCSTR def_val, LPSTR buffer, LPCSTR def_val, LPSTR buffer,
uint len, LPCSTR filename, uint len, LPCSTR filename,
bool allow_section_name_copy) BOOL allow_section_name_copy)
{ {
int ret; int ret;
LPSTR pDefVal = NULL; LPSTR pDefVal = NULL;
...@@ -1143,10 +1140,10 @@ int GetPrivateProfileSection(LPCSTR section, LPSTR buffer, ...@@ -1143,10 +1140,10 @@ int GetPrivateProfileSection(LPCSTR section, LPSTR buffer,
/*********************************************************************** /***********************************************************************
* WritePrivateProfileStringA (KERNEL32.@) * WritePrivateProfileStringA (KERNEL32.@)
***********************************************************************/ ***********************************************************************/
bool WritePrivateProfileString(LPCSTR section, LPCSTR entry, BOOL WritePrivateProfileString(LPCSTR section, LPCSTR entry,
LPCSTR string, LPCSTR filename) LPCSTR string, LPCSTR filename)
{ {
bool ret = FALSE; BOOL ret = FALSE;
EnterCriticalSection( &PROFILE_CritSect ); EnterCriticalSection( &PROFILE_CritSect );
...@@ -1176,10 +1173,10 @@ bool WritePrivateProfileString(LPCSTR section, LPCSTR entry, ...@@ -1176,10 +1173,10 @@ bool WritePrivateProfileString(LPCSTR section, LPCSTR entry,
/*********************************************************************** /***********************************************************************
* WritePrivateProfileSectionA (KERNEL32.@) * WritePrivateProfileSectionA (KERNEL32.@)
***********************************************************************/ ***********************************************************************/
bool WritePrivateProfileSection(LPCSTR section, BOOL WritePrivateProfileSection(LPCSTR section,
LPCSTR string, LPCSTR filename ) LPCSTR string, LPCSTR filename )
{ {
bool ret = FALSE; BOOL ret = FALSE;
LPSTR p ; LPSTR p ;
EnterCriticalSection(&PROFILE_CritSect); EnterCriticalSection(&PROFILE_CritSect);
......
...@@ -26,6 +26,7 @@ typedef unsigned char BYTE; ...@@ -26,6 +26,7 @@ typedef unsigned char BYTE;
typedef char *LPSTR; typedef char *LPSTR;
typedef char *LPTSTR; typedef char *LPTSTR;
typedef char *PSZ; typedef char *PSZ;
typedef long BOOL;
typedef int INT; typedef int INT;
#if !defined(NODW) #if !defined(NODW)
/* /*
...@@ -39,13 +40,6 @@ typedef unsigned long DWORD; ...@@ -39,13 +40,6 @@ typedef unsigned long DWORD;
#undef HANDLE #undef HANDLE
typedef int HANDLE; typedef int HANDLE;
/* TODO-BAR: remove this */
#ifdef __cplusplus
typedef int bool;
#else
#define bool my_bool
#endif
#define stricmp strcasecmp #define stricmp strcasecmp
#define _stricmp strcasecmp #define _stricmp strcasecmp
#define strnicmp strncasecmp #define strnicmp strncasecmp
......
...@@ -17,7 +17,6 @@ my_bool CloseFileHandle(HANDLE h) ...@@ -17,7 +17,6 @@ my_bool CloseFileHandle(HANDLE h)
//#include <ctype.h> //#include <ctype.h>
#include <fcntl.h> #include <fcntl.h>
#define DWORD int
extern FILE *debug; extern FILE *debug;
/***********************************************************************/ /***********************************************************************/
...@@ -195,7 +194,7 @@ char *_fullpath(char *absPath, const char *relPath, size_t maxLength) ...@@ -195,7 +194,7 @@ char *_fullpath(char *absPath, const char *relPath, size_t maxLength)
return absPath; return absPath;
} /* end of _fullpath */ } /* end of _fullpath */
bool MessageBeep(uint i) BOOL MessageBeep(uint i)
{ {
// Fixme // Fixme
return TRUE; return TRUE;
......
...@@ -29,7 +29,7 @@ int GetLastError(); ...@@ -29,7 +29,7 @@ int GetLastError();
void _splitpath(const char*, char*, char*, char*, char*); void _splitpath(const char*, char*, char*, char*, char*);
void _makepath(char*, const char*, const char*, const char*, const char*); void _makepath(char*, const char*, const char*, const char*, const char*);
char *_fullpath(char *absPath, const char *relPath, size_t maxLength); char *_fullpath(char *absPath, const char *relPath, size_t maxLength);
bool MessageBeep(uint); BOOL MessageBeep(uint);
unsigned long _filelength(int fd); unsigned long _filelength(int fd);
int GetPrivateProfileString( int GetPrivateProfileString(
...@@ -48,7 +48,7 @@ uint GetPrivateProfileInt( ...@@ -48,7 +48,7 @@ uint GetPrivateProfileInt(
LPCTSTR lpFileName // initialization file name LPCTSTR lpFileName // initialization file name
); );
bool WritePrivateProfileString( BOOL WritePrivateProfileString(
LPCTSTR lpAppName, // section name LPCTSTR lpAppName, // section name
LPCTSTR lpKeyName, // key name LPCTSTR lpKeyName, // key name
LPCTSTR lpString, // string to add LPCTSTR lpString, // string to add
...@@ -62,7 +62,7 @@ int GetPrivateProfileSection( ...@@ -62,7 +62,7 @@ int GetPrivateProfileSection(
LPCTSTR lpFileName // initialization file name LPCTSTR lpFileName // initialization file name
); );
bool WritePrivateProfileSection( BOOL WritePrivateProfileSection(
LPCTSTR lpAppName, // section name LPCTSTR lpAppName, // section name
LPCTSTR lpString, // data LPCTSTR lpString, // data
LPCTSTR lpFileName // file name LPCTSTR lpFileName // file name
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment