зеркало из https://github.com/mozilla/gecko-dev.git
bug 461844 - posix IO functions do not exist on windows ce, work around for liboggz r=doublec
This commit is contained in:
Родитель
7d939aed25
Коммит
541b9f5556
|
@ -15,3 +15,5 @@ http://trac.annodex.net/ticket/431
|
|||
|
||||
The oggz_off_t.patch fixes a compile error on Solaris see bug 449754
|
||||
for details
|
||||
|
||||
The wince.patch addresses the lack of posix file IO suppor on windows ce see bug 461844 for details.
|
||||
|
|
|
@ -39,6 +39,10 @@
|
|||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef WINCE
|
||||
typedef long off_t;
|
||||
#endif
|
||||
|
||||
/* MSVC/Borland & Cygwin */
|
||||
typedef off_t oggz_off_t;
|
||||
|
||||
|
|
|
@ -572,11 +572,14 @@ oggz_seek_guess (ogg_int64_t unit_at, ogg_int64_t unit_target,
|
|||
static oggz_off_t
|
||||
oggz_offset_end (OGGZ * oggz)
|
||||
{
|
||||
#ifndef WINCE
|
||||
int fd;
|
||||
struct stat statbuf;
|
||||
#endif
|
||||
oggz_off_t offset_end = -1;
|
||||
|
||||
if (oggz->file != NULL) {
|
||||
#ifndef WINCE
|
||||
if ((fd = fileno (oggz->file)) == -1) {
|
||||
/*oggz_set_error (oggz, OGGZ_ERR_SYSTEM);*/
|
||||
return -1;
|
||||
|
@ -598,6 +601,12 @@ oggz_offset_end (OGGZ * oggz)
|
|||
/* XXX: should be able to just carry on and guess, as per io */
|
||||
/*return -1;*/
|
||||
}
|
||||
#else
|
||||
int current = ftell(oggz->file);
|
||||
fseek (oggz->file, 0, SEEK_END);
|
||||
offset_end = ftell (oggz->file);
|
||||
fseek (oggz->file, current, SEEK_SET);
|
||||
#endif
|
||||
} else {
|
||||
oggz_off_t offset_save;
|
||||
|
||||
|
|
|
@ -44,3 +44,4 @@ cp $1/AUTHORS ./AUTHORS
|
|||
patch -p4 <seek.patch
|
||||
patch -p4 <warning.patch
|
||||
patch -p3 <oggz_off_t.patch
|
||||
patch -p3 <wince.patch
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
diff --git a/media/liboggz/include/oggz/oggz_off_t.h b/media/liboggz/include/oggz/oggz_off_t.h
|
||||
--- a/media/liboggz/include/oggz/oggz_off_t.h
|
||||
+++ b/media/liboggz/include/oggz/oggz_off_t.h
|
||||
@@ -39,6 +39,10 @@
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
+#ifdef WINCE
|
||||
+ typedef long off_t;
|
||||
+#endif
|
||||
+
|
||||
/* MSVC/Borland & Cygwin */
|
||||
typedef off_t oggz_off_t;
|
||||
|
||||
diff --git a/media/liboggz/src/liboggz/oggz_seek.c b/media/liboggz/src/liboggz/oggz_seek.c
|
||||
--- a/media/liboggz/src/liboggz/oggz_seek.c
|
||||
+++ b/media/liboggz/src/liboggz/oggz_seek.c
|
||||
@@ -572,32 +572,41 @@ static oggz_off_t
|
||||
static oggz_off_t
|
||||
oggz_offset_end (OGGZ * oggz)
|
||||
{
|
||||
+#ifndef WINCE
|
||||
int fd;
|
||||
struct stat statbuf;
|
||||
+#endif
|
||||
oggz_off_t offset_end = -1;
|
||||
|
||||
if (oggz->file != NULL) {
|
||||
+#ifndef WINCE
|
||||
if ((fd = fileno (oggz->file)) == -1) {
|
||||
/*oggz_set_error (oggz, OGGZ_ERR_SYSTEM);*/
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (fstat (fd, &statbuf) == -1) {
|
||||
/*oggz_set_error (oggz, OGGZ_ERR_SYSTEM);*/
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (oggz_stat_regular (statbuf.st_mode)) {
|
||||
offset_end = statbuf.st_size;
|
||||
#ifdef DEBUG
|
||||
printf ("oggz_offset_end: stat size %" PRI_OGGZ_OFF_T "d\n", offset_end);
|
||||
#endif
|
||||
} else {
|
||||
/*oggz_set_error (oggz, OGGZ_ERR_NOSEEK);*/
|
||||
|
||||
/* XXX: should be able to just carry on and guess, as per io */
|
||||
/*return -1;*/
|
||||
}
|
||||
+#else
|
||||
+ int current = ftell(oggz->file);
|
||||
+ fseek (oggz->file, 0, SEEK_END);
|
||||
+ offset_end = ftell (oggz->file);
|
||||
+ fseek (oggz->file, current, SEEK_SET);
|
||||
+#endif
|
||||
} else {
|
||||
oggz_off_t offset_save;
|
||||
|
Загрузка…
Ссылка в новой задаче