Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • FreeType Demo Programs FreeType Demo Programs
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 5
    • Issues 5
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 3
    • Merge requests 3
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • FreeTypeFreeType
  • FreeType Demo ProgramsFreeType Demo Programs
  • Issues
  • #10
Closed
Open
Issue created Jun 20, 2022 by Charlie Jiang@cqjjjzrDeveloper

ftinspect: compile warning on MSVC about int->FTC_FaceID conversion

MSVC complains when compiling ftinspect code:

engine.cpp(265): warning C4312: 'reinterpret_cast': conversion from 'T' to 'void *' of greater size
          with
          [
              T=int
          ]

The affected code is like:

FTC_FaceID ftcFaceID = reinterpret_cast<void*>
                           (faceIDMap.value(FaceID(fontIndex,
                                                   0,
                                                   0)));
.....
ftcFaceID = reinterpret_cast<void*>(faceCounter);

where faceCounter and value return from faceIDMap.value are all int.

There're two possible solutions:

  1. Use intptr_t in favor of int. This enables 8 bytes long face id on 64 bit machines. The faceIDMap and faceCounter would be redefined (maybe we need type aliasing);
  2. Cast int to intptr_t at all sites of conversion. This can ensure consistent behavior on 32 and 64 bit machines.

Which solution should be preferred?

Assignee
Assign to
Time tracking