[libgdata] [core] Use libsoup status constants



commit f0a69f5d52511152e089977827eb69e0497c88d2
Author: Philip Withnall <philip tecnocode co uk>
Date:   Thu Apr 1 20:23:36 2010 +0100

    [core] Use libsoup status constants
    
    Use libsoup status constants when dealing with HTTP statuses for clarity.

 gdata/gdata-access-handler.c                       |    8 ++++----
 gdata/gdata-service.c                              |   12 ++++++------
 gdata/gdata-upload-stream.c                        |    2 +-
 gdata/services/contacts/gdata-contacts-contact.c   |    4 ++--
 gdata/services/documents/gdata-documents-service.c |    4 ++--
 5 files changed, 15 insertions(+), 15 deletions(-)
---
diff --git a/gdata/gdata-access-handler.c b/gdata/gdata-access-handler.c
index faa299a..31e5069 100644
--- a/gdata/gdata-access-handler.c
+++ b/gdata/gdata-access-handler.c
@@ -117,7 +117,7 @@ gdata_access_handler_get_rules (GDataAccessHandler *self, GDataService *service,
 		return NULL;
 	}
 
-	if (status != 200) {
+	if (status != SOUP_STATUS_OK) {
 		/* Error */
 		g_assert (klass->parse_error_response != NULL);
 		klass->parse_error_response (service, GDATA_OPERATION_QUERY, status, message->reason_phrase, message->response_body->data,
@@ -206,7 +206,7 @@ gdata_access_handler_insert_rule (GDataAccessHandler *self, GDataService *servic
 		return NULL;
 	}
 
-	if (status != 201) {
+	if (status != SOUP_STATUS_CREATED) {
 		/* Error */
 		g_assert (klass->parse_error_response != NULL);
 		klass->parse_error_response (service, GDATA_OPERATION_INSERTION, status, message->reason_phrase, message->response_body->data,
@@ -320,7 +320,7 @@ gdata_access_handler_update_rule (GDataAccessHandler *self, GDataService *servic
 		return NULL;
 	}
 
-	if (status != 200) {
+	if (status != SOUP_STATUS_OK) {
 		/* Error */
 		g_assert (klass->parse_error_response != NULL);
 		klass->parse_error_response (service, GDATA_OPERATION_UPDATE, status, message->reason_phrase, message->response_body->data,
@@ -403,7 +403,7 @@ gdata_access_handler_delete_rule (GDataAccessHandler *self, GDataService *servic
 		return FALSE;
 	}
 
-	if (status != 200) {
+	if (status != SOUP_STATUS_OK) {
 		/* Error */
 		g_assert (klass->parse_error_response != NULL);
 		klass->parse_error_response (service, GDATA_OPERATION_DELETION, status, message->reason_phrase, message->response_body->data,
diff --git a/gdata/gdata-service.c b/gdata/gdata-service.c
index 98e09a2..3188544 100644
--- a/gdata/gdata-service.c
+++ b/gdata/gdata-service.c
@@ -636,7 +636,7 @@ authenticate (GDataService *self, const gchar *username, const gchar *password,
 		return FALSE;
 	}
 
-	if (status != 200) {
+	if (status != SOUP_STATUS_OK) {
 		const gchar *response_body = message->response_body->data;
 		gchar *error_start, *error_end, *uri_start, *uri_end, *uri = NULL;
 
@@ -1039,11 +1039,11 @@ _gdata_service_query (GDataService *self, const gchar *feed_uri, GDataQuery *que
 		return NULL;
 	}
 
-	if (status == 304) {
+	if (status == SOUP_STATUS_NOT_MODIFIED) {
 		/* Not modified; ETag has worked */
 		g_object_unref (message);
 		return NULL;
-	} else if (status != 200) {
+	} else if (status != SOUP_STATUS_OK) {
 		/* Error */
 		g_assert (klass->parse_error_response != NULL);
 		klass->parse_error_response (self, GDATA_OPERATION_QUERY, status, message->reason_phrase, message->response_body->data,
@@ -1485,7 +1485,7 @@ gdata_service_insert_entry (GDataService *self, const gchar *upload_uri, GDataEn
 		return NULL;
 	}
 
-	if (status != 201) {
+	if (status != SOUP_STATUS_CREATED) {
 		/* Error */
 		g_assert (klass->parse_error_response != NULL);
 		klass->parse_error_response (self, GDATA_OPERATION_INSERTION, status, message->reason_phrase, message->response_body->data,
@@ -1662,7 +1662,7 @@ gdata_service_update_entry (GDataService *self, GDataEntry *entry, GCancellable
 		return NULL;
 	}
 
-	if (status != 200) {
+	if (status != SOUP_STATUS_OK) {
 		/* Error */
 		g_assert (klass->parse_error_response != NULL);
 		klass->parse_error_response (self, GDATA_OPERATION_UPDATE, status, message->reason_phrase, message->response_body->data,
@@ -1826,7 +1826,7 @@ gdata_service_delete_entry (GDataService *self, GDataEntry *entry, GCancellable
 		return FALSE;
 	}
 
-	if (status != 200) {
+	if (status != SOUP_STATUS_OK) {
 		/* Error */
 		g_assert (klass->parse_error_response != NULL);
 		klass->parse_error_response (self, GDATA_OPERATION_DELETION, status, message->reason_phrase, message->response_body->data,
diff --git a/gdata/gdata-upload-stream.c b/gdata/gdata-upload-stream.c
index c8dd184..23dee7c 100644
--- a/gdata/gdata-upload-stream.c
+++ b/gdata/gdata-upload-stream.c
@@ -650,7 +650,7 @@ gdata_upload_stream_get_response (GDataUploadStream *self, gssize *length)
 
 	g_static_mutex_lock (&(self->priv->response_mutex));
 
-	if (self->priv->response_status == 0) {
+	if (self->priv->response_status == SOUP_STATUS_NONE) {
 		/* We can't touch the message until the network thread has finished using it, since it isn't threadsafe */
 		_length = -1;
 		_response = NULL;
diff --git a/gdata/services/contacts/gdata-contacts-contact.c b/gdata/services/contacts/gdata-contacts-contact.c
index a1b0c4e..8f083b3 100644
--- a/gdata/services/contacts/gdata-contacts-contact.c
+++ b/gdata/services/contacts/gdata-contacts-contact.c
@@ -1823,7 +1823,7 @@ gdata_contacts_contact_get_photo (GDataContactsContact *self, GDataContactsServi
 		return NULL;
 	}
 
-	if (status != 200) {
+	if (status != SOUP_STATUS_OK) {
 		/* Error */
 		g_assert (klass->parse_error_response != NULL);
 		klass->parse_error_response (GDATA_SERVICE (service), GDATA_OPERATION_DOWNLOAD, status, message->reason_phrase,
@@ -1922,7 +1922,7 @@ gdata_contacts_contact_set_photo (GDataContactsContact *self, GDataService *serv
 		return FALSE;
 	}
 
-	if (status != 200) {
+	if (status != SOUP_STATUS_OK) {
 		/* Error */
 		g_assert (klass->parse_error_response != NULL);
 		klass->parse_error_response (service, GDATA_OPERATION_UPLOAD, status, message->reason_phrase, message->response_body->data,
diff --git a/gdata/services/documents/gdata-documents-service.c b/gdata/services/documents/gdata-documents-service.c
index e1b4dd9..0413b2b 100644
--- a/gdata/services/documents/gdata-documents-service.c
+++ b/gdata/services/documents/gdata-documents-service.c
@@ -563,7 +563,7 @@ gdata_documents_service_move_document_to_folder (GDataDocumentsService *self, GD
 		return NULL;
 	}
 
-	if (status != 201) {
+	if (status != SOUP_STATUS_CREATED) {
 		/* Error */
 		g_assert (klass->parse_error_response != NULL);
 		klass->parse_error_response (GDATA_SERVICE (self), GDATA_OPERATION_UPDATE, status, message->reason_phrase,
@@ -665,7 +665,7 @@ gdata_documents_service_remove_document_from_folder (GDataDocumentsService *self
 		return NULL;
 	}
 
-	if (status != 200) {
+	if (status != SOUP_STATUS_OK) {
 		/* Error */
 		g_assert (klass->parse_error_response != NULL);
 		klass->parse_error_response (GDATA_SERVICE (self), GDATA_OPERATION_UPDATE, status, message->reason_phrase, message->response_body->data,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]