cURL / Mailing Lists / curl-library / Single Mail

curl-library

compile warning in formdata.c

From: Daniel Steinberg <daniel_at_instantharmony.com>
Date: Mon, 8 Jun 2009 15:33:22 -0700

In my compile environment, most warnings are treated as errors. In
lib/formdata.c, gcc was complaining about readfromfile() calling
form->fread_func when that field might not be initialized, eg when
called from curl_formget() which does:

      struct Form temp;
      Curl_FormInit(&temp, ptr);
      do {
        nread = readfromfile(&temp, buffer, sizeof(buffer));

The solution (ie, to quiet the compiler warning) is to add this line
to Curl_FormInit() (formdata.c, line 1428):
       form->fread_func = NULL;

Just a friendly suggestion....

-daniel
Received on 2009-06-09