kasjer commented on code in PR #3233:
URL: https://github.com/apache/mynewt-core/pull/3233#discussion_r1632934813


##########
util/stream/src/stream.c:
##########
@@ -107,3 +108,30 @@ istream_read(struct in_stream *istream, uint8_t *buf, 
uint32_t count)
     return istream->vft->read(istream, buf, count);
 }
 
+int
+stream_pump(struct in_stream *istream, struct out_stream *ostream, uint32_t 
count)
+{
+    int pumped;
+
+    /* If output stream has pump_from function used it */
+    if (ostream->vft->pump_from) {
+        pumped = ostream->vft->pump_from(ostream, istream, count);
+    } else if (istream->vft->pump_to) {
+        /* When input stream has pump_to used it */
+        pumped = istream->vft->pump_to(istream, ostream, count);
+    } else {
+        /* Both stream don't provide pump functions, use local buffer for 
pumping data */
+        uint8_t buf[16];
+        pumped = 0;
+        while (count) {

Review Comment:
   fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to