{"action":"created","comment":{"url":"https://api.github.com/repos/Steveice10/citrus/pulls/comments/58275750","id":58275750,"diff_hunk":"@@ -385,6 +386,65 @@ void ctr::app::install(ctr::fs::MediaType mediaType, FILE* fd, u64 size, std::fu\n     ctr::err::parse(ctr::err::SOURCE_AM_FINISH_CIA_INSTALL, (u32) AM_FinishCiaInstall(mediaType, &ciaHandle));\n }\n \n+void ctr::app::install(ctr::fs::MediaType mediaType, std::function<Result(void *buf, u32 bufSize, u32 *bufFill)> fetchData, u64 size, std::function<bool(u64 pos, u64 totalSize)> onProgress) {\n+    if(!initialized) {\n+        ctr::err::set(initError);\n+        return;\n+    }\n+\n+    Result ret=0;\n+    u32 pos=0, len=0;\n+    u32 bufSize = 128 * 1024; // 128KB\n+    u8 *buf = (u8*)malloc(bufSize);\n+    if(buf==NULL) {\n+\tctr::err::set({ctr::err::SOURCE_ALLOCATE_BUFFER, ctr::err::MODULE_NN_SOCKET, ctr::err::LEVEL_PERMANENT, ctr::err::SUMMARY_OUT_OF_RESOURCE, ctr::err::DESCRIPTION_OUT_OF_MEMORY});\n+        return;\n+    };\n+    memset(buf, 0, bufSize);\n+\n+    Handle ciaHandle;\n+    ctr::err::parse(ctr::err::SOURCE_AM_START_CIA_INSTALL, (u32) AM_StartCiaInstall(mediaType, &ciaHandle));\n+    if(ctr::err::has()) {\n+        return;\n+    }\n+\n+    ret=(s32)HTTPC_RESULTCODE_DOWNLOADPENDING;","path":"source/citrus/app.cpp","position":34,"original_position":34,"commit_id":"a4097ec65dc188e927aa2bfa5b33439efc08c03e","original_commit_id":"a4097ec65dc188e927aa2bfa5b33439efc08c03e","user":{"login":"Steveice10","id":1269164,"avatar_url":"https://avatars.githubusercontent.com/u/1269164?v=3","gravatar_id":"","url":"https://api.github.com/users/Steveice10","html_url":"https://github.com/Steveice10","followers_url":"https://api.github.com/users/Steveice10/followers","following_url":"https://api.github.com/users/Steveice10/following{/other_user}","gists_url":"https://api.github.com/users/Steveice10/gists{/gist_id}","starred_url":"https://api.github.com/users/Steveice10/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Steveice10/subscriptions","organizations_url":"https://api.github.com/users/Steveice10/orgs","repos_url":"https://api.github.com/users/Steveice10/repos","events_url":"https://api.github.com/users/Steveice10/events{/privacy}","received_events_url":"https://api.github.com/users/Steveice10/received_events","type":"User","site_admin":false},"body":"Probably shouldn't be HTTPC related if this is now a generic callback-based function?","created_at":"2016-04-01T22:20:06Z","updated_at":"2016-04-01T22:20:06Z","html_url":"https://github.com/Steveice10/citrus/pull/17#discussion_r58275750","pull_request_url":"https://api.github.com/repos/Steveice10/citrus/pulls/17","_links":{"self":{"href":"https://api.github.com/repos/Steveice10/citrus/pulls/comments/58275750"},"html":{"href":"https://github.com/Steveice10/citrus/pull/17#discussion_r58275750"},"pull_request":{"href":"https://api.github.com/repos/Steveice10/citrus/pulls/17"}}},"pull_request":{"url":"https://api.github.com/repos/Steveice10/citrus/pulls/17","id":64891863,"html_url":"https://github.com/Steveice10/citrus/pull/17","diff_url":"https://github.com/Steveice10/citrus/pull/17.diff","patch_url":"https://github.com/Steveice10/citrus/pull/17.patch","issue_url":"https://api.github.com/repos/Steveice10/citrus/issues/17","number":17,"state":"open","locked":false,"title":"overloaded app::install() that uses a callback to get data","user":{"login":"ksanislo","id":4238216,"avatar_url":"https://avatars.githubusercontent.com/u/4238216?v=3","gravatar_id":"","url":"https://api.github.com/users/ksanislo","html_url":"https://github.com/ksanislo","followers_url":"https://api.github.com/users/ksanislo/followers","following_url":"https://api.github.com/users/ksanislo/following{/other_user}","gists_url":"https://api.github.com/users/ksanislo/gists{/gist_id}","starred_url":"https://api.github.com/users/ksanislo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ksanislo/subscriptions","organizations_url":"https://api.github.com/users/ksanislo/orgs","repos_url":"https://api.github.com/users/ksanislo/repos","events_url":"https://api.github.com/users/ksanislo/events{/privacy}","received_events_url":"https://api.github.com/users/ksanislo/received_events","type":"User","site_admin":false},"body":"This is my proposed extension to allow installing from a variety of data sources by use of a callback. This keeps all the messy compression/encryption code out of libcitrus, while still allowing for direct stream installs from pretty much any data source someone can come up with.","created_at":"2016-04-01T03:42:17Z","updated_at":"2016-04-01T22:20:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"996f7aa0c60823ba3f68aa0f5dc659bc92200505","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Steveice10/citrus/pulls/17/commits","review_comments_url":"https://api.github.com/repos/Steveice10/citrus/pulls/17/comments","review_comment_url":"https://api.github.com/repos/Steveice10/citrus/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Steveice10/citrus/issues/17/comments","statuses_url":"https://api.github.com/repos/Steveice10/citrus/statuses/a4097ec65dc188e927aa2bfa5b33439efc08c03e","head":{"label":"ksanislo:master","ref":"master","sha":"a4097ec65dc188e927aa2bfa5b33439efc08c03e","user":{"login":"ksanislo","id":4238216,"avatar_url":"https://avatars.githubusercontent.com/u/4238216?v=3","gravatar_id":"","url":"https://api.github.com/users/ksanislo","html_url":"https://github.com/ksanislo","followers_url":"https://api.github.com/users/ksanislo/followers","following_url":"https://api.github.com/users/ksanislo/following{/other_user}","gists_url":"https://api.github.com/users/ksanislo/gists{/gist_id}","starred_url":"https://api.github.com/users/ksanislo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ksanislo/subscriptions","organizations_url":"https://api.github.com/users/ksanislo/orgs","repos_url":"https://api.github.com/users/ksanislo/repos","events_url":"https://api.github.com/users/ksanislo/events{/privacy}","received_events_url":"https://api.github.com/users/ksanislo/received_events","type":"User","site_admin":false},"repo":{"id":55200420,"name":"citrus","full_name":"ksanislo/citrus","owner":{"login":"ksanislo","id":4238216,"avatar_url":"https://avatars.githubusercontent.com/u/4238216?v=3","gravatar_id":"","url":"https://api.github.com/users/ksanislo","html_url":"https://github.com/ksanislo","followers_url":"https://api.github.com/users/ksanislo/followers","following_url":"https://api.github.com/users/ksanislo/following{/other_user}","gists_url":"https://api.github.com/users/ksanislo/gists{/gist_id}","starred_url":"https://api.github.com/users/ksanislo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ksanislo/subscriptions","organizations_url":"https://api.github.com/users/ksanislo/orgs","repos_url":"https://api.github.com/users/ksanislo/repos","events_url":"https://api.github.com/users/ksanislo/events{/privacy}","received_events_url":"https://api.github.com/users/ksanislo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ksanislo/citrus","description":"Simplified 3DS homebrew library.","fork":true,"url":"https://api.github.com/repos/ksanislo/citrus","forks_url":"https://api.github.com/repos/ksanislo/citrus/forks","keys_url":"https://api.github.com/repos/ksanislo/citrus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ksanislo/citrus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ksanislo/citrus/teams","hooks_url":"https://api.github.com/repos/ksanislo/citrus/hooks","issue_events_url":"https://api.github.com/repos/ksanislo/citrus/issues/events{/number}","events_url":"https://api.github.com/repos/ksanislo/citrus/events","assignees_url":"https://api.github.com/repos/ksanislo/citrus/assignees{/user}","branches_url":"https://api.github.com/repos/ksanislo/citrus/branches{/branch}","tags_url":"https://api.github.com/repos/ksanislo/citrus/tags","blobs_url":"https://api.github.com/repos/ksanislo/citrus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ksanislo/citrus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ksanislo/citrus/git/refs{/sha}","trees_url":"https://api.github.com/repos/ksanislo/citrus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ksanislo/citrus/statuses/{sha}","languages_url":"https://api.github.com/repos/ksanislo/citrus/languages","stargazers_url":"https://api.github.com/repos/ksanislo/citrus/stargazers","contributors_url":"https://api.github.com/repos/ksanislo/citrus/contributors","subscribers_url":"https://api.github.com/repos/ksanislo/citrus/subscribers","subscription_url":"https://api.github.com/repos/ksanislo/citrus/subscription","commits_url":"https://api.github.com/repos/ksanislo/citrus/commits{/sha}","git_commits_url":"https://api.github.com/repos/ksanislo/citrus/git/commits{/sha}","comments_url":"https://api.github.com/repos/ksanislo/citrus/comments{/number}","issue_comment_url":"https://api.github.com/repos/ksanislo/citrus/issues/comments{/number}","contents_url":"https://api.github.com/repos/ksanislo/citrus/contents/{+path}","compare_url":"https://api.github.com/repos/ksanislo/citrus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ksanislo/citrus/merges","archive_url":"https://api.github.com/repos/ksanislo/citrus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ksanislo/citrus/downloads","issues_url":"https://api.github.com/repos/ksanislo/citrus/issues{/number}","pulls_url":"https://api.github.com/repos/ksanislo/citrus/pulls{/number}","milestones_url":"https://api.github.com/repos/ksanislo/citrus/milestones{/number}","notifications_url":"https://api.github.com/repos/ksanislo/citrus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ksanislo/citrus/labels{/name}","releases_url":"https://api.github.com/repos/ksanislo/citrus/releases{/id}","deployments_url":"https://api.github.com/repos/ksanislo/citrus/deployments","created_at":"2016-04-01T03:17:33Z","updated_at":"2016-04-01T03:17:33Z","pushed_at":"2016-04-01T03:22:05Z","git_url":"git://github.com/ksanislo/citrus.git","ssh_url":"git@github.com:ksanislo/citrus.git","clone_url":"https://github.com/ksanislo/citrus.git","svn_url":"https://github.com/ksanislo/citrus","homepage":null,"size":2861,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Steveice10:master","ref":"master","sha":"71f027e80f164b60802c2e69f682c7b1ee05fbe2","user":{"login":"Steveice10","id":1269164,"avatar_url":"https://avatars.githubusercontent.com/u/1269164?v=3","gravatar_id":"","url":"https://api.github.com/users/Steveice10","html_url":"https://github.com/Steveice10","followers_url":"https://api.github.com/users/Steveice10/followers","following_url":"https://api.github.com/users/Steveice10/following{/other_user}","gists_url":"https://api.github.com/users/Steveice10/gists{/gist_id}","starred_url":"https://api.github.com/users/Steveice10/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Steveice10/subscriptions","organizations_url":"https://api.github.com/users/Steveice10/orgs","repos_url":"https://api.github.com/users/Steveice10/repos","events_url":"https://api.github.com/users/Steveice10/events{/privacy}","received_events_url":"https://api.github.com/users/Steveice10/received_events","type":"User","site_admin":false},"repo":{"id":36106251,"name":"citrus","full_name":"Steveice10/citrus","owner":{"login":"Steveice10","id":1269164,"avatar_url":"https://avatars.githubusercontent.com/u/1269164?v=3","gravatar_id":"","url":"https://api.github.com/users/Steveice10","html_url":"https://github.com/Steveice10","followers_url":"https://api.github.com/users/Steveice10/followers","following_url":"https://api.github.com/users/Steveice10/following{/other_user}","gists_url":"https://api.github.com/users/Steveice10/gists{/gist_id}","starred_url":"https://api.github.com/users/Steveice10/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Steveice10/subscriptions","organizations_url":"https://api.github.com/users/Steveice10/orgs","repos_url":"https://api.github.com/users/Steveice10/repos","events_url":"https://api.github.com/users/Steveice10/events{/privacy}","received_events_url":"https://api.github.com/users/Steveice10/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Steveice10/citrus","description":"Simplified 3DS homebrew library.","fork":false,"url":"https://api.github.com/repos/Steveice10/citrus","forks_url":"https://api.github.com/repos/Steveice10/citrus/forks","keys_url":"https://api.github.com/repos/Steveice10/citrus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Steveice10/citrus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Steveice10/citrus/teams","hooks_url":"https://api.github.com/repos/Steveice10/citrus/hooks","issue_events_url":"https://api.github.com/repos/Steveice10/citrus/issues/events{/number}","events_url":"https://api.github.com/repos/Steveice10/citrus/events","assignees_url":"https://api.github.com/repos/Steveice10/citrus/assignees{/user}","branches_url":"https://api.github.com/repos/Steveice10/citrus/branches{/branch}","tags_url":"https://api.github.com/repos/Steveice10/citrus/tags","blobs_url":"https://api.github.com/repos/Steveice10/citrus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Steveice10/citrus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Steveice10/citrus/git/refs{/sha}","trees_url":"https://api.github.com/repos/Steveice10/citrus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Steveice10/citrus/statuses/{sha}","languages_url":"https://api.github.com/repos/Steveice10/citrus/languages","stargazers_url":"https://api.github.com/repos/Steveice10/citrus/stargazers","contributors_url":"https://api.github.com/repos/Steveice10/citrus/contributors","subscribers_url":"https://api.github.com/repos/Steveice10/citrus/subscribers","subscription_url":"https://api.github.com/repos/Steveice10/citrus/subscription","commits_url":"https://api.github.com/repos/Steveice10/citrus/commits{/sha}","git_commits_url":"https://api.github.com/repos/Steveice10/citrus/git/commits{/sha}","comments_url":"https://api.github.com/repos/Steveice10/citrus/comments{/number}","issue_comment_url":"https://api.github.com/repos/Steveice10/citrus/issues/comments{/number}","contents_url":"https://api.github.com/repos/Steveice10/citrus/contents/{+path}","compare_url":"https://api.github.com/repos/Steveice10/citrus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Steveice10/citrus/merges","archive_url":"https://api.github.com/repos/Steveice10/citrus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Steveice10/citrus/downloads","issues_url":"https://api.github.com/repos/Steveice10/citrus/issues{/number}","pulls_url":"https://api.github.com/repos/Steveice10/citrus/pulls{/number}","milestones_url":"https://api.github.com/repos/Steveice10/citrus/milestones{/number}","notifications_url":"https://api.github.com/repos/Steveice10/citrus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Steveice10/citrus/labels{/name}","releases_url":"https://api.github.com/repos/Steveice10/citrus/releases{/id}","deployments_url":"https://api.github.com/repos/Steveice10/citrus/deployments","created_at":"2015-05-23T03:58:55Z","updated_at":"2016-03-23T00:50:32Z","pushed_at":"2016-04-01T03:42:18Z","git_url":"git://github.com/Steveice10/citrus.git","ssh_url":"git@github.com:Steveice10/citrus.git","clone_url":"https://github.com/Steveice10/citrus.git","svn_url":"https://github.com/Steveice10/citrus","homepage":null,"size":2907,"stargazers_count":22,"watchers_count":22,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":3,"forks":9,"open_issues":3,"watchers":22,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Steveice10/citrus/pulls/17"},"html":{"href":"https://github.com/Steveice10/citrus/pull/17"},"issue":{"href":"https://api.github.com/repos/Steveice10/citrus/issues/17"},"comments":{"href":"https://api.github.com/repos/Steveice10/citrus/issues/17/comments"},"review_comments":{"href":"https://api.github.com/repos/Steveice10/citrus/pulls/17/comments"},"review_comment":{"href":"https://api.github.com/repos/Steveice10/citrus/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Steveice10/citrus/pulls/17/commits"},"statuses":{"href":"https://api.github.com/repos/Steveice10/citrus/statuses/a4097ec65dc188e927aa2bfa5b33439efc08c03e"}}}}