コード例 #1
0
ファイル: Drakes.cpp プロジェクト: justinabrahms/avendar
const Drakes::MapType & Drakes::BuildInfos()
{
    static MapType infos;
    int stoneType;
    Info * info;

    #define ADD_INFO(name, matMod, hpMod, damMod, damType) \
    stoneType = AddInfo(infos, (name), Info((matMod), (hpMod), (damMod), (damType))); \
    info = &infos.find(stoneType)->second

    #define ADD_RESIST(type, modBase, modStep) \
    info->resistances.push_back(ResistInfo((type), (modBase), (modStep)))

    #define ADD_SPECIAL(type, age, amount) \
    info->specials.push_back(SpecialInfo((type), (age), (amount)))

    ADD_INFO("diamond", 40, 40, 0, DAM_PIERCE);
        ADD_RESIST(RESIST_ENERGY, -25, 0);
        ADD_RESIST(RESIST_WEAPON, 10, 5);
        ADD_SPECIAL(Loyal, Hatchling, 25);
        ADD_SPECIAL(Diamondskin, Youngling, 2);
        ADD_SPECIAL(Loyal, Fledgling, 5);
        ADD_SPECIAL(Diamondskin, Wingborne, 1);
        ADD_SPECIAL(Loyal, Greater, 5);
        ADD_SPECIAL(Diamondskin, Elder, 1);
        ADD_SPECIAL(Loyal, Ancient, 5);
        ADD_SPECIAL(Diamondskin, Ancient, 1);

    ADD_INFO("granite", 50, 20, 10, DAM_BASH);
        ADD_RESIST(RESIST_MENTAL, -25, 0);
        ADD_RESIST(RESIST_BASH, 5, 5);
        ADD_SPECIAL(Bash, Hatchling, 1);
        ADD_SPECIAL(Bash, Youngling, 1);
        ADD_SPECIAL(Bash, Fledgling, 1);
        ADD_SPECIAL(Bash, Wingborne, 3);
        ADD_SPECIAL(Ferocious, Greater, 10);
        ADD_SPECIAL(Ferocious, Elder, 20);
        ADD_SPECIAL(Ferocious, Ancient, 30);

    ADD_INFO("quartz", 30, 20, 0, DAM_BASH);
        ADD_RESIST(RESIST_ACID, -25, 0);
        ADD_RESIST(RESIST_ENERGY, 5, 5);
        ADD_RESIST(RESIST_HOLY, 5, 5);
        ADD_RESIST(RESIST_LIGHT, 5, 5);
        ADD_SPECIAL(Overwhelm, Hatchling, 1);
        ADD_SPECIAL(Overwhelm, Youngling, 1);
        ADD_SPECIAL(Overwhelm, Fledgling, 1);
        ADD_SPECIAL(Overwhelm, Wingborne, 1);
        ADD_SPECIAL(Loyal, Wingborne, 10);
        ADD_SPECIAL(Overwhelm, Greater, 1);
        ADD_SPECIAL(Overwhelm, Elder, 1);
        ADD_SPECIAL(Overwhelm, Ancient, 1);

    ADD_INFO("obsidian", 20, -10, 0, DAM_PIERCE);
        ADD_RESIST(RESIST_SOUND, -25, 0);
        ADD_RESIST(RESIST_LIGHT, 0, 10);
        ADD_SPECIAL(Frantic, Youngling, 1);
        ADD_SPECIAL(Frantic, Wingborne, 1);
        ADD_SPECIAL(Frantic, Elder, 1);
        ADD_SPECIAL(Frantic, Ancient, 2);

    
    ADD_INFO("onyx", 20, 0, 0, DAM_BASH);
        ADD_RESIST(RESIST_SLASH, -25, 0);
        ADD_RESIST(RESIST_NEGATIVE, 5, 5);
        ADD_SPECIAL(Stonemend, Hatchling, 1);
        ADD_SPECIAL(Stonemend, Fledgling, 1);
        ADD_SPECIAL(Ambush, Wingborne, 1);
        ADD_SPECIAL(Stonemend, Greater, 1);
        ADD_SPECIAL(Stonemend, Ancient, 1);

    ADD_INFO("marble", 10, 10, 20, DAM_BASH);
        ADD_RESIST(RESIST_MAGIC, -25, 0);
        ADD_RESIST(RESIST_SLASH, 5, 5);
        ADD_SPECIAL(Stonemend, Hatchling, 1);
        ADD_SPECIAL(Stonemend, Youngling, 1);
        ADD_SPECIAL(Stonemend, Fledgling, 2);
        ADD_SPECIAL(Stonemend, Wingborne, 2);
        ADD_SPECIAL(Stonemend, Greater, 3);
        ADD_SPECIAL(Stonemend, Elder, 3);
        ADD_SPECIAL(Stonemend, Ancient, 4);
 
    ADD_INFO("jade", 0, -20, -10, DAM_SLASH);
        ADD_RESIST(RESIST_WEAPON, -25, 0);
        ADD_RESIST(RESIST_MAGIC, 10, 1);
        ADD_SPECIAL(Charge, Youngling, 20);
        ADD_SPECIAL(Charge, Fledgling, 20);
        ADD_SPECIAL(Charge, Wingborne, 20);
        ADD_SPECIAL(Charge, Greater, 20);
        ADD_SPECIAL(Charge, Elder, 20);
        ADD_SPECIAL(Ferocious, Ancient, 25);
 
    ADD_INFO("sapphire", 0, 0, 0, DAM_BASH);
        ADD_RESIST(RESIST_FIRE, -25, 0);
        ADD_RESIST(RESIST_COLD, 5, 5);
        ADD_SPECIAL(Loyal, Hatchling, 50);
        ADD_SPECIAL(Loyal, Youngling, 10);
        ADD_SPECIAL(Loyal, Fledgling, 10);
        ADD_SPECIAL(Loyal, Wingborne, 10);
        ADD_SPECIAL(Overwhelm, Wingborne, 2);
        ADD_SPECIAL(Loyal, Greater, 10);
        ADD_SPECIAL(Loyal, Elder, 10);
        ADD_SPECIAL(Loyal, Ancient, 50);
        ADD_SPECIAL(Overwhelm, Ancient, 1);
 
    ADD_INFO("ruby", 0, 0, 10, DAM_BASH);
        ADD_RESIST(RESIST_COLD, -25, 0);
        ADD_RESIST(RESIST_FIRE, 5, 5);
        ADD_SPECIAL(Vicious, Hatchling, 1);
        ADD_SPECIAL(Vicious, Youngling, 1);
        ADD_SPECIAL(Vicious, Fledgling, 2);
        ADD_SPECIAL(Vicious, Wingborne, 2);
        ADD_SPECIAL(Vicious, Greater, 3);
        ADD_SPECIAL(Vicious, Elder, 3);
        ADD_SPECIAL(Vicious, Ancient, 4);
 
    ADD_INFO("amethyst", 0, 10, -10, DAM_PIERCE);
        ADD_RESIST(RESIST_HOLY, -25, 0);
        ADD_RESIST(RESIST_NEGATIVE, 10, 2);
        ADD_SPECIAL(Defender, Hatchling, 10);
        ADD_SPECIAL(Ferocious, Youngling, 10);
        ADD_SPECIAL(Defender, Fledgling, 10);
        ADD_SPECIAL(Ferocious, Wingborne, 10);
        ADD_SPECIAL(Defender, Greater, 10);
        ADD_SPECIAL(Ferocious, Elder, 10);
        ADD_SPECIAL(Defender, Ancient, 10);
        ADD_SPECIAL(Ferocious, Ancient, 10);
 
    ADD_INFO("emerald", 0, 0, 0, DAM_BASH);
        ADD_RESIST(RESIST_WEAPON, 5, 1);
        ADD_RESIST(RESIST_MAGIC, 5, 1);
        ADD_SPECIAL(Loyal, Hatchling, 25);
        ADD_SPECIAL(Sunderer, Youngling, 5);
        ADD_SPECIAL(Sunderer, Fledgling, 10);
        ADD_SPECIAL(Sunderer, Wingborne, 15);
        ADD_SPECIAL(Sunderer, Greater, 20);
        ADD_SPECIAL(Sunderer, Elder, 25);
        ADD_SPECIAL(Sunderer, Ancient, 25);
 
    ADD_INFO("topaz", -10, 10, 0, DAM_BASH);
        ADD_RESIST(RESIST_LIGHTNING, -25, 0);
        ADD_RESIST(RESIST_WEAPON, 10, 0);
        ADD_SPECIAL(Loyal, Hatchling, 10);
        ADD_SPECIAL(Ferocious, Youngling, 20);
        ADD_SPECIAL(Ferocious, Fledgling, 20);
        ADD_SPECIAL(Ferocious, Wingborne, 20);
        ADD_SPECIAL(Ferocious, Greater, 20);
        ADD_SPECIAL(Ferocious, Elder, 20);
        ADD_SPECIAL(Overwhelm, Ancient, 1);
 
    ADD_INFO("opal", -10, -10, 0, DAM_BASH);
        ADD_RESIST(RESIST_NEGATIVE, -25, 0);
        ADD_RESIST(RESIST_ILLUSION, 30, 0);
        ADD_SPECIAL(Bash, Hatchling, 1);
        ADD_SPECIAL(Vicious, Youngling, 1);
        ADD_SPECIAL(Loyal, Fledgling, 10);
        ADD_SPECIAL(Overwhelm, Wingborne, 1);
        ADD_SPECIAL(Ferocious, Greater, 25);
        ADD_SPECIAL(Stonemend, Elder, 2);
        ADD_SPECIAL(Biting, Ancient, 2);
 
    ADD_INFO("bloodstone", -20, -40, 25, DAM_BASH);
        ADD_RESIST(RESIST_POISON, -25, 0);
        ADD_RESIST(RESIST_FIRE, -25, 0);
        ADD_SPECIAL(Biting, Hatchling, 2);
        ADD_SPECIAL(Biting, Youngling, 1);
        ADD_SPECIAL(Biting, Fledgling, 1);
        ADD_SPECIAL(Biting, Wingborne, 2);
        ADD_SPECIAL(Biting, Greater, 1);
        ADD_SPECIAL(Biting, Elder, 1);
        ADD_SPECIAL(Biting, Ancient, 2);
 
    ADD_INFO("aquamarine", -20, 0, 0, DAM_BASH);
        ADD_RESIST(RESIST_LIGHT, -25, 0);
        ADD_RESIST(RESIST_DROWNING, 50, 0);
        ADD_SPECIAL(Attentive, Hatchling, 1);
        ADD_SPECIAL(Attentive, Youngling, 2);
        ADD_SPECIAL(Attentive, Fledgling, 1);
        ADD_SPECIAL(Attentive, Wingborne, 2);
        ADD_SPECIAL(Attentive, Greater, 1);
        ADD_SPECIAL(Attentive, Elder, 2);
        ADD_SPECIAL(Attentive, Ancient, 3);
 
    ADD_INFO("shale", -30, 0, -20, DAM_SLASH);
        ADD_RESIST(RESIST_PIERCE, -25, 0);
        ADD_RESIST(RESIST_SLASH, 25, 0);
        ADD_SPECIAL(Defender, Youngling, 10);
        ADD_SPECIAL(Defender, Fledgling, 10);
        ADD_SPECIAL(Defender, Wingborne, 20);
        ADD_SPECIAL(Defender, Greater, 20);
        ADD_SPECIAL(Defender, Elder, 20);
        ADD_SPECIAL(Defender, Ancient, 20);
 
    ADD_INFO("sandstone", -40, -30, -10, DAM_SLASH);
        ADD_RESIST(RESIST_BASH, 25, 0);
        ADD_RESIST(RESIST_PIERCE, 5, 5);
        ADD_SPECIAL(Sandman, Hatchling, 2);
        ADD_SPECIAL(Sandman, Youngling, 1);
        ADD_SPECIAL(Sandman, Fledgling, 1);
        ADD_SPECIAL(Sandman, Wingborne, 2);
        ADD_SPECIAL(Sandman, Greater, 1);
        ADD_SPECIAL(Sandman, Elder, 1);
        ADD_SPECIAL(Sandman, Ancient, 2);
 
    #undef ADD_SPECIAL
    #undef ADD_RESIST
    #undef ADD_INFO

    return infos;
}
コード例 #2
0
ファイル: podcast.c プロジェクト: mstorsjo/vlc
/* "specs" : http://phobos.apple.com/static/iTunesRSS.html */
static int ReadDir( stream_t *p_demux, input_item_node_t *p_subitems )
{
    bool b_item = false;
    bool b_image = false;

    xml_reader_t *p_xml_reader;
    char *psz_elname = NULL;
    char *psz_item_mrl = NULL;
    char *psz_item_size = NULL;
    char *psz_item_type = NULL;
    char *psz_item_name = NULL;
    char *psz_item_date = NULL;
    char *psz_item_author = NULL;
    char *psz_item_category = NULL;
    char *psz_item_duration = NULL;
    char *psz_item_keywords = NULL;
    char *psz_item_subtitle = NULL;
    char *psz_item_summary = NULL;
    char *psz_art_url = NULL;
    const char *node;
    int i_type;
    input_item_t *p_input;

    input_item_t *p_current_input = GetCurrentItem(p_demux);

    p_xml_reader = xml_ReaderCreate( p_demux, p_demux->s );
    if( !p_xml_reader )
        goto error;

    /* xml */
    /* check root node */
    if( xml_ReaderNextNode( p_xml_reader, &node ) != XML_READER_STARTELEM )
    {
        msg_Err( p_demux, "invalid file (no root node)" );
        goto error;
    }

    if( strcmp( node, "rss" ) )
    {
        msg_Err( p_demux, "invalid root node <%s>", node );
        goto error;
    }

    while( (i_type = xml_ReaderNextNode( p_xml_reader, &node )) > 0 )
    {
        switch( i_type )
        {
            case XML_READER_STARTELEM:
            {
                free( psz_elname );
                psz_elname = strdup( node );
                if( unlikely(!psz_elname) )
                    goto error;

                if( !strcmp( node, "item" ) )
                    b_item = true;
                else if( !strcmp( node, "image" ) )
                    b_image = true;

                // Read the attributes
                const char *attr, *value;
                while( (attr = xml_ReaderNextAttr( p_xml_reader, &value )) )
                {
                    if( !strcmp( node, "enclosure" ) )
                    {
                        char **p = NULL;
                        if( !strcmp( attr, "url" ) )
                            p = &psz_item_mrl;
                        else if( !strcmp( attr, "length" ) )
                            p = &psz_item_size;
                        else if( !strcmp( attr, "type" ) )
                            p = &psz_item_type;
                        if( p != NULL )
                        {
                            free( *p );
                            *p = strdup( value );
                        }
                        else
                            msg_Dbg( p_demux,"unhandled attribute %s in <%s>",
                                     attr, node );
                    }
                    else
                        msg_Dbg( p_demux,"unhandled attribute %s in <%s>",
                                 attr, node );
                }
                break;
            }

            case XML_READER_TEXT:
            {
                if(!psz_elname) break;

                /* item specific meta data */
                if( b_item )
                {
                    char **p;

                    if( !strcmp( psz_elname, "title" ) )
                        p = &psz_item_name;
                    else if( !strcmp( psz_elname, "itunes:author" ) ||
                             !strcmp( psz_elname, "author" ) )
                        /* <author> isn't standard iTunes podcast stuff */
                        p = &psz_item_author;
                    else if( !strcmp( psz_elname, "itunes:summary" ) ||
                             !strcmp( psz_elname, "description" ) )
                        /* <description> isn't standard iTunes podcast stuff */
                        p = &psz_item_summary;
                    else if( !strcmp( psz_elname, "pubDate" ) )
                        p = &psz_item_date;
                    else if( !strcmp( psz_elname, "itunes:category" ) )
                        p = &psz_item_category;
                    else if( !strcmp( psz_elname, "itunes:duration" ) )
                        p = &psz_item_duration;
                    else if( !strcmp( psz_elname, "itunes:keywords" ) )
                        p = &psz_item_keywords;
                    else if( !strcmp( psz_elname, "itunes:subtitle" ) )
                        p = &psz_item_subtitle;
                    else
                        break;

                    free( *p );
                    *p = strdup( node );
                }
                /* toplevel meta data */
                else if( !b_image )
                {
                    if( !strcmp( psz_elname, "title" ) )
                        input_item_SetName( p_current_input, node );
#define ADD_GINFO( info, name ) \
    else if( !strcmp( psz_elname, name ) ) \
        input_item_AddInfo( p_current_input, _("Podcast Info"), \
                            info, "%s", node );
                    ADD_GINFO( _("Podcast Link"), "link" )
                    ADD_GINFO( _("Podcast Copyright"), "copyright" )
                    ADD_GINFO( _("Podcast Category"), "itunes:category" )
                    ADD_GINFO( _("Podcast Keywords"), "itunes:keywords" )
                    ADD_GINFO( _("Podcast Subtitle"), "itunes:subtitle" )
#undef ADD_GINFO
                    else if( !strcmp( psz_elname, "itunes:summary" ) ||
                             !strcmp( psz_elname, "description" ) )
                    { /* <description> isn't standard iTunes podcast stuff */
                        input_item_AddInfo( p_current_input,
                            _( "Podcast Info" ), _( "Podcast Summary" ),
                            "%s", node );
                    }
                }
                else
                {
                    if( !strcmp( psz_elname, "url" ) && *node )
                    {
                        free( psz_art_url );
                        psz_art_url = strdup( node );
                    }
                    else
                        msg_Dbg( p_demux, "unhandled text in element <%s>",
                                 psz_elname );
                }
                break;
            }

            // End element
            case XML_READER_ENDELEM:
            {
                FREENULL( psz_elname );

                if( !strcmp( node, "item" ) )
                {
                    if( psz_item_mrl == NULL )
                    {
                        if (psz_item_name)
                            msg_Warn( p_demux, "invalid XML item, skipping %s",
                                      psz_item_name );
                        else
                            msg_Warn( p_demux, "invalid XML item, skipped" );
                        FREENULL( psz_item_name );
                        FREENULL( psz_item_size );
                        FREENULL( psz_item_type );
                        FREENULL( psz_item_date );
                        FREENULL( psz_item_author );
                        FREENULL( psz_item_category );
                        FREENULL( psz_item_duration );
                        FREENULL( psz_item_keywords );
                        FREENULL( psz_item_subtitle );
                        FREENULL( psz_item_summary );
                        FREENULL( psz_art_url );
                        FREENULL( psz_elname );
                        continue;
                    }

                    vlc_xml_decode( psz_item_mrl );
                    vlc_xml_decode( psz_item_name );
                    p_input = input_item_New( psz_item_mrl, psz_item_name );
                    FREENULL( psz_item_mrl );
                    FREENULL( psz_item_name );

                    if( p_input == NULL )
                        break; /* FIXME: meta data memory leaks? */

                    /* Set the duration if available */
                    if( psz_item_duration )
                        p_input->i_duration = strTimeToMTime( psz_item_duration );

#define ADD_INFO( info, field ) \
    if( field ) { \
        input_item_AddInfo( p_input, _( "Podcast Info" ), (info), "%s", \
                            (field) ); \
        FREENULL( field ); }
                    ADD_INFO( _("Podcast Publication Date"), psz_item_date  );
                    ADD_INFO( _("Podcast Author"), psz_item_author );
                    ADD_INFO( _("Podcast Subcategory"), psz_item_category );
                    ADD_INFO( _("Podcast Duration"), psz_item_duration );
                    ADD_INFO( _("Podcast Keywords"), psz_item_keywords );
                    ADD_INFO( _("Podcast Subtitle"), psz_item_subtitle );
                    ADD_INFO( _("Podcast Summary"), psz_item_summary );
                    ADD_INFO( _("Podcast Type"), psz_item_type );
#undef ADD_INFO

                    /* Add the global art url to this item, if any */
                    if( psz_art_url )
                    {
                        vlc_xml_decode( psz_art_url );
                        input_item_SetArtURL( p_input, psz_art_url );
                    }

                    if( psz_item_size )
                    {
                        input_item_AddInfo( p_input,
                                                _( "Podcast Info" ),
                                                _( "Podcast Size" ),
                                                _("%s bytes"),
                                                psz_item_size );
                        FREENULL( psz_item_size );
                    }
                    input_item_node_AppendItem( p_subitems, p_input );
                    input_item_Release( p_input );
                    b_item = false;
                }
                else if( !strcmp( node, "image" ) )
                {
                    b_image = false;
                }
                break;
            }
        }
    }
コード例 #3
0
ファイル: font.c プロジェクト: GunioRobot/starruby
void
strb_InitializeSdlFont(void)
{
  if (TTF_Init()) {
    rb_raise_sdl_ttf_error();
  }
  fontFileInfos = ALLOC(FontFileInfo);
  fontFileInfos->rbFontNameSymbol = Qundef;
  fontFileInfos->rbFileNameSymbol = Qundef;
  fontFileInfos->ttcIndex         = -1;
  fontFileInfos->next             = NULL;
  FontFileInfo* currentInfo = fontFileInfos;
  (void)currentInfo;

#ifdef WIN32
  HKEY hKey;
  TCHAR* regPath =
    _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts");
  if (SUCCEEDED(RegOpenKeyEx(HKEY_LOCAL_MACHINE, regPath, 0,
                             KEY_READ, &hKey))) {
    DWORD fontNameBuffMaxLength;
    DWORD fileNameBuffMaxByteLength;
    RegQueryInfoKey(hKey, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                    &fontNameBuffMaxLength, &fileNameBuffMaxByteLength,
                    NULL, NULL);
    TCHAR fontNameBuff[fontNameBuffMaxLength + 1];
    BYTE fileNameByteBuff[fileNameBuffMaxByteLength];
    for (DWORD dwIndex = 0; ;dwIndex++) {
      ZeroMemory(fontNameBuff, sizeof(fontNameBuff));
      ZeroMemory(fileNameByteBuff, sizeof(fileNameByteBuff));
      DWORD fontNameBuffLength = sizeof(fontNameBuff) / sizeof(TCHAR);
      DWORD fileNameBuffByteLength = fileNameBuffMaxByteLength;
      LONG result = RegEnumValue(hKey, dwIndex,
                                 fontNameBuff, &fontNameBuffLength,
                                 NULL, NULL,
                                 fileNameByteBuff, &fileNameBuffByteLength);
      TCHAR* fileNameBuff = (TCHAR*)fileNameByteBuff;
      DWORD fileNameBuffLength = _tcslen(fileNameBuff);
      if (result == ERROR_SUCCESS) {
        const TCHAR* ext = &(fileNameBuff[fileNameBuffLength - 3]);
        if (tolower(ext[0]) == _T('t') &&
            tolower(ext[1]) == _T('t') &&
            (tolower(ext[2]) == _T('f') ||
             tolower(ext[2]) == _T('c'))) {
          TCHAR* fontName = fontNameBuff;
          const TCHAR* fileName = fileNameBuff;
          // A TTF font name must end with ' (TrueType)'.
          fontName[fontNameBuffLength - 11] = _T('\0');
          for (int i = fileNameBuffLength - 1; 0 <= i; i--) {
            if (fileName[i] == _T('\\')) {
              fileName += i + 1;
              break;
            }
          }
          int length =
            WideCharToMultiByte(CP_UTF8, 0,
                                fontName, -1,
                                NULL, 0,
                                NULL, NULL);
          char fontNameUTF8[length];
          WideCharToMultiByte(CP_UTF8, 0,
                              fontName, -1,
                              fontNameUTF8, length,
                              NULL, NULL);
          volatile VALUE rbFontName = rb_str_new2(fontNameUTF8);
          length =
            WideCharToMultiByte(CP_ACP, 0,
                                fileName, -1,
                                NULL, 0,
                                NULL, NULL);
          char fileNameANSI[length];
          WideCharToMultiByte(CP_ACP, 0,
                              fileName, -1,
                              fileNameANSI, length,
                              NULL, NULL);
          volatile VALUE rbFileName = rb_str_new2(fileNameANSI);
          if (strchr(StringValueCStr(rbFontName), '&')) {
            volatile VALUE rbArr = rb_str_split(rbFontName, "&");
            const int arrLength = RARRAY_LEN(rbArr);
            int ttcIndex = 0;
            for (int i = 0; i < arrLength; i++) {
              volatile VALUE rbFontName = rb_ary_entry(rbArr, i);
              rb_funcall(rbFontName, rb_intern("strip!"), 0);
              if (0 < RSTRING_LEN(rbFontName)) {
                volatile VALUE rbFontNameSymbol = rb_str_intern(rbFontName);
                volatile VALUE rbFileNameSymbol = rb_str_intern(rbFileName);
                ADD_INFO(currentInfo, rbFontNameSymbol, rbFileNameSymbol,
                         ttcIndex);
                ttcIndex++;
              }
            }
          } else {
            volatile VALUE rbFontNameSymbol = rb_str_intern(rbFontName);
            volatile VALUE rbFileNameSymbol = rb_str_intern(rbFileName);
            ADD_INFO(currentInfo, rbFontNameSymbol, rbFileNameSymbol, -1);
          }
        }
      } else {
        break;
      }
    }
    RegCloseKey(hKey);
  } else {
    rb_raise(strb_GetStarRubyErrorClass(),
             "Win32API error: %d", (int)GetLastError());
  }
  TCHAR szWindowsFontDirPath[MAX_PATH + 1];
  if (FAILED(SHGetFolderPath(NULL, CSIDL_FONTS, NULL,
                             SHGFP_TYPE_CURRENT,
                             szWindowsFontDirPath))) {
    rb_raise(strb_GetStarRubyErrorClass(),
             "Win32API error: %d", (int)GetLastError());
  }
  int length =
    WideCharToMultiByte(CP_UTF8, 0,
                        szWindowsFontDirPath, -1,
                        NULL, 0,
                        NULL, NULL);
  char szWindowsFontDirPathUTF8[length];
  WideCharToMultiByte(CP_UTF8, 0,
                      szWindowsFontDirPath, -1,
                      szWindowsFontDirPathUTF8, length,
                      NULL, NULL);
  volatile VALUE rbWindowsFontDirPath = rb_str_new2(szWindowsFontDirPathUTF8);
  rbWindowsFontDirPathSymbol = rb_str_intern(rbWindowsFontDirPath);
#endif
}