diff options
author | Werner Koch <wk@gnupg.org> | 2011-02-04 12:57:53 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2011-02-04 12:57:53 +0100 |
commit | b008274afdbe375b32a7e66dbd073e200f6f0587 (patch) | |
tree | 219e239d39cf06be3f03aa82fb572080ac163a15 /common/w32-reg.c | |
parent | Let autogen.sh check the git config (diff) | |
download | gnupg2-b008274afdbe375b32a7e66dbd073e200f6f0587.tar.xz gnupg2-b008274afdbe375b32a7e66dbd073e200f6f0587.zip |
Nuked almost all trailing white space.post-nuke-of-trailing-ws
We better do this once and for all instead of cluttering all future
commits with diffs of trailing white spaces. In the majority of cases
blank or single lines are affected and thus this change won't disturb
a git blame too much. For future commits the pre-commit scripts
checks that this won't happen again.
Diffstat (limited to 'common/w32-reg.c')
-rw-r--r-- | common/w32-reg.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/common/w32-reg.c b/common/w32-reg.c index 5809c32bb..5dc2be584 100644 --- a/common/w32-reg.c +++ b/common/w32-reg.c @@ -36,7 +36,7 @@ static HKEY get_root_key(const char *root) { HKEY root_key; - + if (!root) root_key = HKEY_CURRENT_USER; else if (!strcmp( root, "HKEY_CLASSES_ROOT" ) ) @@ -53,7 +53,7 @@ get_root_key(const char *root) root_key = HKEY_CURRENT_CONFIG; else return NULL; - + return root_key; } @@ -69,10 +69,10 @@ read_w32_registry_string (const char *root, const char *dir, const char *name) DWORD n1, nbytes, type; char *result = NULL; wchar_t *wdir, *wname; - + if ( !(root_key = get_root_key(root) ) ) return NULL; - + wdir = utf8_to_wchar (dir); if (!wdir) return NULL; @@ -115,7 +115,7 @@ read_w32_registry_string (const char *root, const char *dir, const char *name) goto leave; } result[nbytes] = 0; /* Make sure it is a string. */ - result[nbytes+1] = 0; + result[nbytes+1] = 0; if (type == REG_SZ || type == REG_EXPAND_SZ) { wchar_t *tmp = (void*)result; @@ -131,10 +131,10 @@ read_w32_registry_string (const char *root, const char *dir, const char *name) HKEY root_key, key_handle; DWORD n1, nbytes, type; char *result = NULL; - + if ( !(root_key = get_root_key(root) ) ) return NULL; - + if (RegOpenKeyEx (root_key, dir, 0, KEY_READ, &key_handle) ) { if (root) @@ -160,7 +160,7 @@ read_w32_registry_string (const char *root, const char *dir, const char *name) if (type == REG_EXPAND_SZ && strchr (result, '%')) { char *tmp; - + n1 += 1000; tmp = jnlib_malloc (n1+1); if (!tmp) @@ -177,7 +177,7 @@ read_w32_registry_string (const char *root, const char *dir, const char *name) if (nbytes && nbytes > n1) { /* Oops - truncated, better don't expand at all. */ - jnlib_free (tmp); + jnlib_free (tmp); goto leave; } tmp[nbytes] = 0; @@ -192,14 +192,14 @@ read_w32_registry_string (const char *root, const char *dir, const char *name) result = jnlib_malloc (strlen (tmp)+1); if (!result) result = tmp; - else + else { strcpy (result, tmp); jnlib_free (tmp); } } - else - { + else + { /* Error - don't expand. */ jnlib_free (tmp); } @@ -215,7 +215,7 @@ read_w32_registry_string (const char *root, const char *dir, const char *name) /* Note: This code is not well tested. However, it is not used in GnuPG. */ int -write_w32_registry_string (const char *root, const char *dir, +write_w32_registry_string (const char *root, const char *dir, const char *name, const char *value) { HKEY root_key, reg_key; @@ -236,7 +236,7 @@ write_w32_registry_string (const char *root, const char *dir, return -1; } jnlib_free (wdir); - + if (name) { wname = utf8_to_wchar (name); @@ -253,12 +253,12 @@ write_w32_registry_string (const char *root, const char *dir, return -1; } - if (RegSetValueEx (reg_key, wname, 0, REG_SZ, + if (RegSetValueEx (reg_key, wname, 0, REG_SZ, (BYTE *)wvalue, wcslen (wvalue)) != ERROR_SUCCESS ) { if (RegCreateKeyEx (root_key, wname, 0, NULL, 0, 0, NULL, - ®_key, &disp) != ERROR_SUCCESS) + ®_key, &disp) != ERROR_SUCCESS) { RegCloseKey(reg_key); jnlib_free (wname); @@ -274,7 +274,7 @@ write_w32_registry_string (const char *root, const char *dir, return -1; } } - + jnlib_free (wname); jnlib_free (wvalue); RegCloseKey (reg_key); @@ -283,15 +283,15 @@ write_w32_registry_string (const char *root, const char *dir, if ( !(root_key = get_root_key(root) ) ) return -1; - - if ( RegOpenKeyEx( root_key, dir, 0, KEY_WRITE, ®_key ) + + if ( RegOpenKeyEx( root_key, dir, 0, KEY_WRITE, ®_key ) != ERROR_SUCCESS ) return -1; - - if ( RegSetValueEx (reg_key, name, 0, REG_SZ, (BYTE *)value, + + if ( RegSetValueEx (reg_key, name, 0, REG_SZ, (BYTE *)value, strlen( value ) ) != ERROR_SUCCESS ) { - if ( RegCreateKey( root_key, name, ®_key ) != ERROR_SUCCESS ) + if ( RegCreateKey( root_key, name, ®_key ) != ERROR_SUCCESS ) { RegCloseKey(reg_key); return -1; @@ -303,7 +303,7 @@ write_w32_registry_string (const char *root, const char *dir, return -1; } } - + RegCloseKey (reg_key); return 0; #endif /*!HAVE_W32CE_SYSTEM*/ |