Ignore:
Timestamp:
Oct 18, 2011, 9:16:41 PM (14 years ago)
Author:
dmik
Message:

Use const char * for arguments accepting literal strings.

This is more correct and also clears GCC warnings.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/gcc-kmk/src/kernel32/dbglog.cpp

    r21343 r21717  
    9393/* arguments.                                                        */
    9494/* ----------------------------------------------------------------- */
    95 int SYSTEM WriteLog(char *f, ...)
     95int SYSTEM WriteLog(const char *f, ...)
    9696  {
    9797  TIB    *ptib;                    /* process/thread id structures */
     
    305305}
    306306
    307 int SYSTEM WriteLog(char *tekst, ...)
     307int SYSTEM WriteLog(const char *tekst, ...)
    308308{
    309309  USHORT  sel = RestoreOS2FS();
     
    348348        sprintf(szLogFile, "%s%d.log", pszLogBase, loadNr);
    349349        flog = fopen(szLogFile, "w");
    350         if(flog == NULL) 
     350        if(flog == NULL)
    351351        {//probably running exe on readonly device
    352352            sprintf(szLogFile, "%sodin32_%d.log", kernel32Path, loadNr);
     
    385385    if(logSocket == -1) {
    386386#endif
    387     if(teb) 
     387    if(teb)
    388388    {
    389389      ULONG ulCallDepth;
     
    393393      ulCallDepth = 0;
    394394#endif
    395      
     395
    396396      teb->o.odin.logfile = (DWORD)flog;
    397      
     397
    398398#ifdef LOG_TIME
    399399      if(sel == 0x150b && fSwitchTIBSel)
    400         fprintf(flog, 
     400        fprintf(flog,
    401401                "t%02d (%3d): (%x) (FS=150B) ",
    402402                LOWORD(teb->o.odin.threadId),
    403403                ulCallDepth,
    404404                GetTickCount());
    405       else 
    406         fprintf(flog, 
     405      else
     406        fprintf(flog,
    407407                "t%02d (%3d): (%x) ",
    408408                LOWORD(teb->o.odin.threadId),
     
    410410                GetTickCount());
    411411#else
    412       if(sel == 0x150b && fSwitchTIBSel) 
    413         fprintf(flog, 
     412      if(sel == 0x150b && fSwitchTIBSel)
     413        fprintf(flog,
    414414#ifdef SHOW_FPU_CONTROLREG
    415415                "t%02d (%3d)(%3x): ",
     
    422422                ulCallDepth);
    423423#endif
    424       else 
    425         fprintf(flog, 
     424      else
     425        fprintf(flog,
    426426#ifdef SHOW_FPU_CONTROLREG
    427427                "t%02d (%3d)(%3x): ",
     
    450450        int  prefixlen = 0;
    451451
    452         if(teb) 
     452        if(teb)
    453453        {
    454454            ULONG ulCallDepth;
     
    459459#endif
    460460#ifdef LOG_TIME
    461             if(sel == 0x150b && fSwitchTIBSel) 
     461            if(sel == 0x150b && fSwitchTIBSel)
    462462                sprintf(logbuffer, "t%02d (%3d): %x (FS=150B) ",
    463463                        LOWORD(teb->o.odin.threadId), ulCallDepth, GetTickCount());
    464             else 
     464            else
    465465                sprintf(logbuffer, "t%02d (%3d): %x ",
    466466                        LOWORD(teb->o.odin.threadId), ulCallDepth, GetTickCount());
    467467#else
    468             if(sel == 0x150b && fSwitchTIBSel) 
     468            if(sel == 0x150b && fSwitchTIBSel)
    469469                sprintf(logbuffer, "t%02d (%3d): (FS=150B) ",
    470470                        LOWORD(teb->o.odin.threadId), ulCallDepth);
    471             else 
     471            else
    472472                sprintf(logbuffer, "t%02d (%3d): ",
    473473                        LOWORD(teb->o.odin.threadId), ulCallDepth);
     
    497497        if(tekst[strlen(tekst)-1] != '\n')
    498498            fprintf(flog, "\n");
    499 #if 0       
     499#if 0
    500500if (teb && LOWORD(teb->o.odin.threadId) > 1)
    501501{
     
    514514            break;
    515515        }
    516        
     516
    517517        if ((ULONG)pframe < getESP())
    518518        {
     
    554554//******************************************************************************
    555555//******************************************************************************
    556 int SYSTEM WriteLogNoEOL(char *tekst, ...)
     556int SYSTEM WriteLogNoEOL(const char *tekst, ...)
    557557{
    558558  USHORT  sel = RestoreOS2FS();
     
    612612//******************************************************************************
    613613//******************************************************************************
    614 int SYSTEM WritePrivateLog(void *logfile, char *tekst, ...)
     614int SYSTEM WritePrivateLog(void *logfile, const char *tekst, ...)
    615615{
    616616  USHORT  sel = RestoreOS2FS();
Note: See TracChangeset for help on using the changeset viewer.