Browse Source

Code cleanup: replace "if(" with "if ("

pull/12/head
Bram Matthys 1 year ago
parent
commit
5154038d59
No known key found for this signature in database
GPG Key ID: BF8116B163EAAE98
  1. 2
      include/modules.h
  2. 22
      src/conf.c
  3. 10
      src/misc.c
  4. 8
      src/modules/antimixedutf8.c
  5. 8
      src/modules/cap.c
  6. 4
      src/modules/chanmodes/floodprot.c
  7. 2
      src/modules/clienttagdeny.c
  8. 6
      src/modules/invite.c
  9. 2
      src/modules/kick.c
  10. 10
      src/modules/monitor.c
  11. 2
      src/modules/motd.c
  12. 2
      src/modules/rules.c
  13. 4
      src/modules/tkl.c
  14. 4
      src/modules/whox.c
  15. 24
      src/openssl_hostname_validation.c
  16. 2
      src/parse.c
  17. 2
      src/random.c
  18. 20
      src/serv.c
  19. 2
      src/windows/gui.c
  20. 32
      src/windows/win.c

2
include/modules.h

@ -899,7 +899,7 @@ extern void HooktypeDel(Hooktype *hooktype, Module *module);
} \
}
#define RunHookReturnVoid(hooktype,x,ret) do { Hook *hook; for (hook = Hooks[hooktype]; hook; hook = hook->next) if((*(hook->func.intfunc))(x) ret) return; } while(0)
#define RunHookReturnVoid(hooktype,x,ret) do { Hook *hook; for (hook = Hooks[hooktype]; hook; hook = hook->next) if ((*(hook->func.intfunc))(x) ret) return; } while(0)
#define RunHook2(hooktype,x,y) do { Hook *hook; for (hook = Hooks[hooktype]; hook; hook = hook->next) (*(hook->func.intfunc))(x,y); } while(0)
#define RunHook3(hooktype,a,b,c) do { Hook *hook; for (hook = Hooks[hooktype]; hook; hook = hook->next) (*(hook->func.intfunc))(a,b,c); } while(0)
#define RunHook4(hooktype,a,b,c,d) do { Hook *hook; for (hook = Hooks[hooktype]; hook; hook = hook->next) (*(hook->func.intfunc))(a,b,c,d); } while(0)

22
src/conf.c

@ -1568,9 +1568,9 @@ int config_test_openfile(ConfigEntry *cep, int flags, mode_t mode, const char *e
{
int fd;
if(!cep->value)
if (!cep->value)
{
if(fatal)
if (fatal)
config_error("%s:%i: %s: <no file specified>: no file specified",
cep->file->filename,
cep->line_number,
@ -1586,9 +1586,9 @@ int config_test_openfile(ConfigEntry *cep, int flags, mode_t mode, const char *e
/* There's not much checking that can be done for asynchronously downloaded files */
#ifdef USE_LIBCURL
if(url_is_valid(cep->value))
if (url_is_valid(cep->value))
{
if(allow_url)
if (allow_url)
return 0;
/* but we can check if a URL is used wrongly :-) */
@ -1596,7 +1596,7 @@ int config_test_openfile(ConfigEntry *cep, int flags, mode_t mode, const char *e
cep->file->filename,
cep->line_number,
entry, cep->value);
if(fatal)
if (fatal)
return 1;
else
return 0;
@ -1620,13 +1620,13 @@ int config_test_openfile(ConfigEntry *cep, int flags, mode_t mode, const char *e
* and that we deal with all of the bugs that come with complexity.
* The only files we may be creating are the tunefile and pidfile so far.
*/
if(flags & O_CREAT)
if (flags & O_CREAT)
fd = open(cep->value, flags, mode);
else
fd = open(cep->value, flags);
if(fd == -1)
if (fd == -1)
{
if(fatal)
if (fatal)
config_error("%s:%i: %s: %s: %s",
cep->file->filename,
cep->line_number,
@ -2850,7 +2850,7 @@ int config_run()
* function.
*/
for(allow = conf_allow; allow; allow = allow->next)
if(!allow->ipv6_clone_mask)
if (!allow->ipv6_clone_mask)
allow->ipv6_clone_mask = tempiConf.default_ipv6_clone_mask;
/* ^^^ TODO: due to the two-stage model now we can do it in conf_allow again
@ -2865,7 +2865,7 @@ int config_run()
update_throttling_timer_settings();
/* initialize conf_files with defaults if the block isn't set: */
if(!conf_files)
if (!conf_files)
_conf_files(NULL, NULL);
if (errors > 0)
@ -3704,7 +3704,7 @@ int _conf_files(ConfigFile *conf, ConfigEntry *ce)
* the for loop's initialization of cep would segfault otherwise. We return 1 because
* if config_run() calls us with a NULL ce, it's got a bug...but we can't detect that.
*/
if(!ce)
if (!ce)
return 1;
for (cep = ce->items; cep; cep = cep->next)

10
src/misc.c

@ -357,7 +357,7 @@ int on_dccallow_list(Client *to, Client *from)
Link *lp;
for(lp = to->user->dccallow; lp; lp = lp->next)
if(lp->flags == DCC_LINK_ME && lp->value.client == from)
if (lp->flags == DCC_LINK_ME && lp->value.client == from)
return 1;
return 0;
}
@ -379,11 +379,11 @@ void remove_dcc_references(Client *client)
acptr = lp->value.client;
for(found = 0, lpp = &(acptr->user->dccallow); *lpp; lpp=&((*lpp)->next))
{
if(lp->flags == (*lpp)->flags)
if (lp->flags == (*lpp)->flags)
continue; /* match only opposite types for sanity */
if((*lpp)->value.client == client)
if ((*lpp)->value.client == client)
{
if((*lpp)->flags == DCC_LINK_ME)
if ((*lpp)->flags == DCC_LINK_ME)
{
sendto_one(acptr, NULL, ":%s %d %s :%s has been removed from "
"your DCC allow list for signing off",
@ -397,7 +397,7 @@ void remove_dcc_references(Client *client)
}
}
if(!found)
if (!found)
sendto_realops("[BUG] remove_dcc_references: %s was in dccallowme "
"list[%d] of %s but not in dccallowrem list!",
acptr->name, lp->flags, client->name);

8
src/modules/antimixedutf8.c

@ -99,22 +99,22 @@ int detect_script(const char *t)
else if ((t[0] == 0xd3) && (t[1] >= 0x80) && (t[1] <= 0xbf))
return SCRIPT_CYRILLIC;
if((t[0] == 0xe4) && (t[1] >= 0xb8) && (t[1] <= 0xbf))
if ((t[0] == 0xe4) && (t[1] >= 0xb8) && (t[1] <= 0xbf))
return SCRIPT_CJK;
else if ((t[0] >= 0xe5) && (t[0] <= 0xe9) && (t[1] >= 0x80) && (t[1] <= 0xbf))
return SCRIPT_CJK;
if((t[0] == 0xea) && (t[1] >= 0xb0) && (t[1] <= 0xbf))
if ((t[0] == 0xea) && (t[1] >= 0xb0) && (t[1] <= 0xbf))
return SCRIPT_HANGUL;
else if ((t[0] >= 0xeb) && (t[0] <= 0xec) && (t[1] >= 0x80) && (t[1] <= 0xbf))
return SCRIPT_HANGUL;
else if ((t[0] == 0xed) && (t[1] >= 0x80) && (t[1] <= 0x9f))
return SCRIPT_HANGUL;
if((t[0] == 0xe1) && (t[1] >= 0x90) && (t[1] <= 0x99))
if ((t[0] == 0xe1) && (t[1] >= 0x90) && (t[1] <= 0x99))
return SCRIPT_CANADIAN;
if((t[0] == 0xe0) && (t[1] >= 0xb0) && (t[1] <= 0xb1))
if ((t[0] == 0xe0) && (t[1] >= 0xb0) && (t[1] <= 0xb1))
return SCRIPT_TELUGU;
if ((t[0] >= 'a') && (t[0] <= 'z'))

8
src/modules/cap.c

@ -139,17 +139,17 @@ static ClientCapability *clicap_find(Client *client, const char *data, int *nega
return NULL;
}
if(*p == '-')
if (*p == '-')
{
*negate = 1;
p++;
/* someone sent a '-' without a parameter.. */
if(*p == '\0')
if (*p == '\0')
return NULL;
}
if((s = strchr(p, ' ')))
if ((s = strchr(p, ' ')))
*s++ = '\0';
cap = ClientCapabilityFind(p, client);
@ -406,7 +406,7 @@ CMD_FUNC(cmd_cap)
return;
}
if(!(cmd = bsearch(parv[1], clicap_cmdtable,
if (!(cmd = bsearch(parv[1], clicap_cmdtable,
sizeof(clicap_cmdtable) / sizeof(struct clicap_cmd),
sizeof(struct clicap_cmd), (bqcmp) clicap_cmd_search)))
{

4
src/modules/chanmodes/floodprot.c

@ -1306,10 +1306,10 @@ uint64_t gen_floodprot_msghash(char *text)
if (is_ctcp || is_action)
{
// Remove the \001 chars around the message
if((len = strlen(plaintext)) && plaintext[len - 1] == '\001')
if ((len = strlen(plaintext)) && plaintext[len - 1] == '\001')
plaintext[len - 1] = '\0';
plaintext++;
if(is_action)
if (is_action)
plaintext += 7;
}

2
src/modules/clienttagdeny.c

@ -62,7 +62,7 @@ char *ct_isupport_param(void){
strlcpy(buf, "*", sizeof(buf));
for (m = mtaghandlers; m; m = m->next) {
if(!m->unloaded && m->name[0] == '+'){
if (!m->unloaded && m->name[0] == '+'){
strlcat(buf, ",-", sizeof(buf));
strlcat(buf, m->name+1, sizeof(buf));
}

6
src/modules/invite.c

@ -124,7 +124,7 @@ void invite_free(ModData *md)
{
Link **inv, *tmp;
if(!md->ptr)
if (!md->ptr)
return; // was not set
for (inv = (Link **)md->ptr; (tmp = *inv); inv = &tmp->next)
@ -207,7 +207,7 @@ int invite_is_invited(Client *client, Channel *channel, int *invited)
{
Link *lp;
if(!MyConnect(client))
if (!MyConnect(client))
return 0; // not handling invite lists for remote clients
for (lp = CLIENT_INVITES(client); lp; lp = lp->next)
@ -322,7 +322,7 @@ CMD_FUNC(cmd_invite)
sendnumeric(client, ERR_NOSUCHCHANNEL, parv[2]);
return;
}
if(parc >= 4 && !BadPtr(parv[3]))
if (parc >= 4 && !BadPtr(parv[3]))
{
override = atoi(parv[3]);
}

2
src/modules/kick.c

@ -343,7 +343,7 @@ CMD_FUNC(cmd_kick)
int breakit = 0;
Hook *h;
for (h = Hooks[HOOKTYPE_PRE_LOCAL_KICK]; h; h = h->next) {
if((*(h->func.intfunc))(client,who,channel,comment) > 0) {
if ((*(h->func.intfunc))(client,who,channel,comment) > 0) {
breakit = 1;
break;
}

10
src/modules/monitor.c

@ -81,7 +81,7 @@ char *monitor_isupport_param(void)
int monitor_nickchange(Client *client, MessageTag *mtags, char *newnick)
{
if(!smycmp(client->name, newnick)) // new nick is same as old one, maybe the case changed
if (!smycmp(client->name, newnick)) // new nick is same as old one, maybe the case changed
return 0;
watch_check(client, RPL_MONOFFLINE);
@ -132,7 +132,7 @@ void send_status(Client *client, MessageTag *recv_mtags, char *nick)
Client *user;
user = find_person(nick, NULL);
new_message(client, recv_mtags, &mtags);
if(!user){
if (!user){
sendnumeric(client, RPL_MONOFFLINE, nick);
} else {
sendnumeric(client, RPL_MONONLINE, user->name, user->user->username, GetHost(user));
@ -151,7 +151,7 @@ CMD_FUNC(cmd_monitor)
int toomany = 0;
Link *lp;
if(parc < 2 || BadPtr(parv[1]))
if (parc < 2 || BadPtr(parv[1]))
cmd = 'l';
else
cmd = tolower(*parv[1]);
@ -202,10 +202,10 @@ CMD_FUNC(cmd_monitor)
break;
case '-':
case '+':
if(parc < 3 || BadPtr(parv[2]))
if (parc < 3 || BadPtr(parv[2]))
return;
for(s = strtoken(&p, parv[2], ","); s; s = strtoken(&p, NULL, ",")){
if(cmd == '-'){
if (cmd == '-'){
watch_del(s, client, WATCH_FLAG_TYPE_MONITOR);
} else {
if (WATCHES(client) >= MAXWATCH)

2
src/modules/motd.c

@ -101,7 +101,7 @@ CMD_FUNC(cmd_motd)
}
motdline = NULL;
if(themotd)
if (themotd)
motdline = themotd->lines;
while (motdline)
{

2
src/modules/rules.c

@ -70,7 +70,7 @@ CMD_FUNC(cmd_rules)
if (ptr)
temp = ptr->rules.lines;
if(!temp)
if (!temp)
temp = rules.lines;
if (temp == NULL)

4
src/modules/tkl.c

@ -2773,7 +2773,7 @@ void _tkl_check_local_remove_shun(TKL *tmp)
*/
keep_shun = 0;
for(tk = tklines[tkl_hash('s')]; tk && !keep_shun; tk = tk->next)
if(tk != tmp && match_simple(tk->ptr.serverban->usermask, cname))
if (tk != tmp && match_simple(tk->ptr.serverban->usermask, cname))
{
if ((*tk->ptr.serverban->hostmask >= '0') && (*tk->ptr.serverban->hostmask <= '9')
/* the hostmask is an IP */
@ -2785,7 +2785,7 @@ void _tkl_check_local_remove_shun(TKL *tmp)
keep_shun = 1;
}
if(!keep_shun)
if (!keep_shun)
{
ClearShunned(client);
}

4
src/modules/whox.c

@ -496,7 +496,7 @@ static void who_common_channel(Client *client, Channel *channel,
SetMark(acptr);
if(*maxmatches > 0)
if (*maxmatches > 0)
{
if (do_match(client, acptr, mask, fmt))
{
@ -611,7 +611,7 @@ static void do_who_on_channel(Client *client, Channel *channel,
if (!operspy && (acptr != client) && i != 0 && !(is_skochanop(client, channel)) && !(is_skochanop(acptr, channel) || has_voice(acptr,channel)))
continue;
if(member || !IsInvisible(acptr))
if (member || !IsInvisible(acptr))
do_who(client, acptr, channel, fmt);
}
}

24
src/openssl_hostname_validation.c

@ -146,7 +146,7 @@ static char Curl_raw_toupper(char in)
static int Curl_raw_equal(const char *first, const char *second)
{
while(*first && *second) {
if(Curl_raw_toupper(*first) != Curl_raw_toupper(*second))
if (Curl_raw_toupper(*first) != Curl_raw_toupper(*second))
/* get out of the loop as soon as they don't match */
break;
first++;
@ -161,14 +161,14 @@ static int Curl_raw_equal(const char *first, const char *second)
static int Curl_raw_nequal(const char *first, const char *second, size_t max)
{
while(*first && *second && max) {
if(Curl_raw_toupper(*first) != Curl_raw_toupper(*second)) {
if (Curl_raw_toupper(*first) != Curl_raw_toupper(*second)) {
break;
}
max--;
first++;
second++;
}
if(0 == max)
if (0 == max)
return 1; /* they are equal this far */
return Curl_raw_toupper(*first) == Curl_raw_toupper(*second);
@ -189,7 +189,7 @@ static int hostmatch(const char *hostname, const char *pattern)
int wildcard_enabled;
size_t prefixlen, suffixlen;
pattern_wildcard = strchr(pattern, '*');
if(pattern_wildcard == NULL)
if (pattern_wildcard == NULL)
return Curl_raw_equal(pattern, hostname) ?
CURL_HOST_MATCH : CURL_HOST_NOMATCH;
@ -197,24 +197,24 @@ static int hostmatch(const char *hostname, const char *pattern)
match. */
wildcard_enabled = 1;
pattern_label_end = strchr(pattern, '.');
if(pattern_label_end == NULL || strchr(pattern_label_end+1, '.') == NULL ||
if (pattern_label_end == NULL || strchr(pattern_label_end+1, '.') == NULL ||
pattern_wildcard > pattern_label_end ||
Curl_raw_nequal(pattern, "xn--", 4)) {
wildcard_enabled = 0;
}
if(!wildcard_enabled)
if (!wildcard_enabled)
return Curl_raw_equal(pattern, hostname) ?
CURL_HOST_MATCH : CURL_HOST_NOMATCH;
hostname_label_end = strchr(hostname, '.');
if(hostname_label_end == NULL ||
if (hostname_label_end == NULL ||
!Curl_raw_equal(pattern_label_end, hostname_label_end))
return CURL_HOST_NOMATCH;
/* The wildcard must match at least one character, so the left-most
label of the hostname is at least as large as the left-most label
of the pattern. */
if(hostname_label_end - hostname < pattern_label_end - pattern)
if (hostname_label_end - hostname < pattern_label_end - pattern)
return CURL_HOST_NOMATCH;
prefixlen = pattern_wildcard - pattern;
@ -227,14 +227,14 @@ static int hostmatch(const char *hostname, const char *pattern)
int Curl_cert_hostcheck(const char *match_pattern, const char *hostname)
{
if(!match_pattern || !*match_pattern ||
if (!match_pattern || !*match_pattern ||
!hostname || !*hostname) /* sanity check */
return 0;
if(Curl_raw_equal(hostname, match_pattern)) /* trivial case */
if (Curl_raw_equal(hostname, match_pattern)) /* trivial case */
return 1;
if(hostmatch(hostname,match_pattern) == CURL_HOST_MATCH)
if (hostmatch(hostname,match_pattern) == CURL_HOST_MATCH)
return 1;
return 0;
}
@ -388,7 +388,7 @@ static HostnameValidationResult matches_subject_alternative_name(const char *hos
HostnameValidationResult validate_hostname(const char *hostname, const X509 *server_cert) {
HostnameValidationResult result;
if((hostname == NULL) || (server_cert == NULL))
if ((hostname == NULL) || (server_cert == NULL))
return Error;
// First try the Subject Alternative Names extension

2
src/parse.c

@ -175,7 +175,7 @@ void parse(Client *cptr, char *buffer, int length)
for (h = Hooks[HOOKTYPE_PACKET]; h; h = h->next)
{
(*(h->func.intfunc))(from, &me, NULL, &buffer, &length);
if(!buffer)
if (!buffer)
return;
}

2
src/random.c

@ -276,7 +276,7 @@ chacha_encrypt_bytes(chacha_ctx *x,const u8 *m,u8 *c,u32 bytes)
*/
/* Modified for UnrealIRCd by Bram Matthys ("Syzop") in 2019.
* Things like taking out #if(n)def's for openssl (which we always
* Things like taking out #if (n)def's for openssl (which we always
* compile with), re-indenting, removing various stuff, etc.
*/

20
src/serv.c

@ -782,7 +782,7 @@ void read_motd(const char *filename, MOTDFile *themotd)
/* TODO: if themotd points to a tld's motd,
could a rehash disrupt this pointer?*/
#ifdef USE_LIBCURL
if(themotd->motd_download)
if (themotd->motd_download)
{
themotd->motd_download->themotd = NULL;
/*
@ -794,7 +794,7 @@ void read_motd(const char *filename, MOTDFile *themotd)
}
/* if filename is NULL, do_read_motd will catch it */
if(filename && url_is_valid(filename))
if (filename && url_is_valid(filename))
{
/* prepare our payload for read_motd_async_downloaded() */
motd_download = safe_alloc(sizeof(MOTDDownload));
@ -829,16 +829,16 @@ void read_motd_async_downloaded(const char *url, const char *filename, const cha
check if the download was soft-canceled. See struct.h's docs on
struct MOTDDownload for details.
*/
if(!themotd)
if (!themotd)
{
safe_free(motd_download);
return;
}
/* errors -- check for specialcached version if applicable */
if(!cached && !filename)
if (!cached && !filename)
{
if(has_cached_version(url))
if (has_cached_version(url))
{
config_warn("Error downloading MOTD file from \"%s\": %s -- using cached version instead.", displayurl(url), errorbuf);
filename = unreal_mkcache(url);
@ -856,7 +856,7 @@ void read_motd_async_downloaded(const char *url, const char *filename, const cha
* We need to move our newly downloaded file to its cache file
* if it isn't there already.
*/
if(!cached)
if (!cached)
{
/* create specialcached version for later */
unreal_copyfileex(filename, unreal_mkcache(url), 1);
@ -889,7 +889,7 @@ void do_read_motd(const char *filename, MOTDFile *themotd)
free_motd(themotd);
if(!filename)
if (!filename)
return;
fd = fopen(filename, "r");
@ -915,7 +915,7 @@ void do_read_motd(const char *filename, MOTDFile *themotd)
temp = safe_alloc(sizeof(MOTDLine));
safe_strdup(temp->line, line);
if(last)
if (last)
last->next = temp;
else
/* handle the special case of the first line */
@ -924,7 +924,7 @@ void do_read_motd(const char *filename, MOTDFile *themotd)
last = temp;
}
/* the file could be zero bytes long? */
if(last)
if (last)
last->next = NULL;
fclose(fd);
@ -941,7 +941,7 @@ void free_motd(MOTDFile *themotd)
{
MOTDLine *next, *motdline;
if(!themotd)
if (!themotd)
return;
for (motdline = themotd->lines; motdline; motdline = next)

2
src/windows/gui.c

@ -250,7 +250,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
WM_TASKBARCREATED = RegisterWindowMessage("TaskbarCreated");
WM_FINDMSGSTRING = RegisterWindowMessage(FINDMSGSTRING);
atexit(CleanUp);
if(!LoadLibrary("riched20.dll"))
if (!LoadLibrary("riched20.dll"))
LoadLibrary("riched32.dll");
InitDebug();

32
src/windows/win.c

@ -143,7 +143,7 @@ int GetOSName(char *pszOS)
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
if( !(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osvi)) )
if ( !(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osvi)) )
return -1;
// Call GetNativeSystemInfo if supported or GetSystemInfo otherwise.
@ -151,7 +151,7 @@ int GetOSName(char *pszOS)
pGNSI = (PGNSI) GetProcAddress(
GetModuleHandle(TEXT("kernel32.dll")),
"GetNativeSystemInfo");
if(NULL != pGNSI)
if (NULL != pGNSI)
pGNSI(&si);
else GetSystemInfo(&si);
@ -164,14 +164,14 @@ int GetOSName(char *pszOS)
if ( osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 1 )
{
if( osvi.wProductType == VER_NT_WORKSTATION )
if ( osvi.wProductType == VER_NT_WORKSTATION )
StringCchCat(pszOS, OSVER_SIZE, TEXT("Windows 7 "));
else StringCchCat(pszOS, OSVER_SIZE, TEXT("Windows Server 2008 R2 " ));
}
if ( osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0 )
{
if( osvi.wProductType == VER_NT_WORKSTATION )
if ( osvi.wProductType == VER_NT_WORKSTATION )
StringCchCat(pszOS, OSVER_SIZE, TEXT("Windows Vista "));
else StringCchCat(pszOS, OSVER_SIZE, TEXT("Windows Server 2008 " ));
@ -243,13 +243,13 @@ int GetOSName(char *pszOS)
if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2 )
{
if( GetSystemMetrics(SM_SERVERR2) )
if ( GetSystemMetrics(SM_SERVERR2) )
StringCchCat(pszOS, OSVER_SIZE, TEXT( "Windows Server 2003 R2, "));
else if ( osvi.wSuiteMask==VER_SUITE_STORAGE_SERVER )
StringCchCat(pszOS, OSVER_SIZE, TEXT( "Windows Storage Server 2003"));
else if ( osvi.wSuiteMask==VER_SUITE_WH_SERVER )
StringCchCat(pszOS, OSVER_SIZE, TEXT( "Windows Home Server"));
else if( osvi.wProductType == VER_NT_WORKSTATION &&
else if ( osvi.wProductType == VER_NT_WORKSTATION &&
si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64)
{
StringCchCat(pszOS, OSVER_SIZE, TEXT( "Windows XP Professional x64 Edition"));
@ -261,17 +261,17 @@ int GetOSName(char *pszOS)
{
if ( si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_IA64 )
{
if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
if ( osvi.wSuiteMask & VER_SUITE_DATACENTER )
StringCchCat(pszOS, OSVER_SIZE, TEXT( "Datacenter Edition for Itanium-based Systems" ));
else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
else if ( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
StringCchCat(pszOS, OSVER_SIZE, TEXT( "Enterprise Edition for Itanium-based Systems" ));
}
else if ( si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64 )
{
if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
if ( osvi.wSuiteMask & VER_SUITE_DATACENTER )
StringCchCat(pszOS, OSVER_SIZE, TEXT( "Datacenter x64 Edition" ));
else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
else if ( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
StringCchCat(pszOS, OSVER_SIZE, TEXT( "Enterprise x64 Edition" ));
else StringCchCat(pszOS, OSVER_SIZE, TEXT( "Standard x64 Edition" ));
}
@ -280,9 +280,9 @@ int GetOSName(char *pszOS)
{
if ( osvi.wSuiteMask & VER_SUITE_COMPUTE_SERVER )
StringCchCat(pszOS, OSVER_SIZE, TEXT( "Compute Cluster Edition" ));
else if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
else if ( osvi.wSuiteMask & VER_SUITE_DATACENTER )
StringCchCat(pszOS, OSVER_SIZE, TEXT( "Datacenter Edition" ));
else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
else if ( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
StringCchCat(pszOS, OSVER_SIZE, TEXT( "Enterprise Edition" ));
else if ( osvi.wSuiteMask & VER_SUITE_BLADE )
StringCchCat(pszOS, OSVER_SIZE, TEXT( "Web Edition" ));
@ -294,7 +294,7 @@ int GetOSName(char *pszOS)
if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1 )
{
StringCchCat(pszOS, OSVER_SIZE, TEXT("Windows XP "));
if( osvi.wSuiteMask & VER_SUITE_PERSONAL )
if ( osvi.wSuiteMask & VER_SUITE_PERSONAL )
StringCchCat(pszOS, OSVER_SIZE, TEXT( "Home Edition" ));
else StringCchCat(pszOS, OSVER_SIZE, TEXT( "Professional" ));
}
@ -309,9 +309,9 @@ int GetOSName(char *pszOS)
}
else
{
if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
if ( osvi.wSuiteMask & VER_SUITE_DATACENTER )
StringCchCat(pszOS, OSVER_SIZE, TEXT( "Datacenter Server" ));
else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
else if ( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
StringCchCat(pszOS, OSVER_SIZE, TEXT( "Advanced Server" ));
else StringCchCat(pszOS, OSVER_SIZE, TEXT( "Server" ));
}
@ -319,7 +319,7 @@ int GetOSName(char *pszOS)
// Include service pack (if any) and build number.
if( _tcslen(osvi.szCSDVersion) > 0 )
if ( _tcslen(osvi.szCSDVersion) > 0 )
{
StringCchCat(pszOS, OSVER_SIZE, TEXT(" ") );
StringCchCat(pszOS, OSVER_SIZE, osvi.szCSDVersion);

Loading…
Cancel
Save