Note that there are some explanatory texts on larger screens.

plurals
  1. POProblem with converting compressed swf with cws2fws
    primarykey
    data
    text
    <p>I am trying to convert compressed swf files to uncompressed swf files using the cws2fws utility written by Alex Beregszaszi and which is part of the ffmpeg set of conversion routines. The compressed files I am using are valid files as they can be opened and played by Firefox and other programs, but when I run them through cws2fws the program gives an error (-5) indicating that the files is corrupt. I have downloaded the source for the program and compiled it using Visual Studio. When I run my file through the newly compiled program I get the same result as from the program I downloaded from the web. While debugging the program I noticed that the two of the four bytes that are used to determine the uncompressed file size of the swf are negative (see line 64 below).</p> <pre><code>00056 if (buf_in[0] != 'C' || buf_in[1] != 'W' || buf_in[2] != 'S') 00057 { 00058 printf("Not a compressed flash file\n"); 00059 exit(1); 00060 } 00061 00062 fstat(fd_in, &amp;statbuf); 00063 comp_len = statbuf.st_size; 00064 uncomp_len = buf_in[4] | (buf_in[5] &lt;&lt; 8) | (buf_in[6] &lt;&lt; 16) | (buf_in[7] &lt;&lt; 24); 00065 00066 printf("Compressed size: %d Uncompressed size: %d\n", comp_len-4, uncomp_len-4); </code></pre> <p>So, my questions are:</p> <p>1) I am feeling a bit dense, so could someone please explain the logic of determining the file size from the 4 bytes as shown in line 64. I understand that the size is probably the addition of a series of powers of 2 up to 2^32, but how are the bitwise operators working on the bytes to get the right number?</p> <p>2) buf_in[5] and buf_in[6] are both negative which might be a problem between OS's as I am on a windows machine and this code was developed apparently on a *nix machine. To me this indicates a bug in the program which has to do with signed and unsigned integers. Am I correct and how do I proceed?</p> <p>3) Is it possible that this code can't handle newer swf files?</p> <p>4) Has anyone recently used this program with success?</p> <p>Thanks for you help in advance.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload