cgicc and 64bit OS

Vyacheslav Ignatyuk <[email protected]> Wed, 27 Oct 2004 17:49:57 +0300
Newsgroups gmane.comp.gcc.cgicc.bugs
Message-ID <[email protected]>
cgicc improperly handles multipart/form-data on 64bit OS.

[ivrom@mars pgml2]$ cat /etc/issue
Fedora Core release 2 (Tettnang)
Kernel \r on an \m

[ivrom@mars pgml2]$ uname -a
Linux mars 2.6.5-1.358 #1 Sat May 8 09:01:26 EDT 2004 x86_64 x86_64 x86_64 
GNU/Linux


Warnings are issued during compilation:

CgiUtils.cpp: In function `std::string cgicc::extractBetween(const
   std::string&, const std::string&, const std::string&)':
CgiUtils.cpp:217: warning: comparison is always true due to limited range of
   data type
CgiUtils.cpp:220: warning: comparison is always true due to limited range of
   data type


Trouble caused by 
std::string cgicc::extractBetween(const std::string&,                     
const std::string&, const std::string&) function.

local variables "start" and "limit" originally have type unsigned int and 
should be changed to the same size type is used by std::string.

So line 
  unsigned int start, limit;
should be replaced with this one
  std::string::size_type start, limit;

This is the simplest way to get gid of this problem.
I didn't check full source tree but IMHO all local counters should not be 
declared  as unsigned int or unsigned long. Better to use size_t or 
std::STL_CONTAINER::sitze_type typedef.

Thanks
Vyacheslav Ignatyuk

PS: Is this good idea to fetch file is being uploaded into memory 
(std::string)? We usually upload huge files so there is a problem. I know 
otherwise we'll got a problem with temporary files but cgicc::Cgicc class 
might provide garbage collection in destructor.
Thanks again