Author: rolf
Date: 2008-02-04 12:00:59 -0500 (Mon, 04 Feb 2008)
New Revision: 94761
Modified:
trunk/moon/src/asf/ChangeLog
trunk/moon/src/asf/asf.cpp
trunk/moon/src/asf/asf.h
Log:
* asf/asf.cpp, asf/asf.h: Fix more signedness problems.
Modified: trunk/moon/src/asf/ChangeLog
===================================================================
--- trunk/moon/src/asf/ChangeLog 2008-02-04 16:51:44 UTC (rev 94760)
+++ trunk/moon/src/asf/ChangeLog 2008-02-04 17:00:59 UTC (rev 94761)
@@ -1,5 +1,9 @@
2008-02-04 Rolf Bjarne Kvinge <[EMAIL PROTECTED]>
+ * asf.cpp, asf.h: Fix more signedness problems.
+
+2008-02-04 Rolf Bjarne Kvinge <[EMAIL PROTECTED]>
+
* asf.cpp, asf.h: Make packet index a uint64. When adding an index
entry,
cap the packet index to the size of the index (fixes a crash).
Modified: trunk/moon/src/asf/asf.cpp
===================================================================
--- trunk/moon/src/asf/asf.cpp 2008-02-04 16:51:44 UTC (rev 94760)
+++ trunk/moon/src/asf/asf.cpp 2008-02-04 17:00:59 UTC (rev 94761)
@@ -806,7 +806,8 @@
}
}
- int k = MAX (packet_index, index_size - 1);
+ // index_size can't be 0 here.
+ uint32_t k = MAX (packet_index, index_size - 1);
uint64_t current_start = index [k].start_pts;
index [k].start_pts = MIN (index [k].start_pts, Pts ());
index [k].end_pts = MAX (index [k].end_pts, Pts ());
@@ -815,10 +816,10 @@
}
}
-int32_t
+uint32_t
ASFFrameReader::FrameSearch (uint64_t pts)
{
- for (int i = 0; i < index_size; i++) {
+ for (uint32_t i = 0; i < index_size; i++) {
//printf ("ASFFrameReader::FrameSearch (%llu): Checking
start_pts: %llu, end_pts: %llu, pi: %i\n", pts, index [i].start_pts, index
[i].end_pts, index [i].packet_index);
if (index [i].start_pts == INVALID_START_PTS)
@@ -826,7 +827,7 @@
if (index [i].start_pts > pts) {
//printf ("ASFFrameReader::FrameSearch (%llu): index
not created for the desired pts (found starting pts after the requested
one)\n", pts);
- return -1;
+ return UINT32_MAX;
}
if (index [i].start_pts <= pts && index [i].end_pts >= pts) {
@@ -1161,14 +1162,14 @@
packet_index = FrameSearch (pts);
- if (packet_index >= 0) {
+ if (packet_index != UINT32_MAX) {
//printf ("ASFFrameReader::GetPositionOfPts (%llu, %p): Found
pts in index, position: %lld, pi: %i\n", pts, estimate, parser->GetPacketOffset
(packet_index), packet_index);
return packet_index;
}
*estimate = true;
- for (int i = 0; i < index_size; i++) {
+ for (uint32_t i = 0; i < index_size; i++) {
if (!(index [i].start_pts != INVALID_START_PTS && index
[i].end_pts > index [i].start_pts))
continue;
Modified: trunk/moon/src/asf/asf.h
===================================================================
--- trunk/moon/src/asf/asf.h 2008-02-04 16:51:44 UTC (rev 94760)
+++ trunk/moon/src/asf/asf.h 2008-02-04 17:00:59 UTC (rev 94761)
@@ -189,7 +189,7 @@
uint64_t pts;
// Index data
- int32_t index_size; // The number of items in the index.
+ uint32_t index_size; // The number of items in the index.
ASFFrameReaderIndex *index; // A table of ASFFrameReaderIndexes.
bool ResizeList (int size); // Resizes the list of payloads to the
requested size.
@@ -224,8 +224,8 @@
void FindScriptCommandStream ();
// Index, returns the packet index of where the frame is.
- // returns -1 if not found in the index.
- int32_t FrameSearch (uint64_t pts);
+ // returns UINT32_MAX if not found in the index.
+ uint32_t FrameSearch (uint64_t pts);
int64_t GetPositionOfPts (uint64_t pts, bool *estimate);
uint64_t GetPacketIndexOfPts (uint64_t pts, bool *estimate);
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches