D20149: Fix compilation

2019-04-01 Thread Stefan Brüns
bruns added a comment.


  Although s_magic **decays** to a char*, it **is not** a char*. char[n] is a 
type distinct from char*
  
  From e.g. man strlen
  
char string[32] = "hello, world";
char *ptr = string;
sizeof (string)
⇒ 32
sizeof (ptr)
⇒ 4  /* (on a machine with 4 byte pointers) */

REPOSITORY
  R287 KImageFormats

REVISION DETAIL
  https://phabricator.kde.org/D20149

To: aacid, svuorela
Cc: bruns, svuorela, apol, pino, kde-frameworks-devel, michaelh, ngraham


D20149: Fix compilation

2019-04-01 Thread Aleix Pol Gonzalez
apol added inline comments.

INLINE COMMENTS

> ora.cpp:21
>  static constexpr char s_magic[] = "image/openraster";
> -static constexpr int s_magic_size = strlen(s_magic);
> +static constexpr int s_magic_size = sizeof(s_magic) - 1; // -1 to remove the 
> last \0
>  

Won't sizeof give the sizeof(char*)?

REPOSITORY
  R287 KImageFormats

REVISION DETAIL
  https://phabricator.kde.org/D20149

To: aacid, svuorela
Cc: svuorela, apol, pino, kde-frameworks-devel, michaelh, ngraham, bruns


D20149: Fix compilation

2019-03-31 Thread Albert Astals Cid
aacid closed this revision.

REPOSITORY
  R287 KImageFormats

REVISION DETAIL
  https://phabricator.kde.org/D20149

To: aacid, svuorela
Cc: svuorela, apol, pino, kde-frameworks-devel, michaelh, ngraham, bruns


D20149: Fix compilation

2019-03-31 Thread Sune Vuorela
svuorela accepted this revision.
This revision is now accepted and ready to land.

REPOSITORY
  R287 KImageFormats

BRANCH
  master

REVISION DETAIL
  https://phabricator.kde.org/D20149

To: aacid, svuorela
Cc: svuorela, apol, pino, kde-frameworks-devel, michaelh, ngraham, bruns


D20149: Fix compilation

2019-03-31 Thread Albert Astals Cid
aacid added subscribers: pino, apol, svuorela.

REPOSITORY
  R287 KImageFormats

REVISION DETAIL
  https://phabricator.kde.org/D20149

To: aacid
Cc: svuorela, apol, pino, kde-frameworks-devel, michaelh, ngraham, bruns


D20149: Fix compilation

2019-03-31 Thread Albert Astals Cid
aacid created this revision.
Herald added a project: Frameworks.
Herald added a subscriber: kde-frameworks-devel.
aacid requested review of this revision.

REVISION SUMMARY
  Seems only gcc can do a constexpr with strlen.
  
  This fixes the build with clang, hopefully to with MSVC?

REPOSITORY
  R287 KImageFormats

BRANCH
  master

REVISION DETAIL
  https://phabricator.kde.org/D20149

AFFECTED FILES
  src/imageformats/kra.cpp
  src/imageformats/ora.cpp

To: aacid
Cc: kde-frameworks-devel, michaelh, ngraham, bruns