Merge pull request #66 from dot-asm/master
Fix AFCFileRef[Read|Write] prototypes
This commit is contained in:
commit
0467b69fd8
@ -396,11 +396,11 @@ afc_error_t AFCFileRefOpen(afc_connection *conn, const char *path,
|
||||
afc_error_t AFCFileRefSeek(afc_connection *conn, afc_file_ref ref,
|
||||
unsigned long long offset1, unsigned long long offset2);
|
||||
afc_error_t AFCFileRefRead(afc_connection *conn, afc_file_ref ref,
|
||||
void *buf, unsigned int *len);
|
||||
void *buf, size_t *len);
|
||||
afc_error_t AFCFileRefSetFileSize(afc_connection *conn, afc_file_ref ref,
|
||||
unsigned long long offset);
|
||||
afc_error_t AFCFileRefWrite(afc_connection *conn, afc_file_ref ref,
|
||||
const void *buf, unsigned int len);
|
||||
const void *buf, size_t len);
|
||||
afc_error_t AFCFileRefClose(afc_connection *conn, afc_file_ref ref);
|
||||
|
||||
afc_error_t AFCFileInfoOpen(afc_connection *conn, const char *path, struct
|
||||
@ -493,4 +493,4 @@ typedef unsigned int (*t_performOperation)(struct am_restore_device *rdev,
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
51
ios-deploy.c
51
ios-deploy.c
@ -644,12 +644,12 @@ void write_lldb_prep_cmds(AMDeviceRef device, CFURLRef disk_app_url) {
|
||||
if (args) {
|
||||
CFStringRef cf_args = CFStringCreateWithCString(NULL, args, kCFStringEncodingASCII);
|
||||
CFStringFindAndReplace(cmds, CFSTR("{args}"), cf_args, range, 0);
|
||||
rangeLLDB.length = CFStringGetLength(pmodule);
|
||||
CFStringFindAndReplace(pmodule, CFSTR("{args}"), cf_args, rangeLLDB, 0);
|
||||
|
||||
CFRelease(cf_args);
|
||||
} else {
|
||||
CFStringFindAndReplace(cmds, CFSTR(" {args}"), CFSTR(""), range, 0);
|
||||
CFStringFindAndReplace(cmds, CFSTR("{args}"), CFSTR(""), range, 0);
|
||||
CFStringFindAndReplace(pmodule, CFSTR("{args}"), CFSTR(""), rangeLLDB, 0);
|
||||
}
|
||||
range.length = CFStringGetLength(cmds);
|
||||
|
||||
@ -1002,7 +1002,8 @@ CFStringRef get_bundle_id(CFURLRef app_url)
|
||||
return bundle_id;
|
||||
}
|
||||
|
||||
void read_dir(service_conn_t afcFd, afc_connection* afc_conn_p, const char* dir)
|
||||
void read_dir(service_conn_t afcFd, afc_connection* afc_conn_p, const char* dir,
|
||||
void(*callback)(afc_connection *conn,const char *dir,int file))
|
||||
{
|
||||
char *dir_ent;
|
||||
|
||||
@ -1014,24 +1015,38 @@ void read_dir(service_conn_t afcFd, afc_connection* afc_conn_p, const char* dir)
|
||||
|
||||
printf("%s\n", dir);
|
||||
|
||||
afc_dictionary afc_dict;
|
||||
afc_dictionary* afc_dict_p = &afc_dict;
|
||||
afc_dictionary* afc_dict_p;
|
||||
char *key, *val;
|
||||
int not_dir;
|
||||
|
||||
AFCFileInfoOpen(afc_conn_p, dir, &afc_dict_p);
|
||||
|
||||
afc_directory afc_dir;
|
||||
afc_directory* afc_dir_p = &afc_dir;
|
||||
while((AFCKeyValueRead(afc_dict_p,&key,&val) == 0) && key && val) {
|
||||
if (strcmp(key,"st_ifmt")==0) {
|
||||
not_dir = strcmp(val,"S_IFDIR");
|
||||
break;
|
||||
}
|
||||
}
|
||||
AFCKeyValueClose(afc_dict_p);
|
||||
|
||||
if (not_dir) {
|
||||
if (callback) (*callback)(afc_conn_p, dir, not_dir);
|
||||
return;
|
||||
}
|
||||
|
||||
afc_directory* afc_dir_p;
|
||||
afc_error_t err = AFCDirectoryOpen(afc_conn_p, dir, &afc_dir_p);
|
||||
|
||||
if (err != 0)
|
||||
{
|
||||
if (err != 0) {
|
||||
// Couldn't open dir - was probably a file
|
||||
return;
|
||||
} else {
|
||||
if (callback) (*callback)(afc_conn_p, dir, not_dir);
|
||||
}
|
||||
|
||||
while(true) {
|
||||
err = AFCDirectoryRead(afc_conn_p, afc_dir_p, &dir_ent);
|
||||
|
||||
if (!dir_ent)
|
||||
if (err != 0 || !dir_ent)
|
||||
break;
|
||||
|
||||
if (strcmp(dir_ent, ".") == 0 || strcmp(dir_ent, "..") == 0)
|
||||
@ -1042,7 +1057,7 @@ void read_dir(service_conn_t afcFd, afc_connection* afc_conn_p, const char* dir)
|
||||
if (dir_joined[strlen(dir)-1] != '/')
|
||||
strcat(dir_joined, "/");
|
||||
strcat(dir_joined, dir_ent);
|
||||
read_dir(afcFd, afc_conn_p, dir_joined);
|
||||
read_dir(afcFd, afc_conn_p, dir_joined, callback);
|
||||
free(dir_joined);
|
||||
}
|
||||
|
||||
@ -1119,11 +1134,11 @@ void list_files(AMDeviceRef device)
|
||||
{
|
||||
service_conn_t houseFd = start_house_arrest_service(device);
|
||||
|
||||
afc_connection afc_conn;
|
||||
afc_connection* afc_conn_p = &afc_conn;
|
||||
AFCConnectionOpen(houseFd, 0, &afc_conn_p);
|
||||
|
||||
read_dir(houseFd, afc_conn_p, "/");
|
||||
afc_connection* afc_conn_p;
|
||||
if (AFCConnectionOpen(houseFd, 0, &afc_conn_p) == 0) {
|
||||
read_dir(houseFd, afc_conn_p, "/", NULL);
|
||||
AFCConnectionClose(afc_conn_p);
|
||||
}
|
||||
}
|
||||
|
||||
void upload_file(AMDeviceRef device) {
|
||||
@ -1135,7 +1150,7 @@ void upload_file(AMDeviceRef device) {
|
||||
afc_connection* afc_conn_p = &afc_conn;
|
||||
AFCConnectionOpen(houseFd, 0, &afc_conn_p);
|
||||
|
||||
// read_dir(houseFd, NULL, "/");
|
||||
// read_dir(houseFd, NULL, "/", NULL);
|
||||
|
||||
if (!target_filename)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user