Changeset 91 for branches/v2.9_Lars/mediafolder/c
- Timestamp:
- Oct 1, 2023, 4:30:02 PM (23 months ago)
- Location:
- branches/v2.9_Lars
- Files:
-
- 5 edited
- 11 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/v2.9_Lars
- Property svn:mergeinfo changed
/branches/v2.9 (added) merged: 7-39
- Property svn:mergeinfo changed
-
branches/v2.9_Lars/mediafolder/c/cddb/cddb.cpp
r40 r91 88 88 delete(tempTrack); 89 89 } 90 90 91 91 if(nextCddb)delete nextCddb; 92 92 … … 129 129 if(tempTrack) { 130 130 /* Yes, add the rest of the title to that what we already have */ 131 strncat(tempTrack->trackname, track->trackname, sizeof(tempTrack->trackname)-strlen(tempTrack->trackname)-1); 131 strncat(tempTrack->trackname, track->trackname, sizeof(tempTrack->trackname)-strlen(tempTrack->trackname)-1); 132 132 delete(track); 133 133 return; … … 136 136 tempTrack=firstTrack; 137 137 while(tempTrack->nextTrack) { 138 tempTrack=tempTrack->nextTrack; 138 tempTrack=tempTrack->nextTrack; 139 139 } 140 140 tempTrack->nextTrack=track; 141 return; 141 return; 142 142 } 143 143 … … 152 152 return tempTrack; 153 153 154 tempTrack=tempTrack->nextTrack; 154 tempTrack=tempTrack->nextTrack; 155 155 } 156 156 … … 169 169 170 170 #if 0 171 /* now defined in printHelper.cpp 171 /* now defined in printHelper.cpp 172 172 or cddbhelper.cpp. By choosing the right module to link to, it's possible 173 173 to redirect the messages without changing this module. Used for different … … 191 191 fileHandle=open("cddb.out",O_APPEND|O_TEXT|O_WRONLY); 192 192 if(fileHandle==-1) { 193 printError( "Cannot open cddb.out");193 printError((char *)"Cannot open cddb.out"); 194 194 return; 195 195 } … … 205 205 206 206 int readResponse(int s, char * buffer,int size) 207 { 207 { 208 208 int a; 209 209 int rc; 210 210 211 211 rc=1; 212 212 for(a=0;a<size&&rc>0;a++) { … … 217 217 } 218 218 if(rc==-1) 219 return CDDB_ERROR; 220 } 221 219 return CDDB_ERROR; 220 } 221 222 222 return CDDB_ERROR; 223 223 } … … 237 237 case '3': return CDDB_MORE; 238 238 case '4': 239 printError( "CDDB server error");239 printError((char *)"CDDB server error"); 240 240 return CDDB_ERROR; 241 241 case '5': 242 printError( "CDDB client error");242 printError((char *)"CDDB client error"); 243 243 return CDDB_ERROR; 244 244 default: 245 printError( "Unknown error");245 printError((char *)"Unknown error"); 246 246 break; 247 247 } … … 258 258 /* Handshaking */ 259 259 if(verbose) 260 printError( "Handshaking... ");260 printError((char *)"Handshaking... "); 261 261 sprintf(buffer,"cddb hello %s %s %s %s\n",username,hostname,clientname,version); 262 if(verbose==2) 262 if(verbose==2) 263 263 printError(buffer); 264 264 rc=write(s,buffer,strlen(buffer)); 265 265 if(rc==-1) { 266 printError( "Handshaking: cannot write to CDDB server");267 return -1; 268 } 269 if(verbose) 270 printError( "done\n");271 if(verbose==2) 272 printError( "Response: ");273 266 printError((char *)"Handshaking: cannot write to CDDB server"); 267 return -1; 268 } 269 if(verbose) 270 printError((char *)"done\n"); 271 if(verbose==2) 272 printError((char *)"Response: "); 273 274 274 rc=readResponse(s,buffer,sizeof(buffer)); 275 275 if(rc==CDDB_ERROR) { 276 printError( "Handshaking: cannot get response");277 return -1; 278 } 279 if(verbose==2) 276 printError((char *)"Handshaking: cannot get response"); 277 return -1; 278 } 279 if(verbose==2) 280 280 printErrorCR(buffer); 281 281 282 282 if(check_cddb_code(buffer)==CDDB_ERROR) 283 283 return -1; … … 297 297 do { 298 298 if(verbose) 299 printError( "\nSetting protocol level... ");299 printError((char *)"\nSetting protocol level... "); 300 300 sprintf(buffer,"proto %d\n",iProtLevel); 301 301 printError(buffer); 302 302 rc=write(s,buffer,strlen(buffer)); 303 303 if(rc==-1) { 304 printError( "Protocol: cannot write to CDDB server");304 printError((char *)"Protocol: cannot write to CDDB server"); 305 305 return -1; 306 306 } 307 307 if(verbose) 308 printError( "done\n");308 printError((char *)"done\n"); 309 309 if(verbose==2) 310 printError( "Response: ");311 310 printError((char *)"Response: "); 311 312 312 rc=readResponse(s,buffer,sizeof(buffer)); 313 313 if(rc==CDDB_ERROR) { 314 printError( "Set protocol: cannot get response");314 printError((char *)"Set protocol: cannot get response"); 315 315 return -1; 316 316 } 317 317 if(verbose==2) 318 318 printErrorCR(buffer); 319 319 320 320 /* Check cddb code */ 321 321 if(check_cddb_code(buffer)==CDDB_ERROR) { … … 326 326 break; 327 327 /* protocol not supported. Decrement level and try again. */ 328 iProtLevel--; 328 iProtLevel--; 329 329 }while(iProtLevel>0); 330 330 331 331 return 0; 332 332 } … … 343 343 do { 344 344 rc=readResponse(s,buffer,sizeof(buffer)); /* Get next line */ 345 345 346 346 if(rc==CDDB_ERROR) 347 347 return root; /* return what we have so far */ … … 351 351 352 352 /* A new cddb instance for every match */ 353 Cddb=new cddb( "","","",1); /* One fuzzy match or one of several matches */353 Cddb=new cddb((char *)"",(char *)"",(char *)"",1); /* One fuzzy match or one of several matches */ 354 354 /* Get the data for this match */ 355 355 sscanf(buffer, " %20s %x %100[^/\r\n] / %100[^\r\n]", Cddb->category,&Cddb->discid,Cddb->artist,Cddb->title); … … 359 359 else 360 360 root->linkCddb(Cddb); 361 361 362 362 }while(true); 363 363 … … 383 383 /* Sending query */ 384 384 if(verbose) 385 printError( "Sending query cmd... ");385 printError((char *)"Sending query cmd... "); 386 386 /* Build cmd-line */ 387 387 sprintf(buffer,"cddb query %08x %d",cddbInfo->discid,cddbInfo->numTracks); … … 389 389 rc=snprintf(track,sizeof(track)," %d",cddbInfo->startSector[a]); 390 390 if(rc==EOF||rc>=sizeof(track)) { 391 printError( "Query: buffer overrun while formatting track offsets.\nPlease report this bug.\n");391 printError((char *)"Query: buffer overrun while formatting track offsets.\nPlease report this bug.\n"); 392 392 return 0; 393 393 } 394 394 if(sizeof(buffer)-strlen(buffer) <= strlen(track)) { 395 printError( "Query: buffer overrun while adding track offsets to command.\nPlease report this bug.\n");395 printError((char *)"Query: buffer overrun while adding track offsets to command.\nPlease report this bug.\n"); 396 396 return 0; 397 397 } … … 401 401 rc=snprintf(track,sizeof(track), " %d\n",cddbInfo->discLength); 402 402 if(rc==EOF||rc>=sizeof(track)) { 403 printError( "Query: buffer overrun while formatting disclength.\nPlease report this bug.\n");403 printError((char *)"Query: buffer overrun while formatting disclength.\nPlease report this bug.\n"); 404 404 return 0; 405 405 } 406 406 if(sizeof(buffer)-strlen(buffer) <= strlen(track)) { 407 printError( "Query: buffer overrun while adding disclength to command.\nPlease report this bug.\n");407 printError((char *)"Query: buffer overrun while adding disclength to command.\nPlease report this bug.\n"); 408 408 return 0; 409 409 } … … 415 415 rc=write(s,buffer,strlen(buffer)); 416 416 if(rc==-1) { 417 printError( "Query: cannot write to CDDB server");417 printError((char *)"Query: cannot write to CDDB server"); 418 418 return 0; 419 419 } 420 420 if(verbose) 421 printError( " done\n");422 if(verbose==2) 423 printError( "Response: ");424 421 printError((char *)" done\n"); 422 if(verbose==2) 423 printError((char *)"Response: "); 424 425 425 rc=readResponse(s,buffer,sizeof(buffer)); 426 426 //rc=read(s,buffer,sizeof(buffer)-1); 427 427 if(rc==CDDB_ERROR) { 428 printError( "Query: cannot get response");428 printError((char *)"Query: cannot get response"); 429 429 return 0; 430 430 } … … 440 440 { 441 441 case 200: /* exact match */ 442 Cddb=new cddb( "","","");442 Cddb=new cddb((char *)"",(char *)"",(char *)""); 443 443 444 444 sscanf(buffer+4, "%20s %x %100[^/\r\n] / %100[^\r\n]", Cddb->category,&Cddb->discid,Cddb->artist,Cddb->title); … … 457 457 /* We shouldn't reach this */ 458 458 return 0; 459 } 459 } 460 460 461 461 /* Reads the CDDB banner from the server after connecting */ … … 471 471 rc=readResponse(s,buffer,sizeof(buffer)); 472 472 if(rc==CDDB_ERROR) { 473 printError( "Cannot read CDDB-Banner");473 printError((char *)"Cannot read CDDB-Banner"); 474 474 return -1; 475 475 } … … 493 493 int iTrack=0; 494 494 int iTemp=0; 495 495 496 496 do{ 497 497 rc=readResponse(s,buffer,sizeof(buffer)); 498 498 if(rc==CDDB_ERROR) { 499 printError( "Read request: cannot get response");499 printError((char *)"Read request: cannot get response"); 500 500 return CDDB_ERROR; 501 501 } … … 504 504 if(buffer[0]!='.') 505 505 printData(buffer); 506 506 507 507 if(buffer[0]=='#') /* This is a comment */ 508 508 { } … … 511 511 if(buffer[0]=='.') /* End of data */ 512 512 return CDDB_OK; /* Done */ 513 513 514 514 //printf("Found data: %s\n",buffer); 515 515 sscanf(buffer,"%20[^0-9=]",key); … … 524 524 }while(rc==CDDB_MORE); 525 525 526 return CDDB_OK; 526 527 } 527 528 … … 534 535 535 536 /* Build cmd-line */ 536 sprintf(buffer,"cddb read %s %08x\n",Cddb->category,Cddb->discid); 537 if(verbose) 538 printError( "\nSending read cmd... ");537 sprintf(buffer,"cddb read %s %08x\n",Cddb->category,Cddb->discid); 538 if(verbose) 539 printError((char *)"\nSending read cmd... "); 539 540 if(verbose==2) 540 541 printError(buffer); 541 542 542 543 rc=write(s,buffer,strlen(buffer)); 543 544 if(rc==-1) { 544 printError( "Read request: cannot write to CDDB server");545 return -1; 546 } 547 if(verbose) 548 printError( "done\n");549 if(verbose==2) 550 printError( "Response: ");551 545 printError((char *)"Read request: cannot write to CDDB server"); 546 return -1; 547 } 548 if(verbose) 549 printError((char *)"done\n"); 550 if(verbose==2) 551 printError((char *)"Response: "); 552 552 553 rc=readResponse(s,buffer,sizeof(buffer)); 553 554 if(rc==CDDB_ERROR) { 554 printError( "Read request: cannot get response");555 return -1; 556 } 557 if(verbose==2) 555 printError((char *)"Read request: cannot get response"); 556 return -1; 557 } 558 if(verbose==2) 558 559 printError(buffer); 559 560 if(check_cddb_code(buffer)==CDDB_ERROR) 560 561 return CDDB_ERROR; 561 562 562 /* Get the data */ 563 /* Get the data */ 563 564 read_and_parse(s,Cddb); 564 return CDDB_OK; 565 return CDDB_OK; 565 566 } 566 567 … … 577 578 /* Creating socket */ 578 579 if(verbose) 579 printError( "Creating socket... ");580 printError((char *)"Creating socket... "); 580 581 s=socket(AF_INET,SOCK_STREAM,0); 581 582 if(s==-1) { 582 printError( "Cannot create socket!");583 printError((char *)"Cannot create socket!"); 583 584 return -1; 584 585 } 585 586 *skt=s; 586 587 if(verbose) 587 printError( "Socket created\n");588 printError((char *)"Socket created\n"); 588 589 589 590 /* Querying host */ 590 591 if(verbose) 591 printError( "Querying host... ");592 printError((char *)"Querying host... "); 592 593 he = gethostbyname(host); 593 594 if(he==NULL) { 594 printError( "Cannot get host address.\ngethostbyname() returned error: ");595 printError((char *)"Cannot get host address.\ngethostbyname() returned error: "); 595 596 switch (h_errno) 596 597 { 597 598 case HOST_NOT_FOUND: 598 printError( "Host not found\n");599 printError((char *)"Host not found\n"); 599 600 break; 600 601 case TRY_AGAIN: 601 printError( "Temporary error. Try again later.\n");602 printError((char *)"Temporary error. Try again later.\n"); 602 603 break; 603 604 case NO_DATA: 604 printError( "Name valid but name server has no associated address.\n");605 printError((char *)"Name valid but name server has no associated address.\n"); 605 606 break; 606 607 case NO_RECOVERY: 607 printError( "Unrecoverable error.\n");608 printError((char *)"Unrecoverable error.\n"); 608 609 break; 609 610 default: 610 printError( "Unknown error\n");611 printError((char *)"Unknown error\n"); 611 612 } 612 613 /* Close the socket */ 613 614 close(s); 614 615 return -1; 615 } 616 617 if(verbose) 618 printError( "Host found.\n");616 } 617 618 if(verbose) 619 printError((char *)"Host found.\n"); 619 620 620 621 621 622 /* Connecting to host */ 622 623 if(verbose) 623 printError( "Connecting to host... ");624 printError((char *)"Connecting to host... "); 624 625 memset(&sa_in,0, sizeof(struct sockaddr_in)); 625 626 … … 634 635 { 635 636 case EBADF: 636 printError( "No valid socket descriptor");637 printError((char *)"No valid socket descriptor"); 637 638 break; 638 639 case EISCONN: 639 printError( "The socket is already connected\n");640 printError((char *)"The socket is already connected\n"); 640 641 break; 641 642 case ETIMEDOUT: 642 printError( "No connection. Timed out.\n");643 printError((char *)"No connection. Timed out.\n"); 643 644 break; 644 645 case ECONNREFUSED: 645 printError( "Connection refused by host.\n");646 printError((char *)"Connection refused by host.\n"); 646 647 break; 647 648 case EADDRNOTAVAIL: 648 printError( "Address not avaiable.\n");649 printError((char *)"Address not avaiable.\n"); 649 650 break; 650 651 651 652 default: 652 printError( "General failure: Cannot connect to host\n");653 printError((char *)"General failure: Cannot connect to host\n"); 653 654 } 654 655 close(s); … … 656 657 } 657 658 if(verbose) 658 printError( "connected.\n");659 printError((char *)"connected.\n"); 659 660 return 0; 660 661 } -
branches/v2.9_Lars/mediafolder/c/cddb/printhelper.cpp
r2 r91 30 30 */ 31 31 32 void externprintError(char* errorString)32 void printError(char* errorString) 33 33 { 34 34 fprintf(stderr,"%s",errorString); 35 35 } 36 36 37 void externprintErrorCR(char* errorString)37 void printErrorCR(char* errorString) 38 38 { 39 39 fprintf(stderr,"%s\n",errorString); … … 41 41 42 42 43 void externprintData(char* outString)43 void printData(char* outString) 44 44 { 45 45 int fileHandle; -
branches/v2.9_Lars/mediafolder/c/cddb/res/makefile
r53 r91 13 13 14 14 CPPFILES = 15 all: pmcddb001.dll pmcddb049.dll pmcddb031.dll pmcddb039.dll pmcddb088.dll 15 all: pmcddb001.dll pmcddb049.dll pmcddb031.dll pmcddb039.dll pmcddb088.dll pmcddb033.dll pmcddb034.dll 16 16 17 17 … … 29 29 gcc -Zdll -Zomf -I$(INC) pmcddb049.c pmcddb049.def 30 30 rc pmcddb049.res pmcddb049.dll 31 # icc $(CPPFLAGS) -I$(INC) pmcddb001.c pmcddb04á.def32 31 33 32 pmcddb049.res: pmcddb049.rc pmcddb049.dlg $(INC)\pmcddbres.h … … 37 36 gcc -Zdll -Zomf -I$(INC) pmcddb031.c pmcddb031.def 38 37 rc pmcddb031.res pmcddb031.dll 39 # icc $(CPPFLAGS) -I$(INC) pmcddb001.c pmcddb04á.def40 38 41 39 pmcddb031.res: pmcddb031.rc pmcddb031.dlg $(INC)\pmcddbres.h … … 45 43 gcc -Zdll -Zomf -I$(INC) pmcddb039.c pmcddb039.def 46 44 rc pmcddb039.res pmcddb039.dll 47 # icc $(CPPFLAGS) -I$(INC) pmcddb001.c pmcddb04á.def48 45 49 46 pmcddb039.res: pmcddb039.rc pmcddb039.dlg $(INC)\pmcddbres.h … … 57 54 rc -i $(INC) -r pmcddb088.rc 58 55 56 pmcddb033.dll: pmcddb033.c pmcddb033.res 57 gcc -Zdll -Zomf -I$(INC) pmcddb033.c pmcddb033.def 58 rc pmcddb033.res pmcddb033.dll 59 60 pmcddb033.res: pmcddb033.rc pmcddb033.dlg $(INC)\pmcddbres.h 61 rc -i $(INC) -r pmcddb033.rc 62 63 pmcddb034.dll: pmcddb034.c pmcddb034.res 64 gcc -Zdll -Zomf -I$(INC) pmcddb034.c pmcddb034.def 65 rc pmcddb034.res pmcddb034.dll 66 67 pmcddb034.res: pmcddb034.rc pmcddb034.dlg $(INC)\pmcddbres.h 68 rc -i $(INC) -r pmcddb034.rc 69 59 70 clean: 60 71 -rm *.obj … … 64 75 cleaner: 65 76 -rm *.*~ 66 67 68 -
branches/v2.9_Lars/mediafolder/c/cddb/res/pmcddb007.DEF
r90 r91 19 19 ; */ 20 20 21 LIBRARY PMDB00 1 INITGLOBAL21 LIBRARY PMDB007 INITINSTANCE TERMINSTANCE 22 22 DESCRIPTION '$@#(c) Chris Wohlgemuth :0.1 (12.05.02) (PMDB001.DLL)#@##1## 12.05.2002 18:17:00 ;-) ::::1::@@Resource-DLL' 23 PROTMODE 24 CODE LOADONCALL DISCARDABLE 25 DATA SINGLE SHARED DISCARDABLE 26 EXPORTS 27 queryLanguage 23 DATA MULTIPLE NONSHARED 24 EXPORTS 25 queryLanguage = _queryLanguage 28 26 -
branches/v2.9_Lars/mediafolder/c/cddb/res/pmcddb033.DEF
r90 r91 22 22 ; */ 23 23 24 LIBRARY PMDB033 INIT GLOBAL24 LIBRARY PMDB033 INITINSTANCE TERMINSTANCE 25 25 DESCRIPTION '$@#(c) Chris Wohlgemuth :0.1 (12.05.02) (PMDB033.DLL)#@##1## 12.05.2002 18:17:00 Mon ;-) ::::1::@@DLL Ressource' 26 PROTMODE 27 CODE LOADONCALL DISCARDABLE 28 DATA SINGLE SHARED DISCARDABLE 26 DATA MULTIPLE NONSHARED 29 27 EXPORTS 30 28 queryLanguage = _queryLanguage -
branches/v2.9_Lars/mediafolder/c/cddb/res/pmcddb034.DEF
r90 r91 18 18 ; */ 19 19 20 LIBRARY PMDB034 INIT GLOBAL20 LIBRARY PMDB034 INITINSTANCE TERMINSTANCE 21 21 DESCRIPTION '$@#ž Chris Wohlgemuth :0.1 (12.05.02) (PMDB034.DLL)#@##1## 12.05.2002 18:17:00 Mi ;-) ::::1::@@DLL de recursos' 22 PROTMODE 23 CODE LOADONCALL DISCARDABLE 24 DATA SINGLE SHARED DISCARDABLE 22 DATA MULTIPLE NONSHARED 25 23 EXPORTS 26 24 queryLanguage = _queryLanguage 27 25 -
branches/v2.9_Lars/mediafolder/c/cddb/res/pmcddb034.c
r90 r91 17 17 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 18 18 */ 19 /*20 * French translation....: Guillaume Gay <guillaume[dot]gay[arobase]gmail[dot]com>21 * Version...............: 2020-07-2222 */23 19 24 20 #include <os2.h> … … 26 22 PSZ queryLanguage() 27 23 { 28 return " Franais (033)";24 return "Espagnol (034)"; 29 25 } -
branches/v2.9_Lars/mediafolder/c/helper/cddbhelper.cpp
r57 r91 38 38 */ 39 39 40 void externprintError(char* errorString)40 void printError(char* errorString) 41 41 { 42 42 char buffer[CCHMAXPATH] = {0}; … … 55 55 } 56 56 57 void externprintErrorCR(char* errorString)57 void printErrorCR(char* errorString) 58 58 { 59 59 fprintf(stderr,"%s\n",errorString); … … 63 63 64 64 65 void externprintData(char* outString)65 void printData(char* outString) 66 66 { 67 67 int fileHandle; 68 68 int rc; 69 69 70 /* The name cddbDataFile is defined in the main pmcddb.cpp file. It is 70 /* The name cddbDataFile is defined in the main pmcddb.cpp file. It is 71 71 the discid (this is the native format of the data hold by a cddb server) */ 72 72 fileHandle=open(cddbDataFile,O_APPEND|O_TEXT|O_WRONLY|O_CREAT,S_IWRITE);
Note:
See TracChangeset
for help on using the changeset viewer.