[tracker: 2/14] tracker-sparql: Simplify and fix signed vs unsigned comparison
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker: 2/14] tracker-sparql: Simplify and fix signed vs unsigned comparison
- Date: Sat, 8 May 2021 17:25:47 +0000 (UTC)
commit 66c9c400b2227d2926d8eb13de006001942b75d8
Author: Daniele Nicolodi <daniele grinta net>
Date: Sun May 2 12:29:51 2021 +0200
tracker-sparql: Simplify and fix signed vs unsigned comparison
src/libtracker-sparql/tracker-endpoint-http.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/src/libtracker-sparql/tracker-endpoint-http.c b/src/libtracker-sparql/tracker-endpoint-http.c
index 5aa82b03d..bf28329f2 100644
--- a/src/libtracker-sparql/tracker-endpoint-http.c
+++ b/src/libtracker-sparql/tracker-endpoint-http.c
@@ -89,7 +89,6 @@ handle_request_in_thread (GTask *task,
{
Request *request = task_data;
gchar *buffer[1000];
- gboolean finished = FALSE;
SoupMessageBody *message_body;
GError *error = NULL;
gssize count;
@@ -100,20 +99,22 @@ handle_request_in_thread (GTask *task,
message_body = request->message->response_body;
#endif
- while (!finished) {
+ for (;;) {
count = g_input_stream_read (request->istream,
buffer, sizeof (buffer),
cancellable, &error);
- if (count == -1) {
+ if (count < 0) {
g_task_return_error (task, error);
break;
- } else if (count < sizeof (buffer)) {
- finished = TRUE;
}
soup_message_body_append (message_body,
SOUP_MEMORY_COPY,
buffer, count);
+
+ if ((gsize) count < sizeof (buffer)) {
+ break;
+ }
}
g_input_stream_close (request->istream, cancellable, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]