summaryrefslogtreecommitdiffstats
path: root/rbutil
diff options
context:
space:
mode:
Diffstat (limited to 'rbutil')
-rw-r--r--rbutil/ipodpatcher/ipodio-posix.c2
-rw-r--r--rbutil/ipodpatcher/ipodio-win32.c20
-rw-r--r--rbutil/ipodpatcher/ipodio.h2
-rw-r--r--rbutil/ipodpatcher/ipodpatcher.c6
-rw-r--r--rbutil/sansapatcher/sansaio-posix.c4
-rw-r--r--rbutil/sansapatcher/sansaio-win32.c23
-rw-r--r--rbutil/sansapatcher/sansaio.h2
-rw-r--r--rbutil/sansapatcher/sansapatcher.c2
8 files changed, 29 insertions, 32 deletions
diff --git a/rbutil/ipodpatcher/ipodio-posix.c b/rbutil/ipodpatcher/ipodio-posix.c
index be048fc986..8398eca566 100644
--- a/rbutil/ipodpatcher/ipodio-posix.c
+++ b/rbutil/ipodpatcher/ipodio-posix.c
@@ -160,7 +160,7 @@ static int ipod_unmount(struct ipod_t* ipod)
}
#endif
-void print_error(char* msg)
+void ipod_print_error(char* msg)
{
perror(msg);
}
diff --git a/rbutil/ipodpatcher/ipodio-win32.c b/rbutil/ipodpatcher/ipodio-win32.c
index 29391bfa4f..abf7bdf46e 100644
--- a/rbutil/ipodpatcher/ipodio-win32.c
+++ b/rbutil/ipodpatcher/ipodio-win32.c
@@ -54,7 +54,7 @@ static int unlock_volume(HANDLE hDisk)
&dummy, NULL);
}
-void print_error(char* msg)
+void ipod_print_error(char* msg)
{
LPSTR pMsgBuf = NULL;
@@ -78,7 +78,7 @@ int ipod_open(struct ipod_t* ipod, int silent)
FILE_FLAG_WRITE_THROUGH | FILE_FLAG_NO_BUFFERING, NULL);
if (ipod->dh == INVALID_HANDLE_VALUE) {
- if (!silent) print_error(" Error opening disk: ");
+ if (!silent) ipod_print_error(" Error opening disk: ");
if(GetLastError() == ERROR_ACCESS_DENIED)
return -2;
else
@@ -86,7 +86,7 @@ int ipod_open(struct ipod_t* ipod, int silent)
}
if (!lock_volume(ipod->dh)) {
- if (!silent) print_error(" Error locking disk: ");
+ if (!silent) ipod_print_error(" Error locking disk: ");
return -1;
}
@@ -110,7 +110,7 @@ int ipod_open(struct ipod_t* ipod, int silent)
sizeof(diskgeometry),
&n,
NULL)) {
- if (!silent) print_error(" Error reading disk geometry: ");
+ if (!silent) ipod_print_error(" Error reading disk geometry: ");
return -1;
} else {
ipod->sector_size = diskgeometry.BytesPerSector;
@@ -137,12 +137,12 @@ int ipod_reopen_rw(struct ipod_t* ipod)
FILE_FLAG_WRITE_THROUGH | FILE_FLAG_NO_BUFFERING, NULL);
if (ipod->dh == INVALID_HANDLE_VALUE) {
- print_error(" Error opening disk: ");
+ ipod_print_error(" Error opening disk: ");
return -1;
}
if (!lock_volume(ipod->dh)) {
- print_error(" Error locking disk: ");
+ ipod_print_error(" Error locking disk: ");
return -1;
}
@@ -162,7 +162,7 @@ int ipod_alloc_buffer(unsigned char** sectorbuf, int bufsize)
the disk sector size. */
*sectorbuf = (unsigned char*)VirtualAlloc(NULL, bufsize, MEM_COMMIT, PAGE_READWRITE);
if (*sectorbuf == NULL) {
- print_error(" Error allocating a buffer: ");
+ ipod_print_error(" Error allocating a buffer: ");
return -1;
}
return 0;
@@ -171,7 +171,7 @@ int ipod_alloc_buffer(unsigned char** sectorbuf, int bufsize)
int ipod_seek(struct ipod_t* ipod, unsigned long pos)
{
if (SetFilePointer(ipod->dh, pos, NULL, FILE_BEGIN)==0xffffffff) {
- print_error(" Seek error ");
+ ipod_print_error(" Seek error ");
return -1;
}
return 0;
@@ -182,7 +182,7 @@ ssize_t ipod_read(struct ipod_t* ipod, unsigned char* buf, int nbytes)
unsigned long count;
if (!ReadFile(ipod->dh, buf, nbytes, &count, NULL)) {
- print_error(" Error reading from disk: ");
+ ipod_print_error(" Error reading from disk: ");
return -1;
}
@@ -194,7 +194,7 @@ ssize_t ipod_write(struct ipod_t* ipod, unsigned char* buf, int nbytes)
unsigned long count;
if (!WriteFile(ipod->dh, buf, nbytes, &count, NULL)) {
- print_error(" Error writing to disk: ");
+ ipod_print_error(" Error writing to disk: ");
return -1;
}
diff --git a/rbutil/ipodpatcher/ipodio.h b/rbutil/ipodpatcher/ipodio.h
index 5c098ab60c..6aa675535a 100644
--- a/rbutil/ipodpatcher/ipodio.h
+++ b/rbutil/ipodpatcher/ipodio.h
@@ -91,7 +91,7 @@ struct ipod_t {
#endif
};
-void print_error(char* msg);
+void ipod_print_error(char* msg);
int ipod_open(struct ipod_t* ipod, int silent);
int ipod_reopen_rw(struct ipod_t* ipod);
int ipod_close(struct ipod_t* ipod);
diff --git a/rbutil/ipodpatcher/ipodpatcher.c b/rbutil/ipodpatcher/ipodpatcher.c
index 7116056350..dc023f0a51 100644
--- a/rbutil/ipodpatcher/ipodpatcher.c
+++ b/rbutil/ipodpatcher/ipodpatcher.c
@@ -175,7 +175,7 @@ int read_partinfo(struct ipod_t* ipod, int silent)
count = ipod_read(ipod,ipod_sectorbuf, ipod->sector_size);
if (count <= 0) {
- print_error(" Error reading from disk: ");
+ ipod_print_error(" Error reading from disk: ");
return -1;
}
@@ -225,7 +225,7 @@ int read_partinfo(struct ipod_t* ipod, int silent)
count = ipod_read(ipod, ipod_sectorbuf, ipod->sector_size);
if (count <= 0) {
- print_error(" Error reading from disk: ");
+ ipod_print_error(" Error reading from disk: ");
return -1;
}
@@ -372,7 +372,7 @@ int write_partition(struct ipod_t* ipod, int infile)
res = ipod_write(ipod, ipod_sectorbuf, n);
if (res < 0) {
- print_error(" Error writing to disk: ");
+ ipod_print_error(" Error writing to disk: ");
fprintf(stderr,"Bytes written: %d\n",byteswritten);
return -1;
}
diff --git a/rbutil/sansapatcher/sansaio-posix.c b/rbutil/sansapatcher/sansaio-posix.c
index 4c28afa1c2..56f755ab9a 100644
--- a/rbutil/sansapatcher/sansaio-posix.c
+++ b/rbutil/sansapatcher/sansaio-posix.c
@@ -65,12 +65,10 @@ static int sansa_unmount(struct sansa_t* sansa)
#endif
-#ifndef RBUTIL
-void print_error(char* msg)
+void sansa_print_error(char* msg)
{
perror(msg);
}
-#endif
int sansa_open(struct sansa_t* sansa, int silent)
{
diff --git a/rbutil/sansapatcher/sansaio-win32.c b/rbutil/sansapatcher/sansaio-win32.c
index 2b93d2807d..c27092762a 100644
--- a/rbutil/sansapatcher/sansaio-win32.c
+++ b/rbutil/sansapatcher/sansaio-win32.c
@@ -55,8 +55,7 @@ static int unlock_volume(HANDLE hDisk)
&dummy, NULL);
}
-#ifndef RBUTIL
-void print_error(char* msg)
+void sansa_print_error(char* msg)
{
char* pMsgBuf;
@@ -68,7 +67,7 @@ void print_error(char* msg)
printf(pMsgBuf);
LocalFree(pMsgBuf);
}
-#endif
+
int sansa_open(struct sansa_t* sansa, int silent)
{
DISK_GEOMETRY_EX diskgeometry_ex;
@@ -80,7 +79,7 @@ int sansa_open(struct sansa_t* sansa, int silent)
FILE_FLAG_WRITE_THROUGH | FILE_FLAG_NO_BUFFERING, NULL);
if (sansa->dh == INVALID_HANDLE_VALUE) {
- if (!silent) print_error(" Error opening disk: ");
+ if (!silent) sansa_print_error(" Error opening disk: ");
if(GetLastError() == ERROR_ACCESS_DENIED)
return -2;
else
@@ -88,7 +87,7 @@ int sansa_open(struct sansa_t* sansa, int silent)
}
if (!lock_volume(sansa->dh)) {
- if (!silent) print_error(" Error locking disk: ");
+ if (!silent) sansa_print_error(" Error locking disk: ");
return -1;
}
@@ -108,7 +107,7 @@ int sansa_open(struct sansa_t* sansa, int silent)
sizeof(diskgeometry),
&n,
NULL)) {
- if (!silent) print_error(" Error reading disk geometry: ");
+ if (!silent) sansa_print_error(" Error reading disk geometry: ");
return -1;
} else {
sansa->sector_size=diskgeometry.BytesPerSector;
@@ -131,12 +130,12 @@ int sansa_reopen_rw(struct sansa_t* sansa)
FILE_FLAG_WRITE_THROUGH | FILE_FLAG_NO_BUFFERING, NULL);
if (sansa->dh == INVALID_HANDLE_VALUE) {
- print_error(" Error opening disk: ");
+ sansa_print_error(" Error opening disk: ");
return -1;
}
if (!lock_volume(sansa->dh)) {
- print_error(" Error locking disk: ");
+ sansa_print_error(" Error locking disk: ");
return -1;
}
@@ -156,7 +155,7 @@ int sansa_alloc_buffer(unsigned char** sectorbuf, int bufsize)
the disk sector size. */
*sectorbuf = (unsigned char*)VirtualAlloc(NULL, bufsize, MEM_COMMIT, PAGE_READWRITE);
if (*sectorbuf == NULL) {
- print_error(" Error allocating a buffer: ");
+ sansa_print_error(" Error allocating a buffer: ");
return -1;
}
return 0;
@@ -171,7 +170,7 @@ int sansa_seek(struct sansa_t* sansa, loff_t pos)
li.LowPart = SetFilePointer (sansa->dh, li.LowPart, &li.HighPart, FILE_BEGIN);
if (li.LowPart == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) {
- print_error(" Seek error ");
+ sansa_print_error(" Seek error ");
return -1;
}
return 0;
@@ -182,7 +181,7 @@ int sansa_read(struct sansa_t* sansa, unsigned char* buf, int nbytes)
unsigned long count;
if (!ReadFile(sansa->dh, buf, nbytes, &count, NULL)) {
- print_error(" Error reading from disk: ");
+ sansa_print_error(" Error reading from disk: ");
return -1;
}
@@ -194,7 +193,7 @@ int sansa_write(struct sansa_t* sansa, unsigned char* buf, int nbytes)
unsigned long count;
if (!WriteFile(sansa->dh, buf, nbytes, &count, NULL)) {
- print_error(" Error writing to disk: ");
+ sansa_print_error(" Error writing to disk: ");
return -1;
}
diff --git a/rbutil/sansapatcher/sansaio.h b/rbutil/sansapatcher/sansaio.h
index 5fd98a11ed..9563b572a7 100644
--- a/rbutil/sansapatcher/sansaio.h
+++ b/rbutil/sansapatcher/sansaio.h
@@ -65,7 +65,7 @@ struct sansa_t {
loff_t start; /* Offset in bytes of firmware partition from start of disk */
};
-void print_error(char* msg);
+void sansa_print_error(char* msg);
int sansa_open(struct sansa_t* sansa, int silent);
int sansa_reopen_rw(struct sansa_t* sansa);
int sansa_close(struct sansa_t* sansa);
diff --git a/rbutil/sansapatcher/sansapatcher.c b/rbutil/sansapatcher/sansapatcher.c
index 015e5cbaf2..69e89e993e 100644
--- a/rbutil/sansapatcher/sansapatcher.c
+++ b/rbutil/sansapatcher/sansapatcher.c
@@ -99,7 +99,7 @@ int sansa_read_partinfo(struct sansa_t* sansa, int silent)
count = sansa_read(sansa,sansa_sectorbuf, sansa->sector_size);
if (count <= 0) {
- print_error(" Error reading from disk: ");
+ sansa_print_error(" Error reading from disk: ");
return -1;
}