Exemplo n.º 1
0
void ID3V2::parse_comment_frame(FXint framesize) {
  FXString key,field;

  const FXuchar & encoding = buffer[p];
  const FXchar* textstart  = (const FXchar*)(buffer+p+4);
  const FXint   textlength = framesize - 4;

  if (encoding==UTF16_BOM || encoding==UTF16) {
    FXint ksize = strwlen(textstart,textlength);
    FXint vsize = strwlen(textstart+ksize+2,textlength-ksize-2);
    parse_text(encoding,textstart,ksize,key);
    parse_text(encoding,textstart+ksize+2,vsize,field);
    }
  else {
    FXint ksize = strnlen(textstart,textlength);
    FXint vsize = strnlen(textstart+ksize+1,textlength-ksize-1);
    parse_text(encoding,textstart,ksize,key);
    parse_text(encoding,textstart+ksize+1,vsize,field);
    }

  FXString comment = key + " " + field;
  if (comment.find("iTunSMPB")>=0) {
    comment.simplify().scan("iTunSMPB %*x %hx %hx %lx",&padstart,&padend,&length);
    GM_DEBUG_PRINT("[id3v2] found iTunSMPB (padding %d %d, length %ld)\n",padstart,padend,length);
    }
  }
Exemplo n.º 2
0
static void multiboot_parse_mods(multiboot_mod_t *mods, size_t count)
{
    size_t i;
    
    for (i = 0; i < count; ++i)
    {
        multiboot_mod_t * mod = &mods[i];
        
        jg_info_module_t * jgmod = &info_module[info_root->module_count++];
        jgmod->address = mod->start;
        jgmod->length = mod->end - mod->start;
        
        char *name = (char *)(uintptr_t)mod->cmdline;

        size_t name_len = strlen(name);
        size_t name_wlen = strwlen(name);

        char * name_tbl = info_string_alloc(name_wlen);
        memcpy(name_tbl, name, name_wlen);
        
        jgmod->name = ((uintptr_t)name_tbl - (uintptr_t)info_strings);

        puts("\r\n     Module ");
        puts(name_tbl);

        if (name_len > name_wlen)
        {
            char * cmdline_tbl = info_string_alloc(name_len - name_wlen - 1);
            memcpy(cmdline_tbl, name + name_wlen + 1, name_len - name_wlen - 1);
            
            jgmod->cmdline = ((uintptr_t)cmdline_tbl - (uintptr_t)info_strings);

            puts("; CL: ");
            puts(cmdline_tbl);
        }
        else
            jgmod->cmdline = 0xFFFFU;
    }
}