Fixed lots of warning and made code compatible with C89 and ANSI with -pedantic.
[pforth] / csrc / pf_save.c
index f3f9ac0..d46958a 100644 (file)
@@ -213,8 +213,8 @@ PF_FLOAT ReadFloatLittleEndian( const PF_FLOAT *addr )
 /***************************************************************/\r
 void WriteCellBigEndian( uint8_t *addr, ucell_t data )\r
 {\r
 /***************************************************************/\r
 void WriteCellBigEndian( uint8_t *addr, ucell_t data )\r
 {\r
-       // Write should be in order of increasing address\r
-       // to optimize for burst writes to DRAM.\r
+       /* Write should be in order of increasing address \r
+        * to optimize for burst writes to DRAM. */\r
        if( sizeof(ucell_t) == 8 )\r
        {\r
                *addr++ = (uint8_t) (data>>56);\r
        if( sizeof(ucell_t) == 8 )\r
        {\r
                *addr++ = (uint8_t) (data>>56);\r
@@ -247,11 +247,11 @@ void Write16BigEndian( uint8_t *addr, uint16_t data )
 /***************************************************************/\r
 void WriteCellLittleEndian( uint8_t *addr, ucell_t data )\r
 {\r
 /***************************************************************/\r
 void WriteCellLittleEndian( uint8_t *addr, ucell_t data )\r
 {\r
-       // Write should be in order of increasing address\r
-       // to optimize for burst writes to DRAM.\r
+       /* Write should be in order of increasing address \r
+        * to optimize for burst writes to DRAM. */\r
        if( sizeof(ucell_t) == 8 )\r
        {\r
        if( sizeof(ucell_t) == 8 )\r
        {\r
-               *addr++ = (uint8_t) data;  // LSB at near end\r
+               *addr++ = (uint8_t) data;  /* LSB at near end */\r
                data = data >> 8;\r
                *addr++ = (uint8_t) data;\r
                data = data >> 8;\r
                data = data >> 8;\r
                *addr++ = (uint8_t) data;\r
                data = data >> 8;\r
@@ -653,7 +653,7 @@ DBUG(("pfLoadDictionary( %s )\n", FileName ));
                        gCurrentDictionary = dic;\r
                        if( sd->sd_NameSize > 0 )\r
                        {\r
                        gCurrentDictionary = dic;\r
                        if( sd->sd_NameSize > 0 )\r
                        {\r
-                               gVarContext = (char *) NAMEREL_TO_ABS(sd->sd_RelContext); /* Restore context. */\r
+                               gVarContext = NAMEREL_TO_ABS(sd->sd_RelContext); /* Restore context. */\r
                                gCurrentDictionary->dic_HeaderPtr = (ucell_t)(uint8_t *)\r
                                        NAMEREL_TO_ABS(sd->sd_RelHeaderPtr);\r
                        }\r
                                gCurrentDictionary->dic_HeaderPtr = (ucell_t)(uint8_t *)\r
                                        NAMEREL_TO_ABS(sd->sd_RelHeaderPtr);\r
                        }\r
@@ -674,7 +674,7 @@ DBUG(("pfLoadDictionary( %s )\n", FileName ));
                        pfReportError("pfLoadDictionary", PF_ERR_NO_SHELL );\r
                        goto error;\r
 #else\r
                        pfReportError("pfLoadDictionary", PF_ERR_NO_SHELL );\r
                        goto error;\r
 #else\r
-                       if( NAME_BASE == NULL )\r
+                       if( NAME_BASE == 0 )\r
                        {\r
                                pfReportError("pfLoadDictionary", PF_ERR_NO_NAMES );\r
                                goto error;\r
                        {\r
                                pfReportError("pfLoadDictionary", PF_ERR_NO_NAMES );\r
                                goto error;\r
@@ -689,7 +689,7 @@ DBUG(("pfLoadDictionary( %s )\n", FileName ));
                                pfReportError("pfLoadDictionary", PF_ERR_TOO_BIG);\r
                                goto error;\r
                        }\r
                                pfReportError("pfLoadDictionary", PF_ERR_TOO_BIG);\r
                                goto error;\r
                        }\r
-                       numr = sdReadFile( NAME_BASE, 1, ChunkSize, fid );\r
+                       numr = sdReadFile( (char *) NAME_BASE, 1, ChunkSize, fid );\r
                        if( numr != ChunkSize ) goto read_error;\r
                        BytesLeft -= ChunkSize;\r
 #endif /* PF_NO_SHELL */\r
                        if( numr != ChunkSize ) goto read_error;\r
                        BytesLeft -= ChunkSize;\r
 #endif /* PF_NO_SHELL */\r
@@ -706,7 +706,7 @@ DBUG(("pfLoadDictionary( %s )\n", FileName ));
                                pfReportError("pfLoadDictionary", PF_ERR_TOO_BIG);\r
                                goto error;\r
                        }\r
                                pfReportError("pfLoadDictionary", PF_ERR_TOO_BIG);\r
                                goto error;\r
                        }\r
-                       numr = sdReadFile( CODE_BASE, 1, ChunkSize, fid );\r
+                       numr = sdReadFile( (uint8_t *) CODE_BASE, 1, ChunkSize, fid );\r
                        if( numr != ChunkSize ) goto read_error;\r
                        BytesLeft -= ChunkSize;\r
                        break;\r
                        if( numr != ChunkSize ) goto read_error;\r
                        BytesLeft -= ChunkSize;\r
                        break;\r
@@ -720,7 +720,7 @@ DBUG(("pfLoadDictionary( %s )\n", FileName ));
 \r
        sdCloseFile( fid );\r
 \r
 \r
        sdCloseFile( fid );\r
 \r
-       if( NAME_BASE != NULL)\r
+       if( NAME_BASE != 0)\r
        {\r
                cell_t Result;\r
 /* Find special words in dictionary for global XTs. */\r
        {\r
                cell_t Result;\r
 /* Find special words in dictionary for global XTs. */\r
@@ -809,18 +809,18 @@ PForthDictionary pfLoadStaticDictionary( void )
        gCurrentDictionary = dic = pfCreateDictionary( NewNameSize, NewCodeSize );\r
        if( !dic ) goto nomem_error;\r
 \r
        gCurrentDictionary = dic = pfCreateDictionary( NewNameSize, NewCodeSize );\r
        if( !dic ) goto nomem_error;\r
 \r
-       pfCopyMemory( dic->dic_HeaderBase, MinDicNames, sizeof(MinDicNames) );\r
-       pfCopyMemory( dic->dic_CodeBase, MinDicCode, sizeof(MinDicCode) );\r
+       pfCopyMemory( (uint8_t *) dic->dic_HeaderBase, MinDicNames, sizeof(MinDicNames) );\r
+       pfCopyMemory( (uint8_t *) dic->dic_CodeBase, MinDicCode, sizeof(MinDicCode) );\r
        DBUG(("Static data copied to newly allocated dictionaries.\n"));\r
 \r
        dic->dic_CodePtr.Byte = (uint8_t *) CODEREL_TO_ABS(CODEPTR);\r
        gNumPrimitives = NUM_PRIMITIVES;\r
 \r
        DBUG(("Static data copied to newly allocated dictionaries.\n"));\r
 \r
        dic->dic_CodePtr.Byte = (uint8_t *) CODEREL_TO_ABS(CODEPTR);\r
        gNumPrimitives = NUM_PRIMITIVES;\r
 \r
-       if( NAME_BASE != NULL)\r
+       if( NAME_BASE != 0)\r
        {\r
 /* Setup name space. */\r
                dic->dic_HeaderPtr = (ucell_t)(uint8_t *) NAMEREL_TO_ABS(HEADERPTR);\r
        {\r
 /* Setup name space. */\r
                dic->dic_HeaderPtr = (ucell_t)(uint8_t *) NAMEREL_TO_ABS(HEADERPTR);\r
-               gVarContext = (char *) NAMEREL_TO_ABS(RELCONTEXT); /* Restore context. */\r
+               gVarContext = NAMEREL_TO_ABS(RELCONTEXT); /* Restore context. */\r
 \r
 /* Find special words in dictionary for global XTs. */\r
                if( (Result = FindSpecialXTs()) < 0 )\r
 \r
 /* Find special words in dictionary for global XTs. */\r
                if( (Result = FindSpecialXTs()) < 0 )\r