mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
remove broken ADVIO_MEM flag
This commit is contained in:
parent
3aa097f006
commit
506873a25a
3 changed files with 8 additions and 20 deletions
|
@ -25,8 +25,7 @@
|
|||
#include <curl/curl.h>
|
||||
|
||||
enum advio_flags {
|
||||
ADVIO_MEM = (1 << 0), /**< Instead of a real file, a memory backed stdio stream is used. */
|
||||
ADVIO_DIRTY = (1 << 1) /**< The file contents have been modified. We need to upload. */
|
||||
ADVIO_DIRTY = (1 << 0) /**< The file contents have been modified. We need to upload. */
|
||||
};
|
||||
|
||||
struct advio {
|
||||
|
@ -34,11 +33,7 @@ struct advio {
|
|||
|
||||
CURL *curl;
|
||||
FILE *file;
|
||||
|
||||
/* For use with ADVIO_MODE_MEM */
|
||||
char *buf;
|
||||
size_t size;
|
||||
|
||||
|
||||
const char *uri;
|
||||
};
|
||||
|
||||
|
|
17
lib/advio.c
17
lib/advio.c
|
@ -49,7 +49,6 @@ static int xferinfo(void *p, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ul
|
|||
int dotz = round(frac * BAR_WIDTH);
|
||||
|
||||
// create the "meter"
|
||||
|
||||
printf("%3.0f%% in %f s (%" CURL_FORMAT_CURL_OFF_T " / %" CURL_FORMAT_CURL_OFF_T ") [", frac * 100, curtime, dlnow, dltotal);
|
||||
|
||||
// part that's full already
|
||||
|
@ -71,14 +70,11 @@ static int xferinfo(void *p, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ul
|
|||
AFILE * afopen(const char *uri, const char *mode, int flags)
|
||||
{
|
||||
CURLcode res;
|
||||
long code;
|
||||
|
||||
AFILE *af = alloc(sizeof(AFILE));
|
||||
|
||||
if (flags & ADVIO_MEM)
|
||||
af->file = open_memstream(&af->buf, &af->size);
|
||||
else
|
||||
af->file = tmpfile();
|
||||
|
||||
af->file = tmpfile();
|
||||
if (!af->file)
|
||||
goto out2;
|
||||
|
||||
|
@ -157,12 +153,9 @@ int afflush(AFILE *af)
|
|||
CURLcode res;
|
||||
long pos;
|
||||
|
||||
/* Flushing a memory backed stream is sensless */
|
||||
if (!(af->flags & ADVIO_MEM)) {
|
||||
ret = fflush(af->file);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
ret = fflush(af->file);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
curl_easy_setopt(af->curl, CURLOPT_UPLOAD, 1L);
|
||||
curl_easy_setopt(af->curl, CURLOPT_READDATA, af->file);
|
||||
|
|
|
@ -103,7 +103,7 @@ int super_node_parse_uri(struct super_node *sn, const char *uri)
|
|||
}
|
||||
/* Use advio (libcurl) to fetch the config from a remote */
|
||||
else {
|
||||
af = afopen(uri, "r", ADVIO_MEM);
|
||||
af = afopen(uri, "r", 0);
|
||||
f = af ? af->file : NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue