[Swfed-svn] swfed-svn [422] - 念の為の NULL 初期化

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2011年 3月 12日 (土) 12:42:54 JST


Revision: 422
          http://sourceforge.jp/projects/swfed/svn/view?view=rev&revision=422
Author:   yoya
Date:     2011-03-12 12:42:54 +0900 (Sat, 12 Mar 2011)

Log Message:
-----------
- 念の為の NULL 初期化
- NULL チェック変更
- エラー文言修正

Modified Paths:
--------------
    trunk/src/bitstream.c


-------------- next part --------------
Modified: trunk/src/bitstream.c
===================================================================
--- trunk/src/bitstream.c	2011-03-11 15:59:03 UTC (rev 421)
+++ trunk/src/bitstream.c	2011-03-12 03:42:54 UTC (rev 422)
@@ -25,6 +25,7 @@
 bitstream_close(bitstream_t * bs) {
     if (bs->data) {
         free(bs->data);
+        bs->data = NULL;
     }
     free(bs);
     return ;
@@ -75,13 +76,14 @@
 bitstream_steal(bitstream_t *bs, unsigned long *length) {
     unsigned char *data, *tmp;
     *length = 0;
-    if (! bs) {
+    if (bs == NULL) {
+        fprintf(stderr, "bitstream_steal: bs == NULL\n");
         return NULL;
     }
     data = bs->data;
     *length = bs->data_len;
     if ((tmp = realloc(data, *length)) == NULL) {
-        fprintf(stderr, "Can't realloc\n");
+        fprintf(stderr, "bitstream_steal: Can't realloc\n");
     }
     bs->data = NULL;
     bs->data_len = 0;
@@ -92,8 +94,8 @@
 unsigned char *
 bitstream_output_sub(bitstream_t *bs, unsigned long offset, unsigned long length) {
     unsigned char *data;
-    if (! bs) {
-        fprintf(stderr, "bs == NULL");
+    if (bs == NULL) {
+        fprintf(stderr, "bitstream_output_sub: bs == NULL\n");
         return NULL;
     }
     if (bs->data_len < offset + length ) {



Swfed-svn メーリングリストの案内
Back to archive index