~ubuntu-branches/debian/experimental/gpac/experimental

« back to all changes in this revision

Viewing changes to src/odf/odf_code.c

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2014-02-22 18:15:00 UTC
  • mfrom: (1.2.2) (3.1.6 sid)
  • Revision ID: package-import@ubuntu.com-20140222181500-b4phupo05gjpmopa
Tags: 0.5.0+svn5104~dfsg1-1
* New  upstream version 0.5.0+svn5104~dfsg1:
  - src/utils/sha1.c is relicensed under LGPLv2.1, Closes: #730759
* Don't install modules in multi-arch directories, Closes: #730497
* Add libusb-1.0.0-dev headers because libfreenect requires this
* Fix install rule
* Follow upstream soname bump
  - Drop the symbols file for now until it has been revised thourougly
* Let binaries produce the correct svn revision
* Refresh patches
* Patch and build against libav10, Closes: #739321
* Bump standards version, no changes necessary

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
 
45
45
static GFINLINE u32 OD_SizeUTF8String(char *string, Bool isUTF8)
46
46
{
47
 
        if (isUTF8) return 1 + strlen(string);
48
 
        return 1 + 2*gf_utf8_wcslen((const unsigned short *)string);
 
47
        if (isUTF8) return 1 + (u32) strlen(string);
 
48
        return 1 + 2 * (u32) gf_utf8_wcslen((const unsigned short *)string);
49
49
}
50
50
 
51
51
static GFINLINE void OD_WriteUTF8String(GF_BitStream *bs, char *string, Bool isUTF8)
52
52
{
53
53
        u32 len;
54
54
        if (isUTF8) {
55
 
                len = strlen(string);
 
55
                len = (u32) strlen(string);
56
56
                gf_bs_write_int(bs, len, 8);
57
57
                gf_bs_write_data(bs, string, len);
58
58
        } else {
59
 
                len = gf_utf8_wcslen((const unsigned short *)string);
 
59
                len = (u32) gf_utf8_wcslen((const unsigned short *)string);
60
60
                gf_bs_write_int(bs, len, 8);
61
61
                gf_bs_write_data(bs, string, len*2);
62
62
        }
99
99
                gf_bs_write_int(bs, 0, 8);
100
100
                return GF_OK;
101
101
        }               
102
 
        len = strlen(string);
 
102
        len = (u32) strlen(string);
103
103
        if (len > 255) {
104
104
                gf_bs_write_int(bs, 0, 8);
105
105
                gf_bs_write_int(bs, len, 32);
112
112
 
113
113
u32 gf_odf_size_url_string(char *string)
114
114
{
115
 
        u32 len = strlen(string);
 
115
        u32 len = (u32) strlen(string);
116
116
        if (len>255) return len+5;
117
117
        return len+1;
118
118
}
1420
1420
{
1421
1421
        if (!sd) return GF_BAD_PARAM;
1422
1422
        *outSize = 17;
1423
 
        if (sd->SegmentName) *outSize += strlen(sd->SegmentName);
 
1423
        if (sd->SegmentName) *outSize += (u32) strlen(sd->SegmentName);
1424
1424
        return GF_OK;
1425
1425
}
1426
1426
 
1436
1436
        gf_bs_write_double(bs, sd->startTime);
1437
1437
        gf_bs_write_double(bs, sd->Duration);
1438
1438
        if (sd->SegmentName) {
1439
 
                gf_bs_write_int(bs, strlen(sd->SegmentName), 8);
1440
 
                gf_bs_write_data(bs, sd->SegmentName, strlen(sd->SegmentName));
 
1439
                gf_bs_write_int(bs, (u32) strlen(sd->SegmentName), 8);
 
1440
                gf_bs_write_data(bs, sd->SegmentName, (u32) strlen(sd->SegmentName));
1441
1441
        } else {
1442
1442
                gf_bs_write_int(bs, 0, 8);
1443
1443
        }
2011
2011
        if (cid->contentTypeFlag) *outSize += 1;
2012
2012
 
2013
2013
        if (cid->contentIdentifierFlag) 
2014
 
                *outSize += strlen((const char*)cid->contentIdentifier) - 1 - cid->contentTypeFlag;
 
2014
                *outSize += (u32) strlen((const char*)cid->contentIdentifier) - 1 - cid->contentTypeFlag;
2015
2015
        return GF_OK;
2016
2016
}
2017
2017
 
2171
2171
        *outSize += 1;
2172
2172
        if (etd->NonItemText) {
2173
2173
                if (etd->isUTF8) {
2174
 
                        nonLen = strlen((const char*)etd->NonItemText);
 
2174
                        nonLen = (u32) strlen((const char*)etd->NonItemText);
2175
2175
                } else {
2176
 
                        nonLen = gf_utf8_wcslen((const unsigned short*)etd->NonItemText);
 
2176
                        nonLen = (u32) gf_utf8_wcslen((const unsigned short*)etd->NonItemText);
2177
2177
                }
2178
2178
        } else {
2179
2179
                nonLen = 0;
2221
2221
                OD_WriteUTF8String(bs, tmp->text, etd->isUTF8);
2222
2222
        }
2223
2223
        if (etd->NonItemText) {
2224
 
                nonLen = strlen((const char*)etd->NonItemText) + 1;
 
2224
                nonLen = (u32) strlen((const char*)etd->NonItemText) + 1;
2225
2225
                if (etd->isUTF8) {
2226
 
                        nonLen = strlen((const char*)etd->NonItemText);
 
2226
                        nonLen = (u32) strlen((const char*)etd->NonItemText);
2227
2227
                } else {
2228
 
                        nonLen = gf_utf8_wcslen((const unsigned short*)etd->NonItemText);
 
2228
                        nonLen = (u32) gf_utf8_wcslen((const unsigned short*)etd->NonItemText);
2229
2229
                }
2230
2230
        } else {
2231
2231
                nonLen = 0;
2373
2373
{
2374
2374
        if (!ipmp) return GF_BAD_PARAM;
2375
2375
        if (ipmp->opaque_data) gf_free(ipmp->opaque_data);
 
2376
#ifndef GPAC_MINIMAL_ODF
2376
2377
        /*TODO DELETE IPMPX*/
2377
2378
        while (gf_list_count(ipmp->ipmpx_data)) {
2378
2379
                GF_IPMPX_Data *p = (GF_IPMPX_Data *)gf_list_get(ipmp->ipmpx_data, 0);
2379
2380
                gf_list_rem(ipmp->ipmpx_data, 0);
2380
2381
                gf_ipmpx_data_del(p);
2381
2382
        }
 
2383
#endif
2382
2384
        gf_list_del(ipmp->ipmpx_data);
2383
2385
        gf_free(ipmp);
2384
2386
        return GF_OK;
2458
2460
        }
2459
2461
        else if (! ipmp->IPMPS_Type) {
2460
2462
                if (!ipmp->opaque_data) return GF_ODF_INVALID_DESCRIPTOR;
2461
 
                *outSize += strlen(ipmp->opaque_data);
 
2463
                *outSize += (u32) strlen(ipmp->opaque_data);
2462
2464
        } else {
2463
2465
                *outSize += ipmp->opaque_data_size;
2464
2466
        }
2492
2494
        }
2493
2495
        else if (!ipmp->IPMPS_Type) {
2494
2496
                if (!ipmp->opaque_data) return GF_ODF_INVALID_DESCRIPTOR;
2495
 
                gf_bs_write_data(bs, ipmp->opaque_data, strlen(ipmp->opaque_data));
 
2497
                gf_bs_write_data(bs, ipmp->opaque_data, (u32) strlen(ipmp->opaque_data));
2496
2498
        } else {
2497
2499
                gf_bs_write_data(bs, ipmp->opaque_data, ipmp->opaque_data_size);
2498
2500
        }
2784
2786
                gf_bs_write_int(bs, tmp->langCode, 24);
2785
2787
                gf_bs_write_int(bs, tmp->isUTF8, 1);
2786
2788
                gf_bs_write_int(bs, 0, 7);              //aligned
2787
 
                gf_bs_write_int(bs, strlen(tmp->OCICreatorName) , 8);
 
2789
                gf_bs_write_int(bs, (u32) strlen(tmp->OCICreatorName) , 8);
2788
2790
                OD_WriteUTF8String(bs, tmp->OCICreatorName, tmp->isUTF8);
2789
2791
        }
2790
2792
        return GF_OK;
3305
3307
        if (ipmpt->num_alternate) *outSize += 1 + 16*ipmpt->num_alternate;
3306
3308
 
3307
3309
        if (ipmpt->tool_url) {
3308
 
                u32 s = strlen(ipmpt->tool_url);
 
3310
                u32 s = (u32) strlen(ipmpt->tool_url);
3309
3311
                *outSize += gf_odf_size_field_size(s) - 1 + s;
3310
3312
        }
3311
3313
        return GF_OK;
3331
3333
                gf_bs_write_int(bs, ipmpt->num_alternate, 8);
3332
3334
                for (i=0;i<ipmpt->num_alternate; i++) gf_bs_write_data(bs, (char*)ipmpt->specificToolID[i], 16);
3333
3335
        }
3334
 
        if (ipmpt->tool_url) gf_ipmpx_write_array(bs, ipmpt->tool_url, strlen(ipmpt->tool_url));
 
3336
        if (ipmpt->tool_url) gf_ipmpx_write_array(bs, ipmpt->tool_url, (u32) strlen(ipmpt->tool_url));
3335
3337
        return GF_OK;
3336
3338
}
3337
3339