Shut compiler warnings.
Showing
1 changed file
with
9 additions
and
3 deletions
... | @@ -71,7 +71,7 @@ mh_context_read (mh_context_t *ctx) | ... | @@ -71,7 +71,7 @@ mh_context_read (mh_context_t *ctx) |
71 | fread (blurb, st.st_size, 1, fp); | 71 | fread (blurb, st.st_size, 1, fp); |
72 | fclose (fp); | 72 | fclose (fp); |
73 | 73 | ||
74 | if (status = header_create (&ctx->header, blurb, st.st_size, NULL)) | 74 | if ((status = header_create (&ctx->header, blurb, st.st_size, NULL)) != 0) |
75 | free (blurb); | 75 | free (blurb); |
76 | 76 | ||
77 | return status; | 77 | return status; |
... | @@ -111,14 +111,20 @@ mh_context_write (mh_context_t *ctx) | ... | @@ -111,14 +111,20 @@ mh_context_write (mh_context_t *ctx) |
111 | Instead, it should return a const pointer to the static storage within | 111 | Instead, it should return a const pointer to the static storage within |
112 | the header_t structure and be declared as | 112 | the header_t structure and be declared as |
113 | `const char *mh_context_get_value()'. Current implementation of | 113 | `const char *mh_context_get_value()'. Current implementation of |
114 | header_.* functions does not allow that. */ | 114 | header_.* functions does not allow that. |
115 | |||
116 | This has two drawbacks: | ||
117 | 1) The function is declared as returning char * instead of | ||
118 | intended const char *. | ||
119 | 2) Ugly typecast when returning defval. */ | ||
120 | |||
115 | char * | 121 | char * |
116 | mh_context_get_value (mh_context_t *ctx, const char *name, const char *defval) | 122 | mh_context_get_value (mh_context_t *ctx, const char *name, const char *defval) |
117 | { | 123 | { |
118 | char *p; | 124 | char *p; |
119 | 125 | ||
120 | if (header_aget_value (ctx->header, name, &p)) | 126 | if (header_aget_value (ctx->header, name, &p)) |
121 | p = defval; | 127 | p = (char *) defval; |
122 | return p; | 128 | return p; |
123 | } | 129 | } |
124 | 130 | ... | ... |
-
Please register or sign in to post a comment