portability updates
authorDavid Brownell <dbrownell@users.sourceforge.net>
Thu, 15 Oct 2009 03:04:33 +0000 (20:04 -0700)
committerDavid Brownell <dbrownell@users.sourceforge.net>
Thu, 15 Oct 2009 03:04:33 +0000 (20:04 -0700)
Based on some patches from <redirect.slash.nil@gmail.com>
for preliminary Win64 compilation.  More such updates are
needed, but they need work.  Compile tested on 64 and 32 bit
Linuxes, and Cygwin.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
src/helper/jim.c
src/jtag/core.c
src/target/arm11.c
src/target/armv4_5.h

index 48e21e9ee248a90fd179807bb1dcb2d7a6ce1ee4..dfee1dd5a7d3ed4c42cddb2fc3fcd2de1980b88d 100644 (file)
@@ -4754,7 +4754,7 @@ const char *Jim_GetSharedString(Jim_Interp *interp, const char *str)
         Jim_AddHashEntry(&interp->sharedStrings, strCopy, (void*)1);
         return strCopy;
     } else {
-        long refCount = (long) he->val;
+        intptr_t refCount = (intptr_t) he->val;
 
         refCount++;
         he->val = (void*) refCount;
@@ -4764,13 +4764,13 @@ const char *Jim_GetSharedString(Jim_Interp *interp, const char *str)
 
 void Jim_ReleaseSharedString(Jim_Interp *interp, const char *str)
 {
-    long refCount;
+    intptr_t refCount;
     Jim_HashEntry *he = Jim_FindHashEntry(&interp->sharedStrings, str);
 
     if (he == NULL)
         Jim_Panic(interp,"Jim_ReleaseSharedString called with "
               "unknown shared string '%s'", str);
-    refCount = (long) he->val;
+    refCount = (intptr_t) he->val;
     refCount--;
     if (refCount == 0) {
         Jim_DeleteHashEntry(&interp->sharedStrings, str);
index 564b93f84940d546f35fd00135693467c3978f11..415d1e8244beada363949af8c214ef323f86e13d 100644 (file)
@@ -991,8 +991,9 @@ static bool jtag_examine_chain_match_tap(const struct jtag_tap_s *tap)
                return true;
 
        /* Loop over the expected identification codes and test for a match */
-       uint8_t ii;
-       for (ii = 0; ii < tap->expected_ids_cnt; ii++)
+       unsigned ii, limit = tap->expected_ids_cnt;
+
+       for (ii = 0; ii < limit; ii++)
        {
                if (tap->idcode == tap->expected_ids[ii])
                        return true;
@@ -1005,11 +1006,11 @@ static bool jtag_examine_chain_match_tap(const struct jtag_tap_s *tap)
        /* If none of the expected ids matched, warn */
        jtag_examine_chain_display(LOG_LVL_WARNING, "UNEXPECTED",
                        tap->dotted_name, tap->idcode);
-       for (ii = 0; ii < tap->expected_ids_cnt; ii++)
+       for (ii = 0; ii < limit; ii++)
        {
                char msg[32];
-               snprintf(msg, sizeof(msg), "expected %hhu of %hhu",
-                               ii + 1, tap->expected_ids_cnt);
+
+               snprintf(msg, sizeof(msg), "expected %u of %u", ii + 1, limit);
                jtag_examine_chain_display(LOG_LVL_ERROR, msg,
                                tap->dotted_name, tap->expected_ids[ii]);
        }
index 94d5fb1bc5acaa311fb765f66d25ed4bfc07953c..289d64c05721ab33bcf6933f6dbb62af0f517d13 100644 (file)
@@ -1656,10 +1656,10 @@ int arm11_run_algorithm(struct target_s *target, int num_mem_params, mem_param_t
 //             return ERROR_FAIL;
 
        // Save regs
-       for (size_t i = 0; i < 16; i++)
+       for (unsigned i = 0; i < 16; i++)
        {
                context[i] = buf_get_u32((uint8_t*)(&arm11->reg_values[i]),0,32);
-               LOG_DEBUG("Save %zi: 0x%" PRIx32 "",i,context[i]);
+               LOG_DEBUG("Save %u: 0x%" PRIx32 "", i, context[i]);
        }
 
        cpsr = buf_get_u32((uint8_t*)(arm11->reg_values + ARM11_RC_CPSR),0,32);
index 3c8411f04100488516b2c17b12540cd8c38e83b5..7ea3826ab092a347b64ef10aa03edf9f36e37709 100644 (file)
@@ -74,7 +74,7 @@ typedef struct armv4_5_common_s
 {
        int common_magic;
        reg_cache_t *core_cache;
-       enum armv4_5_mode core_mode;
+       int /* armv4_5_mode */ core_mode;
        enum armv4_5_state core_state;
        bool is_armv4;
        int (*full_context)(struct target_s *target);