comparison ifo_read.c @ 74:133be2fe0eef src

Use NULL instead of 0 consistently. Since this is C and not C++, NULL is the stylistic choice for pointer assignments and checking. This patch, kindly submitted by Frederic Marchal <fmarchal AT perso DOT be> changes all of places were ptl_mait is used in ifo_read.c. Thanks!
author erik
date Fri, 07 Oct 2011 16:56:02 +0000
parents 933bbcf89338
children 8e12b8e01713
comparison
equal deleted inserted replaced
73:933bbcf89338 74:133be2fe0eef
1289 return 0; 1289 return 0;
1290 1290
1291 if(!ifofile->vmgi_mat) 1291 if(!ifofile->vmgi_mat)
1292 return 0; 1292 return 0;
1293 1293
1294 if(ifofile->vmgi_mat->ptl_mait == 0) 1294 if(ifofile->vmgi_mat->ptl_mait == NULL)
1295 return 1; 1295 return 1;
1296 1296
1297 if(!DVDFileSeek_(ifofile->file, ifofile->vmgi_mat->ptl_mait * DVD_BLOCK_LEN)) 1297 if(!DVDFileSeek_(ifofile->file, ifofile->vmgi_mat->ptl_mait * DVD_BLOCK_LEN))
1298 return 0; 1298 return 0;
1299 1299
1303 1303
1304 ifofile->ptl_mait = ptl_mait; 1304 ifofile->ptl_mait = ptl_mait;
1305 1305
1306 if(!(DVDReadBytes(ifofile->file, ptl_mait, PTL_MAIT_SIZE))) { 1306 if(!(DVDReadBytes(ifofile->file, ptl_mait, PTL_MAIT_SIZE))) {
1307 free(ptl_mait); 1307 free(ptl_mait);
1308 ifofile->ptl_mait = 0; 1308 ifofile->ptl_mait = NULL;
1309 return 0; 1309 return 0;
1310 } 1310 }
1311 1311
1312 B2N_16(ptl_mait->nr_of_countries); 1312 B2N_16(ptl_mait->nr_of_countries);
1313 B2N_16(ptl_mait->nr_of_vtss); 1313 B2N_16(ptl_mait->nr_of_vtss);
1322 1322
1323 info_length = ptl_mait->nr_of_countries * sizeof(ptl_mait_country_t); 1323 info_length = ptl_mait->nr_of_countries * sizeof(ptl_mait_country_t);
1324 ptl_mait->countries = (ptl_mait_country_t *)malloc(info_length); 1324 ptl_mait->countries = (ptl_mait_country_t *)malloc(info_length);
1325 if(!ptl_mait->countries) { 1325 if(!ptl_mait->countries) {
1326 free(ptl_mait); 1326 free(ptl_mait);
1327 ifofile->ptl_mait = 0; 1327 ifofile->ptl_mait = NULL;
1328 return 0; 1328 return 0;
1329 } 1329 }
1330 for(i = 0; i < ptl_mait->nr_of_countries; i++) { 1330 for(i = 0; i < ptl_mait->nr_of_countries; i++) {
1331 ptl_mait->countries[i].pf_ptl_mai = NULL; 1331 ptl_mait->countries[i].pf_ptl_mai = NULL;
1332 } 1332 }
1334 for(i = 0; i < ptl_mait->nr_of_countries; i++) { 1334 for(i = 0; i < ptl_mait->nr_of_countries; i++) {
1335 if(!(DVDReadBytes(ifofile->file, &ptl_mait->countries[i], PTL_MAIT_COUNTRY_SIZE))) { 1335 if(!(DVDReadBytes(ifofile->file, &ptl_mait->countries[i], PTL_MAIT_COUNTRY_SIZE))) {
1336 fprintf(stderr, "libdvdread: Unable to read PTL_MAIT.\n"); 1336 fprintf(stderr, "libdvdread: Unable to read PTL_MAIT.\n");
1337 free(ptl_mait->countries); 1337 free(ptl_mait->countries);
1338 free(ptl_mait); 1338 free(ptl_mait);
1339 ifofile->ptl_mait = 0; 1339 ifofile->ptl_mait = NULL;
1340 return 0; 1340 return 0;
1341 } 1341 }
1342 } 1342 }
1343 1343
1344 for(i = 0; i < ptl_mait->nr_of_countries; i++) { 1344 for(i = 0; i < ptl_mait->nr_of_countries; i++) {
1413 for(i = 0; i < ifofile->ptl_mait->nr_of_countries; i++) { 1413 for(i = 0; i < ifofile->ptl_mait->nr_of_countries; i++) {
1414 free(ifofile->ptl_mait->countries[i].pf_ptl_mai); 1414 free(ifofile->ptl_mait->countries[i].pf_ptl_mai);
1415 } 1415 }
1416 free(ifofile->ptl_mait->countries); 1416 free(ifofile->ptl_mait->countries);
1417 free(ifofile->ptl_mait); 1417 free(ifofile->ptl_mait);
1418 ifofile->ptl_mait = 0; 1418 ifofile->ptl_mait = NULL;
1419 } 1419 }
1420 } 1420 }
1421 1421
1422 int ifoRead_VTS_TMAPT(ifo_handle_t *ifofile) { 1422 int ifoRead_VTS_TMAPT(ifo_handle_t *ifofile) {
1423 vts_tmapt_t *vts_tmapt; 1423 vts_tmapt_t *vts_tmapt;