Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-04-12 06:15:33 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-04-12 06:15:33 +0400
commitcc1259178b95d084a7ca9e83c90ef0ab97b7fa86 (patch)
treefb6b69a28ea45fb30373bdc4e387b0eebde4b3ce /intern/utfconv/utf_winfunc.c
parent5aaf3ede76c91a062d09360301083b6f75a6a89f (diff)
code cleanup: utfconv library had some quite confusing formatting, also cleared som warnings.
Diffstat (limited to 'intern/utfconv/utf_winfunc.c')
-rw-r--r--intern/utfconv/utf_winfunc.c65
1 files changed, 33 insertions, 32 deletions
diff --git a/intern/utfconv/utf_winfunc.c b/intern/utfconv/utf_winfunc.c
index 5887b957e29..f48a9c2afaa 100644
--- a/intern/utfconv/utf_winfunc.c
+++ b/intern/utfconv/utf_winfunc.c
@@ -4,7 +4,7 @@
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
+ * of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -17,7 +17,7 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
+ *
* Contributor(s): Alexandr Kuznetsov, Andrea Weikert
*
* ***** END GPL LICENSE BLOCK *****
@@ -37,19 +37,21 @@
FILE * ufopen(const char * filename, const char * mode)
{
- FILE * f = NULL;
+ FILE *f = NULL;
UTF16_ENCODE(filename);
UTF16_ENCODE (mode);
- if(filename_16 && mode_16) f = _wfopen(filename_16, mode_16);
+ if(filename_16 && mode_16) {
+ f = _wfopen(filename_16, mode_16);
+ }
UTF16_UN_ENCODE(mode);
UTF16_UN_ENCODE(filename);
- if(!f)
- {
- if(f=fopen(filename,mode))
+ if (!f) {
+ if ((f = fopen(filename, mode))) {
printf("WARNING: %s is not utf path. Please update it.\n",filename);
+ }
}
return f;
@@ -60,14 +62,16 @@ int uopen(const char *filename, int oflag, int pmode)
int f = -1;
UTF16_ENCODE(filename);
- if(filename_16) f = _wopen(filename_16, oflag, pmode);
+ if (filename_16) {
+ f = _wopen(filename_16, oflag, pmode);
+ }
UTF16_UN_ENCODE(filename);
- if(f==-1)
- {
- if((f=open(filename,oflag, pmode))!=-1)
+ if (f == -1) {
+ if ((f=open(filename,oflag, pmode)) != -1) {
printf("WARNING: %s is not utf path. Please update it.\n",filename);
+ }
}
return f;
@@ -96,7 +100,7 @@ int umkdir(const char *pathname)
UTF16_UN_ENCODE(pathname);
- return r?0:-1;
+ return r ? 0 : -1;
}
char * u_alloc_getenv(const char *varname)
@@ -104,8 +108,10 @@ char * u_alloc_getenv(const char *varname)
char * r = 0;
wchar_t * str;
UTF16_ENCODE(varname);
- if(varname_16){ str = _wgetenv(varname_16);
- r = alloc_utf_8_from_16(str,0);}
+ if (varname_16) {
+ str = _wgetenv(varname_16);
+ r = alloc_utf_8_from_16(str, 0);
+ }
UTF16_UN_ENCODE(varname);
return r;
@@ -122,35 +128,30 @@ int uput_getenv(const char *varname, char * value, size_t buffsize)
if(!buffsize) return r;
UTF16_ENCODE(varname);
- if(varname_16)
- {
- str = _wgetenv(varname_16);
- conv_utf_16_to_8(str, value, buffsize);
- r = 1;
- }
+ if(varname_16) {
+ str = _wgetenv(varname_16);
+ conv_utf_16_to_8(str, value, buffsize);
+ r = 1;
+ }
UTF16_UN_ENCODE(varname);
- if(!r) value[0] = 0;
+ if (!r) value[0] = 0;
return r;
}
-
-
int uputenv(const char *name, const char *value)
{
int r = -1;
- UTF16_ENCODE(name)
- UTF16_ENCODE(value)
- if(name_16 && value_16) {
- if(SetEnvironmentVariableW(name_16,value_16)!=0)
- r =0;
- else r = -1;
+ UTF16_ENCODE(name);
+ UTF16_ENCODE(value);
+ if(name_16 && value_16) {
+ r = (SetEnvironmentVariableW(name_16,value_16)!= 0) ? 0 : -1;
}
- UTF16_UN_ENCODE(value)
- UTF16_UN_ENCODE(name)
+ UTF16_UN_ENCODE(value);
+ UTF16_UN_ENCODE(name);
return r;
}
-#endif
+#endif /* WIN32 */