Ignore:
Timestamp:
Jul 20, 2010, 5:52:49 PM (15 years ago)
Author:
David Azarewicz
Message:

Changes to PCI bus scan, malloc, cleanup all warnings, misc other changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GPL/branches/uniaud32-2.1.x/lib32/debug.c

    r504 r519  
    250250}
    251251
    252 char BuildString[1024];
    253 
    254 #if 0
    255 //------------------------- PrintfOut -
    256 void _cdecl DPD(int level, char *DbgStr, ...)
    257 {
    258    char *BuildPtr=BuildString;
    259    char *pStr=(char *) DbgStr;
    260    char *SubStr;
    261    union {
    262          void   *VoidPtr;
    263          USHORT *WordPtr;
    264          ULONG  *LongPtr;
    265          ULONG  *StringPtr;
    266          } Parm;
    267    USHORT wBuildOption;
    268 
    269    Parm.VoidPtr=(void *) &DbgStr;
    270    Parm.StringPtr++;                            // skip size of string pointer
    271 
    272    while (*pStr)
    273       {
    274       // don't overflow target
    275       if (BuildPtr >= (char *) &BuildString[1024-2])
    276          break;
    277 
    278       switch (*pStr)
    279          {
    280          case '%':
    281             wBuildOption=0;
    282             pStr++;
    283             if (*pStr=='0')
    284                {
    285                wBuildOption|=LEADING_ZEROES;
    286                pStr++;
    287                }
    288             if (*pStr=='u')                                                         // always unsigned
    289                pStr++;
    290             if (*pStr=='#')
    291                pStr++;
    292 
    293             switch(*pStr)
    294                {
    295                case 'x':
    296                case 'X':
    297                case 'p':
    298                case 'P':
    299                   BuildPtr=HexLongToASCII(BuildPtr, *Parm.LongPtr++,wBuildOption);
    300                   pStr++;
    301                   continue;
    302 
    303                case 'd':
    304                   BuildPtr=DecLongToASCII(BuildPtr, *Parm.LongPtr++,wBuildOption);
    305                   pStr++;
    306                   continue;
    307 
    308                case 's':
    309                   SubStr=(char *)*Parm.StringPtr;
    310                   while (*BuildPtr++ = *SubStr++);
    311                   Parm.StringPtr++;
    312                   BuildPtr--;                      // remove the \0
    313                   pStr++;
    314                   continue;
    315 
    316                case 'l':
    317                   pStr++;
    318                   switch (*pStr)
    319                   {
    320                   case 'x':
    321                   case 'X':
    322                   BuildPtr=HexLongToASCII(BuildPtr, *Parm.LongPtr++,wBuildOption);
    323                   pStr++;
    324                   continue;
    325 
    326                   case 'd':
    327                      BuildPtr=DecLongToASCII(BuildPtr, *Parm.LongPtr++,wBuildOption);
    328                      pStr++;
    329                      continue;
    330                   } // end switch
    331                   continue;                        // dunno what he wants
    332 
    333                case 0:
    334                   continue;
    335                } // end switch
    336             break;
    337 
    338       case '\\':
    339          pStr++;
    340          switch (*pStr)
    341             {
    342             case 'n':
    343             *BuildPtr++=LF;
    344             pStr++;
    345             continue;
    346 
    347             case 'r':
    348             *BuildPtr++=CR;
    349             pStr++;
    350             continue;
    351 
    352             case 0:
    353             continue;
    354             break;
    355             } // end switch
    356 
    357          break;
    358          } // end switch
    359 
    360       *BuildPtr++=*pStr++;
    361       } // end while
    362 
    363    *BuildPtr=0;                                 // cauterize the string
    364    StringOut((char *) BuildString);
    365 }
    366 #endif
    367 
    368 void _cdecl DPE(char *DbgStr, ...)
    369 {
    370    char *BuildPtr=BuildString;
    371    char *pStr = (char *) DbgStr;
    372    char *SubStr;
    373    union {
    374          void   *VoidPtr;
    375          USHORT *WordPtr;
    376          ULONG  *LongPtr;
    377          ULONG  *StringPtr;
    378          } Parm;
    379    USHORT wBuildOption;
    380 
    381    Parm.VoidPtr=(void *) &DbgStr;
    382    Parm.StringPtr++;                            // skip size of string pointer
    383 
    384    while (*pStr)
    385       {
    386       // don't overflow target
    387       if (BuildPtr >= (char *) &BuildString[1024-2])
    388          break;
    389 
    390       switch (*pStr)
    391          {
    392          case '%':
    393             wBuildOption=0;
    394             pStr++;
    395             if (*pStr=='0')
    396                {
    397                wBuildOption|=LEADING_ZEROES;
    398                pStr++;
    399                }
    400 //            if (*pStr=='u')                                                         // always unsigned
    401 //               pStr++;
    402 
    403             switch(*pStr)
    404                {
    405                case 'x':
    406                case 'X':
    407                case 'p':
    408                case 'P':
    409                   BuildPtr=HexLongToASCII(BuildPtr, *Parm.LongPtr++,wBuildOption);
    410                   pStr++;
    411                   continue;
    412 
    413                case 'd':
    414                case 'u':
    415                   BuildPtr=DecLongToASCII(BuildPtr, *Parm.LongPtr++,wBuildOption);
    416                   pStr++;
    417                   continue;
    418 
    419                case 's':
    420                   SubStr=(char *)*Parm.StringPtr;
    421                   while (*BuildPtr++ = *SubStr++);
    422                   Parm.StringPtr++;
    423                   BuildPtr--;                      // remove the \0
    424                   pStr++;
    425                   continue;
    426 
    427                case 'c':
    428                   *BuildPtr++ = (char)*Parm.LongPtr;
    429                   Parm.LongPtr++;
    430                   pStr++;
    431                   continue;
    432 
    433                case 'l':
    434                   pStr++;
    435                   switch (*pStr)
    436                   {
    437                   case 'x':
    438                   case 'X':
    439                   BuildPtr=HexLongToASCII(BuildPtr, *Parm.LongPtr++,wBuildOption);
    440                   pStr++;
    441                   continue;
    442 
    443                   case 'd':
    444                      BuildPtr=DecLongToASCII(BuildPtr, *Parm.LongPtr++,wBuildOption);
    445                      pStr++;
    446                      continue;
    447                   } // end switch
    448                   continue;                        // dunno what he wants
    449 
    450                case 0:
    451                   continue;
    452                } // end switch
    453             break;
    454 
    455       case '\\':
    456          pStr++;
    457          switch (*pStr)
    458             {
    459             case 'n':
    460             *BuildPtr++=LF;
    461             pStr++;
    462             continue;
    463 
    464             case 'r':
    465             *BuildPtr++=CR;
    466             pStr++;
    467             continue;
    468 
    469             case 0:
    470             continue;
    471             break;
    472             } // end switch
    473 
    474          break;
    475          } // end switch
    476 
    477       *BuildPtr++=*pStr++;
    478       } // end while
    479 
    480    *BuildPtr=0;                                 // cauterize the string
    481    StringOut((char *) BuildString);
    482 }
    483 
    484252struct snd_info_buffer {
    485253        char *buffer;           /* pointer to begin of buffer */
Note: See TracChangeset for help on using the changeset viewer.