Browse Source

Merge branch 'master' of github.com:VCVRack/Rack

tags/v0.3.1
Andrew Belt 7 years ago
parent
commit
db2dee3ff2
2 changed files with 8 additions and 6 deletions
  1. +7
    -4
      src/plugin.cpp
  2. +1
    -2
      src/util/request.cpp

+ 7
- 4
src/plugin.cpp View File

@@ -92,6 +92,8 @@ static int loadPlugin(std::string slug) {
}

void pluginInit() {


// Load core
// This function is defined in core.cpp
Plugin *corePlugin = init();
@@ -146,20 +148,21 @@ static void extractZip(const char *filename, const char *dir) {
zip_file_t *zf = zip_fopen_index(za, i, 0);
if (!zf) goto cleanup;

int out = open(path, O_RDWR | O_TRUNC | O_CREAT, 0644);
assert(out != -1);
FILE *outFile = fopen(path, "wb");
if (!outFile)
continue;

while (1) {
char buffer[4096];
int len = zip_fread(zf, buffer, sizeof(buffer));
if (len <= 0)
break;
write(out, buffer, len);
fwrite(buffer, 1, len, outFile);
}

err = zip_fclose(zf);
assert(!err);
close(out);
fclose(outFile);
}
}



+ 1
- 2
src/util/request.cpp View File

@@ -84,7 +84,6 @@ json_t *requestJson(RequestMethod method, std::string url, json_t *dataJ) {
printf("Requesting %s\n", url.c_str());
// curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
CURLcode res = curl_easy_perform(curl);
printf("%d\n", res);

// Cleanup
if (method != GET_METHOD)
@@ -130,7 +129,7 @@ bool requestDownload(std::string url, std::string filename, float *progress) {
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_VERBOSE, false);
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, false);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writeFileCallback);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, NULL);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, file);
curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, xferInfoCallback);
curl_easy_setopt(curl, CURLOPT_XFERINFODATA, progress);


Loading…
Cancel
Save