comparison music2/koedec.cc @ 53:ddbcbd000206

* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons * ParseMoji moved to TextStream * Some cleaning (0 -> NULL when needed, removal of useless returns, ...)
author thib
date Sun, 19 Apr 2009 11:44:05 +0000
parents 15a18fbe6f21
children 4416cfac86ae
comparison
equal deleted inserted replaced
52:15a18fbe6f21 53:ddbcbd000206
94 AvgKoeInfo info; 94 AvgKoeInfo info;
95 info.stream = NULL; 95 info.stream = NULL;
96 info.length = 0; 96 info.length = 0;
97 info.offset = 0; 97 info.offset = 0;
98 98
99 FileSearcher* file_searcher = FileSearcher::GetInstance();
100
99 list<AvgKoeHead>::iterator it; 101 list<AvgKoeHead>::iterator it;
100 it = find(cache.begin(), cache.end(), file_number); 102 it = find(cache.begin(), cache.end(), file_number);
101 if (it == cache.end()) { 103 if (it == cache.end()) {
102 /* 新たに head を作る */ 104 /* 新たに head を作る */
103 char fname[100]; 105 char fname[100];
104 KoeType type = koe_unknown; 106 KoeType type = koe_unknown;
105 sprintf(fname, "z%03d.koe", file_number); 107 sprintf(fname, "z%03d.koe", file_number);
106 ARCINFO* arcinfo = file_searcher.Find(FILESEARCH::KOE,fname,".koe"); 108 ARCINFO* arcinfo = file_searcher->Find(FileSearcher::KOE,fname,".koe");
107 if (arcinfo == NULL) { 109 if (arcinfo == NULL) {
108 type = koe_nwk; 110 type = koe_nwk;
109 sprintf(fname, "z%04d.nwk", file_number); 111 sprintf(fname, "z%04d.nwk", file_number);
110 arcinfo = file_searcher.Find(FILESEARCH::KOE,fname,".nwk"); 112 arcinfo = file_searcher->Find(FileSearcher::KOE,fname,".nwk");
111 } 113 }
112 if (arcinfo == NULL) { 114 if (arcinfo == NULL) {
113 type = koe_ovk; 115 type = koe_ovk;
114 sprintf(fname, "z%04d.ovk", file_number); 116 sprintf(fname, "z%04d.ovk", file_number);
115 arcinfo = file_searcher.Find(FILESEARCH::KOE,fname,".ovk"); 117 arcinfo = file_searcher->Find(FileSearcher::KOE,fname,".ovk");
116 } 118 }
117 #if HAVE_LIBVORBISFILE || HAVE_LIBVORBISIDEC 119 #if HAVE_LIBVORBISFILE || HAVE_LIBVORBISIDEC
118 if (arcinfo == NULL) { 120 if (arcinfo == NULL) {
119 //FIXME: OMG that's ugly, improve it as soon as you can! 121 //FIXME: OMG that's ugly, improve it as soon as you can!
120 DIRFILE* koedir = (DIRFILE*) file_searcher.MakeARCFILE((FILESEARCH::ARCTYPE)0, "koe"); 122 DIRFILE* koedir = (DIRFILE*) file_searcher->MakeARCFILE((FileSearcher::ARCTYPE)0, "koe");
121 sprintf(fname, "%04d", file_number); 123 sprintf(fname, "%04d", file_number);
122 char* dirname = koedir->SearchFile(fname); 124 char* dirname = koedir->SearchFile(fname);
123 delete koedir; 125 delete koedir;
124 koedir = new DIRFILE(dirname); 126 koedir = new DIRFILE(dirname);
125 delete[] dirname; 127 delete[] dirname;