winlin

refine code for #277, the copy first param is the dest.

@@ -344,7 +344,7 @@ int SrsGoHttpFileServer::serve_file(ISrsGoHttpResponseWriter* w, SrsHttpMessage* @@ -344,7 +344,7 @@ int SrsGoHttpFileServer::serve_file(ISrsGoHttpResponseWriter* w, SrsHttpMessage*
344 344
345 // write body. 345 // write body.
346 int64_t left = length; 346 int64_t left = length;
347 - if ((ret = copy(&fs, w, r, left)) != ERROR_SUCCESS) { 347 + if ((ret = copy(w, &fs, r, left)) != ERROR_SUCCESS) {
348 srs_warn("read file=%s size=%d failed, ret=%d", fullpath.c_str(), left, ret); 348 srs_warn("read file=%s size=%d failed, ret=%d", fullpath.c_str(), left, ret);
349 return ret; 349 return ret;
350 } 350 }
@@ -357,7 +357,7 @@ int SrsGoHttpFileServer::serve_flv_stream(ISrsGoHttpResponseWriter* w, SrsHttpMe @@ -357,7 +357,7 @@ int SrsGoHttpFileServer::serve_flv_stream(ISrsGoHttpResponseWriter* w, SrsHttpMe
357 return serve_file(w, r, fullpath); 357 return serve_file(w, r, fullpath);
358 } 358 }
359 359
360 -int SrsGoHttpFileServer::copy(SrsFileReader* fs, ISrsGoHttpResponseWriter* w, SrsHttpMessage* r, int size) 360 +int SrsGoHttpFileServer::copy(ISrsGoHttpResponseWriter* w, SrsFileReader* fs, SrsHttpMessage* r, int size)
361 { 361 {
362 int ret = ERROR_SUCCESS; 362 int ret = ERROR_SUCCESS;
363 363
@@ -217,7 +217,7 @@ protected: @@ -217,7 +217,7 @@ protected:
217 /** 217 /**
218 * copy the fs to response writer in size bytes. 218 * copy the fs to response writer in size bytes.
219 */ 219 */
220 - virtual int copy(SrsFileReader* fs, ISrsGoHttpResponseWriter* w, SrsHttpMessage* r, int size); 220 + virtual int copy(ISrsGoHttpResponseWriter* w, SrsFileReader* fs, SrsHttpMessage* r, int size);
221 }; 221 };
222 222
223 // the mux entry for server mux. 223 // the mux entry for server mux.
@@ -127,7 +127,7 @@ int SrsVodStream::serve_flv_stream(ISrsGoHttpResponseWriter* w, SrsHttpMessage* @@ -127,7 +127,7 @@ int SrsVodStream::serve_flv_stream(ISrsGoHttpResponseWriter* w, SrsHttpMessage*
127 } 127 }
128 128
129 // send data 129 // send data
130 - if ((ret = copy(&fs, w, r, left)) != ERROR_SUCCESS) { 130 + if ((ret = copy(w, &fs, r, left)) != ERROR_SUCCESS) {
131 srs_warn("read flv=%s size=%d failed, ret=%d", fullpath.c_str(), left, ret); 131 srs_warn("read flv=%s size=%d failed, ret=%d", fullpath.c_str(), left, ret);
132 return ret; 132 return ret;
133 } 133 }