diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-09-27 14:06:37 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-09-27 14:06:37 +0000 |
commit | bb325e4a419aa2ec5ddff34b45a49dcaaa53d0ab (patch) | |
tree | 3056b04d5e1ba0e316ee3f9ceeb8cd76133cde13 /src/gns | |
parent | 0132ed3cba1026781772b98c737048311b510977 (diff) | |
download | gnunet-bb325e4a419aa2ec5ddff34b45a49dcaaa53d0ab.tar.gz gnunet-bb325e4a419aa2ec5ddff34b45a49dcaaa53d0ab.zip |
-some fixes for monkey
Diffstat (limited to 'src/gns')
-rw-r--r-- | src/gns/gnunet-gns-fcfsd.c | 5 | ||||
-rw-r--r-- | src/gns/gnunet-gns-proxy.c | 28 |
2 files changed, 15 insertions, 18 deletions
diff --git a/src/gns/gnunet-gns-fcfsd.c b/src/gns/gnunet-gns-fcfsd.c index 1d69cde17..7ef066957 100644 --- a/src/gns/gnunet-gns-fcfsd.c +++ b/src/gns/gnunet-gns-fcfsd.c | |||
@@ -771,6 +771,9 @@ request_completed_callback (void *cls, | |||
771 | } | 771 | } |
772 | 772 | ||
773 | 773 | ||
774 | #define UNSIGNED_MHD_LONG_LONG unsigned MHD_LONG_LONG | ||
775 | |||
776 | |||
774 | /** | 777 | /** |
775 | * Schedule tasks to run MHD server. | 778 | * Schedule tasks to run MHD server. |
776 | */ | 779 | */ |
@@ -785,7 +788,7 @@ run_httpd () | |||
785 | struct GNUNET_NETWORK_FDSet *wes; | 788 | struct GNUNET_NETWORK_FDSet *wes; |
786 | int max; | 789 | int max; |
787 | int haveto; | 790 | int haveto; |
788 | unsigned MHD_LONG_LONG timeout; | 791 | UNSIGNED_MHD_LONG_LONG timeout; |
789 | struct GNUNET_TIME_Relative tv; | 792 | struct GNUNET_TIME_Relative tv; |
790 | 793 | ||
791 | FD_ZERO (&rs); | 794 | FD_ZERO (&rs); |
diff --git a/src/gns/gnunet-gns-proxy.c b/src/gns/gnunet-gns-proxy.c index 2017018c3..bef3c75e0 100644 --- a/src/gns/gnunet-gns-proxy.c +++ b/src/gns/gnunet-gns-proxy.c | |||
@@ -1074,13 +1074,11 @@ mhd_content_cb (void *cls, | |||
1074 | struct ProxyCurlTask *ctask = cls; | 1074 | struct ProxyCurlTask *ctask = cls; |
1075 | struct ProxyREMatch *re_match; | 1075 | struct ProxyREMatch *re_match; |
1076 | ssize_t copied = 0; | 1076 | ssize_t copied = 0; |
1077 | long long int bytes_to_copy = ctask->buffer_write_ptr - ctask->buffer_read_ptr; | 1077 | size_t bytes_to_copy = ctask->buffer_write_ptr - ctask->buffer_read_ptr; |
1078 | 1078 | ||
1079 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1079 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1080 | "MHD: content cb for %s. To copy: %lld\n", | 1080 | "MHD: content cb for %s. To copy: %u\n", |
1081 | ctask->url, bytes_to_copy); | 1081 | ctask->url, (unsigned int) bytes_to_copy); |
1082 | GNUNET_assert (bytes_to_copy >= 0); | ||
1083 | |||
1084 | if ((GNUNET_YES == ctask->download_is_finished) && | 1082 | if ((GNUNET_YES == ctask->download_is_finished) && |
1085 | (GNUNET_NO == ctask->download_error) && | 1083 | (GNUNET_NO == ctask->download_error) && |
1086 | (0 == bytes_to_copy)) | 1084 | (0 == bytes_to_copy)) |
@@ -1117,15 +1115,13 @@ mhd_content_cb (void *cls, | |||
1117 | "MHD: Processing PP %s\n", | 1115 | "MHD: Processing PP %s\n", |
1118 | re_match->hostname); | 1116 | re_match->hostname); |
1119 | bytes_to_copy = re_match->start - ctask->buffer_read_ptr; | 1117 | bytes_to_copy = re_match->start - ctask->buffer_read_ptr; |
1120 | GNUNET_assert (bytes_to_copy >= 0); | ||
1121 | |||
1122 | if (bytes_to_copy+copied > max) | 1118 | if (bytes_to_copy+copied > max) |
1123 | { | 1119 | { |
1124 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1120 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1125 | "MHD: buffer in response too small for %d. Using available space (%d). (%s)\n", | 1121 | "MHD: buffer in response too small for %u. Using available space (%d). (%s)\n", |
1126 | bytes_to_copy, | 1122 | (unsigned int) bytes_to_copy, |
1127 | max, | 1123 | max, |
1128 | ctask->url); | 1124 | ctask->url); |
1129 | memcpy (buf+copied, ctask->buffer_read_ptr, max-copied); | 1125 | memcpy (buf+copied, ctask->buffer_read_ptr, max-copied); |
1130 | ctask->buffer_read_ptr += max-copied; | 1126 | ctask->buffer_read_ptr += max-copied; |
1131 | copied = max; | 1127 | copied = max; |
@@ -1135,8 +1131,8 @@ mhd_content_cb (void *cls, | |||
1135 | } | 1131 | } |
1136 | 1132 | ||
1137 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1133 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1138 | "MHD: copying %d bytes to mhd response at offset %d\n", | 1134 | "MHD: copying %u bytes to mhd response at offset %d\n", |
1139 | bytes_to_copy, ctask->buffer_read_ptr); | 1135 | (unsigned int) bytes_to_copy, ctask->buffer_read_ptr); |
1140 | memcpy (buf+copied, ctask->buffer_read_ptr, bytes_to_copy); | 1136 | memcpy (buf+copied, ctask->buffer_read_ptr, bytes_to_copy); |
1141 | copied += bytes_to_copy; | 1137 | copied += bytes_to_copy; |
1142 | 1138 | ||
@@ -1178,12 +1174,10 @@ mhd_content_cb (void *cls, | |||
1178 | bytes_to_copy = ctask->buffer_write_ptr - ctask->buffer_read_ptr; | 1174 | bytes_to_copy = ctask->buffer_write_ptr - ctask->buffer_read_ptr; |
1179 | 1175 | ||
1180 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1176 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1181 | "MHD: copied: %d left: %d, space left in buf: %d\n", | 1177 | "MHD: copied: %d left: %u, space left in buf: %d\n", |
1182 | copied, | 1178 | copied, |
1183 | bytes_to_copy, (int) (max - copied)); | 1179 | (unsigned int) bytes_to_copy, (int) (max - copied)); |
1184 | 1180 | ||
1185 | GNUNET_assert (0 <= bytes_to_copy); | ||
1186 | |||
1187 | if (GNUNET_NO == ctask->download_is_finished) | 1181 | if (GNUNET_NO == ctask->download_is_finished) |
1188 | { | 1182 | { |
1189 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1183 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |