Skip to content

Commit

Permalink
explicit casts, add includes
Browse files Browse the repository at this point in the history
  • Loading branch information
jpoirier committed Jun 17, 2015
1 parent 97fbbaa commit 011ee0f
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 17 deletions.
1 change: 1 addition & 0 deletions cstdlib/math.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* */
#include <math.h>
#include "../interpreter.h"


Expand Down
1 change: 1 addition & 0 deletions cstdlib/stdbool.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* */
#include <stdbool.h>
#include "../interpreter.h"


Expand Down
6 changes: 3 additions & 3 deletions cstdlib/stdio.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* */

#include <stdio.h>
#include <errno.h>
#include "../interpreter.h"

#define MAX_FORMAT 80
#define MAX_SCANF_ARGS 10
#define MAX_FORMAT (80)
#define MAX_SCANF_ARGS (10)

static int Stdio_ZeroValue = 0;
static int EOFValue = EOF;
Expand Down
1 change: 1 addition & 0 deletions cstdlib/stdlib.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* */
#include <stdlib.h>
#include "../interpreter.h"


Expand Down
5 changes: 3 additions & 2 deletions cstdlib/string.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* */
#include <string.h>
#include "../interpreter.h"


Expand Down Expand Up @@ -176,13 +177,13 @@ void StringStrxfrm(struct ParseState *Parser, struct Value *ReturnValue,
void StringStrdup(struct ParseState *Parser, struct Value *ReturnValue,
struct Value **Param, int NumArgs)
{
ReturnValue->Val->Pointer = strdup(Param[0]->Val->Pointer);
ReturnValue->Val->Pointer = (void*)strdup(Param[0]->Val->Pointer);
}

void StringStrtok_r(struct ParseState *Parser, struct Value *ReturnValue,
struct Value **Param, int NumArgs)
{
ReturnValue->Val->Pointer = strtok_r(Param[0]->Val->Pointer,
ReturnValue->Val->Pointer = (void*)strtok_r(Param[0]->Val->Pointer,
Param[1]->Val->Pointer, Param[2]->Val->Pointer);
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion cstdlib/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void StdStrptime(struct ParseState *Parser, struct Value *ReturnValue,
void StdGmtime_r(struct ParseState *Parser, struct Value *ReturnValue,
struct Value **Param, int NumArgs)
{
ReturnValue->Val->Pointer = gmtime_r(Param[0]->Val->Pointer,
ReturnValue->Val->Pointer = (void*)gmtime_r(Param[0]->Val->Pointer,
Param[1]->Val->Pointer);
}

Expand Down
2 changes: 1 addition & 1 deletion cstdlib/unistd.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ void UnistdGetpagesize(struct ParseState *Parser, struct Value *ReturnValue,
void UnistdGetpass(struct ParseState *Parser, struct Value *ReturnValue,
struct Value **Param, int NumArgs)
{
ReturnValue->Val->Pointer = getpass(Param[0]->Val->Pointer);
ReturnValue->Val->Pointer = (void*)getpass(Param[0]->Val->Pointer);
}

#if 0
Expand Down
2 changes: 1 addition & 1 deletion expression.c
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ void ExpressionPrefixOperator(struct ParseState *Parser,
/* pointer prefix arithmetic */
int Size = TypeSize(TopValue->Typ->FromType, 0, true);
struct Value *StackValue;
void *ResultPtr;
void *ResultPtr = 0;
if (Op != TokenUnaryNot && TopValue->Val->Pointer == NULL)
ProgramFail(Parser, "a. invalid use of a NULL pointer");
if (!TopValue->IsLValue)
Expand Down
14 changes: 7 additions & 7 deletions lex.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ struct ReservedWord {

static struct ReservedWord ReservedWords[] = {
/* wrf, when optimizations are set escaping certain chars is required or they disappear */
{"\#define", TokenHashDefine},
{"\#else", TokenHashElse},
{"\#endif", TokenHashEndif},
{"\#if", TokenHashIf},
{"\#ifdef", TokenHashIfdef},
{"\#ifndef", TokenHashIfndef},
{"\#include", TokenHashInclude},
{"#define", TokenHashDefine},
{"#else", TokenHashElse},
{"#endif", TokenHashEndif},
{"#if", TokenHashIf},
{"#ifdef", TokenHashIfdef},
{"#ifndef", TokenHashIfndef},
{"#include", TokenHashInclude},
{"auto", TokenAutoType},
{"break", TokenBreak},
{"case", TokenCase},
Expand Down
2 changes: 1 addition & 1 deletion picoc.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

/* picoc version number */
#ifdef VER
/* VER is the git hash number, obtained via the Makefile */
/* VER, the git hash number, and TAG are obtained via the Makefile */
#define PICOC_VERSION TAG " r" VER
#else
#define PICOC_VERSION "v2.2"
Expand Down
2 changes: 1 addition & 1 deletion platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
#define ALIGN_TYPE double
#else
/* the default data type to use for alignment */
#define ALIGN_TYPE void *
#define ALIGN_TYPE void*
#endif

#define GLOBAL_TABLE_SIZE (97) /* global variable table */
Expand Down

0 comments on commit 011ee0f

Please sign in to comment.