Changeset 17586 in niluje


Ignore:
Timestamp:
Jul 28, 2020, 9:13:01 PM (2 weeks ago)
Author:
NiLuJe
Message:

MobiCover:

  • Fix warnings
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Configs/trunk/Kindle/Touch_Hacks/MobiCover/LibMobi/mobicover.c

    r17585 r17586  
    141141                        fprintf(
    142142                            stderr,
    143                             "Warning: EXTH CoverOffset is a NULL pointer, discarding it and assuming the first resource record has the cover!\n",
     143                            "Warning: EXTH CoverOffset is a NULL pointer, discarding it and assuming the first resource record (%zu) has the cover!\n",
    144144                            uid);
    145145                }
     
    149149                fprintf(
    150150                    stderr,
    151                     "Warning: could not determine cover location (CoverOffset missing from EXTH), assuming the first resource record has the cover!\n",
     151                    "Warning: could not determine cover location (CoverOffset missing from EXTH), assuming the first resource record (%zu) has the cover!\n",
    152152                    uid);
    153153        }
     
    227227        } else {
    228228                // Use the sha1 of the full path, like the Kindle
    229                 char abspath[PATH_MAX];
    230                 (void) realpath(fullpath, abspath);
     229                char     abspath[PATH_MAX];
     230                uint8_t* p = (uint8_t*) realpath(fullpath, abspath);
     231                if (p == NULL) {
     232                        fprintf(stderr, "Unable to resolve input file's path (realpath: %m)!\n");
     233                        return ERRCODE(EXIT_FAILURE);
     234                }
    231235
    232236                struct sha1_ctx sha1;
    233237                uint8_t         digest[SHA1_DIGEST_SIZE];
    234238                sha1_init(&sha1);
    235                 sha1_update(&sha1, strlen(abspath), abspath);
     239                sha1_update(&sha1, strlen(abspath), p);
    236240                sha1_digest(&sha1, SHA1_DIGEST_SIZE, digest);
    237241
Note: See TracChangeset for help on using the changeset viewer.