clang-cl loplugin: solenv

Change-Id: I0a1075b92e787fc8bab7cfab5c3f24ad918a9181
Reviewed-on: https://gerrit.libreoffice.org/29850
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann
2016-10-14 16:52:01 +02:00
parent 48b1c8898d
commit ce8bb761f3
2 changed files with 9 additions and 10 deletions

View File

@@ -28,7 +28,6 @@
#endif /* Def _AIX */ #endif /* Def _AIX */
#ifdef _MSC_VER #ifdef _MSC_VER
#define __windows
#undef CORE_BIG_ENDIAN #undef CORE_BIG_ENDIAN
#define CORE_LITTLE_ENDIAN #define CORE_LITTLE_ENDIAN
#endif /* Def _MSC_VER */ #endif /* Def _MSC_VER */
@@ -80,7 +79,7 @@
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#ifdef __windows #ifdef _MSC_VER
#include <io.h> #include <io.h>
#else #else
#include <unistd.h> #include <unistd.h>
@@ -89,7 +88,7 @@
#include <config_options.h> #include <config_options.h>
/* modes */ /* modes */
#ifdef __windows #ifdef _MSC_VER
#define FILE_O_RDONLY _O_RDONLY #define FILE_O_RDONLY _O_RDONLY
#define FILE_O_BINARY _O_BINARY #define FILE_O_BINARY _O_BINARY
#define PATHNCMP _strnicmp /* MSVC converts paths to lower-case sometimes? */ #define PATHNCMP _strnicmp /* MSVC converts paths to lower-case sometimes? */

View File

@@ -129,7 +129,7 @@ string processccargs(vector<string> rawargs) {
} }
else if(!(*i).compare(0,2,"-D")) { else if(!(*i).compare(0,2,"-D")) {
// need to re-escape strings for preprocessor // need to re-escape strings for preprocessor
for(size_t pos=(*i).find("\"",0); pos!=string::npos; pos=(*i).find("\"",pos)) { for(size_t pos=(*i).find("\""); pos!=string::npos; pos=(*i).find("\"",pos)) {
(*i).replace(pos,0,"\\"); (*i).replace(pos,0,"\\");
pos+=2; pos+=2;
} }
@@ -202,12 +202,12 @@ int startprocess(string command, string args) {
if(!CreateProcess(nullptr, // Process Name if(!CreateProcess(nullptr, // Process Name
cmdlineBuf, // Command Line cmdlineBuf, // Command Line
NULL, // Process Handle not Inheritable nullptr, // Process Handle not Inheritable
NULL, // Thread Handle not Inheritable nullptr, // Thread Handle not Inheritable
TRUE, // Handles are Inherited TRUE, // Handles are Inherited
0, // No creation flags 0, // No creation flags
NULL, // Environment for process nullptr, // Environment for process
NULL, // Use same starting directory nullptr, // Use same starting directory
&si, // Startup Info &si, // Startup Info
&pi) // Process Information &pi) // Process Information
) { ) {
@@ -223,7 +223,7 @@ int startprocess(string command, string args) {
DWORD readlen, writelen, ret; DWORD readlen, writelen, ret;
HANDLE stdout_handle=GetStdHandle(STD_OUTPUT_HANDLE); HANDLE stdout_handle=GetStdHandle(STD_OUTPUT_HANDLE);
while(true) { while(true) {
int success=ReadFile(childout_read,buffer,BUFLEN,&readlen,NULL); int success=ReadFile(childout_read,buffer,BUFLEN,&readlen,nullptr);
// check if the child process has exited // check if the child process has exited
if(GetLastError()==ERROR_BROKEN_PIPE) if(GetLastError()==ERROR_BROKEN_PIPE)
break; break;
@@ -232,7 +232,7 @@ int startprocess(string command, string args) {
exit(1); exit(1);
} }
if(readlen!=0) { if(readlen!=0) {
WriteFile(stdout_handle,buffer,readlen,&writelen,NULL); WriteFile(stdout_handle,buffer,readlen,&writelen,nullptr);
} }
} }
WaitForSingleObject(pi.hProcess, INFINITE); WaitForSingleObject(pi.hProcess, INFINITE);