예제 #1
0
파일: nls.cpp 프로젝트: ErisBlastar/osfree
STATIC VOID InitUpperMap(VOID)
{
    ULONG ul;
    COUNTRYCODE cc;
    BOOL fDBCS = nlsDBCS();

    for (ul = 0;
         ul < 256;
         ++ul)
    {
        G_szUpperMap[ul] = (CHAR)ul;

        if (    (fDBCS)
             && (G_afLeadByte[ul] != TYPE_SBCS)
           )
            G_szUpperMap[ul] = ' ';
    }

    G_szUpperMap[256] = '\0';

    cc.country = 0;         // use system country code
    cc.codepage = 0;        // use process default codepage
    DosMapCase(255,
               &cc,
               G_szUpperMap + 1);

    G_fUpperMapInited = TRUE;
}
예제 #2
0
int main(VOID) {



COUNTRYCODE Country       = {0};        /* Country code  */

CHAR        uchString[80] = "";         /* String        */

APIRET      rc            = 0;          /* Return code   */



   Country.country  = COUNTRY_CODE;     /* Country code  */



   Country.codepage = NLS_CODEPAGE;     /* Code page     */



   strcpy(uchString, "Capitalize this entire sTrInG, please!");



   printf("Original string is:  %s\n", uchString);



   rc = DosMapCase(sizeof(uchString),   /* Length of string to convert */

                   &Country,            /* Country and code page info  */

                   uchString);          /* String to convert           */



   if (rc != NO_ERROR) {

      printf("DosMapCase error: return code = %u\n", rc);

      return 1;

   } else {

      printf("Converted string is: %s\n", uchString);

   } /* endif */



   return NO_ERROR;

}
예제 #3
0
ULONG       FileGetFormat( char * szFilename)

{
    ULONG       ulRtn = PTP_OFC_Undefined;
    char *      ptr;
    COUNTRYCODE cc = {0,0};
    union CAMJEXT {
                    char    ch[4];
                    ULONG   ul;
                  } ext;

    ptr = strrchr( szFilename, '.');
    if (!ptr)
        return (ulRtn);

    ptr++;
    strncpy( ext.ch, ptr, 4);
    DosMapCase( 4, &cc, ext.ch);

    switch (ext.ul) {

        case MAKE4CC('J','P','G','\0'):
        case MAKE4CC('T','H','M','\0'):
        case MAKE4CC('J','P','E','G'):
            ulRtn = PTP_OFC_JFIF;
            break;

        case MAKE4CC('A','V','I','\0'):
            ulRtn = PTP_OFC_AVI;
            break;

        case MAKE4CC('M','O','V','\0'):
            ulRtn = PTP_OFC_QT;
            break;

        case MAKE4CC('M','P','G','\0'):
        case MAKE4CC('M','P','E','G'):
            ulRtn = PTP_OFC_MPEG;
            break;

        case MAKE4CC('A','S','F','\0'):
            ulRtn = PTP_OFC_ASF;
            break;

        case MAKE4CC('W','A','V','\0'):
            ulRtn = PTP_OFC_WAV;
            break;

        case MAKE4CC('M','P','3','\0'):
            ulRtn = PTP_OFC_MP3;
            break;

        case MAKE4CC('A','I','F','\0'):
        case MAKE4CC('A','I','F','F'):
            ulRtn = PTP_OFC_AIFF;
            break;

        case MAKE4CC('M','R','K','\0'):
            ulRtn = PTP_OFC_DPOF;
            break;

        case MAKE4CC('T','X','T','\0'):
            ulRtn = PTP_OFC_Text;
            break;

        case MAKE4CC('H','T','M','\0'):
        case MAKE4CC('H','T','M','L'):
            ulRtn = PTP_OFC_HTML;
            break;

        case MAKE4CC('T','I','F','\0'):
        case MAKE4CC('T','I','F','F'):
        case MAKE4CC('R','A','W','\0'):
            ulRtn = PTP_OFC_TIFF;
            break;

        case MAKE4CC('B','M','P','\0'):
            ulRtn = PTP_OFC_BMP;
            break;

        case MAKE4CC('G','I','F','\0'):
            ulRtn = PTP_OFC_GIF;
            break;

        case MAKE4CC('P','N','G','\0'):
            ulRtn = PTP_OFC_PNG;
            break;

        case MAKE4CC('F','P','X','\0'):
            ulRtn = PTP_OFC_FlashPix;
            break;

        case MAKE4CC('J','P','2','\0'):
            ulRtn = PTP_OFC_JP2;
            break;

        case MAKE4CC('J','P','X','\0'):
            ulRtn = PTP_OFC_JPX;
            break;

        case MAKE4CC('C','R','W','\0'):     // Canon    .CRW
        case MAKE4CC('C','R','2','\0'):     // Canon    .CR2
        case MAKE4CC('N','E','F','\0'):     // Nikon    .NEF
        case MAKE4CC('O','R','F','\0'):     // Olympus  .ORF
        case MAKE4CC('P','E','F','\0'):     // Pentax   .PEF
        case MAKE4CC('D','C','R','\0'):     // Kodak    .DCR
        case MAKE4CC('K','D','C','\0'):     // Kodak    .KDC
        case MAKE4CC('S','R','F','\0'):     // Sony     .SRF
        case MAKE4CC('M','R','W','\0'):     // Minolta  .MRW
        case MAKE4CC('R','A','F','\0'):     // Fuji     .RAF
        case MAKE4CC('D','N','G','\0'):     // Adobe    .DNG
            ulRtn = PTP_OFC_CAMRAW;
            break;
    }

    return (ulRtn);
}