summaryrefslogtreecommitdiffstats
path: root/src/libirecovery.c
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2013-09-26 22:42:53 +0200
committerGravatar Martin Szulecki2013-09-26 22:42:53 +0200
commit5877a05844fc3bd224dec206c54fe6633c671455 (patch)
treea697209ee629f10d1c28b41cacfda9fb85fe528f /src/libirecovery.c
parent871ffcdcf06692fd306c8f63cd7796277c2b3d27 (diff)
downloadlibirecovery-5877a05844fc3bd224dec206c54fe6633c671455.tar.gz
libirecovery-5877a05844fc3bd224dec206c54fe6633c671455.tar.bz2
Remove irecv_read|write_file() which are obsolete now
Diffstat (limited to 'src/libirecovery.c')
-rw-r--r--src/libirecovery.c64
1 files changed, 0 insertions, 64 deletions
diff --git a/src/libirecovery.c b/src/libirecovery.c
index 87ec520..f51ca3d 100644
--- a/src/libirecovery.c
+++ b/src/libirecovery.c
@@ -48,8 +48,6 @@ static int libirecovery_debug = 0;
48static libusb_context* libirecovery_context = NULL; 48static libusb_context* libirecovery_context = NULL;
49#endif 49#endif
50 50
51int irecv_write_file(const char* filename, const void* data, size_t size);
52int irecv_read_file(const char* filename, char** data, uint32_t* size);
53 51
54static unsigned int dfu_hash_t1[256] = { 52static unsigned int dfu_hash_t1[256] = {
55 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 53 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA,
@@ -1369,68 +1367,6 @@ const char* irecv_strerror(irecv_error_t error) {
1369 return NULL; 1367 return NULL;
1370} 1368}
1371 1369
1372int irecv_write_file(const char* filename, const void* data, size_t size) {
1373 size_t bytes = 0;
1374 FILE* file = NULL;
1375
1376 debug("Writing data to %s\n", filename);
1377 file = fopen(filename, "wb");
1378 if (file == NULL) {
1379 //error("read_file: Unable to open file %s\n", filename);
1380 return -1;
1381 }
1382
1383 bytes = fwrite(data, 1, size, file);
1384 fclose(file);
1385
1386 if (bytes != size) {
1387 //error("ERROR: Unable to write entire file: %s: %d of %d\n", filename, bytes, size);
1388 return -1;
1389 }
1390
1391 return size;
1392}
1393
1394int irecv_read_file(const char* filename, char** data, uint32_t* size) {
1395 size_t bytes = 0;
1396 size_t length = 0;
1397 FILE* file = NULL;
1398 char* buffer = NULL;
1399 debug("Reading data from %s\n", filename);
1400
1401 *size = 0;
1402 *data = NULL;
1403
1404 file = fopen(filename, "rb");
1405 if (file == NULL) {
1406 //error("read_file: File %s not found\n", filename);
1407 return -1;
1408 }
1409
1410 fseek(file, 0, SEEK_END);
1411 length = ftell(file);
1412 rewind(file);
1413
1414 buffer = (char*) malloc(length);
1415 if(buffer == NULL) {
1416 //error("ERROR: Out of memory\n");
1417 fclose(file);
1418 return -1;
1419 }
1420 bytes = fread(buffer, 1, length, file);
1421 fclose(file);
1422
1423 if(bytes != length) {
1424 //error("ERROR: Unable to read entire file\n");
1425 free(buffer);
1426 return -1;
1427 }
1428
1429 *size = length;
1430 *data = buffer;
1431 return 0;
1432}
1433
1434irecv_error_t irecv_reset_counters(irecv_client_t client) { 1370irecv_error_t irecv_reset_counters(irecv_client_t client) {
1435 if (check_context(client) != IRECV_E_SUCCESS) return IRECV_E_NO_DEVICE; 1371 if (check_context(client) != IRECV_E_SUCCESS) return IRECV_E_NO_DEVICE;
1436 if ((client->mode == kDfuMode) || (client->mode == kWTFMode)) { 1372 if ((client->mode == kDfuMode) || (client->mode == kWTFMode)) {