Exemple #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);
    }
  }
Exemple #2
0
// Check for an already-selected filename
static void GetFilenameFromSelection(FXMainWindow*tw,SciDoc*sci, FXString &filename)
{
#ifdef WIN32
  sci->GetSelText(filename);
#else // On X11 platforms, try first to get a filename from the X-Selection
  FXuchar*xsel=NULL;
  FXuint xlen=0;
  FXDragType types[] = { tw->textType, tw->utf8Type, tw->stringType, 0 };
  for ( FXDragType*type=types; *type; type++ ) {
    if (tw->getDNDData(FROM_SELECTION,*type, xsel, xlen) && xsel && *xsel) {
      FXuchar*eol=(FXuchar*)memchr(xsel,'\n', xlen);
      FXuint n = eol ? (eol-xsel) : xlen;
      filename.assign((FXchar*)xsel,n);
      filename=filename.simplify();
      if (!FXStat::exists(filename.contains(':')?filename.section(':',0):filename)) {
        filename=FXString::null;
      }
      break;
    }
    if ( filename.empty() ) { sci->GetSelText(filename); }
  }
#endif
}