[rtmpdump] r27 - rtmp.cpp rtmp.h

hyc subversion at mplayerhq.hu
Sat Nov 7 08:19:32 CET 2009


Author: hyc
Date: Sat Nov  7 08:19:31 2009
New Revision: 27

Log:
FLV Ints seem to always be unsigned

Modified:
   rtmp.cpp
   rtmp.h

Modified: rtmp.cpp
==============================================================================
--- rtmp.cpp	Fri Nov  6 06:38:22 2009	(r26)
+++ rtmp.cpp	Sat Nov  7 08:19:31 2009	(r27)
@@ -1477,27 +1477,27 @@ bool CRTMP::ReadPacket(RTMPPacket &packe
   return true;
 }
 
-short  CRTMP::ReadInt16(const char *data)
+unsigned short  CRTMP::ReadInt16(const char *data)
 {
   unsigned char *c = (unsigned char *)data;
-  short val;
+  unsigned short val;
   val = (c[0] << 8) | c[1];
   return val;
 }
 
-int  CRTMP::ReadInt24(const char *data)
+unsigned int  CRTMP::ReadInt24(const char *data)
 {
   unsigned char *c = (unsigned char *)data;
-  int val;
-  val = (data[0] << 16) | (c[1] << 8) | c[2];
+  unsigned int val;
+  val = (c[0] << 16) | (c[1] << 8) | c[2];
   return val;
 }
 
 // big-endian 32bit integer
-int  CRTMP::ReadInt32(const char *data)
+unsigned int  CRTMP::ReadInt32(const char *data)
 {
   unsigned char *c = (unsigned char *)data;
-  int val;
+  unsigned int val;
   val = (c[0] << 24) | (c[1] << 16) | (c[2] << 8) | c[3];
   return val;
 }

Modified: rtmp.h
==============================================================================
--- rtmp.h	Fri Nov  6 06:38:22 2009	(r26)
+++ rtmp.h	Sat Nov  7 08:19:31 2009	(r27)
@@ -156,9 +156,9 @@ class CRTMP
       static int EncodeInt32(char *output, int nVal);
       static int EncodeBoolean(char *output,bool bVal);
 
-      static short ReadInt16(const char *data);
-      static int  ReadInt24(const char *data);
-      static int  ReadInt32(const char *data);
+      static unsigned short ReadInt16(const char *data);
+      static unsigned int  ReadInt24(const char *data);
+      static unsigned int  ReadInt32(const char *data);
       static std::string ReadString(const char *data);
       static bool ReadBool(const char *data);
       static double ReadNumber(const char *data);


More information about the rtmpdump mailing list