projects
/
platform
/
upstream
/
glib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
gnetworking.h.in: move "#undef interface"
[platform/upstream/glib.git]
/
gio
/
win32
/
gwinhttpfileoutputstream.c
diff --git
a/gio/win32/gwinhttpfileoutputstream.c
b/gio/win32/gwinhttpfileoutputstream.c
index
898a729
..
760a87a
100644
(file)
--- a/
gio/win32/gwinhttpfileoutputstream.c
+++ b/
gio/win32/gwinhttpfileoutputstream.c
@@
-1,5
+1,5
@@
/* GIO - GLib Input, Output and Streaming Library
/* GIO - GLib Input, Output and Streaming Library
- *
+ *
* Copyright (C) 2006-2007 Red Hat, Inc.
* Copyright (C) 2008 Novell, Inc.
*
* Copyright (C) 2006-2007 Red Hat, Inc.
* Copyright (C) 2008 Novell, Inc.
*
@@
-14,9
+14,7
@@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
*
* Author: Alexander Larsson <alexl@redhat.com>
* Author: Tor Lillqvist <tml@novell.com>
*
* Author: Alexander Larsson <alexl@redhat.com>
* Author: Tor Lillqvist <tml@novell.com>
@@
-26,13
+24,11
@@
#include <glib.h>
#include <glib.h>
-#include "gcancellable.h"
-#include "gioerror.h"
+#include "g
io/g
cancellable.h"
+#include "gio
/gio
error.h"
#include "gwinhttpfileoutputstream.h"
#include "glibintl.h"
#include "gwinhttpfileoutputstream.h"
#include "glibintl.h"
-#include "gioalias.h"
-
struct _GWinHttpFileOutputStream
{
GFileOutputStream parent_instance;
struct _GWinHttpFileOutputStream
{
GFileOutputStream parent_instance;
@@
-60,11
+56,11
@@
static void
g_winhttp_file_output_stream_finalize (GObject *object)
{
GWinHttpFileOutputStream *winhttp_stream;
g_winhttp_file_output_stream_finalize (GObject *object)
{
GWinHttpFileOutputStream *winhttp_stream;
-
+
winhttp_stream = G_WINHTTP_FILE_OUTPUT_STREAM (object);
if (winhttp_stream->connection != NULL)
winhttp_stream = G_WINHTTP_FILE_OUTPUT_STREAM (object);
if (winhttp_stream->connection != NULL)
- G_WINHTTP_VFS_GET_CLASS (winhttp_stream->file->vfs)->pWinHttpCloseHandle (winhttp_stream->connection);
+ G_WINHTTP_VFS_GET_CLASS (winhttp_stream->file->vfs)->
funcs->
pWinHttpCloseHandle (winhttp_stream->connection);
G_OBJECT_CLASS (g_winhttp_file_output_stream_parent_class)->finalize (object);
}
G_OBJECT_CLASS (g_winhttp_file_output_stream_parent_class)->finalize (object);
}
@@
-74,7
+70,7
@@
g_winhttp_file_output_stream_class_init (GWinHttpFileOutputStreamClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GOutputStreamClass *stream_class = G_OUTPUT_STREAM_CLASS (klass);
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GOutputStreamClass *stream_class = G_OUTPUT_STREAM_CLASS (klass);
-
+
gobject_class->finalize = g_winhttp_file_output_stream_finalize;
stream_class->write_fn = g_winhttp_file_output_stream_write;
gobject_class->finalize = g_winhttp_file_output_stream_finalize;
stream_class->write_fn = g_winhttp_file_output_stream_write;
@@
-87,12
+83,12
@@
g_winhttp_file_output_stream_init (GWinHttpFileOutputStream *info)
/**
* g_winhttp_file_output_stream_new:
/**
* g_winhttp_file_output_stream_new:
- * @file: the GWinHttpFile being read
+ * @file: the GWinHttpFile being read
* @connection: handle to the HTTP connection, as from WinHttpConnect()
* @request: handle to the HTTP request, as from WinHttpOpenRequest
* @connection: handle to the HTTP connection, as from WinHttpConnect()
* @request: handle to the HTTP request, as from WinHttpOpenRequest
- *
+ *
* Returns: #GFileOutputStream for the given request
* Returns: #GFileOutputStream for the given request
- *
*
/
+ */
GFileOutputStream *
_g_winhttp_file_output_stream_new (GWinHttpFile *file,
HINTERNET connection)
GFileOutputStream *
_g_winhttp_file_output_stream_new (GWinHttpFile *file,
HINTERNET connection)
@@
-121,7
+117,7
@@
g_winhttp_file_output_stream_write (GOutputStream *stream,
wchar_t *wheaders;
DWORD bytes_written;
wchar_t *wheaders;
DWORD bytes_written;
- request = G_WINHTTP_VFS_GET_CLASS (winhttp_stream->file->vfs)->pWinHttpOpenRequest
+ request = G_WINHTTP_VFS_GET_CLASS (winhttp_stream->file->vfs)->
funcs->
pWinHttpOpenRequest
(winhttp_stream->connection,
L"PUT",
winhttp_stream->file->url.lpszUrlPath,
(winhttp_stream->connection,
L"PUT",
winhttp_stream->file->url.lpszUrlPath,
@@
-132,12
+128,7
@@
g_winhttp_file_output_stream_write (GOutputStream *stream,
if (request == NULL)
{
if (request == NULL)
{
- char *emsg = _g_winhttp_error_message (GetLastError ());
-
- g_set_error (error, G_IO_ERROR,
- G_IO_ERROR_FAILED,
- "%s", emsg);
- g_free (emsg);
+ _g_winhttp_set_error (error, GetLastError (), "PUT request");
return -1;
}
return -1;
}
@@
-147,58
+138,46
@@
g_winhttp_file_output_stream_write (GOutputStream *stream,
wheaders = g_utf8_to_utf16 (headers, -1, NULL, NULL, NULL);
g_free (headers);
wheaders = g_utf8_to_utf16 (headers, -1, NULL, NULL, NULL);
g_free (headers);
- if (!G_WINHTTP_VFS_GET_CLASS (winhttp_stream->file->vfs)->pWinHttpSendRequest
+ if (!G_WINHTTP_VFS_GET_CLASS (winhttp_stream->file->vfs)->
funcs->
pWinHttpSendRequest
(request,
wheaders, -1,
NULL, 0,
count,
0))
{
(request,
wheaders, -1,
NULL, 0,
count,
0))
{
- char *emsg = _g_winhttp_error_message (GetLastError ());
-
- g_set_error (error, G_IO_ERROR,
- G_IO_ERROR_FAILED,
- "%s", emsg);
- g_free (emsg);
-
- G_WINHTTP_VFS_GET_CLASS (winhttp_stream->file->vfs)->pWinHttpCloseHandle (request);
+ _g_winhttp_set_error (error, GetLastError (), "PUT request");
+
+ G_WINHTTP_VFS_GET_CLASS (winhttp_stream->file->vfs)->funcs->pWinHttpCloseHandle (request);
g_free (wheaders);
return -1;
}
g_free (wheaders);
return -1;
}
-
+
g_free (wheaders);
g_free (wheaders);
- if (!G_WINHTTP_VFS_GET_CLASS (winhttp_stream->file->vfs)->pWinHttpWriteData
+ if (!G_WINHTTP_VFS_GET_CLASS (winhttp_stream->file->vfs)->
funcs->
pWinHttpWriteData
(request, buffer, count, &bytes_written))
{
(request, buffer, count, &bytes_written))
{
- char *emsg = _g_winhttp_error_message (GetLastError ());
- g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
- "%s",
- emsg);
- g_free (emsg);
+ _g_winhttp_set_error (error, GetLastError (), "PUT request");
- G_WINHTTP_VFS_GET_CLASS (winhttp_stream->file->vfs)->pWinHttpCloseHandle (request);
+ G_WINHTTP_VFS_GET_CLASS (winhttp_stream->file->vfs)->
funcs->
pWinHttpCloseHandle (request);
return -1;
}
return -1;
}
-
+
winhttp_stream->offset += bytes_written;
winhttp_stream->offset += bytes_written;
- if (!G_WINHTTP_VFS_GET_CLASS (winhttp_stream->file->vfs)->pWinHttpReceiveResponse
- (request, NULL))
+ if (!_g_winhttp_response (winhttp_stream->file->vfs,
+ request,
+ error,
+ "PUT request"))
{
{
- char *emsg = _g_winhttp_error_message (GetLastError ());
- g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
- "%s",
- emsg);
- g_free (emsg);
-
- G_WINHTTP_VFS_GET_CLASS (winhttp_stream->file->vfs)->pWinHttpCloseHandle (request);
+ G_WINHTTP_VFS_GET_CLASS (winhttp_stream->file->vfs)->funcs->pWinHttpCloseHandle (request);
+
return -1;
}
return -1;
}
- G_WINHTTP_VFS_GET_CLASS (winhttp_stream->file->vfs)->pWinHttpCloseHandle (request);
+ G_WINHTTP_VFS_GET_CLASS (winhttp_stream->file->vfs)->
funcs->
pWinHttpCloseHandle (request);
return bytes_written;
}
return bytes_written;
}