diff options
| author | 2014-10-02 16:13:49 +0200 | |
|---|---|---|
| committer | 2014-10-02 16:13:49 +0200 | |
| commit | 9eaaae751d4a3b3e6bd6d95e5c355cb26390845f (patch) | |
| tree | 782fb20c2a638993b44b003da33dc8b9a609e42e | |
| parent | ff5807ceca06d67a3f87c1aa147416b4ef3c25ec (diff) | |
| download | libimobiledevice-9eaaae751d4a3b3e6bd6d95e5c355cb26390845f.tar.gz libimobiledevice-9eaaae751d4a3b3e6bd6d95e5c355cb26390845f.tar.bz2 | |
afc: Unify argument names for some functions to match overall API
| -rw-r--r-- | include/libimobiledevice/afc.h | 28 | ||||
| -rw-r--r-- | src/afc.c | 24 |
2 files changed, 27 insertions, 25 deletions
diff --git a/include/libimobiledevice/afc.h b/include/libimobiledevice/afc.h index 2f272e0..a3cde32 100644 --- a/include/libimobiledevice/afc.h +++ b/include/libimobiledevice/afc.h | |||
| @@ -139,37 +139,39 @@ afc_error_t afc_client_free(afc_client_t client); | |||
| 139 | * and blocksize on the accessed disk partition. | 139 | * and blocksize on the accessed disk partition. |
| 140 | * | 140 | * |
| 141 | * @param client The client to get device info for. | 141 | * @param client The client to get device info for. |
| 142 | * @param infos A char ** list of parameters as given by AFC or NULL if there | 142 | * @param device_information A char list of device information terminated by an |
| 143 | * was an error. | 143 | * empty string or NULL if there was an error. Free with |
| 144 | * afc_dictionary_free(). | ||
| 144 | * | 145 | * |
| 145 | * @return AFC_E_SUCCESS on success or an AFC_E_* error value. | 146 | * @return AFC_E_SUCCESS on success or an AFC_E_* error value. |
| 146 | */ | 147 | */ |
| 147 | afc_error_t afc_get_device_info(afc_client_t client, char ***infos); | 148 | afc_error_t afc_get_device_info(afc_client_t client, char ***device_information); |
| 148 | 149 | ||
| 149 | /** | 150 | /** |
| 150 | * Gets a directory listing of the directory requested. | 151 | * Gets a directory listing of the directory requested. |
| 151 | * | 152 | * |
| 152 | * @param client The client to get a directory listing from. | 153 | * @param client The client to get a directory listing from. |
| 153 | * @param dir The directory to list. (must be a fully-qualified path) | 154 | * @param path The directory for listing. (must be a fully-qualified path) |
| 154 | * @param list A char list of files in that directory, terminated by an empty | 155 | * @param directory_information A char list of files in the directory |
| 155 | * string or NULL if there was an error. | 156 | * terminated by an empty string or NULL if there was an error. Free with |
| 157 | * afc_dictionary_free(). | ||
| 156 | * | 158 | * |
| 157 | * @return AFC_E_SUCCESS on success or an AFC_E_* error value. | 159 | * @return AFC_E_SUCCESS on success or an AFC_E_* error value. |
| 158 | */ | 160 | */ |
| 159 | afc_error_t afc_read_directory(afc_client_t client, const char *dir, char ***list); | 161 | afc_error_t afc_read_directory(afc_client_t client, const char *path, char ***directory_information); |
| 160 | 162 | ||
| 161 | /** | 163 | /** |
| 162 | * Gets information about a specific file. | 164 | * Gets information about a specific file. |
| 163 | * | 165 | * |
| 164 | * @param client The client to use to get the information of the file. | 166 | * @param client The client to use to get the information of the file. |
| 165 | * @param path The fully-qualified path to the file. | 167 | * @param path The fully-qualified path to the file. |
| 166 | * @param infolist Pointer to a buffer that will be filled with a NULL-terminated | 168 | * @param file_information Pointer to a buffer that will be filled with a |
| 167 | * list of strings with the file information. | 169 | * NULL-terminated list of strings with the file information. Set to NULL |
| 168 | * Set to NULL before calling this function. | 170 | * before calling this function. Free with afc_dictionary_free(). |
| 169 | * | 171 | * |
| 170 | * @return AFC_E_SUCCESS on success or an AFC_E_* error value. | 172 | * @return AFC_E_SUCCESS on success or an AFC_E_* error value. |
| 171 | */ | 173 | */ |
| 172 | afc_error_t afc_get_file_info(afc_client_t client, const char *filename, char ***infolist); | 174 | afc_error_t afc_get_file_info(afc_client_t client, const char *filename, char ***file_information); |
| 173 | 175 | ||
| 174 | /** | 176 | /** |
| 175 | * Opens a file on the device. | 177 | * Opens a file on the device. |
| @@ -296,12 +298,12 @@ afc_error_t afc_rename_path(afc_client_t client, const char *from, const char *t | |||
| 296 | * Creates a directory on the device. | 298 | * Creates a directory on the device. |
| 297 | * | 299 | * |
| 298 | * @param client The client to use to make a directory. | 300 | * @param client The client to use to make a directory. |
| 299 | * @param dir The directory's path. (must be a fully-qualified path, I assume | 301 | * @param path The directory's path. (must be a fully-qualified path, I assume |
| 300 | * all other mkdir restrictions apply as well) | 302 | * all other mkdir restrictions apply as well) |
| 301 | * | 303 | * |
| 302 | * @return AFC_E_SUCCESS on success or an AFC_E_* error value. | 304 | * @return AFC_E_SUCCESS on success or an AFC_E_* error value. |
| 303 | */ | 305 | */ |
| 304 | afc_error_t afc_make_directory(afc_client_t client, const char *dir); | 306 | afc_error_t afc_make_directory(afc_client_t client, const char *path); |
| 305 | 307 | ||
| 306 | /** | 308 | /** |
| 307 | * Sets the size of a file on the device without prior opening it. | 309 | * Sets the size of a file on the device without prior opening it. |
| @@ -402,19 +402,19 @@ static char **make_strings_list(char *tokens, uint32_t length) | |||
| 402 | return list; | 402 | return list; |
| 403 | } | 403 | } |
| 404 | 404 | ||
| 405 | afc_error_t afc_read_directory(afc_client_t client, const char *dir, char ***list) | 405 | afc_error_t afc_read_directory(afc_client_t client, const char *path, char ***directory_information) |
| 406 | { | 406 | { |
| 407 | uint32_t bytes = 0; | 407 | uint32_t bytes = 0; |
| 408 | char *data = NULL, **list_loc = NULL; | 408 | char *data = NULL, **list_loc = NULL; |
| 409 | afc_error_t ret = AFC_E_UNKNOWN_ERROR; | 409 | afc_error_t ret = AFC_E_UNKNOWN_ERROR; |
| 410 | 410 | ||
| 411 | if (!client || !dir || !list || (list && *list)) | 411 | if (!client || !path || !directory_information || (directory_information && *directory_information)) |
| 412 | return AFC_E_INVALID_ARG; | 412 | return AFC_E_INVALID_ARG; |
| 413 | 413 | ||
| 414 | afc_lock(client); | 414 | afc_lock(client); |
| 415 | 415 | ||
| 416 | /* Send the command */ | 416 | /* Send the command */ |
| 417 | ret = afc_dispatch_packet(client, AFC_OP_READ_DIR, dir, strlen(dir)+1, NULL, 0, &bytes); | 417 | ret = afc_dispatch_packet(client, AFC_OP_READ_DIR, path, strlen(path)+1, NULL, 0, &bytes); |
| 418 | if (ret != AFC_E_SUCCESS) { | 418 | if (ret != AFC_E_SUCCESS) { |
| 419 | afc_unlock(client); | 419 | afc_unlock(client); |
| 420 | return AFC_E_NOT_ENOUGH_DATA; | 420 | return AFC_E_NOT_ENOUGH_DATA; |
| @@ -433,18 +433,18 @@ afc_error_t afc_read_directory(afc_client_t client, const char *dir, char ***lis | |||
| 433 | free(data); | 433 | free(data); |
| 434 | 434 | ||
| 435 | afc_unlock(client); | 435 | afc_unlock(client); |
| 436 | *list = list_loc; | 436 | *directory_information = list_loc; |
| 437 | 437 | ||
| 438 | return ret; | 438 | return ret; |
| 439 | } | 439 | } |
| 440 | 440 | ||
| 441 | afc_error_t afc_get_device_info(afc_client_t client, char ***infos) | 441 | afc_error_t afc_get_device_info(afc_client_t client, char ***device_information) |
| 442 | { | 442 | { |
| 443 | uint32_t bytes = 0; | 443 | uint32_t bytes = 0; |
| 444 | char *data = NULL, **list = NULL; | 444 | char *data = NULL, **list = NULL; |
| 445 | afc_error_t ret = AFC_E_UNKNOWN_ERROR; | 445 | afc_error_t ret = AFC_E_UNKNOWN_ERROR; |
| 446 | 446 | ||
| 447 | if (!client || !infos) | 447 | if (!client || !device_information) |
| 448 | return AFC_E_INVALID_ARG; | 448 | return AFC_E_INVALID_ARG; |
| 449 | 449 | ||
| 450 | afc_lock(client); | 450 | afc_lock(client); |
| @@ -470,7 +470,7 @@ afc_error_t afc_get_device_info(afc_client_t client, char ***infos) | |||
| 470 | 470 | ||
| 471 | afc_unlock(client); | 471 | afc_unlock(client); |
| 472 | 472 | ||
| 473 | *infos = list; | 473 | *device_information = list; |
| 474 | 474 | ||
| 475 | return ret; | 475 | return ret; |
| 476 | } | 476 | } |
| @@ -559,7 +559,7 @@ afc_error_t afc_rename_path(afc_client_t client, const char *from, const char *t | |||
| 559 | return ret; | 559 | return ret; |
| 560 | } | 560 | } |
| 561 | 561 | ||
| 562 | afc_error_t afc_make_directory(afc_client_t client, const char *dir) | 562 | afc_error_t afc_make_directory(afc_client_t client, const char *path) |
| 563 | { | 563 | { |
| 564 | uint32_t bytes = 0; | 564 | uint32_t bytes = 0; |
| 565 | afc_error_t ret = AFC_E_UNKNOWN_ERROR; | 565 | afc_error_t ret = AFC_E_UNKNOWN_ERROR; |
| @@ -570,7 +570,7 @@ afc_error_t afc_make_directory(afc_client_t client, const char *dir) | |||
| 570 | afc_lock(client); | 570 | afc_lock(client); |
| 571 | 571 | ||
| 572 | /* Send command */ | 572 | /* Send command */ |
| 573 | ret = afc_dispatch_packet(client, AFC_OP_MAKE_DIR, dir, strlen(dir)+1, NULL, 0, &bytes); | 573 | ret = afc_dispatch_packet(client, AFC_OP_MAKE_DIR, path, strlen(path)+1, NULL, 0, &bytes); |
| 574 | if (ret != AFC_E_SUCCESS) { | 574 | if (ret != AFC_E_SUCCESS) { |
| 575 | afc_unlock(client); | 575 | afc_unlock(client); |
| 576 | return AFC_E_NOT_ENOUGH_DATA; | 576 | return AFC_E_NOT_ENOUGH_DATA; |
| @@ -583,13 +583,13 @@ afc_error_t afc_make_directory(afc_client_t client, const char *dir) | |||
| 583 | return ret; | 583 | return ret; |
| 584 | } | 584 | } |
| 585 | 585 | ||
| 586 | afc_error_t afc_get_file_info(afc_client_t client, const char *path, char ***infolist) | 586 | afc_error_t afc_get_file_info(afc_client_t client, const char *path, char ***file_information) |
| 587 | { | 587 | { |
| 588 | char *received = NULL; | 588 | char *received = NULL; |
| 589 | uint32_t bytes = 0; | 589 | uint32_t bytes = 0; |
| 590 | afc_error_t ret = AFC_E_UNKNOWN_ERROR; | 590 | afc_error_t ret = AFC_E_UNKNOWN_ERROR; |
| 591 | 591 | ||
| 592 | if (!client || !path || !infolist) | 592 | if (!client || !path || !file_information) |
| 593 | return AFC_E_INVALID_ARG; | 593 | return AFC_E_INVALID_ARG; |
| 594 | 594 | ||
| 595 | afc_lock(client); | 595 | afc_lock(client); |
| @@ -604,7 +604,7 @@ afc_error_t afc_get_file_info(afc_client_t client, const char *path, char ***inf | |||
| 604 | /* Receive data */ | 604 | /* Receive data */ |
| 605 | ret = afc_receive_data(client, &received, &bytes); | 605 | ret = afc_receive_data(client, &received, &bytes); |
| 606 | if (received) { | 606 | if (received) { |
| 607 | *infolist = make_strings_list(received, bytes); | 607 | *file_information = make_strings_list(received, bytes); |
| 608 | free(received); | 608 | free(received); |
| 609 | } | 609 | } |
| 610 | 610 | ||
