/*tokenizing the strings*/ int parse_string(char *loc,http_request_t *request,http_response_t *response,int newfd) { struct stat st; char *token = malloc(sizeof(char)*SMALL); char s[3] = " ";char *lasts; char *uri; char *method, *httpversion;char temp[] ="HTTP"; method = malloc(sizeof(char)*SMALL); httpversion = malloc(sizeof(char)*SMALL); uri =malloc(sizeof(char)*SMALL); sscanf(loc,"%s %s %s",method,request->uri,httpversion); if(strstr(request->uri,".")== NULL) strcat(request->uri,"index.html"); if(strstr(request->uri,"?")!=NULL) { strtok(request->uri,"?"); } else if(strstr(request->uri,"#")!=NULL) { strtok(request->uri,"#"); } strtok(httpversion,"/"); token =strtok(NULL,"."); request->major_version=atoi(token); token =strtok(NULL,"\r"); request->minor_version=atoi(token); checkget(method,request,response,newfd); return 0; }
int proc_settings_fileencoder(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam) { # define addit(h, a) (SendDlgItemMessage(hwnd, h, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)a)) # define selit(h, n) (SendDlgItemMessage(hwnd, h, CB_SETCURSEL, (WPARAM)n, 0)) # define getsel(h) (SendDlgItemMessage(hwnd, h, CB_GETCURSEL, 0, 0)) # define items_i(x) (sizeof(x) / sizeof((x)[0])) # define checkset(h, s)(CheckDlgButton(hwnd, h, s ? BST_CHECKED : BST_UNCHECKED)) # define checkget(h) (IsDlgButtonChecked(hwnd, h) == BST_CHECKED) switch(uMsg) { case WM_COMMAND: switch(LOWORD(wParam)) { case IDOK: fsettings.plugin_settings_setnum("aac", "bitrate", (int)getsel(combo_bitrate)); fsettings.plugin_settings_setnum("aac", "quality", (int)getsel(combo_quality)); fsettings.plugin_settings_setnum("aac", "mp4", (int)checkget(check_mp4)); case IDCANCEL: EndDialog(hwnd, 0); break; } break; case WM_INITDIALOG: { unsigned int i; int v = 0; for(i = 0; i < items_i(sbitrates); i++) { addit(combo_bitrate, sbitrates[i]); } if(fsettings.plugin_settings_getnum("aac", "bitrate", &v, 0, 0))v = 0xa; selit(combo_bitrate, v); for(i = 0; i < items_i(squalities); i++) { addit(combo_quality, squalities[i]); } if(fsettings.plugin_settings_getnum("aac", "quality", &v, 0, 0))v = 0x2; selit(combo_quality, v); if(fsettings.plugin_settings_getnum("aac", "mp4", &v, 0, 0))v = 0; checkset(check_mp4, v); } break; case WM_DESTROY: EndDialog(hwnd, 0); break; } return 0; }