SF.net SVN: geany:[3820] trunk/src/win32.c
eht16 at users.sourceforge.net
eht16 at xxxxx
Wed May 27 18:54:16 UTC 2009
Revision: 3820
http://geany.svn.sourceforge.net/geany/?rev=3820&view=rev
Author: eht16
Date: 2009-05-27 18:54:16 +0000 (Wed, 27 May 2009)
Log Message:
-----------
Minor cleanup
Modified Paths:
--------------
trunk/src/win32.c
Modified: trunk/src/win32.c
===================================================================
--- trunk/src/win32.c 2009-05-27 18:34:39 UTC (rev 3819)
+++ trunk/src/win32.c 2009-05-27 18:54:16 UTC (rev 3820)
@@ -323,7 +323,6 @@
wchar_t w_dir[MAX_PATH];
fname[0] = '\0';
- g_message("%d",MAX_PATH);
MultiByteToWideChar(CP_UTF8, 0, initial_dir, -1, w_dir, sizeof(w_dir));
@@ -816,7 +815,7 @@
SetHandleInformation(gw_spawn.hChildStdoutRd, HANDLE_FLAG_INHERIT, 0);
/* Create a pipe for the child process's STDERR. */
- if (!CreatePipe(&(gw_spawn.hChildStderrRd), &(gw_spawn.hChildStderrWr), &saAttr, 0))
+ if (! CreatePipe(&(gw_spawn.hChildStderrRd), &(gw_spawn.hChildStderrWr), &saAttr, 0))
{
gchar *msg = g_win32_error_message(GetLastError());
geany_debug("win32_spawn: Stderr pipe creation failed");
@@ -830,7 +829,7 @@
SetHandleInformation(gw_spawn.hChildStderrRd, HANDLE_FLAG_INHERIT, 0);
/* Create a pipe for the child process's STDIN. */
- if (!CreatePipe(&(gw_spawn.hChildStdinRd), &(gw_spawn.hChildStdinWr), &saAttr, 0))
+ if (! CreatePipe(&(gw_spawn.hChildStdinRd), &(gw_spawn.hChildStdinWr), &saAttr, 0))
{
gchar *msg = g_win32_error_message(GetLastError());
geany_debug("win32_spawn: Stdin pipe creation failed");
@@ -850,7 +849,7 @@
*exit_status = gw_spawn.dwExitCode;
}
- if (!fSuccess)
+ if (! fSuccess)
{
geany_debug("win32_spawn: Create process failed");
if (error != NULL)
@@ -862,7 +861,7 @@
if (std_out != NULL)
{
ReadFromPipe(gw_spawn.hChildStdoutRd, gw_spawn.hChildStdoutWr, hStdoutTempFile, error);
- if (!GetContentFromHandle(hStdoutTempFile, &stdout_content, error))
+ if (! GetContentFromHandle(hStdoutTempFile, &stdout_content, error))
{
return FALSE;
}
@@ -872,7 +871,7 @@
if (std_err != NULL)
{
ReadFromPipe(gw_spawn.hChildStderrRd, gw_spawn.hChildStderrWr, hStderrTempFile, error);
- if (!GetContentFromHandle(hStderrTempFile, &stderr_content, error))
+ if (! GetContentFromHandle(hStderrTempFile, &stderr_content, error))
{
return FALSE;
}
@@ -888,15 +887,15 @@
gchar * buffer;
DWORD dwRead;
- filesize = GetFileSize(hFile, NULL);
+ filesize = GetFileSize(hFile, NULL);
if (filesize < 1)
{
*content = NULL;
return TRUE;
}
- buffer = g_malloc(sizeof(gchar*) * (filesize+1));
- if (!buffer)
+ buffer = g_malloc(filesize + 1);
+ if (! buffer)
{
gchar *msg = g_win32_error_message(GetLastError());
geany_debug("GetContentFromHandle: Alloc failed");
@@ -906,9 +905,8 @@
return FALSE;
}
- SetFilePointer(hFile,0, NULL, FILE_BEGIN);
- if (!ReadFile(hFile, buffer, filesize, &dwRead,
- NULL) || dwRead == 0)
+ SetFilePointer(hFile, 0, NULL, FILE_BEGIN);
+ if (! ReadFile(hFile, buffer, filesize, &dwRead, NULL) || dwRead == 0)
{
gchar *msg = g_win32_error_message(GetLastError());
geany_debug("GetContentFromHandle: Cannot read tempfile");
@@ -918,7 +916,7 @@
return FALSE;
}
- if (!CloseHandle (hFile))
+ if (! CloseHandle(hFile))
{
gchar *msg = g_win32_error_message(GetLastError());
geany_debug("GetContentFromHandle: CloseHandle failed (%d)", (gint) GetLastError());
@@ -976,8 +974,8 @@
}
else
{
- int i;
- DWORD dwStatus;
+ gint i;
+ DWORD dwStatus;
for (i = 0; i < 2 && (dwStatus = WaitForSingleObject(piProcInfo.hProcess, 30*1000)) == WAIT_TIMEOUT; i++)
{
@@ -1008,7 +1006,7 @@
/* Close the write end of the pipe before reading from the
read end of the pipe. */
- if (!CloseHandle(hWrite))
+ if (! CloseHandle(hWrite))
{
gchar *msg = g_win32_error_message(GetLastError());
geany_debug("ReadFromPipe: Closing handle failed");
@@ -1021,10 +1019,10 @@
/* Read output from the child process, and write to parent's STDOUT. */
for (;;)
{
- if( !ReadFile(hRead, chBuf, BUFSIZE, &dwRead,
- NULL) || dwRead == 0) break;
+ if (! ReadFile(hRead, chBuf, BUFSIZE, &dwRead, NULL) || dwRead == 0)
+ break;
- if (!WriteFile(hFile, chBuf, dwRead, &dwWritten, NULL))
+ if (! WriteFile(hFile, chBuf, dwRead, &dwWritten, NULL))
break;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list