Skip to content

Commit

Permalink
Fixed usage of string literals with non-const char pointers.
Browse files Browse the repository at this point in the history
Apparently gcc 4.2 starts to warn about that.

--HG--
branch : trunk
  • Loading branch information
icculus committed Apr 3, 2008
1 parent fe72e1e commit 229cb90
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions mojoshader.c
Expand Up @@ -672,10 +672,13 @@ static const char *get_D3D_register_string(Context *ctx,

static char *make_D3D_destarg_string(Context *ctx, const int idx)
{
char *retval = get_scratch_buffer(ctx);
*retval = '\0'; // truncate string to start.

if (idx >= STATICARRAYLEN(ctx->dest_args))
{
fail(ctx, "Too many destination args");
return "";
return retval;
} // if

const DestArgInfo *arg = &ctx->dest_args[idx];
Expand All @@ -702,7 +705,7 @@ static char *make_D3D_destarg_string(Context *ctx, const int idx)
if (regtype_str == NULL)
{
fail(ctx, "Unknown destination register type.");
return "";
return retval;
} // if

char writemask_str[6];
Expand All @@ -719,7 +722,6 @@ static char *make_D3D_destarg_string(Context *ctx, const int idx)
assert(i < sizeof (writemask_str));

// may turn out something like "_x2_sat_pp_centroid r0.xyzw" ...
char *retval = get_scratch_buffer(ctx);
snprintf(retval, SCRATCH_BUFFER_SIZE, "%s%s%s%s %s%s%s",
result_shift_str, sat_str, pp_str, cent_str,
regtype_str, regnum_str, writemask_str);
Expand Down

0 comments on commit 229cb90

Please sign in to comment.