title: Warnings during compilation of some old C++ software (format expects type int, argument has int32)
body: <p>I want to compile some C++ software that one can <a href="http://ftp3.itu.ch/av-arch/video-site/0109_San/VCEG-N80_software.zip" rel="nofollow">download here</a>. It's from 2001. Running <code>make</code> should do the trick.</p>
  
  <p>I'm on Ubuntu 10.10 and I had to change <code>gcc</code> in the makefile to <code>g++</code> for compilation  to work.</p>
  
  <h3>Warnings:</h3>
  
  <p>Now, the program needs to scan a parameter file. When I compile, I receive several warnings:</p>
  
  <pre><code>g++    -c -o packet_data_agent.o packet_data_agent.cpp
  packet_data_agent.cpp: In constructor ‘PACKET_DATA_AGENT::PACKET_DATA_AGENT()’:
  packet_data_agent.cpp:34: warning: deprecated conversion from string constant to ‘char*’
  packet_data_agent.cpp: In member function ‘void PACKET_DATA_AGENT::initialize(FILE*, FILE*)’:
  packet_data_agent.cpp:109: warning: format ‘%d’ expects type ‘int’, but argument 4 has type ‘int32’
  packet_data_agent.cpp:128: warning: format ‘%d’ expects type ‘int*’, but argument 3 has type ‘int32*’
  packet_data_agent.cpp:131: warning: format ‘%d’ expects type ‘int’, but argument 4 has type ‘int32’
  packet_data_agent.cpp:136: warning: format ‘%d’ expects type ‘int’, but argument 4 has type ‘int32’
  packet_data_agent.cpp:141: warning: format ‘%d’ expects type ‘int*’, but argument 3 has type ‘int32*’
  packet_data_agent.cpp:144: warning: format ‘%d’ expects type ‘int’, but argument 4 has type ‘int32’
  packet_data_agent.cpp:149: warning: format ‘%d’ expects type ‘int’, but argument 4 has type ‘int32’
  packet_data_agent.cpp: In member function ‘int32 PACKET_DATA_AGENT::get_PDU(int32, VIRTUAL_PDU*)’:
  packet_data_agent.cpp:213: warning: format ‘%d’ expects type ‘int’, but argument 4 has type ‘int32’
  packet_data_agent.cpp:244: warning: format ‘%d’ expects type ‘int’, but argument 4 has type ‘int32’
  packet_data_agent.cpp: In member function ‘void PACKET_DATA_AGENT::put_PDU(int32, VIRTUAL_PDU*)’:
  packet_data_agent.cpp:312: warning: format ‘%d’ expects type ‘int’, but argument 4 has type ‘int32’
  packet_data_agent.cpp: In member function ‘void PACKET_DATA_AGENT::write_statistics(FILE*)’:
  packet_data_agent.cpp:393: warning: format ‘%10d’ expects type ‘int’, but argument 3 has type ‘int32’
  packet_data_agent.cpp:394: warning: format ‘%10d’ expects type ‘int’, but argument 3 has type ‘int32’
  g++ -O4  mobile_ip.o loss_generator.o radio_link_agent.o packet_data_agent.o -o mobile_ip -lm
  </code></pre>
  
  <h3>My Problem:</h3>
  
  <p>Those lead to the fact that I can't parse the included settings file. In the <code>packet_data_agent.h</code>, the variable is declared as <code>int32</code>:</p>
  
  <pre><code>int32 compressed_Internet_header_size;
  </code></pre>
  
  <p>And the C++ code to scan the parameter file in <code>packet_data_agent.cpp:128</code>:</p>
  
  <pre><code>fscanf(ParameterFile_ptr,"- compressed RTP/UDP/IP header size (in bytes): %d\n",&amp;compressed_Internet_header_size);
  </code></pre>
  
  <p>But when I run the program, I receive the following error:</p>
  
  <pre><code>!!error in module PACKET-DATA-AGENT: illegal value 0 for the compressed RTP/UDP/IP header size
  </code></pre>
  
  <p>Although the parameter file clearly has:</p>
  
  <pre><code>- compressed RTP/UDP/IP header size (in bytes): 3
  </code></pre>
  
  <p>What can I do to make the program correctly parse the parameter file?</p>
  
  <h3>Additional information:</h3>
  
  <ul>
  <li>Size of <code>int</code> on my platform is 4</li>
  </ul>
  
  <p>Here's my g++ version:</p>
  
  <pre><code>$ g++ -v
  Using built-in specs.
  Target: i686-linux-gnu
  Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.4.4-14ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.4 --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
  Thread model: posix
  gcc version 4.4.5 (Ubuntu/Linaro 4.4.4-14ubuntu5) 
  </code></pre>
  
  <h3>Some very simple debugging:</h3>
  
  <p>I changed the source code as follows:</p>
  
  <pre><code>int return_test = fscanf(ParameterFile_ptr,"- compressed RTP/UDP/IP header size (in bytes): %d\n",&amp;compressed_Internet_header_size);
  printf ("%d\n", return_test);
  printf ("%d\n", compressed_Internet_header_size);
  </code></pre>
  
  <p>The output is 0, 0. What could that mean? I mean, seriously, it's right in front of me and it won't find the parameter?</p>